Dear kerryzhou
(URGENT HEP NEEDED)
Here I have a new problem. I have now 2 applications that sit on the MCU flash. One is a custom bootloader FW (that sits at address zero in the program memory and at some point the execution jumps from the bootloader FW to the application FW that sits in the higher area of program memory (flash).
The applicaton firmware is using a NO_INIT region in RAM (its defined in the scatter file of the application FW). When the execution jumps from the bootloader to the application, perhaps this NO_INIT area in the RAM is not available as the bootloader scatter file does not have it defined.
I tried to define it in the bootloader scatter file but I think it won't work like that. Following are the snippets from the .map files. Please note that the bootloader FW does not need the files clock_calibration.c, invisibles_sys.c and sessionmanager.c. They were added in the bootloader FW only to have this section allocated. The padding somehow does not seem to match. Not sure if this would be a problem:
Application firmware
======================
Execution Region MYRAM (Base: 0x20000500, Size: 0x00000054, Max: 0x00000100, ABSOLUTE, UNINIT)
Base Addr Size Type Attr Idx E Section Name Object
0x20000500 0x00000001 Zero RW 77 NO_INIT invisibles_sys.o
0x20000501 0x00000003 PAD
0x20000504 0x0000004c Zero RW 417 NO_INIT sessionmanager.o
0x20000550 0x00000002 Zero RW 1019 NO_INIT clock_calibration.o
======================
Bootloader firmware
======================
Execution Region MYRAM (Base: 0x20000500, Size: 0x00000050, Max: 0x00000100, ABSOLUTE, UNINIT)
Base Addr Size Type Attr Idx E Section Name Object
0x20000500 0x00000002 Zero RW 315 NO_INIT clock_calibration.o
0x20000502 0x00000001 Zero RW 329 NO_INIT invisibles_sys.o
0x20000503 0x00000001 PAD
0x20000504 0x0000004c Zero RW 343 NO_INIT sessionmanager.o
======================
How do I make this work?
Best regards,
Gaurav.
Solved! Go to Solution.
Hi Gaurav,
Do you still use the KL03?
KL03 already have the ROM bootloader, you don't need to use the flash bootloader.
If you still need to use the flash bootloader, and want the application code RAM area won't be influenced, I think you may consider to divide the RAM into two place, take an example, define the application bootloader RAM in the defined area, name that RAM area as one place, then just don't do the initialize for the application RAM area. This the thought, you need to try it on your side.
If you meet any question, just let me know.
You also should let me know the chip and the IDE you are using.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Gaurav,
Do you still use the KL03?
KL03 already have the ROM bootloader, you don't need to use the flash bootloader.
If you still need to use the flash bootloader, and want the application code RAM area won't be influenced, I think you may consider to divide the RAM into two place, take an example, define the application bootloader RAM in the defined area, name that RAM area as one place, then just don't do the initialize for the application RAM area. This the thought, you need to try it on your side.
If you meet any question, just let me know.
You also should let me know the chip and the IDE you are using.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Kerry,
Thanks for your response. I am using the MKL03Z32VFG4 and using Keil MDK for developing with it.
I have been able to solve the issue in similar lines that you have proposed. I am now just making sure that the flash bootloader does not use the RAM area that is used by the application code as a NO_INIT area. Except for the no_init area, I have allowed the flash bootloader and the app to use the (overlapping) RAM area as only one of the two firmwares run at a given time.
Cheers,
Gaurav.