Commit 936b9f7b authored by deroo's avatar deroo
Browse files

Update README.md

parent c10625c5
......@@ -8,26 +8,17 @@ The Flash on the nRF52840 has 256 pages of 1024 words, each word is 4 bytes.
Each page is individually erasable; each word is individually writable.
This library defines 2 functions:<br>
int flashErasePage(byte page);
void flashMode(_flashModeEnum mode);
where mode is one of
FLASH_READONLY
FLASH_WRITE
FLASH_ERASE
it also declares 3 constants
flashBytesPerPage
flashBytesPerWord
flashNumberOfPages
int flashErasePage(byte page);<br>
void flashMode(_flashModeEnum mode);<br>
where mode is one of<br>
FLASH_READONLY <br>
FLASH_WRITE <br>
FLASH_ERASE <br>
it also declares 3 constants<br>
flashBytesPerPage<br>
flashBytesPerWord<br>
flashNumberOfPages<br>
with the values given above, or derived from it.
This code is most useful for implementing non-volatile arrays,
......@@ -47,7 +38,7 @@ flashErasePage(pageNumber);
flashMode(FLASH_READONLY);
The first 16 pages (0-15) are used for the bootloader.
Do not corrupt the bootloader lest your Nano become useless!
<b>Do not corrupt the bootloader lest your Nano become useless!</b>
The next N pages (16-..) are used by the sketch.
Larger sketches may use more pages.
It seems the smallest sketches, like blink, take 19 pages.
......@@ -57,12 +48,12 @@ Or, compile and take the number of bytes
in "Sketch uses NNNN bytes (X%) of program storage space..."
and divide by 4096, rounding up.
Declare arrays in flash using pointers:
datatype *arrayInFlash = (datatype *)flashAddress;
Declare arrays in flash using pointers:<br>
datatype *arrayInFlash = (datatype *)flashAddress;<br>
where the flashAddress is the number of bytes into the flash memory.
for example,
int *intsInFlash = (int *)(flashNumberOfPages-2)*flashBytesPerPage;
for example,<br>
int *intsInFlash = (int *)(flashNumberOfPages-2)*flashBytesPerPage;<br>
to use the last two flash pages as an array of ints.
Since the size of flash word is the same as sizeof(int) on the Nano 33 BLE,
the maximum index is the number of words on two pages, or 2048.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment