How to define const in the fixed flash addres

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
GrWa_2302706
Level 4
Level 4
50 questions asked 25 replies posted 10 replies posted

Hi

May I know how to define a const in the fixed flash address ?

Thanks.

BR

Grace

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

1:

copy你工程生成的ld 文件。

然后找到: 

.cy_checksum_exclude : { KEEP(*(.cy_checksum_exclude)) } >rom

2:接着下面加这么一段语句:(地址你可以放到你想放的地址上面)

  EM_EEPROM_START_ADDRESS      = 0x3E000;

.my_emulated_eeprom EM_EEPROM_START_ADDRESS :

{

KEEP(*(.my_emulated_eeprom))

} >rom

3:

main函数之前这么定义一个const 类型的变量:

const uint8 emEeprom[512] 

CY_SECTION(".my_emulated_eeprom") __ALIGNED(CY_FLASH_SIZEOF_ROW) = {0x28u,0x29,0x30,0x10,0x11,0x12,0x13,0x14};

4: 你可以debug查看,是否是放到了指定的地址。

5: 测试工程放在附件。

6:另外可以参考下面文档:  Function/ Variable at an Absolute Location: PSoC® 3, PSoC 4, and PSoC 5LP - KBA84773

View solution in original post

2 Replies
Weeden_ding
Level 2
Level 2
Distributor - Weikeng(GC)
25 sign-ins 5 replies posted 10 questions asked

for  example:

const uint8_t BoardInfoLenth[2] @(0x4F0) =  {0x00,0x1D};

0 Likes
lock attach
Attachments are accessible only for community members.
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

1:

copy你工程生成的ld 文件。

然后找到: 

.cy_checksum_exclude : { KEEP(*(.cy_checksum_exclude)) } >rom

2:接着下面加这么一段语句:(地址你可以放到你想放的地址上面)

  EM_EEPROM_START_ADDRESS      = 0x3E000;

.my_emulated_eeprom EM_EEPROM_START_ADDRESS :

{

KEEP(*(.my_emulated_eeprom))

} >rom

3:

main函数之前这么定义一个const 类型的变量:

const uint8 emEeprom[512] 

CY_SECTION(".my_emulated_eeprom") __ALIGNED(CY_FLASH_SIZEOF_ROW) = {0x28u,0x29,0x30,0x10,0x11,0x12,0x13,0x14};

4: 你可以debug查看,是否是放到了指定的地址。

5: 测试工程放在附件。

6:另外可以参考下面文档:  Function/ Variable at an Absolute Location: PSoC® 3, PSoC 4, and PSoC 5LP - KBA84773