Bootload doesn't launch application

cancel
Showing results for 
Search instead for 
Did you mean: 

Bootload doesn't launch application

184 Views
MarcoGiammarini
Contributor III

Dear all,

I'm working on bootloader over KL27. I put the bootloader at address 0x0, and the application at 0x4000.

After I write the new application into flash memory, I try to restart the application by pointing to application startup address, but it fail and restart the code from 0 (from the bootloader).

The launch code is the following. Is it correct?

Any ideas?

Thanks

Marco

appStartAddress = APPLICATION_START_ADDRESS;
p_appStartAddress = (uint32_t *) appStartAddress;

// Read the first location of application section
// which contains the address of stack pointer.
// If it is 0xFFFFFFFF then the application section is empty.
if (*p_appStartAddress == 0xFFFFFFFF)
{
    while (1)
    {
                // Wait indefinitely
    }
}

// Start address is valid...
// Pointer to the Application Section
void (*applicationCodeEntry)(void);

// Rebase the Stack Pointer
__set_MSP(*(uint32_t *) APPLICATION_START_ADDRESS);

// Rebase the vector table base address
SCB->VTOR = ((uint32_t) APPLICATION_START_ADDRESS & SCB_VTOR_TBLOFF_Msk);

// Load the Reset Handler address of the application
applicationCodeEntry = (void (*)(void))(unsigned *)(*(unsigned *)(APPLICATION_START_ADDRESS + 4));

// Jump to user Reset Handler in the application
applicationCodeEntry();

 

Labels (1)
Tags (2)
0 Kudos
3 Replies

172 Views
nxf56274
NXP TechSupport
NXP TechSupport

Hi,

You can refer this link. bootloader

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 days 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

165 Views
MarcoGiammarini
Contributor III

Dear @nxf56274 

with the code suggested in the post, the MCU reset immediately with LOCKUP bit high.

What's wrong?

Best,

Marco

0 Kudos

150 Views
nxf56274
NXP TechSupport
NXP TechSupport

Hi,

Please use the led demo as application. And show me how you go to application.

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 days 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