How to change Main stack pointer value

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to change Main stack pointer value

1,591件の閲覧回数
AnwarSheik
Contributor I

Hi,

I recently started working on bootloader for s32k144. I am using s32ds for arm

can some one guide me how to change the MSP value to jump from bootloader to user application 

@JozefKozon @jann_ @guoweisun @TomasVaverka @lukaszadrapa

0 件の賞賛
1 返信

1,580件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@AnwarSheik

you can refer to AN12218 and AN12218SW,

https://www.nxp.com/search?keyword=AN12218&start=0 

and below demo code can be found in AN12218SW

/**
 * Used to jump to the entry point of the user application
 * The Vector table of the user application must be located at 0x1000
 *
 * */
void JumpToUserApplication( unsigned int userSP,  unsigned int userStartup)
{
	/* Check if Entry address is erased and return if erased */
	if(userSP == 0xFFFFFFFF){
		return;
	}

	/* Set up stack pointer */
	__asm("msr msp, r0");
	__asm("msr psp, r0");

	/* Relocate vector table */
	S32_SCB->VTOR = (uint32_t)APP_START_ADDRESS;

	/* Jump to application PC (r1) */
	__asm("mov pc, r1");
}

 

0 件の賞賛