How to fill unused area of flash memory with a certain value for PSoC4S

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

cross mob
lock attach
Attachments are accessible only for community members.
YoIs_1298666
Level 5
Level 5
250 sign-ins 100 replies posted 100 sign-ins

Hello,

If you need to fill  unused area of flash memory, this is available.

If you build your project with PSoC Creator, the unused area of flash memory are filled with ""0x0000".

pastedImage_0.png

We know that machine code "0xe7fe" means "while(1)".

So, let's fill with "0xe7fe". We need to add it to Linker script.

We prepare the .ld that added fill script.

...\FillUnusedFlash\SCB_Uart_FilledUnusedFlash.cydsn\Generated_Source\cm0plusgcc_filled.ld

pastedImage_2.png

The value to be filled is described in big endian.

      FILL(0xfee7);

For the .ld file, refer to the application note AN89610 below.

https://japan.cypress.com/documentation/application-notes/an89610-psoc-4-and-psoc-5lp-arm-cortex-cod...

You must specify the "Custom Linker Script" in "Build Settings..." of PSoC Creator.

      .\Generated_Source\cm0plusgcc_filled.ld

pastedImage_3.png

The result of building is as follows.

pastedImage_4.png

The firmware echoes back when you type a character in your terminal software.

Best regards,

Yocchi

0 Likes
1 Reply
Takashi_M
Moderator
Moderator
Moderator
1000 replies posted 500 solutions authored 750 replies posted

Dear Yocchi-san,

Thank you very much for sharing your Code Example.

We appreciate your contribution for this.

Best regards.

0 Likes