Hello,
But when we debug the sample code, after flashing, the PC goes to random RAM locations and not to the main function
Ok, seems to me weird. The core will execute the instruction loaded in it. Not some random ones.
There must be executed in your SW some branch (jump) to that RAM location. And the RAM location must be defined in your core registers, to perform branch.
If you do step by step debug, you will see exactly where the branch to RAM is happening, and also its preconditions.
But PC does not halt at the main and goes to random RAM locations and halts there. I tried with another example code for S32k311 and it gave the same output.
Yes, if the main is not reached, it wont halt at main breakpoint.
Since the another example gives you the same result, it could be some jumper settings on the board if you use our EVB.
We supply the EVBs with getting started guide, where all necessary HW settings are described.
But debugging of startup will simply tell you where the issue lie.
Best regards,
Peter