??? 02/23/11 18:14 Read: times |
#181265 - Odd use of code banking |
Here's an odd request. Maybe someone has a good idea.
I'm using the SiLabs F120 and the Keil compiler (old v7.x). I would like to implement a firmware update feature, using the UART0 as the port to the host computer. As you may know, the F120 has 128 kBytes of flash, divided into four banks. I have reserved Bank 3 for parameter and data storage. My application so far is only about 20 kBytes, so it easily fits into Bank 0 (the common bank). The idea is to put the firmware-update program code into Bank 2, and when the micro receives a magic "enter firmware update mode" command, it jumps to that FWU code. There, it will listen to the serial port, looking for a special header, a target address, a byte count, and up to 1024 bytes (one page) of new firmware data which are stuffed into a buffer in XDATA space. The micro will erase the target page. Once the page is erased, I loop through the buffer, copying four bytes at a time into a temporary buffer in DATA space, which is used as the source for the flash programming (can't use anything in XDATA space as the source for flash programming!). The Keil tools happily compile and build a banked application, and in response to the magic command, the micro jumps to the programming code in Bank 2. The rub is that the hex file that the compiler spits out includes the firmware-update code in Bank 2, and when the programming algorithm gets to it, the micro erases the code space out of which it's executing. This is not good. So what makes sense to me is this. Is there a way to get the compiler/linker to output separate hex files for each bank? My host application can then just use the image for Bank 0 and the firmware update code in Bank 2 never gets touched. Thanks! -a |
Topic | Author | Date |
Odd use of code banking | 01/01/70 00:00 | |
I don't know about Keil's... | 01/01/70 00:00 | |
Seperate Program? | 01/01/70 00:00 | |
separate program | 01/01/70 00:00 | |
Often special lock bits for boot regions | 01/01/70 00:00 | |
linker magic | 01/01/70 00:00 | |
RTFM | 01/01/70 00:00 | |
You are not good to go | 01/01/70 00:00 | |
updater and libraries | 01/01/70 00:00 | |
which is why | 01/01/70 00:00 | |
Please Reconsider | 01/01/70 00:00 | |
the golden rule | 01/01/70 00:00 | |
re: Reconsider | 01/01/70 00:00 | |
If needed... | 01/01/70 00:00 |