I have spent many hours trying to add a bootloader to my product. I am using the s12g128 example bootloader. This the version I am using,
File main.c
Owner b01802
Version 1.0
Date Dec-02-2010
Classification General Business Information
Brief Serial bootloader for families S12G, S12P, S12HY and S12HA
I have added the interrupt vector table modifications to my project and made the changes to the Program.prm file.
When I try to load my project using terminal software I get "S-Record Out Of Range"
I have used SRecCvt-GUI, Burner.exe and LogPHY12 to create the S19 file. All three give different results when I view the created file. None of them can be loaded via the terminal software.
I have attached the bootloader and my project.
Ray.
Original Attachment has been moved to: Bootloader_S12.zip
Original Attachment has been moved to: CAN_EGTamp.zip
Hi Ray,
I checked your code and I found two small issues which partially blocks loading into MCU and could cause problem during application code execution.
However despite on fact these modifications, bootloader still reported "S-Record Out Of Range" due to user application reset vector.
Please update valid memory range in bootloader for your MCU. In bootloader main.c file please replace “ProgSRec.LoadAddr <= 0x03EFDFUL” by “ProgSRec.LoadAddr <= 0x03EFEFUL”.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
RadekS,
I am still getting the "S-Record Out Of Range". But now when I select "d" to start application it does start. The problem is the interrupts do not work.
Also just loading the project via the P&E Multilink BDM give the same result. It does not run due to the interrupts.
When I used the Atmel AVR the project file needed no changes to be used with a bootloader. It would be so much easier if there was a bootloader that worked with normal interrupt vectors and memory locations, like the AVR.
Ray.
Hi Ray,
Did you implement all described changes from my last reply?
Because I worked with your project and error "S-Record Out Of Range" disappear after these changes.
It seems that you miss some of steps. You have to update IVBR register in application(for point to application vector table), delete numbers from all interrupt declarations (this will just cause that linker will not generate vectors in restricted area for bootloader) and increase testing range in bootloader (this will allow that application vector could be part of application code).
I didn’t test your code directly – therefore I am not sure whether your interrupts works or not.
However currently I do not see any reason why it should not work.
About interrupt vectors location)
Unfortunately this is system issue. In case of S12 devices, interrupt and reset vectors are in the same flash sector (upper flash sector). We could simply use bootloader which will be loaded into RAM and it could rewrite all flash data include reset and interrupt vectors, but this is one way route. After reset, bootloader will be not accessible.
Other way could be implementing bootloader into application however this approach has also some disadvantages. If we will allow rewriting default reset and interrupting vectors, bootloader will be not safe anymore. For write into flash, flash sector must be erased prior programming. If any power down occurs prior we load new reset vector, application nor bootloader will not work anymore. For fix that, we have to use BDM interface to programming reset vector again.
So, AN4258 presents one of most often use way for implementing bootloader into system (Bootloader keeps on reset vector). Other approaches are also possible, but every other has also some disadvantages.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------