Code Warrior Not Recognising CPU Registers in ISR

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Code Warrior Not Recognising CPU Registers in ISR

442 次查看
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

标签 (1)
0 项奖励
1 回复

334 次查看
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 项奖励