How to Preform an Application Jump in Internal Flash Memory of RT 1064

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Preform an Application Jump in Internal Flash Memory of RT 1064

668 Views
mthimsen
Contributor II

Hi,

I need to preform an application jump from a bootloader application to another application (an LED blink example) somewhere else in the internal flash memory. Both applications are executing in place in internal flash memory. 

Eventually the application will be programmed to the internal flash via the ROM api as a part of the bootloader. For the sake of simplicity this is being done using the MCUXpresso 11.0 GUI Flash tool. 

The bin file of the iled_blinky example is being placed at address location 0x70200000 as follows:

pastedImage_1.png

The bootloader application is the uploaded using the same method at address 0x70000000, and the board is reset. 

The flash memory is erased between attempts.

I am attempting to skip any IVT by jumping to the application entry point of the iled project, which is the ResetISR function. The .map file shows it at address 0x70002308. I am assuming that by giving the GUI flash tool the base address of 0x70200000, this then becomes  0x70202308. Is that correct?

The code am using to preform the jump is as follows:

__attribute__((always_inline)) static inline void JumpApplication(uint32_t topOfMainStack, uint32_t AppliAddr){
   asm volatile ("mov r13, %0" : : "r" (topOfMainStack) : );
   asm volatile ("mov r15, %0" : : "r" (AppliAddr) : );
   }  

DisableGlobalIRQ();
SCB_DisableDCache();
SCB_DisableICache();

JumpApplication(*(uint32_t*)0x70202304, *(uint32_t*)0x70202308);

Attempting the jump just results in a hardfault.

Both projects are attached.

There are multiple threads on this issue but most of them are inconclusive. If we can figure this one out I will upload both projects so they can be used as examples.

Thanks

Labels (1)
Tags (1)
2 Replies

265 Views
Takashi_Kashiwagi
Senior Contributor I

Hi Matt.

I checked "evkmimxrt1064_application_jump.map" and "evkmimxrt1064_iled_blinky.map".

According to these file, the ROM layout of "evkmimxrt1064_iled_blinky" is the same as "evkmimxrt1064_application_jump" (Both .boot_hdr section is located 0x70000000).

Please review the ld file.  (I think that evkmimxrt1064_iled_blinky is allocated from 0x70200000.)

After reviewing it, change

JumpApplication (* (uint32_t *) 0x70202304, * (uint32_t *) 0x70202308);

to

JumpApplication (* (uint32_t *) 0x70202000, * (uint32_t *) 0x70202004);

Also, Please check that the PC and SP are the intended values immediately after the jump.

Best Regards,

T.Kashiwagi

265 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi Matt Thimsen,

Thank you for your interest in NXP Semiconductor products and
the opportunity to serve you.
To provide the fastest possible support, I'd highly recommend you to follow the application note to implement it.

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos