2024-03-16 3:06 AM
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?
Thank you in advance for your help!
Best regards,
2024-03-16 8:25 AM
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.
2024-03-16 8:31 AM
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.
2024-03-16 8:38 AM
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
2024-03-16 9:33 AM
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.
2024-03-16 9:40 AM
2024-03-16 10:47 AM
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!
2024-03-16 10:53 AM
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.
2024-03-16 11:12 AM
Then the internal flash will be the storage. Same plan.
2024-03-21 2:46 AM
@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.