Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21605 Discussions

using assembly macro in inline assembly in C

Altera_Forum
Honored Contributor II
1,521 Views

Hi all, 

 

I want to use inline assembly in my code. 

I understand that the syntax should be: 

 

asm("<instruct1>; 

<instruct2>; 

<instruct3>; 

.... 

;"); 

 

My problem is that many NIOS II instructions are defines as pseudo-instructions (for instance movi, movia...) and also use assembler macros (for instance %lo, %hi....) and I don't know how to use them with the asm("") function. In other words: 

asm("movia r2,1; 

movia r3,2;"); 

won't work because the GCC compiler will not recognize the pseudo-instruction movia defined in the file: nios_macros.s. 

 

If I try to include the file "nios_macros" writing: .include "nios_macros.s" in the c file, it does not work. 

 

What should I do? 

 

Thank you in advance, 

Mike
0 Kudos
0 Replies
Reply