I am working on bootloader software for S32K116 device. When trying debugging program does not start correctly, only when I single step through init routine (init flex ram) write init data to flex ram will be successful and program run correctly. I thought may be stack size problem, I have no idea what is the issue. Any help?
Program received signal SIGINT, Interrupt.
Reset_Handler () at ../Project_Settings/Startup_Code/startup_S32K116.S:138
138 subs r2, 4
this is the failure I become during ECC RAM init
thank you for the reply I have tried to add the fault exeption from the example you provided but the s32K116 support only the hardfault interrupt, is there any example for trap handling for s32k116 device? (MemManage_Handler, BusFault_Handler and UsageFault_Handler are not available in the s32k116 device)
Hello @Hb2023,
Hard to say, it could be because while you are programming the PFlash or the EEPROM (DFlash), a collision on the Flash block occurs.
Do you see FSAT[RDCOLERR] set?
Do you see a fault exception? If so, can you provide more details about it, like the type of the exception, possibly the fault instruction or bus fault location?
https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447
Regards,
Daniel
@danielmartynekI found out that with optimization set to zero, program is able to run without problems, but when activating the optimization program gets fail at NVM init flash partition. I can attach list files with optimization set to zero and with optimazation set to one if this could be helpful.
@danielmartynekwith optimization enabled the program get failed when excuting the flash command for flash partition added the debug log. Do you have any idea what is going wrong. I need urgent help.
Does it fail after the CCIF is cleared by the SW to launch the Program partition command?
If so, please make sure that the function is in SRAM and that interrupts are masked globally.
@danielmartynekis there a way to disable optimization for one siongle function s32DS GCC compiler?
Hello @Hb2023,
You can define a function with this attribute:
__attribute__((optimize("-O0")))
Or you can move the function to another .c file and set a different optimization level for it.
In S32DS IDE, right-click on a .c file, go to properties:
If the issue is caused by the optimization, I would recommend comparing the two compiled ASM codes.
Regards,
Daniel
@danielmartynekif I single step through the flash execute command function it does not fail, it fails only when I let debug run without single step, it seems to be optimization problem. Now I kept optimization enabled for complete project and disable optimization only for flash driver module where flash execute command function is defined (seems to work ok, but still have trouble why it does not work with optimization enabled).
Yes the execute command function is copied into ram with start ram declaration and end ram declaration, and global interrupt is disabled before clearing the CCIF command per SW.
@danielmartynekNo I am not using NXP driver code, its our own written code originally for ARMCC compiler (IAR IDE) now switching to GCC compiler/S32DS studio raises some problems