I am using CodeWarrior Development Studio Version 10.6.4 to develop firmware for a MC9S08DZ32 bare metal target board. I have 2 separate projects. One for the main application and one for the bootloader for field upgrades. I can download and run/debug both separately but when I jump from the bootloader to the main application, the main app still tries to use the bootloader vectors. Here is how I have things setup in CodeWarrior:
Bootloader
In processor build options
ROM F400 size=BAE
In processor properties
Vector table F3C0 size=3E
Reset Vector FFFE
Protected area F400-FFFF (3 KB)
Vector redirection yes
In the CodeWarrior debug configurations
preserved area = 7C00 to F3BE
Main app
In processor build options
ROM 7C00 size=77C0
In processor properties
Vector table FFC0 size=3E
Reset Vector FFFE
Protected area Disabled
Vector redirection no
In the CodeWarrior debug configurations
preserved area = none
I first download the main app. Then I download the bootloader. I look at memory and the main app is still intact including its vectors. I then run and I can verify that the bootloader is running. I can communicate with it via a serial port and give it commands. When I give it the command to execute the main app, it goes to the correct location but when an interrupt happens, it uses the bootloader vectors instead of its own. What have I done wrong?
Note that I have searched the forums and found no direct answer. I have a trouble ticket into NXP and they have not been able to help yet. They suggested I come here so here I am. Please don't refer me to a link that supposedly answers this question because there isn't any. I will give you any additional details you need. Please! Thank you!
Hello Mike Maddi ,
Do you redirected the vector of Bootloader , not applicaton ?
Sorry I know the S08 bit mcu little, I think you should redirect the vector table of application.
And the vector redirection must be enabled.
I know you don't like link, while I think the problme is the vector redirection failed , so maybe
you can refer to other bootloader to redirect it :
关于飞思卡尔的Bootloader S08的试验AN2295
If still can''t work, please let me know. And which IDE do you used, If I have , I can test your code on my side.
BR
Alice
Thanks for your response Alice. My last failed attempt was to set the bootloader's vector table the normal default location but still have the upper 3 kb of flash, where the bootloader code resides, protected and enabled vector redirection. I set the main application code vector table at the redirected location and have also protected the bootloader flash and enabled vector redirection. I get the same results when I transfer control to the main app. To get by this crisis and get on with my work I've given up and rewrote the bootloader to not use any interrupts. I don't like it but it works. I still need to know how to do this though. If you could look at my code, I would be eternally grateful. I am using CodeWarrior Development Studio Version 10.6.4 build ID 150416. My target board is a bare metal MC9S08DZ32.
Hi Mike,
Thanks for your sharing.
- How about this steps:
1) start the bootloader (normal vectors)
2) bootloader decides if it should run the application firmware (check for pin state, serial message, ...)
3) Before run the application:
i) disable interrupts
ii) enable vector redirection
iii) JMP to application _Startup or main
- Or how about bootloader and APP use the same interrupt vector .
Best Regards,
Alice
Hi Alice. I appreciate your help. I tried what you suggested however I am unable to do step 3 ii enable vector redirection. Maybe I am doing it wrong. According to the datasheet for this MCU, "Vector redirection is enabled by programming the FNORED bit in the NVOPT register located at address 0xFFBF to 0." However, that is a program once register and will not allow me to change it. So how can I enable the vector redirection?
Hello Mike,
I asked some other colleague and check bootloader information about 8 bit MCU.
It seems the boolotader usually do not use interrtup.
I refer to the AN2295 , the original interrup vector table is empty:
Also there is a part about interrupt relocation:
4.4 Interrupt vector table relocation.
Then I checked the source code , it is enable vector redirecton in bootloader code:
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Alice, sorry I took so long but I have been swamped with work. The pressure has been on me to finish this task so I have gone with the none interrupt version which has been working very well. So I have not tried your last suggestion but will when I get a chance which may be some time from now. Until then, thank you so much for your help.
Hello Mike,
Thanks for your sharing.
Have a nice and good work.
BR
Alice