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

开发环境: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. 2015年4月29日 dayofweek

    #include <stdio.h>#include <stdlib.h>int DayofYear(int year, int month, int day);#define ...

  2. JS-DOM操作应用高级(一)

    表格应用--tBodies  tHead  tFoot  rows  cells <title>无标题文档</title> <script> window.onlo ...

  3. VBS脚本和HTML DOM自动操作网页

    VBS脚本和HTML DOM自动操作网页 2016-06-16 10:24 1068人阅读 评论(0) 收藏 举报  分类: Windows(42)  版权声明:本文为博主原创文章,未经博主允许不得转 ...

  4. 在线的代码托管平台 coding.net ===中国扩展版github

    coding.net 是国内新兴的一个项目管理平台,功能主要包括:代码托管.在线运行环境.监控代码质量,兼有一定的社交功能. 在线运行环境支持Java.Ruby.Node.js.PHP.Python. ...

  5. Codeforces Round #366 (Div. 2) C. Thor (模拟)

    C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  6. 转 区别 getChildFragmentManager getSupportFragmentManager

    The definition of getChildFragmentManager() is: Return a private FragmentManager for placing and man ...

  7. 关于java.lang.reflect.InvocationTargetException(jar 包缺少或者冲突)的错误

    我在合肥那边运行了的是湖北石首市的项目没有错 可是回武汉之后 运行这个项目 点击这里的时候 就报错java.lang.reflect.InvocationTargetException   不是数据库 ...

  8. CALayer --> UIView

    一.CALayer和UIView的关系 UIView显示在屏幕上归功于CALayer 可以说:UIView依赖CALayer,又高于CALayer 通过调用drawRect方法来渲染自身的内容,调节C ...

  9. Apache下的FileUtils.listFiles方法简单使用技巧

    一.引言 Apache提供的很多工具方法非常好用,推荐. 今天在使用的过程中使用到了org.apache.commons.io.FileUtils.listFiles方法,本文主要谈谈这个工具方法的用 ...

  10. 之一 select模型

    // select.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <WinSock2.h> #include ...