Code Warrior Not Recognising CPU Registers in ISR

cancel
Showing results for 
Search instead for 
Did you mean: 

Code Warrior Not Recognising CPU Registers in ISR

215 Views
benjames
Contributor I

I am developing a HAL for a university project on the Kinetis K70 tower modue.

I am using Codewarrior 10.4 and have written the following ISR for the supervisor call to set the code to privelliged mode..

void isrSVCint(void)

{

    uint32_t control;

    uint32_t * controlPtr;

    control = 0x00000000;

    controlPtr = &control;

    asm("LDR R1,[controlPtr,0]");

    asm("MSR CONTROL, R1");

}

The second ASM line is throwing an "unknown identifier: R1" error.

The previous line accept R1 without issue, so I am wondering what is occuring here...

I think I have probably missed something fairly basic here, Please advise...

Ben

Labels (1)
0 Kudos
1 Reply

107 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Ben James,

I think there is some asm syntax issue in your code, please kindly use the following code instead.

uint32_t control;

int main(void)

{

    int counter = 0;

  

    control = 0x00000000;  

      

      

    asm("LDR R7,=control\n\t");

    asm("MSR CONTROL, R7");

  

  

  

    for(;;) {    

          counter++;

    }

  

    return 0;

}

Hope that helps,


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos