Using KBOOT V2 and MQX

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using KBOOT V2 and MQX

Jump to solution
915 Views
kevinlfw
Contributor III

I'm using MQX 5.0.2 that comes with KSDK 1.3.0 for my already developed user application that targets the MK22FN512VLH12.  I am using IAR EWARM IDE.  It uses the usbd_sdk_mqx_lib.  I'm trying to get it to work with the KBOOT v2 bootloader (USB-HID periph. enabled), however I have been unsuccessful at doing so.  I've tried editing the startup and system files in the mqx_frdmk22f project, KSDK Files group, and adding crt0.s, however that doesn't work.  I've tried a few linker file changes, (trying to place the user application at offset 0xA000) but that didn't help, and I think its due to sections not being named the same name.  For instance, when running the application, MQX_init_struct.START_OF_HEAP = (__RW_END > __ZI_END) ? __RW_END : __ZI_END; ends up setting START_OF_HEAP to 0x0, and trying to manually set it to 0x1fffb860 does no good.

I am hoping that someone can take the hello world MQX example project <KSDK_1.3.0 Install Directory>\rtos\mqx\mqx\examples\hello\build\iar\hello_frdmk22f and make necessary changes to it & the KSDK so that it can be placed at the offset 0xA000 to work with KBOOT V2 and post your solution or/and the description here.

Thank you,

Kevin

1 Solution
612 Views
kevinlfw
Contributor III

Yes, I seem to have got it working.

In my MQX project, I edited the startup_MK22F51212.s file in the mqx_frdm22f project found in the KSDK Files directory.  In this file I commented DefaultISR 240-254 and also removed the DCD 0xFFFFFFFF value reserved for user TRIM value (is that okay?).  In placed of that, I added the BCA area (0x3C0-0x3FF) like it was in the demo project.

Additionally, I changed the linker file (MK22FN512xxx12_flash.icf) to define the following symbols:

define symbol __ram_vector_table_size__ = 0x00000400;
define symbol __ram_vector_table_offset__ = 0x000003FF;

define symbol INTERRUPTS_START = 0x0000A000;
define symbol INTERRUPTS_END = 0x0000A3FF;

define symbol FLASH_CONFIG_START = 0x0000A400;
define symbol FLASH_CONFIG_END = 0x0000A40F;

define symbol TEXT_START = 0x0000A410;
define symbol TEXT_END = 0x0007FFFF;

define symbol RAM_INTERRUPTS_START = 0x1FFF0000;
define symbol RAM_INTERRUPTS_END = 0x1FFF0000 + __ram_vector_table_offset__;

define symbol DATA_START = RAM_INTERRUPTS_START + __ram_vector_table_size__;
define symbol DATA_END = 0x1FFFFFFF;

define symbol DATA_2_START = 0x20000000;
define symbol DATA_2_END = 0x2000FFEF;

View solution in original post

2 Replies
612 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Kevin:

Did you solve this problem?

Regards

Daniel

0 Kudos
Reply
613 Views
kevinlfw
Contributor III

Yes, I seem to have got it working.

In my MQX project, I edited the startup_MK22F51212.s file in the mqx_frdm22f project found in the KSDK Files directory.  In this file I commented DefaultISR 240-254 and also removed the DCD 0xFFFFFFFF value reserved for user TRIM value (is that okay?).  In placed of that, I added the BCA area (0x3C0-0x3FF) like it was in the demo project.

Additionally, I changed the linker file (MK22FN512xxx12_flash.icf) to define the following symbols:

define symbol __ram_vector_table_size__ = 0x00000400;
define symbol __ram_vector_table_offset__ = 0x000003FF;

define symbol INTERRUPTS_START = 0x0000A000;
define symbol INTERRUPTS_END = 0x0000A3FF;

define symbol FLASH_CONFIG_START = 0x0000A400;
define symbol FLASH_CONFIG_END = 0x0000A40F;

define symbol TEXT_START = 0x0000A410;
define symbol TEXT_END = 0x0007FFFF;

define symbol RAM_INTERRUPTS_START = 0x1FFF0000;
define symbol RAM_INTERRUPTS_END = 0x1FFF0000 + __ram_vector_table_offset__;

define symbol DATA_START = RAM_INTERRUPTS_START + __ram_vector_table_size__;
define symbol DATA_END = 0x1FFFFFFF;

define symbol DATA_2_START = 0x20000000;
define symbol DATA_2_END = 0x2000FFEF;