“I referred to NXP’s Flash partition sample code and wrote the following code. When executed on S32K146, it works normally and can perform partitioning. However, when debugging on S32K142, the program stops at the execution of [ MSCM->OCMDR[0u] |= MSCM_OCMDR_OCM1(0x3u); ]. After clicking break and then go, it continues to execute without crashing. When not debugging, the program also stops here. I would like to ask why this is happening?”
Could you please to modified the highlight part to S32K142 and then try again.
I could not find any more porblem from the picture you provided, so if this still can't work normally, you may need to test the demo code in IDE:flash_partitioning_s32k142
Hi@Senlent
I apologize for submitting a picture of another project. In fact, what I wrote here is [#ifdef S32K142_SERIES]. My code was written with reference to [IDE:flash_partitioning_s32k142], but I just omitted the step of erasing ALL Blocks.
My confusion is why the code stops at the position of modifying the register.
I don't find any problems from the pictures you provided. I would like to ask if your S32K142 has been partitioned before. If it has been partitioned, please erase the partition first and try again.
If you still have problems, I need you to provide sample project code and I will check it for you
I have tried according to your method, but when using IAR Debug, a new problem occurred. The code is stuck at the position where the OCMDR register is written. Clicking Break prompts that the CPU did not stop.
I can't run the IAR project. You can test the routine on S32 DS so that I can easily reproduce your problem.
You can check the x.map file to see if the function is correctly mapped into RAM