Reserve last page of Flash for virtual EEPROM

Post here first, or if you can't find a relevant section!
Post Reply
User avatar
Alextrical
Posts: 39
Joined: Tue Aug 02, 2022 12:59 pm
Location: Cornwall, UK

Reserve last page of Flash for virtual EEPROM

Post by Alextrical »

Hi All

I'm currently trying to reserve the last page of Flash memory for use with the Virtual EEPROM, however I'm struggling to get the program space to not overlap, as this does not seem to change when the virtual EEPROM is enabled.

Is there a way to set the maximum 'program storage space' from within the Arduino sketch, without having to modify the build flags in 'boards.txt'?

Ideally i would like some way to automatically change
`3dprinter.menu.pnum.EBB42_V1_1.upload.maximum_size=131072`
into
`3dprinter.menu.pnum.EBB42_V1_1.upload.maximum_size=130048`
when the Virtual EEPROM is enabled, but restore it if the Vrtual EEPROM is not being used.
User avatar
fpiSTM
Posts: 1745
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Reserve last page of Flash for virtual EEPROM

Post by fpiSTM »

Simpliest way would be to define in a boards.local.txt a new entry for the board and name it with EE:

`3dprinter.menu.pnum.EBB42_V1_1_EE.upload.maximum_size=130048`

Like this you will have only to select the one you want.

Or you can add a new option in the 3D printer menu to set the correct upload_maximum value.
User avatar
Alextrical
Posts: 39
Joined: Tue Aug 02, 2022 12:59 pm
Location: Cornwall, UK

Re: Reserve last page of Flash for virtual EEPROM

Post by Alextrical »

Sounds good, and that is probably what I will end up doing for my local setup, but that is unlikely to survive across updates.

However I'm thinking more for a larger scale in a system like Marlin? Where an end user can specify that they want to use the virtual EEPROM from a configuration option, but not be aware of how to correctly specify a different board themselves. Is there a programmatic way of setting/altering a value at compile time from within the CPP files of Arduino.

Im happy to do the more work option ;)
Post Reply

Return to “General discussion”