Jump to content
43oh

Recommended Posts

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:

Description Resource Path Location Type
#126 expected a "(" os.c /OperatingSystem line 27 C/C++ Problem
#18 expected a ")" os.c /OperatingSystem line 29 C/C++ Problem

 

I have been unable to really find examples of this syntax in the CCS help files, though the code is supposedly written for CCS.  I am using TI compiler v4.9.5 if that provides any assistance.

 

Thanks for any info you have.  I've done this many times before on other processors, I just haven't been able to find the right manual page with the right details for this part from the materials I have access to.

 

Walt Schilling

 

Note: I've also cross posted this to another TI forum as well.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...