tiny4412 --uboot移植(2) 点灯

时间:2022-03-11 06:36:47

开发环境:win10 64位 + VMware12 + Ubuntu14.04 32位

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

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

Tiny4412开发板硬件版本为

  底板:  Tiny4412SDK 1312B

  核心板:Tiny4412 - 1306

 

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

4412裸板开发 (1点灯)

代码,原理都与裸板相同,就不多做介绍。

 

1、直接将其添加进 arch/arm/cpu/armv7/start.S 

diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index 7eee54b..387f2ac 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -60,7 +60,7 @@ switch_to_hypervisor_ret:
orrne r0, r0, #0x13 @ set SVC mode
orr r0, r0, #0xc0 @ disable FIQ and IRQ
msr cpsr,r0

/*
* Setup vector:
* (OMAP4 spl TEXT_BASE is not 32 byte aligned.
@@ -84,7 +84,7 @@ switch_to_hypervisor_ret:
bl cpu_init_crit
#endif
#endif

// bl_main 之前加,在cpu_init 之后
+ bl light_led
bl _main

/*-----------------------------------------------------------------------------
@@ -293,3 +293,13 @@ 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
+ ldr r1,=0x00001111
+ str r1,[r0]
+
+ ldr r0,=0x110002E4
+ mov r1,#0xF0
+ str r1,[r0]
+ mov pc,lr

 

2、将sd_fuse 文件夹复制到根目录下,其中包括exynos4412启动所需的二进制固件:E4412_N.bl1.bin、E4412_tzsw.bin 、sd_fuse.c、fast_fuse.sh、sd_fusing.sh

只需要修改sd_fusing.sh 

# # Copyright (C) 2011 Samsung Electronics Co., Ltd. # http://www.samsung.com/ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # #################################### if [ -z $1 ] then echo "usage: ./sd_fusing.sh <SD Reader's device file>" exit 0 fi if [ -b $1 ] then echo "$1 reader is identified."
else echo "$1 is NOT identified." exit 0 fi #################################### #<verify device>

BDEV_NAME=`basename $1` BDEV_SIZE=`cat /sys/block/${BDEV_NAME}/size` if [ ${BDEV_SIZE} -le 0 ]; then echo "Error: NO media found in card reader." exit 1 fi
if [ ${BDEV_SIZE} -gt 32000000 ]; then echo "Error: Block device size (${BDEV_SIZE}) is too large" exit 1 fi #################################### # check files #################################### # fusing images signed_bl1_position=1 bl2_position=17 uboot_position=49 tzsw_position=705 #<BL1 fusing> echo "---------------------------------------" echo "BL1 fusing" dd iflag=dsync oflag=dsync if=./E4412_N.bl1.bin of=$1 seek=$signed_bl1_position #<tiny4412-spl.bin fusing> echo "---------------------------------------" echo "tiny4412-spl.bin fusing" dd iflag=dsync oflag=dsync if=./tiny4412-spl.bin of=$1 seek=$bl2_position
#
<u-boot fusing> #echo "---------------------------------------" #echo "u-boot fusing" #dd iflag=dsync oflag=dsync if=E4412UBOOTof=1 seek=$uboot_position #<TrustZone S/W fusing> #echo "---------------------------------------" #echo "TrustZone S/W fusing" #dd iflag=dsync oflag=dsync if=./E4412_tzsw.bin of=1seek=tzsw_position #<flush to disk>

sync #################################### #<Message Display> echo "---------------------------------------" echo "U-boot image is fused successfully." echo "Eject SD card and insert it again."

 

3、u-boot根目录下添加编译脚本文件build-tiny4412.sh

  1 echo "****clean****"
  2 make clean 3 
  4 echo "----config tiny4412----"
  5 make ARCH=arm tiny4412_defconfig 6 
  7 echo "----building----"
  8 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-

 

在完成前两部后,在根目录执行build-tiny4412.sh ,正常会在spl下生成tiny4412-spl.bin。这就是通过board/samsung/tiny4412/tools/mktiny4412spl.h生成的bl2。然后把tiny4412-spl.bin拷入sd_fuse ,用sd_fusing.sh 烧入SD卡即可。