AnsweredAssumed Answered

MPC5604B program interrupt being generated for stw

Question asked by Pradeep M C on Jun 24, 2018
Latest reply on Jun 30, 2018 by Pradeep M C


I was trying to add some assembly code in my project.
I am using the following Codewarrior 10.7 evaluation edition.
Target MCU is MPC5604B.
The following default settings are ON for the project:
c/c++ build -> settings -> PowerPC CPU -> Processor is set to ZEN (I cant find e200z0h core)
c/c++ build -> settings -> PowerPC CPU -> Compress for PowerPC VLE (zen)
c/c++ build -> settings -> PowerPC Compiler -> Processor -> Translate PPC ASM to VLE ASM (ZEN)


I have created a normal c project. And I have one assembly source file within the project.


When the below code is executed, a Program interrupt is hit (IVOR6).
Snippet of code in the source file.

# Saves context to task stack
.macro portSAVE_CONTEXT
    stw         r1,-0x98 (r1)       # store backchain    ----> code causing the interrupt
    addi      r1,r1, 0x98         # allocate stack
    stw     r0,  0x24 (r1)


.align 4


The disassembled code for the above pointed instruction is below. Though I am not quite sure how it is translated by Codewarrior.
267           portSAVE_CONTEXT
40001418:   se_stb r2,0(rsp)
4000141a:   dc.w 0xff68        -----> the actual instruction that is causing the interrupt.
4000141c:   e_lha rsp,152(rsp)
40001420:   se_stb r0,0(rsp)


I couldn't find the what the instruction "dc.w" means.
The following are the register when the interrupt was generated.


SRR0: 0x4000141a
ESR: 0x08000020  --- PIL = 1; VLEMI = 1


 Can somebody help me with the reason for the interrupt being generated?



Pradeep M C