我想在bootloader的SPL阶段进行GPIO操作,这个GPIO外部连接了一个LED,低电平有效。
在uboot的目录下,arch\arm\cpu\armv7\am33xx\board.c中加入了以下代码:
#define CONF_MCASP0_AHCLKR (u32*)(0x44E109A0) //CONTRL_MODE
#define GPIO3_OE (u32*)(0x481AE134) //GPIO3_OE
#define GPIO3_DATATOUT (u32*)(0x481AE13C) //GPIO3_DATAOUT
statci void led2_on(void)
{
/* MCASP0_AHCLKR :mode=7 , fast , pullup */
*CONF_MCASP0_AHCLKR = (u32)0x00000017;
/* gpio3_18 config : output */
*GPIO3_OE |= (u32)0x00040000;
/* gpio3_18 : out low*/
*GPIO3_DATATOUT &=~((u32)0x00040000);
}
void s_init(void)
{
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_RTC_ONLY_SUPPORT)
rtc_only();
#endif
/*
* The ROM will only have set up sufficient pinmux to allow for the
* first 4KiB NOR to be read, we must finish doing what we know of
* the NOR mux in this space in order to continue.
*/
#ifdef CONFIG_NOR_BOOT
enable_norboot_pin_mux();
#endif
watchdog_disable();
set_uart_mux_conf();
setup_clocks_for_console();
uart_soft_reset();
#if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
/* Enable RTC32K clock */
rtc32k_enable();
#endif
led2_on();
}
#endif
编译uboot后生成了uboot_spl.bin文件,串口方式启动,通过xmodel仅仅上传一个uboot_spl.bin,LED没有被点亮,有前辈可以指导一下吗?