Thursday, July 9, 2009

Compile error with global var declared at asm file and used in C files?

Hi


I am using AVR32 + winXP + microcontroler





trying to rebuild aproject (makefile) so I can learn how to do it right





one of my still open errors is a veriable used in *.c file said it is not decleared first


using search I found that it was decleared in *.asm file





I allrady added to the make file the asm path to the *.asm file but it look like I need to do some thing extra





so how do you decleare a global veriabel whic created in asm file and used in c files at the compiler





regard

Compile error with global var declared at asm file and used in C files?
To do it right (politically correct amongst you peers), you should create a header file that is included in the C file whenever you reference the external values or functions declared in the .asm file.





This included header file (.h file) should contain lines such as





extern int MyArray[ ]


or


extern void MySub()








The keyword is "extern".





That way you can define the proper C interface to the assembly language in the header file so that when you need to access the functions or variable in the future, the interfaces will be documented. I would even document the interfaces with a "man page" type of interface.





such as:


/*


MyAsm.asm





extern int MyIntArray[ 16 ]





void MyFunc();





Reference: .....


Notes: ....


Errors: ....


See Also: .....


Author: ....


Modified: ....


Modified: ....


*/


No comments:

Post a Comment