We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I have a couple of executables [ while(1) {...} loop programs within a main() function ] generated ( hex or bin or s19 ; for simplicity lets say hex ) and I want to allocate each hex file at a specific starting address in the flash memory, so that in a main program I can jump to a specific starting address depending on the input to execute the present code.
1. Any help to solve this problem ? 2. Is there any way to merge these hex files together and then I can can jump to their specific location ?
Thank you, Walid Farid
-------------------------------------- More about the problem ------------------------------
So, I've 3 developed projects where each project interfaces with specific peripherals on the development board. And, I want to load all 3 hex files ( or any other form of executable ) corresponding to each project to the flash memory and execute one of these codes at a time from the flash. I'm not sure why did you mention executing the code from the RAM, if I can execute it directly from the flash.
I thought, if I'm able to load the 3 hex files to the flash memory, I can load a 4th hex file, which given a specific input will run one of the 3 hex files at a time directly from the flash.
I'm using KEIL-MDK evaluation version and looking at the hex file, I can see that the starting/entry point of the code is 0x8000_00ED. So, I'm sure that all hex files will have the same entry point.
In KEIL-MDK, If I changed the code memory area to start at a different location than 0x8000_0000 ( say 0x8000_0100 ), will this change the starting/entry point ? Will the bootloader start executing the code at 0x8000_0100 which maps to the RESET routine? Or does the bootloader, regardless of the entry point in the hex file, places the code starting at 0x8000_0000 ?
I hope I clarified what I want to do ... so, regardless of or with regard to using hex files, how can I solve this problem ?
----------------------------------------------------------------------------------------------
P.S. : This question has already been posted on the STM32 forums
So you're going to waste a huge amount of Flash space for the components that are not currently in use!
If that's really not a problem to you, then use a "bootloader" style of arrangement, where the bootloader decides which application to run.
See ST's application note AN2557 for a bootloader example Also http://www.keil.com/forum/16355/ and many posts on the ST forum...
Alternatively, why not store all the components on an SD Card (or similar), and have a more conventional bootloader that loads the required one into Flash, and executes it? To save re-Flashing when the required app is already loaded, you could provide some way for the bootloader to check what application is currently loaded - and its version...
Hi Andrew,
Wasting the flash space for the unused components is not a problem.
I have no problem with either having the components on the flash memory or an SD card. However, I think using the flash will give me the option to protect the code by applying the read-out protection from the flash. What are the other options beside the SD-Card ?
Regarding loading a specific component directly from the SD-card into the flash memory, as you mentioned, it seems that the SD-card gives us only one better option because no need for re-flashing after making changes to a specific component. However, it looks like the same process of trying to jump to a specific code in the flash still exists. Is there any other advantages for using the SD-card ?
Thanks for the link.
Thank you, Walid
Yes, of course it does!