Hi,
I am using MC9S!@ZVML64 board and codewarrior for the development of bootloader. Currently I am facing issue in jumping to the main of user application.
1). I have a bootloader project , startup vector is default ,ie., VECTOR 0 _Startup.
Using bootloader project, I am flashing the .s19 file of user application code through CAN with some customized tool. My bootloader project resides in ROM = READ_ONLY 0xFFE000 TO 0xFFFDFF;
2). In User application application, the vector is VECTOR ADDRESS 0xFFDFFD _Startup, ie., I am storing the startup code address into position 0xFFDFFD. My user application code resides in ROM = READ_ONLY 0xFF7200 TO 0xFFDFF7;
I have relocated the interrupt vector using the IVBR register. Also to have a fixed point between two independent projects I have changed the position of _Startup() function of user application prior to DoZeroOut() and DoCopyDown() functions.
3. After downloading the User application code through CAN, the Startup address(0XFF7200) of user application code is written into address 0xFFdFFd..
4. I am using below code to jump to user main:
app_vector = *(unsigned long int *) (APPLICATION_RESET_VEC_ADD);
asm LD X,app_vector;
asm JMP (0,X);,
where APPLICATION_RESET_VEC_ADD is #define APPLICATION_RESET_VEC_ADD (0xFFDFFDU).
When I am debugging, once the line "asm JMP (0,X)" is executed, I am getting the below error.
Could you please have a look at this and point out why this error is apperaring. I have attached the .prm, main and startup.c files of both bootloader and user application.
Bootloader and also application are specific programs which must meet some conditions to be executable together and correctly. Could you please check your approach with
https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Simple-Serial-Bootloader-for-S12Z-AN-draft/...
I am not able to say what everything can be wrong immediately. MOreover you have in your fresh mind all things you did to be able to compare correct approach with yours. (I do not claim that your is wrong but now it is something wrong...)
Best regards,
Ladislav
Hi,
My idea is that.... what do you want to see if you downloaded the code by CAN and there is no info in the debugger which can show C code interpretation of user app code addresses? There are code lines in the assembler window. It is OK. But the IDE does not know what to show as a C. There is a possibility to download elf file with this info.
There is an answer ( https://community.nxp.com/t5/CodeWarrior-for-MCU/Loading-Multiple-elf-files-in-one-debug-session/m-p... ) related to another mcu but you can also find info in the CodeWarrior help searching for "Load Multiple Binaries".
Best regards,
Ladislav
Hi,
Thanks lama for your reply..
I flashed the bootloader code using BDM. Then I flashed the application code using my flashed bootloader and a customized CAN tool. After power on reset, the application is not working as expected.
My actual application has schedulers, lots of resources used and seems like the schedulers are not working properly..
Then I choose the debug session : "Connect" to see the contents of ADC register. The ADC0CMD register is empty, where as the other register like TIMERs have values as expected. When I flashed the application code alone using BDM, the application is working fine. The only difference in the application which is been flashed using bootloader and CAN is that I am storing the address of the startup function at address 0xFFDFFD.
And when I flashed the application code using BDM and then when I am looking the ADC register, it has values in it..
Do I need to do anything apart from the points which I have posted in my first query. Could you please check and let me know.