Hi again, and thanks for your lengthy response.
You are describing exactly what I want to do. I will not be using a "simple bootloader" to upload the upgrade, because it is a fairly complex procedure using a CAN based protocol over a large geographical area, and the upload sw is located inside the application, since the appliciation is needed to do the communication.´
Since the application/loader puts constants at 0xCnnn it is reasonable to believe that the uploaded upgrade will have similar constants in the same area in block 0, The running program would therefore have its constants overwritten during the upload.
I believe I cannot just move everything the S19 file wants to put in block 0, to another block. I want to link/locate it to block 0, so that the program can still find it. I cannot however figure out how to do this, and that is my major problem right now.
If I could resolve the linker issue I would not need a temporary flash location, which is good because, if something goes wrong during the erase/copy procedure the old and working program may have been erased, and not yet been replaced by the new one. If on the other hand I could have the ENTIRE application in block 1 and than swap to another vector table, the risky time window is almost zero.
Anders
Hi Anders
The internal FLASH of the HC12 is designed for boot loaders (as is FLASH in most other uPs too). I would take a quick look at the serial monitor usind for example in the M9C12NE64. It occupies 2k (I think) and coordinates downloads.
When it starts it it checks to see whether there is a valid application loaded. It can delete an application and accept a download of new code.
It handles all interrupts but allows the user to load a new jump set - also what you are thinking about.
It uses the top 2k in FLASH (protected sectors) and probably this is the best way to go because the code and vectors are together (which seems logical).
Look for the application note AN2548 (code is available to the app. note) and also at AN1280A (the more powerful d-Bug12) which shows how user definable vectors ad calls are implemented.
Good luck.
Mark Butcher
www.mjbc.ch
Mark,
Thanks for your comments.
I have read these AN's, and they are helpful in general terms. It seems however that CW always puts some data in non banked memory as illustrated by the cut-out below from the map file.
I would like to load my application in block 1, above 0xFFFF and NEVER touch non banked memory.
Or, put another way: I want a basic very simple kernel running in non banked memory, that calls the main application in block 1, or on command calls a newly upgraded application in block 2 instead. In this case the question would be how to extract the code that is located in banked memory, and upload only that. Perhaps extract and upload only those S19 records?
It seems my big problem is that CodeWarrior ALWAYS needs some non banked memory.
How to get around that?
My big concern it to minimize the risk of getting a dead device if there is a problem during bootload. A conventional ram based bootload has a rather large time window during which nothing may go wrong. My approach, would shorten this time window to a short one byte Page swap in a EEPROM byte, and a COP reset. Virtually no time window at all, and plenty of time during upload to validate the received new program. The backside to my approach seems to be that I can't make it work :smileysad:
All comments appreciated, thanks,
Anders J
================= CUT ===============
.init 32 R 0xC000 0xC01F ROM_C000
.startData 30 R 0xC020 0xC03D ROM_C000
.rodata 468 R 0xC03E 0xC211 ROM_C000
.rodata1 2642 R 0xC212 0xCC63 ROM_C000
NON_BANKED 2058 R 0xCC64 0xD46D ROM_C000
.copy 255 R 0xD46E 0xD56C ROM_C000
Sten,
I have tried to exclude everything from block 0, but the constants are a problem. If I force them to block 1, by removing the NON BANKED memory areas from the PRM-file, I get various linker errors, seen below. It seems CW needs these constants under 0xFFFF.
Anders
=====================================
L1128: Cutting value pZeroOut startup data member from 0x3D8057 to 0x8057
L1128: Cutting value toCopyDownBeg startup data member from 0x3CBE11 to
Hi Sten,
Can you please explain changes required for placing the application and running application code form the other blocks in more details. I have one use case mentioned below
So I am using MC9S12XEP100CVL controller and I am using Block 0[256KB] for bootloader application which uses around 12 sectors[code and verification data] and user application is around 680KB so we are not able to use remaining sectors of block 0 due to XEp100 limitation mentioned below.
Limitation: XEP100 does not allow to perform any operation like erase and write on the unused flash addresses of particular Block where the code is running.
So there are two options I can think of
1. Using other blocks for running the user application code.
- Can you please share any example code or what all things we need to take care for running user application from different blocks?
- Do we need to update parameter file[prm] ?
2. finding a to way to use the remaining block of the block 0.
- Is there any way we can write to unused sectors of block 0 where my bootloader application is running?
I added this question in detail on community. Please find attached link for same
Any kind of help will be appreciated.
Thanks in advance.