Writing a struct to Flash

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

cross mob
SaGh_4441651
Level 3
Level 3
First like received First like given

I am working with a PSoC 4100S Plus device. I need to write a struct to the flash. My struct is as follows-

typedef struct

{

  uint32_t time;

  uint8_t  index;

  uint8_t  state;

} debug_state;

static debug_state debug_data[100];

During the run of the program, I will be filling in the struct with values. And at the end of the test run, I need to write this struct 'debug_data' to Flash memory. I understand I have to use the function CySysFlashWriteRow, but I am unable to figure out how to calculate the flash row number and how to pass the struct data to the function. Can someone help me with this?

0 Likes
1 Solution
SAJO_1338106
Level 4
Level 4
25 replies posted 10 replies posted 5 replies posted

Hi SaGh,

Take a look at em_EEPROM component. It has very easy API for writing data to the flash.

View solution in original post

0 Likes
1 Reply
SAJO_1338106
Level 4
Level 4
25 replies posted 10 replies posted 5 replies posted

Hi SaGh,

Take a look at em_EEPROM component. It has very easy API for writing data to the flash.

0 Likes