Read files from project?

Hopefully a simple question,

I have some json files that I would like include at compile time and have accessible via the program code at runtime. I have been using LittleFS to create / read files at runtime, but how would I go about including / finding files at compile time? Are they included when published, what would the path be?

Thank you!

That’s not something that’s really possible.

The compiled code needs to fit in the 128K user firmware binary (256K on Device OS 3.1 or later on Gen 3). This is memory mapped so you can include binary assets in it as byte arrays. You don’t need the file system for this, and access is very fast. For small amounts of data, things like icons for LCD displays, fonts, small sound files like beeps, etc., this is commonly done.

You could technically then write binary assets into the Gen 3 LittleFS file system, but this is a weird and inefficient mechanism, except in the case where you want to pre-load the file system once with static data. But you’re still limited to 256K of the 2 MB flash file system, so it’s not really all that practical.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.