Page 1 of 1

Reserve last page of Flash for virtual EEPROM

Posted: Fri May 19, 2023 7:30 am
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.

Re: Reserve last page of Flash for virtual EEPROM

Posted: Fri May 19, 2023 9:09 am
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.

Re: Reserve last page of Flash for virtual EEPROM

Posted: Fri May 19, 2023 11:42 am
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 ;)