Code Warrior Not Recognising CPU Registers in ISR

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Code Warrior Not Recognising CPU Registers in ISR

434件の閲覧回数
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 返信

326件の閲覧回数
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 件の賞賛