Forum Discussion
Altera_Forum
Honored Contributor
21 years agodirect programming Nios II
Can I use some low-level programming language (assembler) to programm NIOS II? I need to integrate NIOS II deeply in my system and I need only core functionality of NIOS II, so I want to have a fu...
Altera_Forum
Honored Contributor
21 years agoIf all you want to do is run a few lines of assembler, then it would be easiest to use the compiler's asm statement. This is described in the gcc documentation that comes with the kit. You can also find examples of this within the HAL.
If you really want to write the entire function in assembler, then you will need to ensure that the function adheres to the processors "application binary interface". This is described in the appendix of the Nios II Processor Reference Handbook, which is also supplied with the kit. To make the call from C++ rather than C you should declare the function as "extern C", e.g.:extern "c"
{
extern void my_asm_func (void);
} That way you don't have to worry about the effects of the C++ mangler.