2 added 823 characters in body
source | link

TwoIf you want to manipulate the Flash in your program, then there are two things you can look at tothat might help you. One is Both are part of the chipKIT project. In there there: There is "EEPROM Emulation" (emulation of the Arduino EEPROM library using Flash).

https://github.com/chipKIT32/chipKIT32-MAX/tree/master/hardware/pic32/libraries/EEPROM

It relies on a section of Flash being set aside in the linker script (linker scripts are in https://github.com/chipKIT32/chipKIT32-MAX/tree/master/hardware/pic32/cores/pic32 ) and also uses a form of wear levelling to increase the life of your flash.

Secondly, for general Flash reading and writing, another library for the chipKIT project (written by me) is here: https://github.com/MajenkoLibraries/Flash

Feel free to take any code from that you fancy.

If you aren't going to be making any changes to the data, and it is fine to include it in the code, then declaring it const is the way to go. When const it will reside in Flash (more specifically the .rodata section) so will not take up any RAM space.

Unlike simpler MCUs the PIC32 has a single monolithic address space, and the Flash is directly mapped into that 4MB memory address space. Consequently the data in Flash can be directly accessed and doesn't require any special register manipulations or instructions. Simpler MCUs often copy the read-only Flash data into RAM to make accessing it easier (unless you specifically force it to do otherwise).

Two things you can look at to help you. One is the chipKIT project. In there there is "EEPROM Emulation" (emulation of the Arduino EEPROM library using Flash).

https://github.com/chipKIT32/chipKIT32-MAX/tree/master/hardware/pic32/libraries/EEPROM

It relies on a section of Flash being set aside in the linker script (linker scripts are in https://github.com/chipKIT32/chipKIT32-MAX/tree/master/hardware/pic32/cores/pic32 )

Secondly, for general Flash reading and writing, another library for the chipKIT project (written by me) is here: https://github.com/MajenkoLibraries/Flash

Feel free to take any code from that you fancy.

If you want to manipulate the Flash in your program, then there are two things you can look at that might help you. Both are part of the chipKIT project: There is "EEPROM Emulation" (emulation of the Arduino EEPROM library using Flash).

https://github.com/chipKIT32/chipKIT32-MAX/tree/master/hardware/pic32/libraries/EEPROM

It relies on a section of Flash being set aside in the linker script (linker scripts are in https://github.com/chipKIT32/chipKIT32-MAX/tree/master/hardware/pic32/cores/pic32 ) and also uses a form of wear levelling to increase the life of your flash.

Secondly, for general Flash reading and writing, another library for the chipKIT project (written by me) is here: https://github.com/MajenkoLibraries/Flash

Feel free to take any code from that you fancy.

If you aren't going to be making any changes to the data, and it is fine to include it in the code, then declaring it const is the way to go. When const it will reside in Flash (more specifically the .rodata section) so will not take up any RAM space.

Unlike simpler MCUs the PIC32 has a single monolithic address space, and the Flash is directly mapped into that 4MB memory address space. Consequently the data in Flash can be directly accessed and doesn't require any special register manipulations or instructions. Simpler MCUs often copy the read-only Flash data into RAM to make accessing it easier (unless you specifically force it to do otherwise).

1
source | link

Two things you can look at to help you. One is the chipKIT project. In there there is "EEPROM Emulation" (emulation of the Arduino EEPROM library using Flash).

https://github.com/chipKIT32/chipKIT32-MAX/tree/master/hardware/pic32/libraries/EEPROM

It relies on a section of Flash being set aside in the linker script (linker scripts are in https://github.com/chipKIT32/chipKIT32-MAX/tree/master/hardware/pic32/cores/pic32 )

Secondly, for general Flash reading and writing, another library for the chipKIT project (written by me) is here: https://github.com/MajenkoLibraries/Flash

Feel free to take any code from that you fancy.