Null pointer deference on MPC5674F

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Null pointer deference on MPC5674F

885 Views
RenatoCorrea
Contributor I

Hi everyone. I'm working on a project using the MPC5674f and can't seem to find a way to generate an exception when a null pointer is deferenced. Is this a possibility? I would be grateful if someone could point me in the right direction

0 Kudos
Reply
1 Reply

855 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @RenatoCorrea 

No, MPC5674F does not provide such functionality. One workaround I can see - NULL pointer is defined as zero. So, an option is to configure MPU to restrict data access or instruction fetch from address 0. In case of access violation (i.e. your code is trying to read/write data or fetch instruction from address 0), machine check exception would be triggered.

Regards,

Lukas