how to access general purpose register from c source file

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

i want to make some changes in Cm0start.c file.In that i want to write assembly instruction for push and pop program counter and stack pointer  i use asm("push {r15}") but its shows error "invalid register list to push/pop instruction ".how to access general purpose register in c source file?

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The way to write assembly was correct, but the assembly instruction was bad.

   

Excerpt from Cortex M0 Defices Generic User's Guide"

   

Concerning the PUSH instruction

   

Restrictions
In these instructions:
• reglist must use only R0-R7.
• The exception is LR for a PUSH and PC for a POP.

   

 

   

Bob

View solution in original post

0 Likes
1 Reply
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The way to write assembly was correct, but the assembly instruction was bad.

   

Excerpt from Cortex M0 Defices Generic User's Guide"

   

Concerning the PUSH instruction

   

Restrictions
In these instructions:
• reglist must use only R0-R7.
• The exception is LR for a PUSH and PC for a POP.

   

 

   

Bob

0 Likes