I want to transfer the KEIL generated .hex file from computer's memory via UART onto the internal flash memory of the STM32F4. Can anyone give me a heads up of where to get started? and what are the important things which needs to be taken care of.
Please note: my UART is working great in both polling and interrupt mode.
thanks, Sam
First google result: stm32f4-discovery.net/.../
Hi Sankalp,
Thank you for your help, but I have seen this link before. It uses a software to do the job for us. I was hoping to do the same using programming, maybe through a python script or c/c++ code. Let me know if you or anyone out there can help me on this.
Best, Sam
If you want to do it using programming then the best way is to grab yourself a copy of the appropriate ST application note on the transfer protocol, do some reading and then simply get coding.
I did the very same thing for my preferred processor (the LPC8xx) and it was very easy. OK, I'm a highly talented, experienced and sought after embedded consultant (who's just going through a quiet period), but even a beginner should be able to get something going with not too much effort.
Hey,
I have one more question on the related topic, what I am trying to do here is store my main application file generated by keil, which is .HEX onto ST internal flash memory.
Micro-controller is talking to PC using USB UART .
So my question is : If I somehow managed to put my .HEX file into one of the sectors of ST internal flash memory and then tell my bootloader to jump to that location , will it work in that case. You think the main application will work smoothly.
If I somehow managed to put my .HEX file into one of the sectors of ST internal flash memory and then tell my bootloader to jump to that location , will it work in that case.
NO. You wouldn't put the HEX file at that location. You'd put the binary image that the HEX file represents at that location.
If you write your bootloader and the file you're wanting to download, then it should work and it should work smoothly. It's not exactly rocket science, but you do have to get a rudimentary understanding of how it all goes together.
Oh OK!
So when you say binary image does that mean I have to first convert my keil generated .hex file into a .bin file and then transfer it to the flash memory. If yes, then what will be the way to do the conversion.
Of course, I want to get the rudimentary knowledge about this but can you please suggest some good sources from where I can read and implement it successfully.
Thanks, Sam
Don't CS courses these days cover Assemblers, Compilers, Linkers and Loaders?
http://www.keil.com/support/docs/1584/ en.wikipedia.org/.../Intel_HEX
The Intel HEX format it pretty simple form of representing addresses and memory content, the sort of thing that could be encoded in 8-bit assembler for micro-processors in the late 70s.
You could write your loader to process this data, and to write it into the STM32's FLASH. Start by understanding the data format, and the data it describes, and then review the reference manual and examples to understand how to write to the FLASH. Look at the IAP examples ST provides, these use binary data, and Y-MODEM to send it to the processor.
The IAP examples also show how to pass control to other code. At the most basic level you can jump to different code, for the Cortex-M3/M4 you'll want to relocate the Vector Table, and make sure you build the code for the memory location you want to place it. I'd recommend reading the Cortex-Mx Technical Reference Manuals, others by Joseph Yiu, and generally those about Micro-Processor and Micro-Controller architectures.
Hello Sir,
Thank you for your help, I am not from CS. I am an electrical engineer specialized in RTL, wanting to learn embedded systems. So all these terms are new to me.
Thanks for the help
Hi Sam,
Were you successful in transferring a file from PC to STM32 flash? I am trying to do the same using IAP USART protocol and having trouble in configuring the user application that is used to load at a particular address. If you have implemented this, can you share the procedure for configuring the user application that is received using YMODEM.
Thank you, Harsha