DSP

uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(18):_sdata

2019-07-13 15:48发布

  快乐虾 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: .long   0 __ramstart: .long   0 __ramend: .long   0 _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) #endif            DATA_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) #endif                 DATA_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]'    

1       参考资料

uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(1):前言(2009-1-12) uclinux-2008R1.5-RC3(bf561)到VDSP5移植(2):代码注释(2009-1-12) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(3):vdsp项目创建(2009-1-12) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(4):目录差异(2009-1-12) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(5):'bf561.h'的问题(2009-1-12) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(6)CONFIG_BFIN_KERNEL_CLOCK(2009-1-12) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(7)CONFIG_MEM_MT48LC16M16A2TG_75(2009-1-12) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(8):CONFIG_CLKIN_HZ(2009-1-12) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(9):CONFIG_MEM_SIZE(2009-1-12) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(10):CONFIG_FLASH_SPEED_BTT(2009-1-13) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(11):__INIT(2009-1-13) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(12):trace_buffer_init(2009-1-13) uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(13):ENDPROC(2009-1-13) uclinux-2008R1.5-RC3(bf561)VDSP5的移植(14)__FINIT(2009-1-13) uclinux-2008R1.5-RC3(bf561)VDSP5的移植(15)CONFIG_BANK_x(2009-1-13) uclinux-2008R1.5-RC3(bf561)VDSP5的移植(16):使用head.s做为入口点(2009-1-13) uclinux-2008R1.5-RC3(bf561)VDSP5的移植(17)__bss_start(2009-1-13)