AM1808开发记录(三)

下面准备移植Uboot,首先把Uart口跑起来,这样可以打印信息,设置断点(在没有昂贵的仿真器下调试的方法)
先简单介绍下我的板子的硬件配置,调试口是Uart0,128MB DDR和256M NAND FLASH,和TI官方的硬件配置稍有不同,他的是Uart2,64MB DDR和SPI的


FLASH
1.修改配置头文件\include\configs\da850evm.h
#define CONFIG_USE_NAND//modify by zss
#define PHYS_SDRAM_1_SIZE (128 << 20)//modify by zss
#define CONFIG_SYS_NS16550_COM1 DAVINCI_UART0_BASE  //modify by zss
#define CONFIG_CONS_INDEX 1/* use UART0 for console */   这个不用修改,就是1,不是0
/*******************别的先不用修改我们先让Uart跑起来打印显示信息就ok***********************/
2.修改板级初始化代码\board\davinci\da8xxevm\da850evm.c
/* UART pin muxer settings */
static const struct pinmux_config uart_pins[] = {
//{ pinmux(0), 4, 6 },
//{ pinmux(0), 4, 7 },
{ pinmux(3), 2, 4 },                        //modify by zss
{ pinmux(3), 2, 5 }                         //modify by zss
};
根据自己的硬件配置修改,猜也能才出来这几个参数的意思
//{ pinmux(3), 8, 4 },                //modify by zss
//{ pinmux(3), 8, 5 },                //modify by zss
这个是配置MII接口的,我使用的是RMII,这个管脚和串口重复了,所以去掉
{ DAVINCI_LPSC_UART0 }, /* console */                      //modify by zss
电源管理,需要打开,官方使用的是uart2
/* setup the SUSPSRC for ARM to control emulation suspend */
writel(readl(&davinci_syscfg_regs->suspsrc) &
      ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
DAVINCI_SYSCFG_SUSPSRC_SPI1 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 |
(1<<18)),  &davinci_syscfg_regs->suspsrc);      //modify by zss
懒的改头文件,查询数据手册找到Uart0的控制位是bit18,直接(1<<18)了事。
/* enable the console UART */
writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
DAVINCI_UART_PWREMU_MGMT_UTRST),
      &davinci_uart0_ctrl_regs->pwremu_mgmt);             //modify by zss原本是UART2


3.保存修改,打开终端,进入Uboot目录
#make distclean ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- 
配置config文件,不知道名字?打开UBOOT顶层目录,有个boards.cfg文件,好像记得有个850什么的,找找
da850evm                     arm         arm926ejs   da8xxevm            davinci        davinci
就是它了
#make da850evm_config ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- 
#make all ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- 
如果一切ok生成u-boot.bin文件复制到前面准备的烧写目录下,接上串口,跳线,执行
sfh_OMAP-L138.exe -targetType AM1808 -flashType NAND -flash ubl_AM1808_NAND.bin u-boot.bin
去掉跳线,重新上电,打开超级终端显示
Booting TI User Boot Loader
        UBL Version: 1.65
        UBL Flashtype: NAND
Starting NAND Copy...
Valid magicnum, 0xA1ACED11, found in block 0x00000006.
   DONE
鶱AND:  128 MiBy point at 0xC1080000.
MMC:   davinci: 0
Bad block table found at page 65472, version 0x01
Bad block table found at page 65408, version 0x01
nand_read_bbt: Bad block at 0x000000760000
nand_read_bbt: Bad block at 0x000000e40000
nand_read_bbt: Bad block at 0x000001540000
nand_read_bbt: Bad block at 0x000001bc0000
nand_read_bbt: Bad block at 0x0000020c0000
nand_read_bbt: Bad block at 0x000002280000
nand_read_bbt: Bad block at 0x000005560000
nand_read_bbt: Bad block at 0x0000069c0000
nand_read_bbt: Bad block at 0x000007380000
NAND read from offset 0 failed -74
*** Warning - readenv() failed, using default environment

红色提示的原因是没有设置必要的环境参数,设置一遍写到NAND里重启即可


In:    serial
Out:   serial
Err:   serial
ARM Clock : 456000000 Hz
DDR Clock : 150000000 Hz
SF: Unsupported manufacturer ff
 Error - unable to probe SPI flash.
Invalid MAC address read.
Net:   Error: Ethernet init failed!
Board Net Initialization Failed
DaVinci-EMAC
Hit any key to stop autoboot:  0
Card did not respond to voltage select!
Unknown command 'sf' - try 'help'
Unknown command 'sf' - try 'help'
U-Boot >
/********************至此,uboot移植完成的一半了,剩下的一半就是以太网,利用打印信息慢慢调吧************************/
最后有点提示,可能系统启动半截没有提示了,貌似司机,其实有可能是linux系统的控制台变了,在启动脚本里可以改

 

 

/***************************************************************************************/

//接着上面,继续修改以太网部分,方法就是printf+sourceinsight+编译下载大法

/***************************************************************************************/

修改部分如下:

1.配置头文件

#undef  CONFIG_MII    //modify by zss
#define CONFIG_DRIVER_TI_EMAC_USE_RMII  //modify by zss

 

2.管脚配置

#ifdef CONFIG_DRIVER_TI_EMAC
static const struct pinmux_config emac_pins[] = {
 { pinmux(14), 8, 2 },
 { pinmux(14), 8, 3 },
 { pinmux(14), 8, 4 },
 { pinmux(14), 8, 5 },
 { pinmux(14), 8, 6 },
 { pinmux(14), 8, 7 },
 { pinmux(15), 0, 0 },
 { pinmux(15), 8, 1 },
 { pinmux(4), 8, 0 },
 { pinmux(4), 8, 1 }
};

 

3.注释掉IIC部分,IIC最容易导致死机

int rmii_hw_init(void)

4.

static int davinci_eth_phy_detect(void)

.........
phy_act_state = readl(&adap_mdio->ALIVE) & EMAC_MDIO_PHY_MASK;
修改为
phy_act_state = readl(&adap_mdio->ALIVE);

至于为什么怎么修改?printf到这里去掉就好使,不然初始化不成功

 

/********************************************************************************************/

上面的步骤做完后编译烧写,上电启动

 

AM1808 initialization passed!
Booting TI User Boot Loader
        UBL Version: 1.65
        UBL Flashtype: NAND
Starting NAND Copy...
Valid magicnum, 0xA1ACED11, found in block 0x00000006.
   DONE
鶱AND:  128 MiBy point at 0xC1080000.
MMC:   davinci: 0
Bad block table found at page 65472, version 0x01
Bad block table found at page 65408, version 0x01
nand_bbt: ECC error while reading bad block table
nand_read_bbt: Bad block at 0x000003140000
In:    serial
Out:   serial
Err:   serial
ARM Clock : 456000000 Hz
DDR Clock : 150000000 Hz
Net:   Ethernet PHY: GENERIC @ 0x01
DaVinci-EMAC
Hit any key to stop autoboot:  0
U-Boot > tftp c0700000 uImage
Using DaVinci-EMAC device
TFTP from server 192.168.1.100; our IP address is 192.168.1.10
Filename 'uImage'.
Load address: 0xc0700000
Loading: #################################################################
         #################################################################
         ############################
done
Bytes transferred = 2314948 (2352c4 hex)
U-Boot >

 

 

/*********************************************************************************/

注意一点,我的笔记本开着无线连接的时候无法tftp下载,关闭无线连接即可

你可能感兴趣的:(AM1808开发记录(三))