uclinux-2008R1-RC8(bf561)到VDSP5的移植(7):_sdata

  
  
在head.s中,要保存数据段的起始位置,如下所示:
       p1.l = __rambase;
       p1.h = __rambase;
       r0.l = __sdata;
       r0.h = __sdata;
       [p1] = r0;
在这里,_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)
 
         DATA_DATA
         *(.data.*)
         CONSTRUCTORS
 
         . = ALIGN(THREAD_SIZE);
         __edata = .;
     }
在VDSP向导生成的LDF文件中,也需要使用数据段,不过它是把代码和数据混合放在一起的:
      sdram
      {
         INPUT_SECTION_ALIGN(4)
         INPUT_SECTIONS($OBJECTS_CORE_A(sdram_bank0) $LIBRARIES_CORE_A(sdram_bank0))
        
         /*$VDSG<insert-input-sections-at-the-start-of-sdram-A> */
         /* Text inserted between these $VDSG comments will be preserved */
         /*$VDSG<insert-input-sections-at-the-start-of-sdram-A> */
        
         INPUT_SECTIONS($OBJECTS_CORE_A(VDK_ISR_code) $LIBRARIES_CORE_A(VDK_ISR_code))
         INPUT_SECTIONS($OBJECTS_CORE_A(program) $LIBRARIES_CORE_A(program))
         INPUT_SECTIONS($OBJECTS_CORE_A(noncache_code) $LIBRARIES_CORE_A(noncache_code))
         INPUT_SECTIONS($OBJECTS_CORE_A(sdram_data) $LIBRARIES_CORE_A(sdram_data))
         INPUT_SECTIONS($OBJECTS_CORE_A(data1) $LIBRARIES_CORE_A(data1))
         INPUT_SECTIONS($OBJECTS_CORE_A(voldata) $LIBRARIES_CORE_A(voldata))
         INPUT_SECTIONS($OBJECTS_CORE_A(constdata) $LIBRARIES_CORE_A(constdata))
        
         /*$VDSG<insert-input-sections-at-the-end-of-sdram-A>   */
         /* Text inserted between these $VDSG comments will be preserved */
         /*$VDSG<insert-input-sections-at-the-end-of-sdram-A>   */
        
      } > MEM_SDRAM
因此我们需要将之拆开分成两个段:
       sdram
      {
         INPUT_SECTION_ALIGN(4)
         INPUT_SECTIONS($OBJECTS_CORE_A(sdram_bank0) $LIBRARIES_CORE_A(sdram_bank0))
        
         /*$VDSG<insert-input-sections-at-the-start-of-sdram-A> */
         /* Text inserted between these $VDSG comments will be preserved */
         /*$VDSG<insert-input-sections-at-the-start-of-sdram-A> */
        
         INPUT_SECTIONS($OBJECTS_CORE_A(VDK_ISR_code) $LIBRARIES_CORE_A(VDK_ISR_code))
         INPUT_SECTIONS($OBJECTS_CORE_A(program) $LIBRARIES_CORE_A(program))
         INPUT_SECTIONS($OBJECTS_CORE_A(noncache_code) $LIBRARIES_CORE_A(noncache_code))
        
         /*$VDSG<insert-input-sections-at-the-end-of-sdram-A>   */
         /* Text inserted between these $VDSG comments will be preserved */
         /*$VDSG<insert-input-sections-at-the-end-of-sdram-A>   */
        
      } > MEM_SDRAM
 
        .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)
               INPUT_SECTIONS($LIBRARIES_CORE_A(.data.init_task))
 
               INPUT_SECTION_ALIGN(32)
               INPUT_SECTIONS($LIBRARIES_CORE_A(.data.cacheline_aligned))
 
         INPUT_SECTIONS($OBJECTS_CORE_A(sdram_data) $LIBRARIES_CORE_A(sdram_data))
         INPUT_SECTIONS($OBJECTS_CORE_A(data1) $LIBRARIES_CORE_A(data1))
         INPUT_SECTIONS($OBJECTS_CORE_A(voldata) $LIBRARIES_CORE_A(voldata))
         INPUT_SECTIONS($OBJECTS_CORE_A(constdata) $LIBRARIES_CORE_A(constdata))
               INPUT_SECTIONS($OBJECTS_CORE_A(.data.*))
 
               . = (. + 8191) / 8192 * 8192;
               __edata = .;
        } > MEM_SDRAM
在这里直接将THREAD_SIZE替换为8192,避免在LDF中包含头文件时可能造成的问题。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌云阁主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值