Shilin Yu wrote: > I have tried by it doesn't work either. Yes, I was wrong about the underscore, sorry.
> I seems like that WinAVR uses the GNU Assembler(GAS), not the AVR Assembler Sorry, I don't know what you mean. Can you share the actual command lines you're using to compile and assemble the files? My new guess is that when you are assembling the file, avr-gcc is also trying to link. One quick test I tried was to make two files, a.c: volatile unsigned char sched_mode; int main(void) { return 0; } and b.S: .extern sched_mode LDS R18, sched_mode and then I compiled them separately and then linked them like so: $ avr-gcc -mmcu=atmega128 -c a.c $ avr-gcc -mmcu=atmega128 -c b.S $ avr-gcc -mmcu=atmega128 -o a.out a.o b.o $ ls -l a.out -rwxr-xr-x 1 dean None 2674 Sep 5 00:59 a.out* Can you try something along those lines? On the other hand, without the -c, the second command will generate an error, something like: $ avr-gcc -mmcu=atmega128 b.S .../crtm128.o:(.init9+0x0): undefined reference to `main' .../ccJeooXf.o:(.text+0x2): undefined reference to `sched_mode' Dean > > 2008/9/5 Dean Ferreyra <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> > > Try using _sched_mode in your assembly code instead. If I remember > correctly, the C compiler automatically prefixes symbols with an > underscore. > > Dean > > Shilin Yu wrote: > > I met an link error when build a project with .c and .S files > > > > the c file like this: > > ... > > volatile unsigned char sched_mode; > > ... > > > > > > the assembly file like this: > > .extern sched_mode > > ... > > LDS R18, sched_mode > > ... > > > > > > when I build the project. the link error about the assembly > file output: > > > > (.text+0x32): undefined reference to `sched_mode' > > > > > > Any reply is welcome! Thanks! > > > > -- > > Sincerely yours, > > Shilin Yu > > > > > > > -- > Sincerely yours, > Shilin Yu _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list