This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C6713编译与内存分配问题



我就是在原有的工程中加入了一段代码,有一个比较大的结构体,然后编译总是有如下问题

>>   error: C60 section .sddata precedes .bss, file
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj

>>   error: 15-bit displacement fffff6b9 is negative. Located in
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj, section .text, SPC offset 00001090

>>   error: C60 section .sddata precedes .bss, file
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj

>>   error: 15-bit displacement fffff6b9 is negative. Located in
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj, section .text, SPC offset 0000111c

>>   error: C60 section .sddata precedes .bss, file
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj

>>   error: 15-bit displacement fffff6b9 is negative. Located in
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj, section .text, SPC offset 00001128

>>   error: C60 section .sddata precedes .bss, file
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj

>>   error: 15-bit displacement fffff6b9 is negative. Located in
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj, section .text, SPC offset 00001170

>>   error: C60 section .sddata precedes .bss, file
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj

>>   error: 15-bit displacement fffff6b9 is negative. Located in
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj, section .text, SPC offset 000011a0

>>   error: C60 section .sddata precedes .bss, file
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj

>>   error: 15-bit displacement fffff6b9 is negative. Located in
            E:\CHY\GPS_Pseudolite\DSP\GPS_Receiver_C2_160510_RTCM_Debugging\Debug\nav_fix.obj, section .text, SPC offset 00001204

>> warning: output file './Debug/DSPFile.out' is not executable

我的cmd文件如下

MEMORY  
{
    VECS        :    o = 00000000h    l = 00200h
    ROM_PMEM    :    o = 00000200h   l = 2DDFFh
    ROM_CINIT    :    o = 0002DFFFh   l = 02000h    
    BMEM        :    o = 00030000h    l = 0A000h
    STACKHEAP    :    o = 00040000h   l = 0B000h
    SDMEM_CODE    :   o = 08000000h   l = 300000h
    SDMEM_DATA    :   o = 08300000h   l = 100000h
}
SECTIONS
{
    .vectors    >    VECS
    .text        >   ROM_PMEM
    .tables     >    BMEM
    .data       >    BMEM
    .sdcode        :    SDMEM_CODE
    .sddata        :    SDMEM_DATA
    .bss        >    BMEM
    .cinit        :    load = ROM_CINIT
    .const        :    load = ROM_CINIT
    .switch        :   load = ROM_CINIT
    .cio        >    BMEM
    .far        >    BMEM
    .stack        >    STACKHEAP
    .sysmem        >    STACKHEAP
}

Memory Models选的是第一个:Far Aggregate。这个错误的原因是什么?有办法解决吗?我的编译环境是CCS 2.2

  • 可以看看.map文件,是不是某些空间满了,需要把它再划的大点

  • 谢谢,问题已经解决了

    实际上我在之前还遇到了relocation overflow这个问题,原因是程序中有比较大的结构体和数组,而程序计数器(PC)不能寻址大于64K的地址空间。我把一部分代码放置到SDRAM后,就出现了帖子中的问题,而relocation overflow这个问题却不再提示了。

    解决方法是将部分大数组定义为 far 类型,但这样访问它就需要3个系统时钟了,这是我不期望的。另一个方法就是适当减小数组的大小,这个勉强能接受。