22849|11

5314

帖子

453

TA的资源

五彩晶圆(高级)

楼主
 

学习Sitara AM335x 的Uboot移植笔记 [复制链接]

一、移植过程
1、架构移植
2SOC移植
3板级移植
二、3种移植的区别
       1、架构移植:Cortex-A8MIPSPOWERPC
       2SOC移植 :同一系列,不同型号间的外设(如I2C)的区别
       3、板级移植:EVM(删减模块,驱动)的SDK到目标板SDK
三、移植原代码目录
u-boot相关原代码目录
ti-sdk-am335x-05.05.00.00/board-support/u-boot-2011.09-psp04.06.00.08/
linux-相关原代码目录
ti-sdk-am335x-05.05.00.00/board-support/linux-3.2-psp04.06.00.08.sdk/
实验及实验原码资源
http://processors.wiki.ti.com/index.php/Sitara_Linux_Training:_UBoot_Board_Port
git://gitorious.org/sitara-board-port/sitara-board-port-uboot.git
http://arago-project.org/git/projects/?p=u-boot-am33x.git;a=summary
四、X-Loader
x-loader是在系统上电之后,执行完ROM中的frimware后最先开始执行的用户程序,它的体积很小,执行的功能也很简单,主要是对系统时钟以及外部SDRAM进行初始化,初始化完成之后就检查Flash中的uboot image是否准备好,如果准备好了就将Flash中的uboot image根据image header中指定的load address加载到外部SDRAM中,然后就跳转到uboot执行代码      
X-Loader U-boot合并
     U-boot目录中含有U-boot又是SPL的代码,通过以下宏选择编译
#ifdef CONFIG_SPL_BUILD
#ifndef CONFIG_SPL_BUILD
五、U-BOOT移植相关目录

2、实现的功能和头文件

六、SDK里板级文件概况
1、板级接口初始化程序
一个文件支持SPLU –BOOT两种程序
通过宏定义区分SPL U –BOOT
2、初始化DDR,串口,外部电源芯片(PMIC)







[ 本帖最后由 蓝雨夜 于 2012-10-25 14:13 编辑 ]

1.JPG (10.64 KB, 下载次数: 5)

1.JPG

1.JPG (10.64 KB, 下载次数: 2)

1.JPG

最新回复

是滴  详情 回复 发表于 2012-10-25 16:18
点赞 关注(3)
 

回复
举报

5314

帖子

453

TA的资源

五彩晶圆(高级)

沙发
 
七、移植模版文件
Evm.c 板级文件
DDR初始化,MPU频率调整初始化,外部电源PMIC初始化等基本的功能。

八、介绍模版文件工作
       1DDR初始化:
    根据不同的DDR时序配置EMIFCMDDATA EMIFO CLK

2、DDR初始化位置  pll.c,ddr_defs.h,cpu.h







































[ 本帖最后由 蓝雨夜 于 2012-10-25 14:19 编辑 ]
 
 

回复

5314

帖子

453

TA的资源

五彩晶圆(高级)

板凳
 
3、DDR代码初始化细节

4、DDR设计参考
http://processors.wiki.ti.com/in ... _Configuration_tips
九、SPL
实现基本的pll,rtc,uart,ddr初始化功能
由lowlevel_init.s调用

十、设置MPU的时钟频率
Spl_board_init()
MPU@720M, VDDmpu=1.26V
MPU@600M, VDDmpu=1.20V
先配置工作电压,再设置MPU工作频率

十一、U-BOOT模版文件
U-BOOT入口函数


十二、添加MMC支持
1、PIN MUX的使用:使用到的管脚进行配置工作
2、设备初始化代码(SDK已实现)
a、 am335x_evm.h中打开MMC include/configs/am355x.evm.h
             bmmc.c文件 (drivers/mmc/mmc.c) 用以下函数初始化
        
             c、在int board_mmc_init(bd_t *bis)里增加MMC的初始化

十三、添加以太网支持
1、net/eth.c
      
     

   

[ 本帖最后由 蓝雨夜 于 2012-10-25 14:28 编辑 ]
 
 
 

回复

5970

帖子

8

TA的资源

版主

4
 
如何添加NAND 支持啊

点评

evm.c 里面有Board_nand_init(mtd),Nand_scan_ident,Board_nand_ecc_init吗?  详情 回复 发表于 2012-10-25 15:43
个人签名生活就是油盐酱醋再加一点糖,快活就是一天到晚乐呵呵的忙
===================================
做一个简单的人,踏实而务实,不沉溺幻想,不庸人自扰
 
 
 

回复

5314

帖子

453

TA的资源

五彩晶圆(高级)

5
 

回复 4楼 chenzhufly 的帖子

evm.c
里面有Board_nand_init(mtd),Nand_scan_ident,Board_nand_ecc_init吗?
 
 
 

回复

5970

帖子

8

TA的资源

版主

6
 
呵呵,看来你没弄过
我自己研究吧,谢谢回复!

点评

Writing Kernel Image to NAND Flash http://processors.wiki.ti.com/index.php/Writing_Kernel_Image_to_NAND_Flash  详情 回复 发表于 2012-10-25 16:30
恩 你要U_Boot从NANDFlash启动?  详情 回复 发表于 2012-10-25 16:07
个人签名生活就是油盐酱醋再加一点糖,快活就是一天到晚乐呵呵的忙
===================================
做一个简单的人,踏实而务实,不沉溺幻想,不庸人自扰
 
 
 

回复

5314

帖子

453

TA的资源

五彩晶圆(高级)

7
 

回复 6楼 chenzhufly 的帖子


你要U_Boot从NANDFlash启动?
 
 
 

回复

5970

帖子

8

TA的资源

版主

8
 
是滴
个人签名生活就是油盐酱醋再加一点糖,快活就是一天到晚乐呵呵的忙
===================================
做一个简单的人,踏实而务实,不沉溺幻想,不庸人自扰
 
 
 

回复

5314

帖子

453

TA的资源

五彩晶圆(高级)

9
 

回复 6楼 chenzhufly 的帖子

 
 
 

回复

5314

帖子

453

TA的资源

五彩晶圆(高级)

10
 
 
 

回复

5314

帖子

453

TA的资源

五彩晶圆(高级)

11
 
 
 

回复

5314

帖子

453

TA的资源

五彩晶圆(高级)

12
 
How to Flash Linux System from U-boot
http://processors.wiki.ti.com/in ... _System_from_U-boot

Application
This article applies to Sitara SDK 4.0.1 which uses the Platform Support Package (PSP) software version 03.01.00.06

for AM35x and AM37x devices.   This information is obsolete as newer software has different NAND ECC requirements.

Introduction
This guide will show how use u-boot to flash the NAND of an OMAP3 EVM (for AM37x, DM37x or OMAP35xx devices) or an AM3517EVM (for AM35x devices) with Linux system binaries.  

Assumptions:
1.SD card with system binaries (x-loader, u-boot, Linux kernel) on boot partition
2.Linux root filesystem in rootfs partition of SD card or root filesystem available via NFS



Caution
The procedures here will erase the NAND flash of the EVM.  This includes all u-boot environment variables.  Use the "printenv" command (or just "pri") in u-boot to print a complete list of environment variables.  Copy and paste these to a text file for safe keeping.




Boot EVM into SD/MMC card boot mode
The SD card must at least have the files MLO, u-boot.bin, and uImage.  All of these files can also be found in the "./psp/prebuilt-images" directory in the Sitara SDK installation (with names that include the platform name and software revision info).  The MLO file is simply a re-named copy of the file x-load.bin.ift that is produced by rebuilding x-loader and signing the file.  When the board is booted in SD/MMC card boot mode, the ROM code looks specifically for the file with the name MLO as the primary bootloader.

To boot from this SD card, the boot switches should be set to SD/MMC boot:




For Mistral OMAP EVM (AM37x, DM37x or OMAP35xx devices)

Set SW4 switches #1, #2, #3 and #6 to the ON position and all others OFF (MMC1, UART3 boot order)

For LogicPD AM3517EVM (AM35x device)

Set SW7 switches #1 and #4 to the ON position and all others OFF.  (USB, UART, MMC1, XIP boot order)
  

Start the board and interrupt the boot process when prompted by hitting any key in the UART terminal application:

Texas Instruments X-Loader 1.45 (Mar 19 2010 - 19:44:19)
Starting X-loader on MMC
Reading boot sector

212504 Bytes Read from MMC
Starting OS Bootloader from MMC...
Starting OS Bootloader...
U-Boot 2009.11 (May 06 2010 - 16:57:54)

OMAP34xx/35xx-GP ES1.0, CPU-OPP2 L3-165MHz
OMAP3 EVM board + LPDDR/NAND
I2C: ready
DRAM: 128 MB
NAND: 256 MiB
*** Warning - bad CRC or NAND, using default environment

In: serial
Out: serial
Err: serial
Read back SMSC id 0x92200000
Die ID #731c0000000000000156087c0a023021
Net: smc911x-0
Hit any key to stop autoboot: 0
OMAP3_EVM #
OMAP3_EVM # All of the commands in this guide are performed at the u-boot prompt.  

  

  

  

Run the u-boot commands to flash the NAND
All of the following commands are performed at the u-boot prompt.

  These commands are actually a series of u-boot commands that are connected together with semicolons.  The individual commands can be entered separately or simple pasted from here.




Complete xloader write from MMC to NAND (only erases one block=128k).
mw.b 0x81600000 0xff 0x20000;nand erase 0 20000;mmc init;fatload mmc 0 0x81600000 x-load.bin.ift;nandecc hw; nand write.i 0x81600000 0 20000  

Complete uboot write from MMC to NAND (only erases two blocks=256k)
mw.b 0x81600000 0xff 0x40000;nand erase 80000 40000;mmc init;fatload mmc 0 0x81600000 u-boot.bin;nandecc sw; nand write.i 0x81600000 80000 40000  

Complete kernel write from MMC to NAND (erases 3M)
mw.b 0x81600000 0xff 0x1400000;nand erase 280000 300000;mmc init;fatload mmc 0 0x81600000 uImage;nandecc sw; nand write.i 0x81600000 280000 300000   

  

Put the EVM in NAND boot mode
With the EVM in NAND boot mode and the images flashed in NAND as detailed above, the SD card does not need to be in the EVM at boot up.  X-loader and u-boot will run from NAND.  In order to also pull the Linux kernel (uImage) from NAND it will be necessary to halt the boot process and edit some u-boot environment variables.




For Mistral OMAP EVM (AM37x, DM37x or OMAP35xx devices)

Set SW4 switches #2, #4 and #6 to the ON position and all others OFF (NAND, UART3 boot order)

For LogicPD AM3517EVM (AM35x device)

Set SW7 with switches #1 thru #8 all to the OFF position. (NAND, EMAC, USB, MMC1 boot order)

  

Save off the original boot command
setenv bootcmd_original ${bootcmd}
saveenv


Create command for reading the kernel from NAND and then another command for doing the boot where the kernel is pulled from NAND and the root filesystem is from the SD/MMC card.  
setenv nand_kernel 'nand read.i ${loadaddr} 280000 300000'
setenv nand_mmc_boot 'run nand_kernel;setenv bootargs ${mmcargs}; bootm'

Run this last command to actually perform the boot.  And always save the environment after making changes.

saveenv
run nand_mmc_boot


  

  

Flashing the Root File System to NAND
A jffs2 file system can be copied into NAND flash.  Copy the file rootfs.tar.gz to the /home/root directory on the SD Card. Boot the EVM to Linux and enter the following commands:

[prompt]$ flash_eraseall –j /dev/mtd4
[prompt]$ mount /dev/mtdblock4 /media/nand –t jffs2
[prompt]$ cd /media/nand
[prompt]$ tar xzf /home/root/rootfs.tar.gz
[prompt]$ reboot –fThe bootargs under u-boot must be altered to use this new NAND file system.

NOTE:After the reboot the board is now running in u-boot, remember to stop the autoboot sequence by typing any key. The following are u-boot commands:

setenv bootargs 'mem=128M console=ttyS0,115200n8 noinitrd root=/dev/mtdblock4 rw rootfstype=jffs2 ip=dhcp'
bootm





Mounting File System from NFS
The file system can also be mounted as a Network File System (NFS).  The NFS is simply a sub-directory of the Linux host development system.  

Another command can be made to pull the root filesystem via NFS.  This command can be combine with the one to pull the bootloaders and kernel from NAND.  (The IP address and path to the NFS is an example and should be changed by the user).

setenv serverip
setenv nfsargs 'setenv bootargs mem=128M console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=${serverip}:/home/user/ti-sdk-AM3715-evm-4.0.0.0/rfs,nolock,rsize=1024,wsize=1024'
setenv nand_nfs_boot 'run nand_kernel;run nfsargs; bootm ${loadaddr}'
saveenv
run nand_nfs_boot
  

Default NAND partitioning (from x-loader)
/* NAND is partitioned:
* 0x00000000 - 0x0007FFFF Booting Image (512k)
* 0x00080000 - 0x0023FFFF U-Boot Image (1.6M)
* 0x00240000 - 0x0027FFFF U-Boot Env Data (256k)
* 0x00280000 - 0x0077FFFF Kernel Image (5M)
* 0x00780000 - 0x08000000 File System

Block size = 0x00020000 (128k)
* Page size = 0x00000800 (2k)
*/
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条
电源解决方案和技术 | DigiKey 应用探索站
当月好物、电源技术资源、特色活动、DigiKey在线实用工具,干货多多~

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表