一、建立开发板相关的目录/文件
- $ tar -xjf u-boot-1.1.6.tar.bz2
- $ cd u-boot-1.1.6/board
- $ cp -r smdk2410 100ask24x0
- $ cd 100ask24x0
- $ mv smdk2410.c 100ask24x0.c
- $ cd ../../include/configs
- $ cp smdk2410.h 100ask24x0.h
二、修改 Makefile 文件
1.修改顶层 Makefile 文件,在其中加入下面2行:
- 100ask24x0_config : unconfig
- @$(MKCONFIG) $(@:_config=) arm arm920t 100ask24x0 NULL s3c24x0
2.修改 board/100ask24x0/Makefile
- COBJS := 100ask24x0.o flash.o
- SOBJS := lowlevel_init.o
3.初次编译
- $ make 100ask24x0_config
- $ make
编译成功的话,顶层目录下面就有 u-boot.bin 等文件了。最重要的是,这说明我们的交叉编译工具链已经没有问题了。
三、增加2个新文件
1.新建文件 u-boot-1.1.6/board/100ask24x0/boot_init.c(参考u-boot-1.1.6_jz2440/board/100ask24x0/boot_init.c)
2.修改 u-boot-1.1.6/board/100ask24x0/Makefile
- COBJS := 100ask24x0.o flash.o
- 改为
- COBJS := 100ask24x0.o boot_init.o
3.修改 u-boot-1.1.5/board/100ask24x0/u-boot.lds
- cpu/arm920t/start.o(.text)
- board/100ask24x0/boot_init.o (.text)
- *(.text)
4.新建文件 u-boot-1.1.6/cpu/arm920t/s3c24x0/nand_flash.c(参考u-boot-1.1.6_jz2440/cpu/arm920t/s3c24x0/nand_flash.c)
5.修改 u-boot-1.1.6/cpu/arm920t/s3c24x0/Makefile
- COBJS= i2c.o interrupts.o serial.o speed.o \
- usb_ohci.o nand_flash.o
四、修改 u-boot-1-1.6/board/100ask24x0/lowlevel_init.S 文件
1.将54-58行的:
- #define B1_BWSCON (DW32)
- #define B2_BWSCON (DW16)
- #define B3_BWSCON (DW16 + WAIT + UBLB)
- #define B4_BWSCON (DW16)
- #define B5_BWSCON (DW16)
- 改为
- #define B1_BWSCON (DW16)
- #define B2_BWSCON (DW16)
- #define B3_BWSCON (DW16 +UBLB)
- #define B4_BWSCON (DW16 + WAIT + UBLB)
- #define B5_BWSCON (DW8)
2.将97-101行的:
- #define B4_Tcos0x0/* 0clk */
- #define B4_Tacc 0x7/* 14clk */
- #define B4_Tcoh 0x0/* 0clk */
- #define B4_Tah 0x0/* 0clk */
- #define B4_Tacp 0x0
- 改为
- #define B4_Tcos0x3/* 4clk */
- #define B4_Tacc 0x7/* 14clk */
- #define B4_Tcoh 0x1/* 1clk */
- #define B4_Tah 0x3/* 4clk */
- #define B4_Tacp 0x6 /* 6clk */
3.将126行的:
- #define REFCNT1113/* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */
- 改为
- #define REFCNT0x4f4/* period=7.8125us, HCLK=100Mhz, (2048+1-7.8125*100) */
4.将165行的:
- .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT)
- .word 0x32
- .word 0x30
- 改为
- .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT)
- .word 0xb1
- .word 0x30
五、修改 u-boot-1.1.6/board/100ask24x0/100ask24x0.c
- #include <common.h>
- #include <s3c2410.h>
- DECLARE_GLOBAL_DATA_PTR;
- /*
- * Miscellaneous platform dependent initialisations
- */
- int board_init (void)
- {
- S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
- S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
- /* set up the I/O ports */
- gpio->GPACON = 0x007FFFFF;
- gpio->GPBCON = 0x00000000;
- gpio->GPBUP = 0x00000000; /* 启用上拉电阻 */
- //gpio->GPBDAT |= (1 << 5);
- gpio->GPCCON = 0xAAAAAAAA;
- gpio->GPCUP = 0x0000FFFF;
- gpio->GPDCON = 0xAAAAAAAA;
- gpio->GPDUP = 0x0000FFFF;
- gpio->GPECON = 0xAAAAAAAA;
- gpio->GPEUP = 0x0000FFFF;
- gpio->GPFCON = 0x000055AA;
- gpio->GPFUP = 0x000000FF;
- gpio->GPGCON = 0xFF95FFBA;
- gpio->GPGUP = 0x0000FFFF;
- gpio->GPHCON = 0x002AFAAA;
- gpio->GPHUP = 0x000007FF;
- /* support both of S3C2410 and S3C2440, by www.100ask.net */
- if (isS3C2410)
- {
- /* arch number of SMDK2410-Board */
- gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
- }
- else
- {
- /* arch number of SMDK2440-Board */
- gd->bd->bi_arch_number = MACH_TYPE_S3C2440;
- }
- /* adress of boot parameters */
- gd->bd->bi_boot_params = 0x30000100;
- #if 0
- icache_enable();
- dcache_enable();
- #endif
- return 0;
- }
- int dram_init (void)
- {
- gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
- gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
- return 0;
- }
六、修改 u-boot-1.1.6/cpu/arm920t/s3c24x0/interrupts.c(copy自jz2440)
七、修改 u-boot-1.1.6/cpu/arm920t/s3c24x0/speed.c(copy自jz2440)
八、修改 u-boot-1.1.6/include/cmd_confdefs.h
- //#define CFG_CMD_FLASH0x00000020ULL/* flinfo, erase, protect*/
- //#define CFG_CMD_IMLS0x0020000000000000ULL/* List all found images*/
九、修改 u-boot-1.1.6/cpu/arm920t/start.S
1.注释掉时钟频率的初始化(其初始化放在堆栈建立后的 C 代码中)
- #if 0
- /* FCLK:HCLK:PCLK = 1:2:4 */
- /* default FCLK is 120 MHz ! */
- ldr r0, =CLKDIVN
- mov r1, #3
- str r1, [r0]
- #endif
2.把建立堆栈代码放在重定位(relocate)代码前,以使用 C 代码来完成重定位的工作
- /*
- * we do sys-critical inits only at reboot,
- * not when booting from ram!
- */
- #ifndef CONFIG_SKIP_LOWLEVEL_INIT
- bl cpu_init_crit
- #endif
- /* Set up the stack */
- stack_setup:
- ldr r0, _TEXT_BASE/* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN/* malloc area */
- sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
- #ifdef CONFIG_USE_IRQ
- sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
- #endif
- sub sp, r0, #12/* leave 3 words for abort-stack */
- #ifndef CONFIG_SKIP_LOWLEVEL_INIT
- bl clock_init /* ± */
- #endif
- #ifndef CONFIG_SKIP_RELOCATE_UBOOT
- relocate: /* relocate U-Boot to RAM */
- adr r0, _start/* r0 <- current position of code */
- ldr r1, _TEXT_BASE/* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- beq clear_bss
- ldr r2, _armboot_start
- ldr r3, _bss_start
- sub r2, r3, r2/* r2 <- size of armboot */
- #if 1
- bl CopyCode2Ram/* r0:source, r1:dest, r2:size */
- #else
- add r2, r0, r2/* r2 <- source end address */
- copy_loop:
- ldmia r0!, {r3-r10}/* copy from source address [r0] */
- stmia r1!, {r3-r10}/* copy to target address [r1] */
- cmp r0, r2/* until source end addreee [r2] */
- ble copy_loop
- #endif
- #endif /* CONFIG_SKIP_RELOCATE_UBOOT */
- clear_bss:
- ldr r0, _bss_start/* find start of bss segment */
- ldr r1, _bss_end/* stop here */
- mov r2, #0x00000000/* clear */
- clbss_l:str r2, [r0]/* clear loop... */
- add r0, r0, #4
- cmp r0, r1
- ble clbss_l
- SetLoadFlag:
- /* Set a global flag, PreLoadedONRAM */
- adr r0, _start/* r0 <- current position of code */
- ldr r1, _TEXT_BASE/* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- ldr r2, =PreLoadedONRAM
- mov r3, #1
- streq r3, [r2]
- #if 0
- /* try doing this stuff after the relocation */
- ldr r0, =pWTCON
- mov r1, #0x0
- str r1, [r0]
十、修改 u-boot-1.1.6/include/configs/100ask24x0.h
1.为支持 DM9000 网卡,将
- #define CONFIG_DRIVER_CS89001/* we have a CS8900 on-board */
- #define CS8900_BASE 0x19000300
- #define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
- 改为
- //#define CONFIG_DRIVER_CS89001/* we have a CS8900 on-board */
- //#define CS8900_BASE 0x19000300
- //#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
- #define CONFIG_DRIVER_DM90001
- #define CONFIG_DM9000_BASE 0x20000300
- #define DM9000_IO CONFIG_DM9000_BASE
- #define DM9000_DATA (CONFIG_DM9000_BASE + 4)
- #define CONFIG_DM9000_USE_16BIT
2.增加 NAND 命令和 ping 命令,将
- /*CFG_CMD_NAND|*/ \
- 改为
- CFG_CMD_PING| \
- CFG_CMD_NAND | \
3.设置 IP,将
- /*#define CONFIG_ETHADDR08:00:3e:26:0a:5b */
- #define CONFIG_NETMASK 255.255.255.0
- #define CONFIG_IPADDR 10.0.0.110
- #define CONFIG_SERVERIP 10.0.0.1
- 改为
- #define CONFIG_ETHADDR08:00:3e:26:0a:5b
- #define CONFIG_NETMASK 255.255.255.0
- #define CONFIG_IPADDR 192.168.1.7
- #define CONFIG_SERVERIP 192.168.1.6
4.将
- #define CFG_FLASH_BASEPHYS_FLASH_1
- 改为
- #define CFG_FLASH_BASEPHYS_FLASH_1
- #define CFG_MONITOR_BASE PHYS_FLASH_1
5.NOR FLASH的设置,将
- #define CONFIG_AMD_LV4001/* uncomment this if you have a LV400 flash */
- #if 0
- #define CONFIG_AMD_LV800 1/* uncomment this if you have a LV800 flash */
- #endif
- 改为
- #define CFG_NO_FLASH1/* 我的 FL2440 没有 NOR Flash */
- #if 0
- #define CONFIG_AMD_LV400 1/* uncomment this if you have a LV400 flash */
- #endif
- //#define CONFIG_AMD_LV800 1/* uncomment this if you have a LV800 flash */
6.把最后几行
- /* timeout values are in ticks */
- #define CFG_FLASH_ERASE_TOUT (5*CFG_HZ) /* Timeout for Flash Erase */
- #define CFG_FLASH_WRITE_TOUT (5*CFG_HZ) /* Timeout for Flash Write */
- #define CFG_ENV_IS_IN_FLASH1
- #define CFG_ENV_SIZE 0x10000/* Total Size of Environment Sector */
- #endif /* __CONFIG_H */
- 改为
- /* 增加对 NOR FLASH 的支持 */
- /*
- #define CFG_FLASH_CFI 1
- #define CFG_FLASH_CFI_DRIVER 1
- #define CFG_FLASH_USE_BUFFER_WRITE 1
- #define CONFIG_FLASH_CFI_LEGACY 1
- */
- #ifdef CFG_FLASH_CFI_DRIVER
- #define CFG_MAX_FLASH_SECT 512 /* max number of sectors on one chip */
- #define CFG_FLASH_CFI_WIDTH 0x02 /* FLASH_CFI_16BIT */
- #endif
- /* timeout values are in ticks */
- #define CFG_FLASH_ERASE_TOUT (5*CFG_HZ) /* Timeout for Flash Erase */
- #define CFG_FLASH_WRITE_TOUT (5*CFG_HZ) /* Timeout for Flash Write */
- //#define CFG_ENV_IS_IN_FLASH1
- #define CFG_ENV_IS_IN_NAND 1
- #define CFG_ENV_OFFSET 0x40000
- #define CFG_ENV_SIZE 0x20000/* Total Size of Environment Sector */
- /*-----------------------------------------------------------------------
- * NAND flash settings
- */
- #define CFG_NAND_BASE 0
- #define CFG_MAX_NAND_DEVICE 1
- #define NAND_MAX_CHIPS 1
- #endif /* __CONFIG_H */
十一、修改 u-boot-1.1.6/lib_arm/board.c
1.增加头文件
- void start_armboot (void)
- {
- S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
- init_fnc_t **init_fnc_ptr;
3.初始化完后点灯
- for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
- if ((*init_fnc_ptr)() != 0) {
- hang ();
- }
- }
- /* 点亮 LED1,LED2 */
- gpio->GPBCON = 0x00001400;
-
- //#ifndef CFG_NO_FLASH
- #if 0
- /* configure available FLASH banks */
- size = flash_init ();
4.初始化 NAND FLASH 后点灯
- #if (CONFIG_COMMANDS & CFG_CMD_NAND)
- puts ("NAND: ");
- nand_init(); /* go init the NAND */
- #endif
- /* 点亮 LED2,LED3 */
- gpio->GPBCON = 0x00011000;
5.进入 main_loop 前点灯
- /* 点亮 LED3,LED4 */
- gpio->GPBCON = 0x00110000;
- /* main_loop() can return to retry autoboot, if so just run it again. */
- for (;;) {
- main_loop ();
- }
十二、修改 u-boot-1.1.6/include/s3c2410.h
1.在100行增加函数定义
- /* for s3c2440, www.100ask.net */
- static inline S3C2440_NAND * const S3C2440_GetBase_NAND(void)
- {
- return (S3C2440_NAND * const)S3C2410_NAND_BASE;
- }
2.在151行增加
- /* add by thisway.diy */
- #define _ISR_STARTADDRESS ((unsigned)isr_handle_array)
- #define ISR_EINT0_OFT 0
- #define ISR_EINT1_OFT 1
- #define ISR_EINT2_OFT 2
- #define ISR_EINT3_OFT 3
- #define ISR_EINT4_7_OFT 4
- #define ISR_EINT8_23_OFT 5
- #define ISR_NOTUSED6_OFT 6
- #define ISR_BAT_FLT_OFT 7
- #define ISR_TICK_OFT 8
- #define ISR_WDT_OFT 9
- #define ISR_TIMER0_OFT 10
- #define ISR_TIMER1_OFT 11
- #define ISR_TIMER2_OFT 12
- #define ISR_TIMER3_OFT 13
- #define ISR_TIMER4_OFT 14
- #define ISR_UART2_OFT 15
- #define ISR_LCD_OFT 16
- #define ISR_DMA0_OFT 17
- #define ISR_DMA1_OFT 18
- #define ISR_DMA2_OFT 19
- #define ISR_DMA3_OFT 20
- #define ISR_SDI_OFT 21
- #define ISR_SPI0_OFT 22
- #define ISR_UART1_OFT 23
- #define ISR_NOTUSED24_OFT 24
- #define ISR_USBD_OFT 25
- #define ISR_USBH_OFT 26
- #define ISR_IIC_OFT 27
- #define ISR_UART0_OFT 28
- #define ISR_SPI1_OFT 29
- #define ISR_RTC_OFT 30
- #define ISR_ADC_OFT 31
- 3.将197行的
- #define BIT_WDT(0x1<<9)
- 改为
- #define BIT_WDT_AC97(0x1<<9)
- 4.删除221行的宏定义
- #define ClearPending(bit) {\
- rSRCPND = bit;\
- rINTPND = bit;\
- rINTPND;\
- }
十三、修改 u-boot-1.1.6/include/s3c24x0.h
1.在128行后且在结构体 S3C24X0_CLOCK_POWER 以内增加
- S3C24X0_REG32 CAMDIVN; /* for s3c2440, by www.100ask.net */
2.在167行增加
- /* NAND FLASH (see S3C2440 manual chapter 6, www.100ask.net) */
- typedef struct {
- S3C24X0_REG32 NFCONF;
- S3C24X0_REG32 NFCONT;
- S3C24X0_REG32 NFCMD;
- S3C24X0_REG32 NFADDR;
- S3C24X0_REG32 NFDATA;
- S3C24X0_REG32 NFMECCD0;
- S3C24X0_REG32 NFMECCD1;
- S3C24X0_REG32 NFSECCD;
- S3C24X0_REG32 NFSTAT;
- S3C24X0_REG32 NFESTAT0;
- S3C24X0_REG32 NFESTAT1;
- S3C24X0_REG32 NFMECC0;
- S3C24X0_REG32 NFMECC1;
- S3C24X0_REG32 NFSECC;
- S3C24X0_REG32 NFSBLK;
- S3C24X0_REG32 NFEBLK;
- } /*__attribute__((__packed__))*/ S3C2440_NAND;
3.在474行后,S3C24X0_GPIO 结构体内增加
- /* s3c2440 */
- S3C24X0_REG32 res9[4];
- S3C24X0_REG32 GPJCON;
- S3C24X0_REG32 GPJDAT;
- S3C24X0_REG32 GPJUP;
4.在结尾处增加两行
- #endif
- #define rGSTATUS1 (*(volatile unsigned *)0x560000B0)
- #define isS3C2410 ((rGSTATUS1 & 0xffff0000) == 0x32410000)
- #endif /*__S3C24X0_H__*/
阅读(2472) | 评论(0) | 转发(1) |