完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我将bootloader用j-link下载到mini2440里面
打印到一下消息Copy kernel from nand0x1234ABCD 0xE1A00000 Set boot params Boot kernel Uncompressing Linux... uImage和u-boot都是用光盘里提供的补丁文件编译出来,而且之前都没问题. 怎么用自己写bootloader那一课的代码却卡死了呢? 请问大家觉得是不是参数传递出错了?? |
|
相关推荐
6个回答
|
|
要先用u-boot(光盘)将uImage写到NAND, 才可以用你写的bootloader读,并且读的时候,开始地址还要+64字节头部,如写到了NAND的60000,nand_read的第一个参数应该是0x60000+0x40
|
|
|
|
确保在配置内核时选上了在Device Drivers->Character devices->Serial drivers中选择加载Samsung SoC serial support ,然后再选上Support for console on Samsung SoC serial port 。
|
|
|
|
我两个都选上了啊。。uImage是用的事百问网主光盘里的配置文件编译的
|
|
|
|
我是先用u-boot将编译出来的bootloader下载到开发板上面
然后在nor Flash启动,结果卡死了 然后我又用j-link重新下载u-boot到nor flash 再启动。。。结果正常启动内核 但是为什么我直接用视频里的代码编译出来的bootloader下载到mini2440不能启动内核,,,而视频里卖弄却可以呢?? |
|
|
|
[code]//file:start.S #define S3C2440_MPLL_200MHZ ((0x5c<<12)|(0x01<<4)|(0x02)) #define S3C2440_MPLL_400MHZ ((0x5c<<12)|(0x01<<4)|(0x01)) #define MEM_CTL_BASE 0x48000000 .text .global _start _start: /* 1. 关看门狗 */ ldr r0, =0x53000000 mov r1, #0 str r1, [r0] /* 2. 设置时钟 */ ldr r0, =0x4c000014 // mov r1, #0x03; // FCLK:HCLK:PCLK=1:2:4, HDIVN=1,PDIVN=1 mov r1, #0x05; // FCLK:HCLK:PCLK=1:4:8 str r1, [r0] /* 如果HDIVN非0,CPU的总线模式应该从“fast bus mode”变为“asynchronous bus mode” */ mrc p15, 0, r1, c1, c0, 0 /* 读出控制寄存器 */ orr r1, r1, #0xc0000000 /* 设置为“asynchronous bus mode” */ mcr p15, 0, r1, c1, c0, 0 /* 写入控制寄存器 */ /* MPLLCON = S3C2440_MPLL_200MHZ */ ldr r0, =0x4c000004 ldr r1, =S3C2440_MPLL_400MHZ str r1, [r0] /* 启动ICACHE */ mrc p15, 0, r0, c1, c0, 0 @ read control reg orr r0, r0, #(1<<12) mcr p15, 0, r0, c1, c0, 0 @ write it back /* 3. 初始化SDRAM */ ldr r0, =MEM_CTL_BASE adr r1, sdram_config /* sdram_config的当前地址 */ add r3, r0, #(13*4) 1: ldr r2, [r1], #4 str r2, [r0], #4 cmp r0, r3 bne 1b /* 4. 重定位 : 把bootloader本身的代码从flash复制到它的链接地址去 */ ldr sp, =0x34000000 bl nand_init mov r0, #0 ldr r1, =_start ldr r2, =__bss_start sub r2, r2, r1 bl copy_code_to_sdram bl clear_bss /* 5. 执行main */ ldr lr, =halt ldr pc, =main halt: b halt sdram_config: .long 0x22011110 //BWSCON .long 0x00000700 //BANKCON0 .long 0x00000700 //BANKCON1 .long 0x00000700 //BANKCON2 .long 0x00000700 //BANKCON3 .long 0x00000700 //BANKCON4 .long 0x00000700 //BANKCON5 .long 0x00018005 //BANKCON6 .long 0x00018005 //BANKCON7 .long 0x008C04F4 // REFRESH .long 0x000000B1 //BANKSIZE .long 0x00000030 //MRSRB6 .long 0x00000030 //MRSRB7 //file:boot.c #include "setup.h" extern void uart0_init(void); extern void nand_read(unsigned int addr, unsigned char *buf, unsigned int len); extern void puts(char *str); extern void puthex(unsigned int val); static struct tag *params; void setup_start_tag(void) { params = (struct tag *)0x30000100; params->hdr.tag = ATAG_CORE; params->hdr.size = tag_size (tag_core); params->u.core.flags = 0; params->u.core.pagesize = 0; params->u.core.rootdev = 0; params = tag_next (params); } void setup_memory_tags(void) { params->hdr.tag = ATAG_MEM; params->hdr.size = tag_size (tag_mem32); params->u.mem.start = 0x30000000; params->u.mem.size = 64*1024*1024; params = tag_next (params); } int strlen(char *str) { int i = 0; while (str) { i++; } return i; } void strcpy(char *dest, char *src) { while ((*dest++ = *src++) != ' |