Sharing Labels between C and Assembler

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

Sharing Labels between C and Assembler

1,135 Views
SebaS
Contributor III
Hello Everybody!!

I'm here again because I'm improving some code donde before and I'm trying to make it easy to read, I'm trying to make it more "friendly"....
My question is: Is there any way to use the same labels (macro declarations) in C and Assembler?

What I was doing before was:

in ASM:
    pin_1      equ     $04
    port_!     equ     PORTA

in C:
    #define     PIN_1           $04
    #define     PORT_1      PORTA

So I was refering to the same pin both in C and ASM, and to distinguish C from ASM I use UPPER CASE for C and lower case for ASM....

I hope you could help me with that....

So I can define in C:
    #define     pin_1           $04
    #define     port_1          PORTA

and use it in ASM like:
    BSET   port_1,pin_1


THANKS!!!!!


Labels (1)
0 Kudos
1 Reply

284 Views
CompilerGuru
NXP Employee
NXP Employee
The compiler supports to generate assembly include files with the content of a C header file, check in the compiler heade file the chapter
Generating Assembler Include Files
(-La compiler option)

Daniel
0 Kudos