X-008 FriendlyARM tiny4412 uboot移植之copy u-boot到DDR内存
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
开发环境: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开发板上片外的DDR内存初始化完成。接下来是把完整的u-boot.bin从SD卡上拷贝到DDR内存,并跳转到DDR内存中去执行u-boot。
1、Exynos4412代码拷贝函数(DEVICE COPY FUNCTIONS)
《Android_Exynos4412_iROM_Secure_Booting_Guide_Ver.1.00.00.pdf》的第21页描述了exynos4412芯片的块拷贝函数。这些内置的函数支持从启动设备拷贝数据到内存。

特别要注意,使用这些函数是对启动设备的时钟有要求,如果时钟不对,这些函数可能无法正常工作:

SD卡和eMMC卡的工作频率是20MHz。因此在设置系统时钟的时候,要把启动设备(SD卡、eMMC卡)的时钟设置为20MHz。
从《Tiny4412-1412-Schematic.pdf》和《Tiny4412SDK-1506-Schematic.pdf》原理图上,我们可以知道tiny4412的SD卡是接在exynos4412芯片的Xmmc2口。

重新设置mmc2的时钟频率为20MHz,相应的代码修改如下:
|
diff --git a/arch/arm/mach-exynos/clock_init_exynos4412.c b/arch/arm/mach-exynos/clock_init_exynos4412.c index cd70185..4617c8c 100644 --- a/arch/arm/mach-exynos/clock_init_exynos4412.c +++ b/arch/arm/mach-exynos/clock_init_exynos4412.c @@ -298,9 +298,9 @@ void system_clock_init(void) * DOUTmmc3 = MOUTmmc3 / (ratio + 1) = 100 (7) * sclk_mmc3 = DOUTmmc3 / (ratio + 1) = 50 (1) * DOUTmmc2 = MOUTmmc2 / (ratio + 1) = 100 (7) - * sclk_mmc2 = DOUTmmc2 / (ratio + 1) = 50 (1) + * sclk_mmc2 = DOUTmmc2 / (ratio + 1) = 20 (4) */ - set = MMC2_RATIO(7) | MMC2_PRE_RATIO(1) | MMC3_RATIO(7) | + set = MMC2_RATIO(7) | MMC2_PRE_RATIO(4) | MMC3_RATIO(7) | MMC3_PRE_RATIO(1); clrsetbits_le32(&clk->div_fsys2, clr, set); |
2、设置SD卡上存放代码的位置
相应的设置参考《Android_Exynos4412_iROM_Secure_Booting_Guide_Ver.1.00.00.pdf》的第24页描述.

对于tiny4412开发板,SD卡上存放代码的位置设置如下:
/ * SD/MMC(1 Block = 512B) layout:
* +------------------------------------------------------------------------------------------------------------------------------------+
* | | | | | |
* | 512B | 8K(bl1) | 16k(bl2/spl) | 16k(ENV) | 512k(u-boot) |
* | | | | | |
* <- Block0 ->-<- Block1~Block16 ->-<- Block17~Block48 ->-<- Block49~Block80 ->-<- Block81~Block1073 ->
*/
相应的代码修改如下:
|
diff --git a/arch/arm/mach-exynos/lowlevel_init.c b/arch/arm/mach-exynos/lowlevel_init.c index 361727d..6a05fda 100644 --- a/arch/arm/mach-exynos/lowlevel_init.c +++ b/arch/arm/mach-exynos/lowlevel_init.c @@ -229,7 +229,10 @@ int do_lowlevel_init(void) #endif #endif mem_ctrl_init(actions & DO_MEM_RESET); + +#ifndef TINY4412 tzpc_init(); +#endif } return actions & DO_WAKEUP; diff --git a/include/configs/tiny4412.h b/include/configs/tiny4412.h index 281838d..3a02f9e 100644 --- a/include/configs/tiny4412.h +++ b/include/configs/tiny4412.h @@ -102,17 +102,33 @@ #define CONFIG_SYS_MMC_ENV_DEV 0 #define CONFIG_ENV_SIZE (16 << 10) /* 16 KB */ #define RESERVE_BLOCK_SIZE (512) -#define BL1_SIZE (16 << 10) /*16 K reserved for BL1*/ -#define CONFIG_ENV_OFFSET (RESERVE_BLOCK_SIZE + BL1_SIZE) +#define BL1_SIZE (8 << 10) /* 8K reserved for BL1*/ +#define BL2_SIZE (16 << 10) /*16 K reserved for BL2/SPL*/ +#define CONFIG_ENV_OFFSET (RESERVE_BLOCK_SIZE + BL1_SIZE + BL2_SIZE) #define CONFIG_SPL_LDSCRIPT "board/samsung/common/exynos-uboot-spl.lds" #define CONFIG_SPL_MAX_FOOTPRINT (14 * 1024) #define CONFIG_SYS_INIT_SP_ADDR 0x02040000 -/* U-Boot copy size from boot Media to DRAM.*/ +/* U-Boot copy size from SD/MMC to DRAM.*/ #define COPY_BL2_SIZE 0x80000 #define BL2_START_OFFSET ((CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)/512) -#define BL2_SIZE_BLOC_COUNT (COPY_BL2_SIZE/512) +#define BL2_SIZE_BLOC_COUNT (COPY_BL2_SIZE/512) /* u-boot size is 512K */ + +/* + * SD/MMC(1 Block = 512B) layout: + * +------------+-------------------------------------------------------------------------------------------------+ + * | | + * | | | | | | + * | 512B | 8K(bl1) | 16k(bl2/spl) | 16k(ENV) | 512k(u-boot) | + * | | | | | | + * | | + * <- Block0 ->-<- Block1~Block16 ->-<- Block17~Block48 ->-<- Block49~Block80 ->-<- Block81~Block1073 ->----------+ + * + * + */ + + #endif /* __CONFIG_H */ |
3、修改sd_fuse/sd_fusing.sh,烧写BL2和u-boot.bin到SD卡中
sd_fuse/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 #################################### # fusing images #E4412_UBOOT = ../u-boot.bin signed_bl1_position=1 bl2_position=17 uboot_position=81 tzsw_position=705 #<BL1 fusing> echo " " echo "---------------------------------------" echo "BL1 fusing" #dd iflag=dsync oflag=dsync if=./E4412_N.bl1.bin of=$1 seek=$signed_bl1_position #<BL2 fusing> echo " " echo "---------------------------------------" echo "BL2 fusing" dd iflag=dsync oflag=dsync if=../spl/tiny4412-spl.bin of=$1 seek=$bl2_position #<u-boot fusing> echo " " echo "---------------------------------------" echo "u-boot fusing" dd iflag=dsync oflag=dsync if=../u-boot.bin of=$1 seek=$uboot_position #<TrustZone S/W fusing> #echo " " #echo "---------------------------------------" #echo "TrustZone S/W fusing" #dd iflag=dsync oflag=dsync if=./E4412_tzsw.bin of=$1 seek=$tzsw_position #<flush to disk> sync #################################### #<Message Display> echo " " echo "---------------------------------------" echo "U-boot image is fused successfully." echo "Eject SD card and insert it to tiny4412 board ." |
编译u-boot,并把相应的BL2和u-boot.bin文件烧写到SD卡,设置tiny4412开发板从SD卡启动,启动后,可以看到串口输出如下信息:

到这里,我们就完成了把u-boot.bin从SD卡拷贝到DDR内存中并在内存中执行u-boot。
u-boot可以在DDR内存执行后,我们转向使用printf函数来打印调试信息。因此可以把SPL阶段的调试串口关闭了:
|
diff --git a/configs/tiny4412_defconfig b/configs/tiny4412_defconfig index 19d0dda..0f4f2b1 100644 --- a/configs/tiny4412_defconfig +++ b/configs/tiny4412_defconfig @@ -26,12 +26,12 @@ CONFIG_OF_CONTROL=y # #DEBUG UART # -CONFIG_DEBUG_UART=y -CONFIG_SPL_SERIAL_SUPPORT=y -CONFIG_SPL_GPIO_SUPPORT=y -CONFIG_DEBUG_UART_S5P=y -CONFIG_DEBUG_UART_BASE=0x13800000 -CONFIG_DEBUG_UART_CLOCK=100000000 +#CONFIG_DEBUG_UART=y +#CONFIG_SPL_SERIAL_SUPPORT=y +#CONFIG_SPL_GPIO_SUPPORT=y +#CONFIG_DEBUG_UART_S5P=y +#CONFIG_DEBUG_UART_BASE=0x13800000 +#CONFIG_DEBUG_UART_CLOCK=100000000 # #NOTE:do not delete this: |
参考
1、《Exynos 4412 SCP_Users Manual_Ver.0.10.00_Preliminary.pdf》
2、tiny210(s5pv210)从存储设备加载代码到DDR http://blog.csdn.net/ooonebook/article/details/52965362
3、uboot_tiny4412-20130729
X-008 FriendlyARM tiny4412 uboot移植之copy u-boot到DDR内存的更多相关文章
- X-003 FriendlyARM tiny4412 uboot移植之添加相应目录文件
X-003 FriendlyARM tiny4412 uboot移植之添加相应目录文件 <<<<<<<<<<<<<< ...
- X-004 FriendlyARM tiny4412 uboot移植之点亮指路灯
<<<<<<<<<<<<<<<<<<<<<<<<< ...
- X-007 FriendlyARM tiny4412 u-boot移植之内存初始化
<<<<<<<<<<<<<<<<<<<<<<<<< ...
- X-009 FriendlyARM tiny4412 uboot移植之SD Card用起来Kernel boot起来
<<<<<<<<<<<<<<<<<<<<<<<<< ...
- X-001 FriendlyARM Tiny4412 uboot移植前奏
版权声明:本文为博主原创文章,转载请注明出处 开发环境:win7 64位 + VMware12 + Ubuntu14.04 64位 工具链:linaro提供的gcc-linaro-6.1.1-2016 ...
- X-010 FriendlyARM tiny4412 uboot移植之移植网卡驱动TFTP用起来
<<<<<<<<<<<<<<<<<<<<<<<<< ...
- X-005 FriendlyARM tiny4412 uboot移植之时钟初始化
<<<<<<<<<<<<<<<<<<<<<<<<< ...
- X-006 FriendlyARM tiny4412 u-boot移植之Debug串口用起来
<<<<<<<<<<<<<<<<<<<<<<<<< ...
- tiny4412 --Uboot移植(5) DDR3内存
开发环境:win10 64位 + VMware12 + Ubuntu14.04 32位 工具链:linaro提供的gcc-linaro-6.1.1-2016.08-x86_64_arm-linux-g ...
随机推荐
- 初识Selenium(四)
用Selenium实现页面自动化测试 引言 要不要做页面测试自动化的争议由来已久,不做或少做的主要原因是其成本太高,其中一个成本就是自动化脚本的编写和维护,那么有没有办法降低这种成本呢?童战同学在其博 ...
- JS-运动基础(一)续
2.淡入淡出的图片 用变量存储透明度 <title>无标题文档</title> <style> #div1{width:293px; height:220px; b ...
- Air打包exe
1.用flash创建一个airtest.fla,发布目标选择为AIR.ctrl+enter会得到如下文件: 2.把flex sdk的bin中找到adl.exe,复制过来,放置到:项目目录\bin\ad ...
- .Net多线程编程—Parallel LINQ、线程池
Parallel LINQ 1 System.Linq.ParallelEnumerable 重要方法概览: 1)public static ParallelQuery<TSource> ...
- Bootstrap Modal 垂直居中
Bootstrap 的 modal 正文中如果内容较少的话,并不会垂直居中,而是偏上, 如果想要达到垂直居中的效果,需要自动动手了. 可以在初始显示时设置垂直居中,可以这样做: $('#YourMod ...
- C# Guid用法
GUID(全局统一标识符)是指在一台机器上生成的数字,它保证对在同一时空 中的所有机器都是唯一的.通常平台会提供生成GUID的API.生成算法很有意思,用到了以太网卡地址.纳秒级时间.芯片ID码和许多 ...
- 在 Android 中调用二进制可执行程序(native executable )
前几天有需要在java代码中调用二进制程序,就在网上找了些资料,写点东西记录下. Android 也是基于linux 的系统,当然也可以运行二进制的可执行文件.只不过Android 限制了直接的方式只 ...
- (转) 通过input分片的大小来设置map的个数
摘要 通过input分片的大小来设置map的个数 map inputsplit hadoop 前言:在具体执行Hadoop程序的时候,我们要根据不同的情况来设置Map的个数.除了设置固定的每个节点上可 ...
- Microsoft Web Test Recorder在录制时没有显示
在进行web test录制时,IE启动后,在左侧可能没有显示Microsoft Web Test Recorder,这很有可能是因为IE加载项中,该项被禁止了,按照如下操作可解决此问题: 1. 打开I ...
- 前端HR告诉你—如何面试Web前端开发
分享一篇HR前端面试心得: 面试前端工程师对我来说是一件非常有意思的事,因为面试过程很大程度上也是自我提升的过程.无论大公司还是小公司,之所以在如何招聘到真正有能力的,前端工程师方面会遇到同样的问题. ...