Commit f7eb2f00 authored by deroo's avatar deroo
Browse files

fix typos in README

parent b867b461
......@@ -8,7 +8,7 @@ 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:
int flashErasePage(int page);
int flashErasePage(int page);
void flashMode(_flashModeEnum mode);
where mode is one of
FLASH_READONLY
......@@ -56,7 +56,7 @@ such as
double *arrayInFlash;
to declare an array of doubles named "arrayInFlash".
The asterisk ( * ) before the array name is important.
The scope of the array is determined by where the declaration is made.
The scope of the array is determined by where the declaration is made.
If outside of any function, the scope is global (all functions can see the array), while if it is inside a function, it will be seen only within that function , and others to which it is passed in the function argument list.
The second step is to specify where and how big the array is.
......@@ -76,6 +76,7 @@ The array macro NANO33BLE_PUT_ARRAY_IN_FLASH must be inside a function, because
The array macro NANO33BLE_PUT_ARRAY_IN_FLASH does not initialize or otherwise modify the contents of the array. It just makes the sketch look in the correct place in flash memory when it encounters future references to the array.
The macro sequentially packs the arrays in from the top of the available flash memory, reaching down as far as it needs to go.
It does not check for any collisions with the sketch or bootloader, which start at the bottom of flash, but it'd have to be a pretty big array and/or sketch for a collision to occur.
The lowest flash page that is partially or fully occupied with your arrays is given by the macro NANO33BLE_FLASH_LOWEST_PAGE.
Thus, if you need to erase all the pages your sketch is using in order to initialize them, loop with a for loop from NANO33BLE_FLASH_LOWEST_PAGE to flashNumberOfPages, erasing each page as you go.
......@@ -87,15 +88,17 @@ If you want more control over the details of the declarations in flash,
declare arrays in flash using pointers:<br>
\<datatype\> *\<arrayInFlash\> = ( \<datatype\> *)\<flashAddress\>;<br>
where the flashAddress is the number of bytes into the flash memory.
This form of the statement does both tasks listed separately above:
it declares the array, defines its scope, and locates it.
For example,<br>
int *intsInFlash = (int *)(flashNumberOfPages-2)*flashBytesPerPage;<br>
to use the last two flash pages as an array of ints.
For example,
int *intsInFlash = (int *)(flashNumberOfPages-2)*flashBytesPerPage;
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.
Note: you have to keep track of which array is where,
and take care not to walk off the end of your array into another one.
and take care not to walk off the end of your array into another one.
Fortunately, past the end of the sketch, it's all available to use.
The first 16 pages (0-15) are used for the bootloader.
......@@ -108,4 +111,4 @@ watch the colored text as it uploads (hit the Arduino reset button to abort).
Or, compile and take the number of bytes
in "Sketch uses NNNN bytes (X%) of program storage space..."
and divide by 4096, rounding up.
Markdown is supported
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