NXP LPC54xxx Reboot example

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

NXP LPC54xxx Reboot example

865 Views
OliveiraNxp
Contributor II

Hi,

I have a project with uses Micrcontroller NXP LPC54616J512.

It uses USB HID Host Communication Channel. For this We created a command with allow to load new firmware into Flash. After loaded, I need to move it to RunApplication Area and performs a GoTo Specific address. I´m looking for an Reboot example with I can pass the Image Address passed as parameter.

Like ISP_Mode >> GO command.

I´m looking for a command or function that performs it operation.

Oliveira
Tags (1)
2 Replies

649 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Oliveira,

This function code you need write by yourself, you can refer to LPC546xx UART Sendary bootloader

https://www.nxp.com.cn/docs/en/application-note/AN12384.pdf 

 

The function is:

void FwBoot_BootToFwImage(uint32_t fwImageBaseAddr)
{
void (*firmwareFunc)(void);
uint32_t fwStackVal = *((uint32_t *)(fwImageBaseAddr)); /* the first word is for the stack
pointer. */
uint32_t fwEntryVal = *((uint32_t *)(fwImageBaseAddr+4U)); /* the second works is for the boot
function. */
firmwareFunc = (void (*)(void))fwEntryVal;

SCB->VTOR = fwImageBaseAddr; /* The stack address is also the start address of vector. */
__set_MSP(fwStackVal); /* setup the stack address for MSP. */
__set_PSP(fwStackVal); /* setpu the stack address for PSP. */
firmwareFunc();
}

 

BR

Alice

0 Kudos

863 Views
OliveiraNxp
Contributor II

on driver file fsl_flashaip.h there are optional commands simmilar to ISP Mode Commands but I Didnt found GoTo specific Address.

enum _flashiap_commands
{
kIapCmd_FLASHIAP_PrepareSectorforWrite = 50U, /*!< Prepare Sector for write */
kIapCmd_FLASHIAP_CopyRamToFlash = 51U, /*!< Copy RAM to flash */
kIapCmd_FLASHIAP_EraseSector = 52U, /*!< Erase Sector */
kIapCmd_FLASHIAP_BlankCheckSector = 53U, /*!< Blank check sector */
kIapCmd_FLASHIAP_ReadPartId = 54U, /*!< Read part id */
kIapCmd_FLASHIAP_Read_BootromVersion = 55U, /*!< Read bootrom version */
kIapCmd_FLASHIAP_Compare = 56U, /*!< Compare */
kIapCmd_FLASHIAP_ReinvokeISP = 57U, /*!< Reinvoke ISP */
kIapCmd_FLASHIAP_ReadUid = 58U, /*!< Read Uid isp */
kIapCmd_FLASHIAP_ErasePage = 59U, /*!< Erase Page */
kIapCmd_FLASHIAP_ReadMisr = 70U, /*!< Read Misr */
kIapCmd_FLASHIAP_ReinvokeI2cSpiISP = 71U /*!< Reinvoke I2C/SPI isp */
};

 

Oliveira
0 Kudos