Having trouble accessing C variable from asm section

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Having trouble accessing C variable from asm section

424 Views
gonzaloalcaraz
Contributor I

Hey. I'm implementing a simple fifo in a project of mine, and am getting both a "C18125 Invalid opcode or ':' expected" and a "C18000 Label not set" errors on third line of the following section of code:

 

unsigned char SaveCCR; //preserve CCR
asm tpa
asm staa SaveCCR
asm sei // make atomic by disabling interrupts

 

Tried adding the ':' at the front of the variable name, but I just get another error and I have no idea what Im doing. Other asm instructions work fine, it seems the syntax is incorrect for accessing variables. I couldn't find why this syntax is wrong anywhere. 

 

Any help is very appreciated!

Labels (1)
0 Kudos
1 Reply

317 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Gonzalo,

I ever made a small sample code to you. see attached “mix_C_Assembly_HCS12X”

 

XDEF specifies labels defined in the current module but can be referenced by other modules.

XREF specifies symbols referenced in the current module but defined in another module

variable "my_C_variable" is accessed by assembly code in this demo.


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos