2414573_en-US

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

2414573_en-US

2414573_en-US

S32K311 bootloader porting

I am currently porting a working Bootloader project from the S32K312 to the S32K311. I am using S32 Design Studio along with NXP RTD 4.9.0 and the GCC compiler. I am encountering two severe issues related to the Vector Table and Reset Handler that seem specific to the S32K311 / RTD 4.9 environment.

Issue 1: Immediate UsageFault on Debugger Reset When launching the PEMicro debugger, the core crashes immediately during the reset script before ever reaching main().

Reset script (...) completed.
UsageFault: An instruction executed with an invalid EPSR.T or EPSR.IT field.
HardFault: A fault has been escalated to a hard fault.


We checked startup_cm7.s and Vector_Table.s. We noticed that Reset_Handler was missing the .type Reset_Handler, %function directive, causing the ELF entry point to be an even address (e.g., 0x00402420 instead of 0x00402421), which naturally causes an ARM-mode UsageFault on the Cortex-M7.

Even after fixing the .type directive and ensuring the Vector Table has the LSB set for Thumb mode, the PEMicro debugger still occasionally throws this UsageFault immediately upon reset.

Issue 2: Interrupts jump to 0x0 (Uninitialized RAM Vector Table) When we successfully bypass the reset issue and reach main(), the system crashes the moment a hardware interrupt (like FlexCAN or SWT) triggers. The PC jumps to 0x00000000.

Upon investigating memory, we found that the RAM vector table at __interrupts_ram_start (0x20000000) is completely uninitialized (filled with zeroes). We discovered that:

startup_cm7.s sets VTOR to __RAM_INTERRUPT_START at the end of initialization but never copies the table from ROM.
IntCtrl_Ip_Init(&IntCtrlConfig_0) (generated by the Platform component) sets VTOR if INT_CTRL_IP_ENABLE_VTOR_CONFIG is enabled, but it also does not copy the default vector table from flash to RAM.
To work around this, we had to write a manual for-loop in main.c to physically copy the vector table from __interrupts_init_start to __interrupts_ram_start and update S32_SCB->VTOR before calling IntCtrl_Ip_InstallHandler().

got the base code from Unified bootloader Demo

does anyone know a post where the bootloader for S32K311 with CAN was ported and posted??


Re: S32K311 bootloader porting

Hi @ujwal12 

For the Cortex-M7, the Reset Handler entry in the vector table must indicate Thumb mode by using an address with the LSB set. If the Reset_Handler symbol is not generated correctly as a function symbol, the linker may place an even address in the vector table, which can lead to a UsageFault during startup. For this reason, we generally do not recommend modifying startup_cm7.s or Vector_Table.s.

By design, the S32K3 RTD uses a RAM-based relocatable interrupt vector table. During startup, the vector table is copied from Flash to RAM, and VTOR is updated to point to the RAM-based table.

Regarding the availability of an S32K311 bootloader example, there is currently no official bootloader example specifically targeting the S32K311. The closest references available are the Example S32K312 Bootloader to Application Jump DS3.5 RTD300 and the Unified Bootloader Demo that you are already using. 

Also, please note that the Unified Bootloader is an unofficial NXP demo that has only been published on the community forum, and therefore it is not supported by NXP technical support.


BR, VaneB

タグ(1)
評価なし
バージョン履歴
最終更新日:
土曜日
更新者: