File System Location in Flash

Using NetOS 7.3, ConnectCore 7u.
I’m scoping out whether to use the file system or not, but I’m not seeing where the location of the file system in flash can be specified. I’ve found the following function in bsp_api.c, but I’m not finding anywhere that it is used or where the value of _NAFlashSizeUsedTop is set:

WORD32 NABspFileSystemStartOffset(void)
extern unsigned int _NAFlashSizeUsedTop;

/* return NAAppOffsetInFlash + NAAppMaxSizeInFlash; */
return (unsigned)&_NAFlashSizeUsedTop;

I tried checking the value of _NAFlashSizeUsedtop from a different function and got a 0 value. I would like to position a 256k file system at the top of flash so that it will have a consistent location and leave the most room for our main application. It looks like there are a couple of settings in customize.ldr, but none specifying the location.

Any suggestions would be appreciated.


Look at file customize.ldr (gnu) customize.lx (GH) in the platforms directory of your bsp directory. In there you’ll find a manifest constant entitled FILE_SYSTEM_SIZE. I believe that is 256K by default. Also I believe the file system starts at the top of flash and moves down, while the bootloader and the application start at the bottom of flash and move up.

Thanks for your response, that helps. I did find the FILE_SYSTEM_SIZE constant in customize.ldr file, I just wasn’t sure where the file system was being put in flash. If it does indeed start at the top of flash and moves down then everything is good. I just hadn’t seen anything that says it actually starts at the top of flash or that gives an option to specify a location.

One other thing to keep in mind, though I believe this is somewhat transparent, the BSP , depending on settings in bsp.h can take the top sector of FLASH and use it for NVRAM. If you let the bsp handle all the placements, then this will be transparent.

For most NET+OS modules the flash file system ends at the end of flash right before NVRAM. I.E. if you use a FFS of 256k, it will end at the end at the last sector of flash - 1 sector (64k sectors), and start at the last sector of flash - 5 sectors. With NVRAM on the CC7U being stored on an I2C EEPROM, I suspect it just uses the last 4 sectors of flash in the above scenario.