save bytes in flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

save bytes in flash

746 Views
nileshravaliya
Contributor II

i am using TWRK80F150M BOARD and i want to save data (50 bytes)permanently (if power off than do not lost data) in flash please suggest how to save data in flash as well as any other option  

Labels (1)
0 Kudos
4 Replies

588 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Nilesh Ravaliya

Please check the following document:

Relocating Code and Data Using the MCUXpresso IDE 

As you can see, you can use the #include <cr_section_macros.h> and save data in a specific flash section. The sector size is 4KB for the K80, and with the management memory, you can reserve some flash space for your data.

Hope this information could help you, please don't hesitate to contact me if you have any other question about this.


Wish it helps you!

Regards

0 Kudos

588 Views
nileshravaliya
Contributor II

Hi,

Thanks for your valuable reply.

In your reply I can use only temporary when I switch off device data will be lost. Am I right??

But I want permanent data bytes store in flash is it possible every time I can read this byte on startup device?

this is my parameter.

Please suggest.

Regards with

Nilesh Ravaliya

8980035565

Access Computech Pvt. Ltd.

0 Kudos

588 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Nilesh Ravaliya

The community document that I share only illustrates the relocation of code and data, but you could use, for example, the __RODATA(bank) define to place rodata into a flash section defined in the linker script.

This will save data when you download the code into the flash, but if you want to place your data in runtime, you going to need to use the Flash APIs from the SDK, you could check the flash example code, which demonstrates how to program user data into the last section memory.

Hope this helps, please let me know if you have any question.

Best regards

0 Kudos

588 Views
nileshravaliya
Contributor II

HI,

Can you provide me flash api document as well as code because I have tried 4 MB qspi flash but it is not working TWRK80 BOARD.

Please help me out of this

Regards with

Nilesh Ravaliya

8980035565

Access Computech Pvt. Ltd.

0 Kudos