s32k148 bootloader to app can't work interrupt

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

s32k148 bootloader to app can't work interrupt

跳至解决方案
3,707 次查看
jaures168
Contributor II

i use can for bootloader and use expert to generate the can driver.

set boot ld

/* Specify the memory areas */
MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0001fbf0 /*0x0017FB00*/
/*m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0017FB00*/
/*m_flash_app_head (RX) : ORIGIN = 0x0017FF10, LENGTH = 0x000000F0*/

/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFE0000, LENGTH = 0x00020000

/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x0001EFF8

/* Reserved 64K data flash for EEPROM emulator (m_flexram) */
m_flexram (RW) : ORIGIN = 0x14000000, LENGTH = 4K

}

app ld file

m_interrupts (RX) : ORIGIN = 0x00020000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00020400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00020410, LENGTH = 0x0015FB00

 

use JumpToUserApplication();

the go to 0x20000 run app that work passed.

but the interrupt can't work at app side.

the all isr can't work and lock at OSIF_SemaWait();

because the isr SysTick_Handler() not work.

lock_osif.jpglock_osif2.jpg

attached zip file

 

0 项奖励
回复
1 解答
3,699 次查看
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

 

Have you relocated the vector table address before the jump?

S32_SCB->VTOR = (uint32_t)APP_START_ADDRESS;

However, I have found a similar thread where is solved a similar issue:

https://community.nxp.com/t5/S32K/Interrupt-can-t-work-in-application/m-p/674635

 

Best regards,

Diana

在原帖中查看解决方案

0 项奖励
回复
8 回复数
3,700 次查看
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

 

Have you relocated the vector table address before the jump?

S32_SCB->VTOR = (uint32_t)APP_START_ADDRESS;

However, I have found a similar thread where is solved a similar issue:

https://community.nxp.com/t5/S32K/Interrupt-can-t-work-in-application/m-p/674635

 

Best regards,

Diana

0 项奖励
回复
3,681 次查看
jaures168
Contributor II

if i use debug tools go to Reset_Handler() that isr can't work.

it's go to address 0x0000908

resethandler.jpg

0 项奖励
回复
3,693 次查看
jaures168
Contributor II

yes ! INT_SYS_DisableIRQGlobal();
JumpToUserApplication(*((uint32_t*)APP_START_ADDRESS), *((uint32_t*)(APP_START_ADDRESS + 4)));

APP_START_ADDRESS 0x20000

JumpToUserApplication2.jpgJumpToUserApplication.jpg

0 项奖励
回复
3,674 次查看
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

 

I have made some tests with the serial bootloader and application which uses SysTick interrupt.

After adding "S32_SCB->VTOR = (uint32_t)APP_START_ADDRESS ;" into application project the interrupt starts working.

After the jump into the application project the VTOR register is reset, so, the vector table needs to be relocated directly in the application project.

I believe it helps.

Best regards,

Diana

0 项奖励
回复
3,663 次查看
jaures168
Contributor II

which c file add the "S32_SCB->VTOR = (uint32_t)APP_START_ADDRESS ;"?

void init_data_bss(void) of startup.c.

i don't know which file add   "S32_SCB->VTOR = (uint32_t)APP_START_ADDRESS ;" was right.

please tell me.

VECTOR_TABLE.jpg

0 项奖励
回复
3,655 次查看
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

 

I'm sorry, I have used it in main.c.

dianabatrlova_0-1602569229604.png

 

Best regards,

Diana

0 项奖励
回复
3,633 次查看
jaures168
Contributor II

i resolve the app can't  interrupt.

bootloader side :

canflash finishing don't use JumpToUserApplication(...); to app.

because the bootloader i have use isr for can,ptc,time isr. if use JumpToUserApplication() that isr irq may trigger,

than at app the __VECTOR_TABLE incorrect trigger.

1.canflash finishinh so needs use than set flag to ram PAddress=0x55aaaa55;

2.SystemSoftwareReset(); 

3.the bootloader sw reset than check PAddress=0x55aaaa55;

4.go to JumpToUserApplication() 

 

app to bootloader  don't use JumpToUserApplication() 

1.stop all isr,set ram/rom flag 

2.use SystemSoftwareReset();  than go to bootloader  

3.bootloader check the ram/rom flag ;if set goto canflash.

 

i think the was startup_S32K148.s bug .

because the Reset_Handler just disable INT_SYS_DisableIRQGlobal();,but isr trigger true exist at boot or app.

so the boot to app DisableIRQGlobal only disable Global isr ,bit unit isr true work.

to go app the isr trigger at app side,than app relocal __flash_vector_table__ can't correct trigger at app isr.

but detail may nxp can try it.

 

 

 

0 项奖励
回复
3,649 次查看
jaures168
Contributor II

add S32_SCB->VTOR= (uint32_t)0x20000; at main

 

I TRY the interrupt can't work.

please tell me how to debug the Global interrupt address.

the ptc isr can't work.

vtor1.jpg

0 项奖励
回复