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

开发环境: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内存的更多相关文章

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

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

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

    <<<<<<<<<<<<<<<<<<<<<<<<< ...

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

    <<<<<<<<<<<<<<<<<<<<<<<<< ...

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

    <<<<<<<<<<<<<<<<<<<<<<<<< ...

  5. X-001 FriendlyARM Tiny4412 uboot移植前奏

    版权声明:本文为博主原创文章,转载请注明出处 开发环境:win7 64位 + VMware12 + Ubuntu14.04 64位 工具链:linaro提供的gcc-linaro-6.1.1-2016 ...

  6. X-010 FriendlyARM tiny4412 uboot移植之移植网卡驱动TFTP用起来

    <<<<<<<<<<<<<<<<<<<<<<<<< ...

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

    <<<<<<<<<<<<<<<<<<<<<<<<< ...

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

    <<<<<<<<<<<<<<<<<<<<<<<<< ...

  9. tiny4412 --Uboot移植(5) DDR3内存

    开发环境:win10 64位 + VMware12 + Ubuntu14.04 32位 工具链:linaro提供的gcc-linaro-6.1.1-2016.08-x86_64_arm-linux-g ...

随机推荐

  1. CDockablepane风格设置

    屏蔽掉pane右上角的几个按钮 即将CDockablePane右上角的三个按钮屏蔽. 1            去掉关闭按钮 在CDockablePane的派生类中,重写方法CanBeClosed即可 ...

  2. c语言scanf详解

    函数名: scanf 功 能: 执行格式化输入 用 法: int scanf(char *format[,argument,...]);scanf()函数是通用终端格式化输入函数,它从标准输入设备(键 ...

  3. UVA - 1347 Tour(DP + 双调旅行商问题)

    题意:给出按照x坐标排序的n个点,让我们求出从最左端点到最右短点然后再回来,并且经过所有点且只经过一次的最短路径. 分析:这个题目刘汝佳的算法书上也有详解(就在基础dp那一段),具体思路如下:按照题目 ...

  4. android 报错之noclassdeffounderror

    解决方案1: 导入第3方jar包问题,明明导入了jar但还是报java.lang.NoClassDefFoundError解决步骤:1.在Android项目根目录下新建一个lib文件夹:2.把你需要导 ...

  5. ThinkPHP3.2.3版本框架could not find driver错误

    ThinkPHP3.2.3版本框架could not find driver错误 在更新ThinkPHP框架 3.2.3 时出现错误 解决方法如下: 修改php.ini文件 extension=php ...

  6. ibdata1文件--缩小mysql数据库的ibdata1文件

    摘要 在MySQL数据库中,如果不指定innodb_file_per_table参数,单独存在每个表的数据,MySQL的数据都会存放在ibdata1文件. mysql ibdata1存放数据,索引等, ...

  7. Django: 之数据库导入、迁移和联用

    Django 数据库导入 从网上下载的一些数据,excel表格,xml文件,txt文件等有时候我们想把它导入数据库,应该如何操作呢? 以下操作符合 Django版本为 1.6 ,兼顾 Django 1 ...

  8. python插入mysql新值

    #Server Connection to MySQL: import MySQLdb conn = MySQLdb.connect(host= "localhost", user ...

  9. github 教程

    http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/

  10. log4j输出到指定日志文件

    log4j.properties: log4j.logger.myTest=DEBUG,console,FILE log4j.appender.console=org.apache.log4j.Con ...