cancel
Showing results for 
Search instead for 
Did you mean: 

How to Inject Configuration Files into STM32 Target Using FileX?

srikanthpalvai
Associate III

Hello STM community,

I'm working on a project where I need to inject pre-configured config.ini and cacert.pem files into my STM32 target for mbedlts communication. I've gone through the STM32CubeU5 example for FileX, which demonstrates creating a file at runtime.

However, I'm unsure how to modify this example to include code that reads these configuration files from storage internal flash and then perform the necessary operations with them.

Could anyone provide guidance or share an example of how to achieve this using FileX on STM32?

https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/B-U585I-IOT02A/Applications/FileX

 

Thank you in advance for your help!

Best regards,

14 REPLIES 14

Could swear you've already asked this. Put the data into a C uint8_t array, put it in it's own .H for convenience. Use pointer and sizeof() to determine location and scope content.

Perhaps if you have some level of sophistication you can put multiple files, with names, sizes, and pointers into a table/structure.

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

Thanks for the quick response 

Is there any other alternative way to achieve this without this uint8_t array

By the way could you please give me some examples to uint8_t.

 

My main motive is to work with config.ini  file.where I will use ini parser to retrieve the  parameters. 
If it’s possible to inject the config.ini file as it is in the flash memory, existing code will satisfy my logic

other wise  I need to write my own logic to retrieve and save the configurations 

hope you understand my query 

Pavel A.
Evangelist III

Do you need a filesystem, besides these two files? If not: find API that takes the data from memory (pointer/array) rather than named files. If no such API, implement _open() , _read() and whatever else your libraries need to read the files rather than hauling entire filesystem package into your project.

@Pavel A. 

I want file system.

 

Pavel A.
Evangelist III

Great. Then you need SD card or eMMC chip, or something else. Create a filesystem image from your files, put it on the storage. Mount it. Task complete!

 

Sorry, I don’t want to use the SD card 

I want to use flash memory for this as I am going to use the STM nucleo which having 4MB flash. 

 

Pavel A.
Evangelist III

Then the internal flash will be the storage. Same plan.

 

srikanthpalvai
Associate III

@Pavel A. 
But my Basic query is, how can I load my raw files(config.ini and cacert.pem) into the flash memory, Without using the array approch.