X-004 FriendlyARM tiny4412 uboot移植之点亮指路灯

Posted LoTGu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了X-004 FriendlyARM tiny4412 uboot移植之点亮指路灯相关的知识,希望对你有一定的参考价值。

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 

开发环境:win7 64 + VMware12 + Ubuntu14.04 64

工具链:linaro提供的gcc-linaro-6.1.1-2016.08-x86_64_arm-linux-gnueabi

要移植的u-boot版本:u-boot-2016-11

Tiny4412开发板硬件版本为

    底板:  Tiny4412/Super4412SDK 1506

       核心板:Tiny4412 - 1412

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

 

在上一节中我们为tiny4412开发板添加相应目录文件,并且可以顺利编译通过生成.bin文件。接下来我们通过点亮tiny4412核心板上的LED灯开始调试u-boot

1Tiny4412 LED硬件原理图与exynos4412相关引脚寄存器

Tiny4412-1412-Schematic.pdf原理图上可以看到板子上的四个LED硬件连接如下图所示:

clip_image002[1]

clip_image004[1]

LED1~LED4分别跟GPM4_0~GPM4_3相接。

    exynos4412 GPM4相关的寄存器如下:

clip_image006[1]

现在我们只是想简单的点亮exynos4412 GPM4管脚上的LED灯,需要设置GPM4CONGPM4DAT寄存器,这两个寄存器的相关描述如下:

clip_image007[1]

clip_image008[1]

clip_image009[1]

 

 

 

 

2、添加LED灯代码

    arch/arm/cpu/armv7/start.S中添加点亮LED的代码。

diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S

index 691e5d3..4496f2f 100755

--- a/arch/arm/cpu/armv7/start.S

+++ b/arch/arm/cpu/armv7/start.S

@@ -47,6 +47,7 @@ save_boot_params_ret:

        orr     r0, r0, #0xc0           @ disable FIQ and IRQ

        msr     cpsr,r0

 

+       bl light_led

 /*

  * Setup vector:

  * (OMAP4 spl TEXT_BASE is not 32 byte aligned.

@@ -63,6 +64,8 @@ save_boot_params_ret:

        mcr     p15, 0, r0, c12, c0, 0  @Set VBAR

 #endif

 

+

+

        /* the mask ROM code should have PLL and others stable */

 #ifndef CONFIG_SKIP_LOWLEVEL_INIT

        bl      cpu_init_cp15

@@ -272,3 +275,18 @@ ENTRY(cpu_init_crit)

        b       lowlevel_init           @ go setup pll,mux,memory

 ENDPROC(cpu_init_crit)

 #endif

+

+       .globl light_led

+light_led:

+       ldr     r0,=0x110002E0      @ set GPM4CON Register

+       ldr     r1,=0x00001111      @ Configurate GPM4_0<A1>GPM4_1<A2>GPM4_2<A2>GPM4_3 output

+       str     r1,[r0]

+

+       ldr     r0,=0x110002E4       @ set GPM4DAT Register

+@      mov     r1,#0xFE             @ light All led1 on

+@      mov     r1,#0xFD             @ light All led2 on

+@      mov     r1,#0xFB             @ light All led3 on

+@      mov     r1,#0xF7             @ light All led4 on

+       mov r1,#0xF0                     @ light All led on

+       str     r1,[r0]

+       mov pc, lr

 

 

 

3、修改board/samsung/tiny4412/tools/mktiny4412spl.c文件,用于生成BL2

(在《X-003 FriendlyARM tiny4412 uboot移植之添加相应目录文件》中已经修改好了mktiny4412spl.c文件,这步可以省略)

diff --git a/board/samsung/tiny4412/tools/mktiny4412spl.c b/board/samsung/tiny4412/tools/mktiny4412spl.c

index 3ed20ef..c3a3e29 100755

--- a/board/samsung/tiny4412/tools/mktiny4412spl.c

+++ b/board/samsung/tiny4412/tools/mktiny4412spl.c

@@ -1,5 +1,6 @@

 /*

- * Copyright (C) 2011 Samsung Electronics

+ *       2016

+ *  Author  AP0904225 <ap0904225@qq.com>

  *

  * SPDX-License-Identifier:    GPL-2.0+

  */

@@ -13,11 +14,9 @@

 #include <sys/stat.h>

 

 #define BUFSIZE                        (16*1024)

-#define IMG_SIZE               (16*1024)

-#define SPL_HEADER_SIZE                16

+#define IMG_SIZE               ( (14*1024)- 4 )

 #define FILE_PERM              (S_IRUSR | S_IWUSR | S_IRGRP \\

                                | S_IWGRP | S_IROTH | S_IWOTH)

-#define SPL_HEADER             "S5PC210 HEADER  "

 /*

 * Requirement:

 * IROM code reads first 14K bytes from boot device.

@@ -37,7 +36,8 @@ int main(int argc, char **argv)

        int i, len;

        unsigned char buffer[BUFSIZE] = {0};

        int ifd, ofd;

-       unsigned int checksum = 0, count;

+       unsigned int checksum = 0;

+       unsigned int count = 0;

 

        if (argc != 3) {

                printf(" %d Wrong number of arguments\\n", argc);

@@ -52,7 +52,7 @@ int main(int argc, char **argv)

        }

 

        ofd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, FILE_PERM);

-       if (ifd < 0) {

+       if (ofd < 0) {

                fprintf(stderr, "%s: Can\'t open %s: %s\\n",

                        以上是关于X-004 FriendlyARM tiny4412 uboot移植之点亮指路灯的主要内容,如果未能解决你的问题,请参考以下文章

X-003 FriendlyARM tiny4412 uboot移植之添加相应目录文件

X-005 FriendlyARM tiny4412 uboot移植之时钟初始化

X-007 FriendlyARM tiny4412 u-boot移植之内存初始化

X-006 FriendlyARM tiny4412 u-boot移植之Debug串口用起来

FriendlyARM Tiny6410-Fedora14-QtSDK-Qt4.7交叉编译环境的建立

X-009 FriendlyARM tiny4412 uboot移植之SD Card用起来Kernel boot起来

(c)2006-2024 SYSTEM All Rights Reserved IT常识