Tool/software:
我在调整项目的时候需要做和XCP相关的功能时候发现我貌似无法把自定义的这个段存入Flash里面,并且无法在Hex里面找到对应地址:
部分代码:
global.c:
#pragma DATA_SECTION (cRad2Grad_C, "shd_data")
real32_T cRad2Grad_C = 57.2957802F;
...
2837x_FLASH_lnk_cpu1.cmd
MEMORY
{
PAGE 0 : /* Program Memory */
/* Memory (RAM/FLASH) blocks can be moved to PAGE1 for data allocation */
...
FLASH_CHARACTERISTIC : origin = 0x0C2000, length = 0x001000
RAMGS6 : origin = 0x012000, length = 0x001000
PAGE 1 : /* Data Memory */
...
}
SECTIONS
{
...
shd_data : LOAD = FLASH_CHARACTERISTIC,
RUN = RAMGS6,
LOAD_START(_shd_dataLoadStart),
LOAD_SIZE(_shd_dataLoadSize),
LOAD_END(_shd_dataLoadEnd),
RUN_START(_shd_dataRunStart),
RUN_SIZE(_shd_dataRunSize),
RUN_END(_shd_dataRunEnd),
PAGE = 0, ALIGN(4)
...
}
编译的时候就报错说:"../2837x_FLASH_lnk_cpu1.cmd", line 479: warning #10083-D: LOAD placement ignored for "shd_data": object is uninitialized
查看hex文件也没有数据。
在此之前我曾经尝试将其写入PAGE0的Group中:则会报错:error #10470-D: Cannot generate CRC for "shd_data" in memory range FLASH_CHARACTERISTIC; objects in CRC range may only have load data in this range.
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 20012000
GROUP { /* GROUP memory ranges for crc/checksum of entire flash */
#endif
#endif
/* BEGIN is used for the "boot to Flash" bootloader mode */
/*BEGIN : origin = 0x084000, length = 0x000008 */
BEGIN : origin = 0x080000, length = 0x000008 // used for debug mode
/* Flash sectors */
/*FLASHA : origin = 0x080000, length = 0x002000 /*on-chip Flash */
FLASHA : origin = 0x080008, length = 0x001FF8 /* on-chip Flash */
FLASHB : origin = 0x082000, length = 0x002000 /* on-chip Flash */
/*FLASHC : origin = 0x084008, length = 0x001FF8 /*on-chip Flash */
FLASHC : origin = 0x084000, length = 0x004000 /* on-chip Flash */
FLASHD : origin = 0x088000, length = 0x002000 /* on-chip Flash */
FLASHE : origin = 0x08A000, length = 0x008000 /* on-chip Flash */
FLASHF : origin = 0x092000, length = 0x008000 /* on-chip Flash */
FLASHG : origin = 0x09A000, length = 0x008000 /* on-chip Flash */
FLASHH : origin = 0x0A2000, length = 0x008000 /* on-chip Flash */
FLASHI : origin = 0x0AA000, length = 0x008000 /* on-chip Flash */
FLASHJ : origin = 0x0B2000, length = 0x008000 /* on-chip Flash */
FLASHK : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
FLASHL : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
FLASHM : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
FLASHN : origin = 0x0C0000, length = 0x001FF0 /* on-chip Flash */
FLASHN_DO_NOT_USE : origin = 0x0C1FF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
FLASH_CHARACTERISTIC : origin = 0x0C2000, length = 0x001000
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 20012000
} crc(_ccs_flash_checksum, algorithm=C28_CHECKSUM_16)
#endif
#endif
shd_data :> FLASH_CHARACTERISTIC,
PAGE = 0, ALIGN(4)
我使用的CCS信息如下: