Hello Rinoa Harasashi:
Typically configuration data is placed at the end of the flash (higher addresses) because application grows from lower addresses. You need to reserve at least one flash sector at the end of flash; for K64 the flash sector size is 4KB.
You can check the generated .map file to see how much memory your code is using and also a very useful feature is to print the code size. The next tutorial explains how to activate "Print Size" with KDS:
GNU Additional Tools: Create Flash Image, Print Size and Extended Listing Options | MCU on Eclipse
The material and examples in the next links will help you understand how to reserve space in flash using the GCC linker file and allocate your Non Volatile data to such space:
Controlling data and function placement in memory
Relocating Code and Data Using the CW GCC Linker File for Kinetis
Defining Variables at Absolute Addresses with gcc | MCU on Eclipse
Some points to consider:
- K64FX512 has FlexNVM memory to be used as EEPROM, while K64FN1M0 only has P-Flash. I don't know which is yours.
- If you intend to frequently update the constant data, you better reserve more than 1 flash sector and alternate programming addresses. This way you do not overuse a single flash space due to its program cycles.
- When calling the program flash routines (Program Phrase command), make sure that the address is aligned to 64 bits.
Regards!,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------