I am implementing a bootloader in S32K344 and encountering some issues after the jump to the application firmware.
1 - I have verified that the jump is occurring correctly, but there are problems during the MCU initialization, its goes to HardFault. However, this does not always happen; often, the jump to the production firmware occurs without any issues. The times when this problem occurs are during the following sections of the MCU initialization:

The peripherals that the bootloader initialize uses are:
MCU, OsIf, Siul2_Port_Ip_Init, IntCtrl_Ip, Gpt, Spi, Sbc_fs26, Wdg_43_fs26, Lpuart_Uart, flash_c40.
The deinit function in bootloader:

How do I perform deinitialization in MCU functions?
Is there any additional step I need to take? Perhaps in the .mex?
2) I use the PTE13 port as an input. I have already used the solution of disabling the LMBCTLEN register, and it worked in the production firmware. However, when the production firmware is initialized by the bootloader, this register remains selected. In other words, the MCU initialization in the bootloader is not redone when I call Mcu_Init / Mcu_InitClock / Mcu_SetMode at production firmware. What do I suposto do?
3) As with question 2, the same issue is occurring with the PTA24 and PTA25 pins. In the production firmware, they have been configured correctly and work normally. However, when initialized by the bootloader, the SOSC source configuration is lost. What do I suposto do?
