cancel
Showing results for 
Search instead for 
Did you mean: 

Store text file in stm32 flash

sne_123
Associate III

How can we store a text file into stm32f103 flash memory and read its contents??

5 REPLIES 5
Ozone
Lead II

Define "read its contents".

You can embed the text as constant string/data into the source code.

You can implement a file system (like FatFS) to access a portion of the internal flash.

sorry but I dint get what you said. How to embed the text as constant string/data into source code???

Also I don't want to implement FatFs . Is there any other way??

> How to embed the text as constant string/data into source code???

static const char *some_text = \
    "Hello world\r\n" \
    "Line 2\r\n" \
    "Line 3\r\n";

One could also use a simple tool to convert a file into a .H file you could include into your project.

A more complex tools could perhaps that the file and create an object file the linker to pull in.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..