快乐虾http://blog.csdn.net/lights_joy/lights@hb165.com本文适用于ADI bf561 DSP优视BF561EVB开发板uclinux-2008r1.5-rc3(smp patch)Visual DSP++ 5.0(update 5)欢迎转载,但请保留作者信息至此,还有几个链接错误:[Error li1021]The following symbols referenced in processor 'p0' could not be resolved:'_sdata [__sdata]' referenced from 'corea.dlb[head.doj]''_stext [__stext]' referenced from 'corea.dlb[head.doj]''bf53x_relocate_l1_mem [_bf53x_relocate_l1_mem]' referenced from 'corea.dlb[head.doj]''cmdline_init [_cmdline_init]' referenced from 'corea.dlb[head.doj]''init_pda [_init_pda]' referenced from 'corea.dlb[head.doj]''init_thread_union [_init_thread_union]' referenced from 'corea.dlb[head.doj]''start_kernel [_start_kernel]' referenced from 'corea.dlb[head.doj]'下面就看看_sdata的问题。在head.s中,要保存数据段的起始位置,如下所示:p1.l = __rambase;p1.h = __rambase;r0.l = __sdata;r0.h = __sdata;[p1] = r0;在这里,__rambase是在head.s中定义的一个变量:.data/** Set up the usable of RAM stuff. Size of RAM is determined then* an initial stack set up at the end.*/.align 4__rambase:.long0__ramstart:.long0__ramend:.long0而_sdata的定义则是在vmlinux.lds.s中,它指向数据段的首地址,如下所示:.data :{/* make sure the init_task is aligned to the* kernel thread size so we can locate the kernel* stack properly and quickly.*/__sdata = .;. = ALIGN(THREAD_SIZE);*(.data.init_task). = ALIGN(32);*(.data.cacheline_aligned)#if !L1_DATA_A_LENGTH. = ALIGN(32);*(.data_l1.cacheline_aligned)#endifDATA_DATA*(.data)CONSTRUCTORS. = ALIGN(THREAD_SIZE);__edata = .;}下面就需要修改LDF文件了,先给数据段分一块内存空间:MEM_UCLINUX_DATA{ TYPE(RAM) START(0x00010000) END(0x0001ffff) WIDTH(8) } MEM_UCLINUX_BSS{ TYPE(RAM) START(0x00020000) END(0x0002ffff) WIDTH(8) } MEM_SDRAM_BANK0{ TYPE(RAM) START(0x00030000) END(0x00ffffff) WIDTH(8) } MEM_SDRAM_BANK1{ TYPE(RAM) START(0x01000000) END(0x01ffffff) WIDTH(8) } MEM_SDRAM_BANK2{ TYPE(RAM) START(0x02000000) END(0x02ffffff) WIDTH(8) } MEM_SDRAM_BANK3{ TYPE(RAM) START(0x03000000) END(0x03ffffff) WIDTH(8) }因为.data段在bss段之前,内存空间定义也相应地在前面,还是以64K为单位定义空间,真浪费!!接下来在LDF中添加一个section:uclinux_data{/* make sure the init_task is aligned to the* kernel thread size so we can locate the kernel* stack properly and quickly.*/__sdata = .;INPUT_SECTION_ALIGN(8192)/**(.data.init_task). = ALIGN(32);*(.data.cacheline_aligned)#if !L1_DATA_A_LENGTH. = ALIGN(32);*(.data_l1.cacheline_aligned)#endifDATA_DATA*(.data)CONSTRUCTORS*/INPUT_SECTION_ALIGN(8192)__edata = .;} > MEM_UCLINUX_DATA在这里,直接将THREAD_SIZE替换为8192,避免在LDF中包含头文件。此外注释了section里面的所有内容,因为我们的原则是:按需添加。看看还有几个error:[Error li1021]The following symbols referenced in processor 'p0' could not be resolved:'_stext [__stext]' referenced from 'corea.dlb[head.doj]''bf53x_relocate_l1_mem [_bf53x_relocate_l1_mem]' referenced from 'corea.dlb[head.doj]''cmdline_init [_cmdline_init]' referenced from 'corea.dlb[head.doj]''init_pda [_init_pda]' referenced from 'corea.dlb[head.doj]''init_thread_union [_init_thread_union]' referenced from 'corea.dlb[head.doj]''start_kernel [_start_kernel]' referenced from 'corea.dlb[head.doj]'