Hi Paul, I've been very interested in this new feature and the limitations are okay with me. Is there any examples on how to use this with the onboard flash? I couldn't find examples of the following two things but I may have missed them.
1) How do I create/populate the LittleFS so that it is included during flash programming?
2) How do access a LittleFS that is stored on the onboard flash?
This 34 page thread covers LittleFS:
LittleFS-port-to-Teensy-SPIFlash
Best version in Beta 7 of TD 1.54.
There is an example sketch : LFSIntegrity.ino
> It demos usage of the startup with typical functions used.
Re #1: Upload blanks the Flash - the LittleFS is created by the sketch starting
> this explains the loss of LittleFS on upload as noted
> The unused Flash over the stored program is available for use.
Re #2: using ...\hardware\teensy\avr\libraries\LittleFS\examples\LFSintegrity\LFSintegrity.ino
Set this for use of onboard FLASH
Code:
//#define TEST_RAM
//#define TEST_SPI
//#define TEST_QSPI
//#define TEST_SPI_NAND
//#define TEST_QSPI_NAND
[B]#define TEST_PROG[/B]
//#define TEST_MRAM
Find this to declare the desired size:
Code:
#elif defined(TEST_PROG)
if (!myfs.begin(1024 * 1024 * 6)) {
> That shows creation and use of PROGRAM FLASH - integrating to your sketch is TBD with that as an example.
After Upload the 'media' will all be formatted - so writes will be fast without formatting:
> All writes typically move to FRESH space until it is used up - then abandoned space will need to be Formatted before use.
> If Teensy restarts - without upload - it will find the existing files in place on the LittleFS media.
> If multiple restarts or runtime uses up the free formatted space and writes format space used before then the interrupts will get disabled as noted.
> If desired on startup [or as desired] when all used space could be formatted in advance to prevent 'on the fly' formatting try:
>> Only the BOLD line is needed in the sketch - and format of the PROG flash is quite fast - and any existing files or data will be preserved.
Code:
case 'f': // Reclaim all unused format
lastTime = micros();
Serial.printf( "\n myfs.formatUnused( 0 ) ...\n" );
timeMe = micros();
[B]myfs.formatUnused( 0, 0 );[/B]
timeMe = micros() - timeMe;
Serial.printf( "\n\t formatUnused :: Done Formatting Low Level in %lu us.\n", timeMe );
chIn = 0;
break;