mozilla-sensorweb / sensorweb-firmware

Contains all code that runs on the SensorWeb device
Mozilla Public License 2.0
4 stars 3 forks source link

Understand the TI SDK filesystem #13

Closed dhylands closed 7 years ago

dhylands commented 7 years ago

TI assumes that there is a filesystem that stores a variety of files to control the processor.

We've been modifying /sys/mcuimg.bin

TI defines a bunch of other files (like alternate firmware versions - perhaps useful for the updater). So we need to understand the filesystem, what we can store there, and how to access the files if things like certificates are stored there.

tdz commented 7 years ago

The SDK comes with 'simplelink,' an example program that provides file-system access.

tdz commented 7 years ago

FAQ: http://processors.wiki.ti.com/index.php/CC31xx_%26_CC32xx_FAQ#File_System

tdz commented 7 years ago

cc3200-rs now comes with the example programs fileio and fcreate that test several file and file-system operations.

tdz commented 7 years ago

When creating a file, the maximum file size has to be supplied. It's static and can't be changed later on. Unfortunately we cannot control the file buffer's position within the flash memory. Disk fragmentation can therefore reduce the maximum buffer size considerably.

tdz commented 7 years ago

There's a per-file fail-safe mode that provides double buffering for the file buffer. It consumes the double amount of flash memory, but preserves file integrity for power-losses during write operations.

tdz commented 7 years ago

With the fcreate example, the largest buffer I could create was ~880 KB, 440 KB in fail-safe mode, on a 1MB flash memory. According to the FAQ, the maximum file size is 1MB; even on flash memory that is significantly larger than that.

dhylands commented 7 years ago

I think we're running into that problem right now. I can flash an 80K image but can't flash a 176K one. I opened a bug with the cc3200tool author, and he's saying that flash file fragmentation may be the issue.

So he's suggesting I erase the entire flash, and reprogram it to see if the larger file will then work.

tdz commented 7 years ago

The PR at https://github.com/fabricedesre/cc3200-rs/pull/60 has support for the file system, files and binary images. The examples also try to work around file-size problems and fragmentation. When the PR landed, this issue can be closed.

tdz commented 7 years ago

Assigned myself, as I already did the work. :)

tdz commented 7 years ago

The PR for file I/O has been merged into cc3200-rs. Closing this issue.