malloc flash / avoid a conflict between data storage and firmware

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

cross mob
xy_283156
Level 2
Level 2

Hi there,

I save some data in flash, it works fine. I'm storing it in array 2 because I think the firmware isn't using this space, but I'm not sure.
How can I avoid a conflict between data storage and firmware?

I'm using a CY8C5888LTI-LP097.

Thank you very much

0 Likes
1 Solution
8 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

xy,

I believe the em_EEPROM takes care of that.  It allocates FLASH space for the emulated EEPROM in pages where the code is not.

If you want more control over where the em_EEPROM is stored there are ways to define where in FLASH to store your data.  It requires knowledge of the device you're using, your compiled code size and linker file manipulation.

Since you are using the PSoC5LP, there is 2K bytes of real EEPROM available.   Smaller row sizes (16 bytes) and longer endurance (> 1,000,000 erase/write cycles @ 25C).

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Maybe thats is an idea, I will look in the em_EEPROM-code and look how they handel that. Thanks

The firmware needs 95000 bytes (36,1%) the bulkdata 50000 bytes of flash.

Can I be sure that firmware is using exclusivly the 95000 bytes from address 0?

I am still open to further suggestions.

0 Likes

xy,

I believe the linker's output of the .map file should indicate where in FLASH the em_EEPROM is placed.  Knowing the sector size of FLASH (16K) you can confirm that the data area is isolated from the code area.

Note:  If your data size was smaller, there is 32K bytes of ECC protected FLASH.  This will allow for a single-bit correction and dual-bit corruption detection.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

How do you get the 95000 bytes, could you attached your test result screenshot?

I think the Em_EEPROM or the EEPROM is a good idea.

Could you  clarify how many bytes you want to store?

0 Likes

"...How do you get the 95000 bytes, could y.."

This is the result from a build-message:

Flash used: 96628 of 262144 bytes (36,9 %).

SRAM used: 17829 of 65536 bytes (27,2 %). Stack: 2048 bytes. Heap: 512 bytes.

I have to store up to 50000 bytes.

0 Likes

Please refer to the following article to solve your issue:

Defining Const Variables for Fixed Address in PSoC 4 - KBA229222

0 Likes

Is this also valid for PSoC5 ?

0 Likes