Skip to content

Instantly share code, notes, and snippets.

@Scrappers-glitch
Created April 24, 2023 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Scrappers-glitch/a4e77adf1f316e029d120b32e6db7b9e to your computer and use it in GitHub Desktop.
Save Scrappers-glitch/a4e77adf1f316e029d120b32e6db7b9e to your computer and use it in GitHub Desktop.
Disassemble code
└──╼ $./avr-objdump -S '/home/twisted/GradleProjects/ShiftAvr/shiftavr-examples/build/atmega328p/hello_gpio_write.c.elf'
/home/twisted/GradleProjects/ShiftAvr/shiftavr-examples/build/atmega328p/hello_gpio_write.c.elf: file format elf32-avr
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end>
4: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
8: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
c: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
10: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
14: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
18: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
1c: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
20: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
24: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
28: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
2c: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
30: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
34: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
38: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
3c: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
40: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
44: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
48: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
4c: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
50: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
54: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
58: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
5c: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
60: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
64: 0c 94 46 00 jmp 0x8c ; 0x8c <__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
00000074 <__do_clear_bss>:
74: 21 e0 ldi r18, 0x01 ; 1
76: a0 e0 ldi r26, 0x00 ; 0
78: b1 e0 ldi r27, 0x01 ; 1
7a: 01 c0 rjmp .+2 ; 0x7e <.do_clear_bss_start>
0000007c <.do_clear_bss_loop>:
7c: 1d 92 st X+, r1
0000007e <.do_clear_bss_start>:
7e: a2 31 cpi r26, 0x12 ; 18
80: b2 07 cpc r27, r18
82: e1 f7 brne .-8 ; 0x7c <.do_clear_bss_loop>
84: 0e 94 e2 00 call 0x1c4 ; 0x1c4 <main>
88: 0c 94 17 01 jmp 0x22e ; 0x22e <_exit>
0000008c <__bad_interrupt>:
8c: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
00000090 <gpio_write>:
90: 0f 93 push r16
92: cf 93 push r28
94: df 93 push r29
96: cd b7 in r28, 0x3d ; 61
98: de b7 in r29, 0x3e ; 62
9a: 2a 97 sbiw r28, 0x0a ; 10
9c: 0f b6 in r0, 0x3f ; 63
9e: f8 94 cli
a0: de bf out 0x3e, r29 ; 62
a2: 0f be out 0x3f, r0 ; 63
a4: cd bf out 0x3d, r28 ; 61
a6: 4b 83 std Y+3, r20 ; 0x03
a8: 5c 83 std Y+4, r21 ; 0x04
aa: 6d 83 std Y+5, r22 ; 0x05
ac: 7e 83 std Y+6, r23 ; 0x06
ae: 8f 83 std Y+7, r24 ; 0x07
b0: 98 87 std Y+8, r25 ; 0x08
b2: 29 87 std Y+9, r18 ; 0x09
b4: 0a 87 std Y+10, r16 ; 0x0a
b6: 8d 81 ldd r24, Y+5 ; 0x05
b8: 9e 81 ldd r25, Y+6 ; 0x06
ba: fc 01 movw r30, r24
bc: 80 81 ld r24, Z
be: 48 2f mov r20, r24
c0: 89 85 ldd r24, Y+9 ; 0x09
c2: 28 2f mov r18, r24
c4: 30 e0 ldi r19, 0x00 ; 0
c6: 81 e0 ldi r24, 0x01 ; 1
c8: 90 e0 ldi r25, 0x00 ; 0
ca: 02 c0 rjmp .+4 ; 0xd0 <gpio_write+0x40>
cc: 88 0f add r24, r24
ce: 99 1f adc r25, r25
d0: 2a 95 dec r18
d2: e2 f7 brpl .-8 ; 0xcc <gpio_write+0x3c>
d4: 24 2f mov r18, r20
d6: 28 2b or r18, r24
d8: 8d 81 ldd r24, Y+5 ; 0x05
da: 9e 81 ldd r25, Y+6 ; 0x06
dc: fc 01 movw r30, r24
de: 20 83 st Z, r18
e0: 8b 81 ldd r24, Y+3 ; 0x03
e2: 9c 81 ldd r25, Y+4 ; 0x04
e4: fc 01 movw r30, r24
e6: 80 81 ld r24, Z
e8: 48 2f mov r20, r24
ea: 89 85 ldd r24, Y+9 ; 0x09
ec: 28 2f mov r18, r24
ee: 30 e0 ldi r19, 0x00 ; 0
f0: 81 e0 ldi r24, 0x01 ; 1
f2: 90 e0 ldi r25, 0x00 ; 0
f4: 02 c0 rjmp .+4 ; 0xfa <gpio_write+0x6a>
f6: 88 0f add r24, r24
f8: 99 1f adc r25, r25
fa: 2a 95 dec r18
fc: e2 f7 brpl .-8 ; 0xf6 <gpio_write+0x66>
fe: 80 95 com r24
100: 84 23 and r24, r20
102: 89 83 std Y+1, r24 ; 0x01
104: 81 e0 ldi r24, 0x01 ; 1
106: 9a 85 ldd r25, Y+10 ; 0x0a
108: 99 23 and r25, r25
10a: 09 f4 brne .+2 ; 0x10e <gpio_write+0x7e>
10c: 80 e0 ldi r24, 0x00 ; 0
10e: 88 2f mov r24, r24
110: 90 e0 ldi r25, 0x00 ; 0
112: 29 85 ldd r18, Y+9 ; 0x09
114: 22 2f mov r18, r18
116: 30 e0 ldi r19, 0x00 ; 0
118: 02 c0 rjmp .+4 ; 0x11e <gpio_write+0x8e>
11a: 88 0f add r24, r24
11c: 99 1f adc r25, r25
11e: 2a 95 dec r18
120: e2 f7 brpl .-8 ; 0x11a <gpio_write+0x8a>
122: 8a 83 std Y+2, r24 ; 0x02
124: 39 81 ldd r19, Y+1 ; 0x01
126: 2a 81 ldd r18, Y+2 ; 0x02
128: 8b 81 ldd r24, Y+3 ; 0x03
12a: 9c 81 ldd r25, Y+4 ; 0x04
12c: 23 2b or r18, r19
12e: fc 01 movw r30, r24
130: 20 83 st Z, r18
132: 00 00 nop
134: 2a 96 adiw r28, 0x0a ; 10
136: 0f b6 in r0, 0x3f ; 63
138: f8 94 cli
13a: de bf out 0x3e, r29 ; 62
13c: 0f be out 0x3f, r0 ; 63
13e: cd bf out 0x3d, r28 ; 61
140: df 91 pop r29
142: cf 91 pop r28
144: 0f 91 pop r16
146: 08 95 ret
00000148 <gpio_initialize_ports>:
148: cf 93 push r28
14a: df 93 push r29
14c: cd b7 in r28, 0x3d ; 61
14e: de b7 in r29, 0x3e ; 62
150: 85 e2 ldi r24, 0x25 ; 37
152: 90 e0 ldi r25, 0x00 ; 0
154: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1>
158: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <__DATA_REGION_ORIGIN__>
15c: 84 e2 ldi r24, 0x24 ; 36
15e: 90 e0 ldi r25, 0x00 ; 0
160: 90 93 03 01 sts 0x0103, r25 ; 0x800103 <__DATA_REGION_ORIGIN__+0x3>
164: 80 93 02 01 sts 0x0102, r24 ; 0x800102 <__DATA_REGION_ORIGIN__+0x2>
168: 83 e2 ldi r24, 0x23 ; 35
16a: 90 e0 ldi r25, 0x00 ; 0
16c: 90 93 05 01 sts 0x0105, r25 ; 0x800105 <__DATA_REGION_ORIGIN__+0x5>
170: 80 93 04 01 sts 0x0104, r24 ; 0x800104 <__DATA_REGION_ORIGIN__+0x4>
174: 88 e2 ldi r24, 0x28 ; 40
176: 90 e0 ldi r25, 0x00 ; 0
178: 90 93 0d 01 sts 0x010D, r25 ; 0x80010d <GPIO_PORTC+0x1>
17c: 80 93 0c 01 sts 0x010C, r24 ; 0x80010c <GPIO_PORTC>
180: 87 e2 ldi r24, 0x27 ; 39
182: 90 e0 ldi r25, 0x00 ; 0
184: 90 93 0f 01 sts 0x010F, r25 ; 0x80010f <GPIO_PORTC+0x3>
188: 80 93 0e 01 sts 0x010E, r24 ; 0x80010e <GPIO_PORTC+0x2>
18c: 86 e2 ldi r24, 0x26 ; 38
18e: 90 e0 ldi r25, 0x00 ; 0
190: 90 93 11 01 sts 0x0111, r25 ; 0x800111 <GPIO_PORTC+0x5>
194: 80 93 10 01 sts 0x0110, r24 ; 0x800110 <GPIO_PORTC+0x4>
198: 8b e2 ldi r24, 0x2B ; 43
19a: 90 e0 ldi r25, 0x00 ; 0
19c: 90 93 07 01 sts 0x0107, r25 ; 0x800107 <GPIO_PORTD+0x1>
1a0: 80 93 06 01 sts 0x0106, r24 ; 0x800106 <GPIO_PORTD>
1a4: 8a e2 ldi r24, 0x2A ; 42
1a6: 90 e0 ldi r25, 0x00 ; 0
1a8: 90 93 09 01 sts 0x0109, r25 ; 0x800109 <GPIO_PORTD+0x3>
1ac: 80 93 08 01 sts 0x0108, r24 ; 0x800108 <GPIO_PORTD+0x2>
1b0: 89 e2 ldi r24, 0x29 ; 41
1b2: 90 e0 ldi r25, 0x00 ; 0
1b4: 90 93 0b 01 sts 0x010B, r25 ; 0x80010b <GPIO_PORTD+0x5>
1b8: 80 93 0a 01 sts 0x010A, r24 ; 0x80010a <GPIO_PORTD+0x4>
1bc: 00 00 nop
1be: df 91 pop r29
1c0: cf 91 pop r28
1c2: 08 95 ret
000001c4 <main>:
1c4: 0e 94 a4 00 call 0x148 ; 0x148 <gpio_initialize_ports>
1c8: 01 e0 ldi r16, 0x01 ; 1
1ca: 25 e0 ldi r18, 0x05 ; 5
1cc: 40 91 00 01 lds r20, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__>
1d0: 50 91 01 01 lds r21, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1>
1d4: 60 91 02 01 lds r22, 0x0102 ; 0x800102 <__DATA_REGION_ORIGIN__+0x2>
1d8: 70 91 03 01 lds r23, 0x0103 ; 0x800103 <__DATA_REGION_ORIGIN__+0x3>
1dc: 80 91 04 01 lds r24, 0x0104 ; 0x800104 <__DATA_REGION_ORIGIN__+0x4>
1e0: 90 91 05 01 lds r25, 0x0105 ; 0x800105 <__DATA_REGION_ORIGIN__+0x5>
1e4: 0e 94 48 00 call 0x90 ; 0x90 <gpio_write>
1e8: 2f ef ldi r18, 0xFF ; 255
1ea: 89 e6 ldi r24, 0x69 ; 105
1ec: 98 e1 ldi r25, 0x18 ; 24
1ee: 21 50 subi r18, 0x01 ; 1
1f0: 80 40 sbci r24, 0x00 ; 0
1f2: 90 40 sbci r25, 0x00 ; 0
1f4: e1 f7 brne .-8 ; 0x1ee <main+0x2a>
1f6: 00 c0 rjmp .+0 ; 0x1f8 <main+0x34>
1f8: 00 00 nop
1fa: 00 e0 ldi r16, 0x00 ; 0
1fc: 25 e0 ldi r18, 0x05 ; 5
1fe: 40 91 00 01 lds r20, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__>
202: 50 91 01 01 lds r21, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1>
206: 60 91 02 01 lds r22, 0x0102 ; 0x800102 <__DATA_REGION_ORIGIN__+0x2>
20a: 70 91 03 01 lds r23, 0x0103 ; 0x800103 <__DATA_REGION_ORIGIN__+0x3>
20e: 80 91 04 01 lds r24, 0x0104 ; 0x800104 <__DATA_REGION_ORIGIN__+0x4>
212: 90 91 05 01 lds r25, 0x0105 ; 0x800105 <__DATA_REGION_ORIGIN__+0x5>
216: 0e 94 48 00 call 0x90 ; 0x90 <gpio_write>
21a: 2f ef ldi r18, 0xFF ; 255
21c: 89 e6 ldi r24, 0x69 ; 105
21e: 98 e1 ldi r25, 0x18 ; 24
220: 21 50 subi r18, 0x01 ; 1
222: 80 40 sbci r24, 0x00 ; 0
224: 90 40 sbci r25, 0x00 ; 0
226: e1 f7 brne .-8 ; 0x220 <main+0x5c>
228: 00 c0 rjmp .+0 ; 0x22a <main+0x66>
22a: 00 00 nop
22c: cd cf rjmp .-102 ; 0x1c8 <main+0x4>
0000022e <_exit>:
22e: f8 94 cli
00000230 <__stop_program>:
230: ff cf rjmp .-2 ; 0x230 <__stop_program>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment