Hi, I'm currently working on 2 routines to perform generic read/writes on the memory of the S32K144. These will be commanded externaly.
The read routine is quite simple:
uint32_t request_addr = 0x0000C000;
uint8_t* data = (uint8_t*)request_addr;
memcpy(response_buffer, data, 1);
It works as expected and I can read data stored in flash. However, if I try to implement a similar routine for writing:
uint32_t destination_addr = 0x0000C000;
memcpy((uint8_t*)destination_addr , &request_data, 1);
volatile static uint8_t validation_value = 0;
validation_value = 0xBA;
uint32_t addr = &validation_value;
uint8_t newValue = 0xFF;
memcpy((uint8_t*)addr, &newValue, 1);
This works fine.
My question here is what's the behaviour when reading/writing to memory spaces in flash? Are reads fine but writes protected in some way? Do I need to use the flash_drv for writes? Am I missing something here?
Thanks!