Reset opcode?

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

Reset opcode?

Jump to solution
3,462 Views
jean-christoph7
Contributor III

Hello,

 

I have to implement a mechanism in my software to reset MPC5604B when my program goes in an unused memory area.

 

Actually I've padded whole my unused flash with the following pattern: 0xDEAD.

 

With this solution, when the program goes in a section padded with this pattern, the program stop and my watchdog reset the MPC5604B.

 

My question is: Is an opcode exist to reset directly the microcontroller? or an opcode jump to the begin of my application?

 

I wish to pad directly with an opcode which permit to reset directly the MPC and don't wait the reset with my watchdog.

 

I sought in the BOOK_EUM.pdf of the PowerPc architecture to know if an opcode permit to reset the MPC, but I didn't find it.

 

Does this opcode exist?

 

Thanks for your support.

Labels (1)
0 Kudos
Reply
1 Solution
2,971 Views
jean-christoph7
Contributor III

Ok, thanks for your support.

View solution in original post

0 Kudos
Reply
8 Replies
2,971 Views
jean-christoph7
Contributor III

In fact I've padded my flash with a linker command in the *.lcf file. With this method, the *.bin file is padded in the unused memory. But in debug, I use *.elf file and when I see the unused memory area, it is not padded. In debug, I don't know how I can pad the unused memory. If you have a method for the debug, I'm very interested.

Best regards.

0 Kudos
Reply
2,971 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Which IDE do you use?

Lukas

0 Kudos
Reply
2,971 Views
jean-christoph7
Contributor III

I'm using CodeWarrior for MCU 10.6.

0 Kudos
Reply
2,973 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

I got information from CodeWarrior guys that it is known limitation. Elf file does not include padded data. It's present only in s-record file or in binary file. For test purposes (for test of IVOR handler) you can simply create a constant in flash which will contain required invalid opcode. Then just jump to this address and test your exception handler.

Regards,

Lukas

0 Kudos
Reply
2,972 Views
jean-christoph7
Contributor III

Ok, thanks for your support.

0 Kudos
Reply
2,973 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

there’s no instruction that would reset the device directly. You can use se_illegal instruction to trigger program interrupt IVOR6 and then reset the device in exception handler.

Notice that if you use se_illegal instruction (opcode 0x0000) then it depends if the device is running in debug mode or in standalone mode:

- in debug mode, se_illegal works like software breakpoint. IVOR6 is not triggered. If you just step the code, it works like nop instruction. If you run the code and the program reaches se_illegal instruction, the device will stop execution and it will enter debug mode.

- if the device is running in standalone without debugger, se_illegal will trigger IVOR6 exception.

If you want to test IVOR6 exception in debug mode, use another invalid opcode. For example, 0x0003 is not assigned to any VLE instruction.

Mode Entry module can be used to reset the device. Use the code below in IVOR6 exception handler:

/* software reset */   

ME.MCTL.R = 0x00005AF0;

ME.MCTL.R = 0x0000A50F;

Regards,

Lukas

0 Kudos
Reply
2,973 Views
jean-christoph7
Contributor III

You say to test in debug mode, I can use 0x0003 instruction.

But how can I fill unused flash memory in debug mode?

I didn't find a solution in debug mode.

Thanks.

0 Kudos
Reply
2,973 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

You wrote:

"Actually I've padded whole my unused flash with the following pattern: 0xDEAD."

Just do the same and use 0x0003 opcode.

0xDEAD is recognized as se_stw instruction. 0x0003 is not valid opcode, so it will trigger IVOR6. Simple test:

pastedImage_0.png

Lukas

0 Kudos
Reply