sudo apt-get install avrdude gcc-avr avr-libc
main.c
int main ( void )
{
return 7;
}
avr-gcc -Os -mmcu=atmega328p -I/usr/lib/avr/include so.c -o so.elf
avr-objdump -D so.elf
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end>
4: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
8: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
10: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
14: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
18: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
1c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
20: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
24: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
28: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
2c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
30: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
34: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
38: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
3c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
40: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
44: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
48: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
4c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
50: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
54: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
58: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
5c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
60: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
64: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt>
00000068 <__ctors_end>:
68: 11 24 eor r1, r1
6a: 1f be out 0x3f, r1 ; 63
6c: cf ef ldi r28, 0xFF ; 255
6e: d8 e0 ldi r29, 0x08 ; 8
70: de bf out 0x3e, r29 ; 62
72: cd bf out 0x3d, r28 ; 61
74: 0e 94 40 00 call 0x80 ; 0x80 <main>
78: 0c 94 43 00 jmp 0x86 ; 0x86 <_exit>
0000007c <__bad_interrupt>:
7c: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
00000080 <main>:
80: 87 e0 ldi r24, 0x07 ; 7
82: 90 e0 ldi r25, 0x00 ; 0
84: 08 95 ret
00000086 <_exit>:
86: f8 94 cli
00000088 <__stop_program>:
88: ff cf rjmp .-2 ; 0x88 <__stop_program>
rm so.o
rm so.elf
avr-gcc -Os -mmcu=atmega328p -I/usr/lib/avr/include -c so.c
avr-gcc -mmcu=atmega328p so.o -o so.elf
avr-objdump -D so.elf
...
00000080 <main>:
80: 87 e0 ldi r24, 0x07 ; 7
82: 90 e0 ldi r25, 0x00 ; 0
84: 08 95 ret
...
No, I am not on a Raspberry Pi, but that shouldn't matter; it's a cross compiler either way. You didn't specify the output file when you broke the compile and link up, which I can appreciate separate linking, especially if you use the linker. But don't always assume the output filename. Sometimes you get a.out instead of whatever.o or whatever.obj.
You can disassemble the object as well
avr-objdump -D so.o
so.o: file format elf32-avr
Disassembly of section .text.startup:
00000000 <main>:
0: 87 e0 ldi r24, 0x07 ; 7
2: 90 e0 ldi r25, 0x00 ; 0
4: 08 95 ret
and confirm the symbol is in there.
Not finding main generally means means that you didn't provide an input that has that symbol. Your question didn't specify the object file filename in the compile but then linked with a specific file name, nor did you show you confirmed the file name was there and had the symbol or even resembles compiled output for that source.
You indicated Atmel Studio on your laptop, did you try command line tools on your laptop before attempting it elsewhere? If your laptop is not running Linux there are countless live usb or dvd bootable ones that don't require any installation on your computer, you can perform the steps you are doing on Linux on the Pi and see if this is a Pi specific Linux thing or a generic problem.