Search the Community
Showing results for tags 'inline assembly'.
-
I am writing a simple task scheduler for my MSP430F5529 USB launchpad. I need to update stack pointer(SP), then enable interrupts and then update program counter (PC). But I am getting an error with my inline asmebly code. void start_scheduler(void) { asm volatile("mov.w task1stack, SP \n" "EINT \n" "mov.w func1, PC \n" ); } - task1stack is the stack area for the task execution. It is an array. - func1 is a function - instead of uppercase for 'SP' and 'PC', I tried lowercase also. But the error was present. But wit
-
Good morning. I am trying to work on a small project for the Stellaris LM4F120 board, and as part of the project, I have a need to read the stack variable. (I'm constructing a small context switcher for demonstration purposes.) I obtained a segment of code from the web as follows: static inline void * rd_stack_ptr(void){ void * result=NULL; asm volatile ("MRS %0, msp\n\t" "MOV r0, %0 \n\t" : "=r" (result) ); return result; } Essentially, what the code is supposed to do is copy the stack pointer into the c variable "result" and return it. However, I am getting errors as follows: