My binary images don't occupy the whole flash memory and they come with holes too, so I would like to fill them with some kind of value that makes the mcu reset if executed by accident.
It needs to work with S32K14x family, but if it works with S32K11x is a bonus.
I followed this thread https://community.nxp.com/thread/453969 but now I'm unsure about which value I should use.
I have found the UDF instruction to be a good candidate, but I don't understand the difference between its T1 (16bit) and T2 (32bit) encodings.
is the T1 version (0xDExx) ok for my purposes?
Are there any flaws with this approach?
Thank you very much,
Thanks for the support.
I didn't think about MPU! However I was thinking of filling empty space with some data pattern because I also need to compute a checksum over the image so I thought I could kill two birds with one stone.
I don't think there is a standard for this.
But AN4779 EMC Design Tips for Kinetis E Family, Cortex M0+, recommends the undefined branch instruction that you are considering 0xDExx.
Checking ARM®v7-M Architecture Reference Manual, I see that only Encoding T1 has the UNDEFINED variant of that instruction. I have tried that on S32K144, it seems to be working, it triggers CFSR[UNDEFINSTR].
If you don't use Supervisor Call, I think you can use __asm__("svc #0x00") as well.
And trigger SW reset from that exception instead of the fault exception.