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.

TMS570LS1114使用问题

Other Parts Discussed in Thread: TMS570LS1114

在TMS570LS1114上自定义一个ROM和RAM的区间。但是通过Debug调试发现,定义的变量能够分配的内存,但是不能够赋值

我的操作步骤:

   定义CMD文件:


MEMORY

{

    VECTORS (X)  : origin=0x00000000 length=0x00000020

    FLASH0  (RX) : origin=0x00000020 length=0x000F5FE0

    CAL_ROM (RX) : origin=0x000FE000 length=0x00001000

    STACKS  (RW) : origin=0x08000000 length=0x00001500

    RAM     (RW) : origin=0x08001501 length=0x0001CFFF

CAL_RAM (RW) : origin=0x0801E500 length=0x00001000

}

 

SECTIONS

{

   .intvecs : {} > VECTORS

    .text    : {} > FLASH0

    .const   : {} > FLASH0

    .cinit   : {} > FLASH0

    .pinit   : {} > FLASH0

    .calRom  : {} > CAL_ROM

    .bss     : {} > RAM

    .data    : {} > RAM

    .sysmem  : {} > RAM

    .calRam  : {} > CAL_RAM

}

 

.h文件:

#ifndef CALDAT_H_

#define CALDAT_H_

 

#include"../AMMCLIB/SWLIBS_Typedefs.h"

 

struct sCCP_CalDat

{

struct sCCP_CanMsg1

{

   tU16 Torq_Kp;

   tU16 Torq_Ki;

   tU16 Torq_Kc;

}CanMsg1;

 

struct sCCP_CanMsg2

{

   tFloat Speed_Kp;

   tFloat Speed_Ki;

   tFloat Speed_Kc;

  }CanMsg2;

};

 

#endif /* CALDAT_H_ */

 

.C文件:

#include"caldat.h"

 

 

#define CAL_ROM __attribute__ ((section(".calRom")))//calRom

#define CAL_RAM __attribute__ ((section(".calRam")))

CAL_ROM static struct sCCP_CalDat CalRom ={

        .CanMsg1.Torq_Kc = 0,

        .CanMsg1.Torq_Ki = 0,

        .CanMsg1.Torq_Kc = 0,

 

        .CanMsg2.Speed_Kp = 0,

        .CanMsg2.Speed_Ki = 0,

        .CanMsg2.Speed_Kc = 0,

};

 

但奇怪的是 .CanMsg1.Torq_Kc 不等于0。为什么呢?

下图是Debug结果: