新闻中心

EEPW首页>嵌入式系统>设计应用> AM335x(TQ335x)学习笔记——u-boot-2014.10移植

AM335x(TQ335x)学习笔记——u-boot-2014.10移植

作者: 时间:2016-11-28 来源:网络 收藏
然后添加board_is_tq335x函数的具体实现,参考其它类似函数实现即可,由于我们的read_eeprom仅读到了name,其内容是"TQ335x",故可如下实现,在board/ti/am335x/board.h中添加如下内容:
  1. staticinlineintboard_is_tq335x(structam335x_baseboard_id*header)
  2. {
  3. return!strncmp(header->name,"TQ335x",HDR_NAME_LEN);
  4. }
最后是修改enable_board_pin_mux(board/ti/am335x/mux.c)函数,具体的修改内容如下:
  1. voidenable_board_pin_mux(structam335x_baseboard_id*header)
  2. {
  3. /*Doboard-specificmuxes.*/
  4. if(board_is_bone(header)||board_is_tq335x(header)){
  5. /*Beaglebonepinmux*/
  6. configure_module_pin_mux(i2c1_pin_mux);
  7. configure_module_pin_mux(mii1_pin_mux);
  8. configure_module_pin_mux(mmc0_pin_mux);
  9. #ifdefined(CONFIG_NAND)
  10. configure_module_pin_mux(nand_pin_mux);
  11. #elifdefined(CONFIG_NOR)
  12. configure_module_pin_mux(bone_norcape_pin_mux);
  13. #else
  14. configure_module_pin_mux(mmc1_pin_mux);
  15. #endif
  16. }elseif(board_is_gp_evm(header)){
  17. /*GeneralPurposeEVM*/
  18. unsignedshortprofile=detect_daughter_board_profile();
  19. configure_module_pin_mux(rgmii1_pin_mux);
  20. configure_module_pin_mux(mmc0_pin_mux);
  21. /*Inprofile#2i2c1andspi0conflict.*/
  22. if(profile&~PROFILE_2)
  23. configure_module_pin_mux(i2c1_pin_mux);
  24. /*Profiles2&3donthaveNAND*/
  25. #ifdefCONFIG_NAND
  26. if(profile&~(PROFILE_2|PROFILE_3))
  27. configure_module_pin_mux(nand_pin_mux);
  28. #endif
  29. elseif(profile==PROFILE_2){
  30. configure_module_pin_mux(mmc1_pin_mux);
  31. configure_module_pin_mux(spi0_pin_mux);
  32. }
  33. }elseif(board_is_idk(header)){
  34. /*IndustrialMotorControl(IDK)*/
  35. configure_module_pin_mux(mii1_pin_mux);
  36. configure_module_pin_mux(mmc0_no_cd_pin_mux);
  37. }elseif(board_is_evm_sk(header)){
  38. /*StarterKitEVM*/
  39. configure_module_pin_mux(i2c1_pin_mux);
  40. configure_module_pin_mux(gpio0_7_pin_mux);
  41. configure_module_pin_mux(rgmii1_pin_mux);
  42. configure_module_pin_mux(mmc0_pin_mux_sk_evm);
  43. }elseif(board_is_bone_lt(header)){
  44. /*BeagleboneLTpinmux*/
  45. configure_module_pin_mux(i2c1_pin_mux);
  46. configure_module_pin_mux(mii1_pin_mux);
  47. configure_module_pin_mux(mmc0_pin_mux);
  48. #ifdefined(CONFIG_NAND)
  49. configure_module_pin_mux(nand_pin_mux);
  50. #elifdefined(CONFIG_NOR)
  51. configure_module_pin_mux(bone_norcape_pin_mux);
  52. #else
  53. configure_module_pin_mux(mmc1_pin_mux);
  54. #endif
  55. }else{
  56. puts("Unknownboard,cannotconfigurepinmux.");
  57. hang();
  58. }
  59. }

另外,这个版本的u-boot有个bug,需要修改fat_register_device(fs/fat/fat.c)函数:

本文引用地址: //m.amcfsurvey.com/article/201611/322817.htm
  1. intfat_register_device(block_dev_desc_t*dev_desc,intpart_no)
  2. {
  3. disk_partition_tinfo;
  4. /*FirstcloseanycurrentlyfoundFATfilesystem*/
  5. cur_dev=NULL;
  6. /*Readthepartitiontable,ifpresent*/
  7. if(get_partition_info(dev_desc,part_no,&info)){
  8. /*if(part_no!=0){
  9. printf("**Partition%dnotvalidondevice%d**",
  10. part_no,dev_desc->dev);
  11. return-1;
  12. }*/
  13. info.start=0;
  14. info.size=dev_desc->lba;
  15. info.blksz=dev_desc->blksz;
  16. info.name[0]=0;
  17. info.type[0]=0;
  18. info.bootable=0;
  19. #ifdefCONFIG_PARTITION_UUIDS
  20. info.uuid[0]=0;
  21. #endif
  22. }
  23. returnfat_set_blk_dev(dev_desc,&info);
  24. }
至此,u-boot就已经可以启动了,但是有多余的步骤和log,不过可以去掉,修改file_fat_read_at(fs/fat/fat.c)函数:
  1. longfile_fat_read_at(constchar*filename,unsignedlongpos,void*buffer,
  2. unsignedlongmaxsize)
  3. {
  4. debug("reading%s",filename);
  5. returndo_fat_read_at(filename,pos,buffer,maxsize,LS_NO,0);
  6. }
最后,TQ335x是MLO启动u-boot,然后u-boot去启动内核,故可以去掉配置项CONFIG_SPL_OS_BOOT,具体的修改文件include/configs/ti_armv7_common.h:
  1. #ifdefined(CONFIG_SPL_OS_BOOT_ENABLE)
  2. #defineCONFIG_SPL_OS_BOOT
  3. #endif

至此,u-boot的移植工作就完成了,编译方法如下:

  1. makeARCH=armCROSS_COMPILE=arm-linux-gnueabi-am335x_evm_defconfig
  2. makeARCH=armCROSS_COMPILE=arm-linux-gnueabi--j8

其中,arm-linux-gnueabi-需要根据自己的交叉编译工具链前缀进行修改。完成u-boot的移植工作后我们来研究如何启动内核。

源码下载地址:

u-boot-2014.10 for TQ335x/TQ3358(SD卡启动)


上一页 1 2 下一页

关键词:AM335xTQ335xu-boo

评论


相关推荐

技术专区

关闭