OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 4324|回复: 1

u-boot(2015.01)在AM335X上移植(接第二天内容2)

[复制链接]

27

主题

30

帖子

0

精华

初级会员

Rank: 2

积分
194
金钱
194
注册时间
2012-4-4
在线时间
46 小时
发表于 2016-1-7 15:49:35 | 显示全部楼层 |阅读模式
本帖最后由 fuqiye 于 2016-1-7 15:56 编辑

接着第二天的内容2
/************************************************************************************************/
2、修改board/wsdv/am335x/board.h文件
添加如下函数
   static inline int board_is_wd335x(struct am335x_baseboard_id *header){
        return !strncmp("WD335X", header->name, 6);
}

说明:通过判断确认相应板子信息(就是刚才人为给的数据啦^_^)
  
  3、修改board/wsdv/am335x/mux.c文件
mmc0_pin_mux[]代码修改成如下
static struct module_pin_mux mmc0_pin_mux[] = {
        {OFFSET(mmc0_dat3), (MODE(0) | RXACTIVE | PULLUP_EN)},        /* MMC0_DAT3 */
        {OFFSET(mmc0_dat2), (MODE(0) | RXACTIVE | PULLUP_EN)},        /* MMC0_DAT2 */
        {OFFSET(mmc0_dat1), (MODE(0) | RXACTIVE | PULLUP_EN)},        /* MMC0_DAT1 */
        {OFFSET(mmc0_dat0), (MODE(0) | RXACTIVE | PULLUP_EN)},        /* MMC0_DAT0 */
        {OFFSET(mmc0_clk), (MODE(0) | RXACTIVE | PULLUP_EN)},        /* MMC0_CLK */
        {OFFSET(mmc0_cmd), (MODE(0) | RXACTIVE | PULLUP_EN)},        /* MMC0_CMD */
        /*{OFFSET(mcasp0_aclkr), (MODE(4) | RXACTIVE)},*/                /* MMC0_WP */
        /*{OFFSET(spi0_cs1), (MODE(5) | RXACTIVE | PULLUP_EN)},*/        /* MMC0_CD */
        {-1},
};
说明:要去了这两个脚,因为此板子便件没有接这两个引脚。
添加如下代码
static struct module_pin_mux gpio3_7_pin_mux[] = {
        {OFFSET(emu0), (MODE(7) | PULLUDEN)},        /* GPIO3_7 */
        {-1},
};
static struct module_pin_mux gpio3_18_pin_mux[] = {
        {OFFSET(mcasp0_aclkr), (MODE(7) | PULLUDEN)},        /* GPIO3_18 LED*/
        {-1},
};
static struct module_pin_mux gpio3_19_pin_mux[] = {
        {OFFSET(mcasp0_fsr), (MODE(7) | RXACTIVE | PULLUDEN | PULLUP_EN)},        /* GPIO3_19 KEY*/
        {-1},
};
static struct module_pin_mux gpio3_20_pin_mux[] = {
        {OFFSET(mcasp0_axr1), (MODE(7) | PULLUDEN)},        /* GPIO3_20 DOG*/
        {-1},
};


说明:初始化LED指示灯、外部按键、外部看门狗的GPIO。
void enable_board_pin_mux(struct am335x_baseboard_id *header)函数添加代码如下红色部分
void enable_board_pin_mux(struct am335x_baseboard_id *header)
{
        /* Do board-specific muxes. */
        if (board_is_bone(header)) {
                /* Beaglebone pinmux */
                configure_module_pin_mux(i2c1_pin_mux);
                configure_module_pin_mux(mii1_pin_mux);
                configure_module_pin_mux(mmc0_pin_mux);
#if defined(CONFIG_NAND)
                configure_module_pin_mux(nand_pin_mux);
#elif defined(CONFIG_NOR)
                configure_module_pin_mux(bone_norcape_pin_mux);
#else
                configure_module_pin_mux(mmc1_pin_mux);
#endif
        } else if (board_is_gp_evm(header)) {
                /* General Purpose EVM */
                unsigned short profile = detect_daughter_board_profile();
                configure_module_pin_mux(rgmii1_pin_mux);
                configure_module_pin_mux(mmc0_pin_mux);
                /* In profile #2 i2c1 and spi0 conflict. */
                if (profile & ~PROFILE_2)
                        configure_module_pin_mux(i2c1_pin_mux);
                /* Profiles 2 & 3 don't have NAND */
#ifdef CONFIG_NAND
                if (profile & ~(PROFILE_2 | PROFILE_3))
                        configure_module_pin_mux(nand_pin_mux);
#endif
                else if (profile == PROFILE_2) {
                        configure_module_pin_mux(mmc1_pin_mux);
                        configure_module_pin_mux(spi0_pin_mux);
                }
        } else if (board_is_idk(header)) {
                /* Industrial Motor Control (IDK) */
                configure_module_pin_mux(mii1_pin_mux);
                configure_module_pin_mux(mmc0_no_cd_pin_mux);
        } else if (board_is_evm_sk(header)) {
                /* Starter Kit EVM */
                configure_module_pin_mux(i2c1_pin_mux);
                configure_module_pin_mux(gpio0_7_pin_mux);
                configure_module_pin_mux(rgmii1_pin_mux);
                configure_module_pin_mux(mmc0_pin_mux_sk_evm);
        } else if (board_is_bone_lt(header)) {
                /* Beaglebone LT pinmux */
                configure_module_pin_mux(i2c1_pin_mux);
                configure_module_pin_mux(mii1_pin_mux);
                configure_module_pin_mux(mmc0_pin_mux);
#if defined(CONFIG_NAND) && defined(CONFIG_EMMC_BOOT)
                configure_module_pin_mux(nand_pin_mux);
#elif defined(CONFIG_NOR) && defined(CONFIG_EMMC_BOOT)
                configure_module_pin_mux(bone_norcape_pin_mux);
#else
                configure_module_pin_mux(mmc1_pin_mux);
#endif
        }  else if (board_is_wd335x(header)){
               
                configure_module_pin_mux(i2c1_pin_mux);/*读取触摸屏芯片*/
                configure_module_pin_mux(mii1_pin_mux);/*网卡芯片MII接口*/
                configure_module_pin_mux(mmc0_pin_mux);/*SD卡接口*/
#if defined(CONFIG_NAND)
                configure_module_pin_mux(nand_pin_mux);/*NAND FLSH接口*/
#elif defined(CONFIG_NOR)
                configure_module_pin_mux(bone_norcape_pin_mux);
#else
                configure_module_pin_mux(mmc1_pin_mux);
#endif
                /*
                *添加了GPIO控制
                */
                configure_module_pin_mux(gpio3_7_pin_mux);        /*LED0*/
                configure_module_pin_mux(gpio3_18_pin_mux); /*LED1*/
                configure_module_pin_mux(gpio3_19_pin_mux);        /*KEY*/
                configure_module_pin_mux(gpio3_20_pin_mux); /*DOG*/
               
        } else {
                puts("Unknown board, cannot configure pinmux.");
                hang();
        }
}
说明:初始化板子便件对应的引脚。四、尝试编译运行代码
make O=am335x ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- 编译完成后将MLO  u-boot.img 程序放到板子上运行。
此时会看到串口打印如下信息:
QQ截图20160107151713.jpg
看到此信息说明板子便件已经成功的跑起了u-boot。^_^


正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2016-1-7 23:01:43 | 显示全部楼层
回复 支持 反对

使用道具 举报

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

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-21 23:29

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表