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 ...
随机推荐
- tiny210移植linux内核(3.0.8)杂项
关于三星芯片nand内存分区文件: linux-3.0.8/drivers/mtd/nand/s3c_nand.c struct mtd_partition s3c_partition_info[] ...
- AutoTile 自动拼接(二) 学习与实践
开始代码前,我们要做点准备工作. 下面 跟着我做. 首先我 扣了一个 图. 这个是 做 水的资源,所以是动态的,我把其余两张也扣了出来. 看起来一样,不是,这样看肯定 看不出所以然,你们先放到u3d中 ...
- java 随机流
Example10_8.java import java.io.*; public class Example10_8 { public static void main(String args[]) ...
- 一个很好的通用 excel 导出工具类
此类用主要 jxl +注解+流 实现扩展性很强,jxl性能会比poi好一点,值得我们学习. package oa.common.utils; import java.io.OutputStream; ...
- synchronized关键字以及实例锁 类锁
Java语言的关键字,当它用来修饰一个方法或者一个代码块的时候,能够保证在同一时刻最多只有一个线程执行该段代码. 一.当两个并发线程访问同一个对象object中的这个synchronized(this ...
- 读《Ext.JS.4.First.Look》随笔
Ext JS 4是最大的改革已经取得了Ext框架.这些变化包括一个新类系统,引入一个新的平台,许多API变化和改进,和新组件,如新图表和新画组件.Ext JS 4是更快,更稳定,易于使用.(注意:Ex ...
- Yii config 配置
Yii2 配置文件 常用配置总结 <?php // 主配置文件 $config = array( 'modules' => array( 'gii' => array( 'class ...
- Bcdedit命令使用详解使用方法
XP,WIN2003,VISTA,万indows,WIN2008多盘多系统多引导bcdedit的使用windows出了新系统vista,2008想赏赏鲜学习学习~~但又习惯于用旧的XP,2003,然而 ...
- android 权限管理和签名 实现静默卸载
为了实现静默卸载, 学了下android的安全体系,记录如下 最近在做个东西,巧合碰到了sharedUserId的问题,所以收集了一些资料,存存档备份. 安装在设备中的每一个apk文件,Android ...
- 详细版在虚拟机安装和使用hadoop分布式集群
集群模式: 一台master 192.168.85.2 一台slave 192.168.85.3 jdk jdk1.8.0_74(版本不重要,看喜欢) hadoop版本 2.7.2(版本不重要,2. ...