2026-03-09 11:24:32 +01:00

502 lines
18 KiB
Plaintext

task1.elf: file format elf32-littlearm
Sections:
Idx Name Size VMA LMA File off Algn
0 .isr_vector 000001d8 08000000 08000000 00001000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .text 00000298 080001d8 080001d8 000011d8 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .rodata 00000000 08000470 08000478 00001478 2**0
CONTENTS, ALLOC, LOAD, DATA
3 .ARM.extab 00000000 08000470 08000470 00001478 2**0
CONTENTS
4 .ARM 00000000 08000470 08000470 00001478 2**0
CONTENTS
5 .preinit_array 00000000 08000470 08000478 00001478 2**0
CONTENTS, ALLOC, LOAD, DATA
6 .init_array 00000004 08000470 08000470 00001470 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
7 .fini_array 00000004 08000474 08000474 00001474 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
8 .data 00000000 20000000 20000000 00001478 2**0
CONTENTS, ALLOC, LOAD, DATA
9 .ccmsram 00000000 10000000 10000000 00001478 2**0
CONTENTS
10 .bss 00000020 20000000 20000000 00002000 2**2
ALLOC
11 ._user_heap_stack 00000600 20000020 20000020 00002000 2**0
ALLOC
12 .ARM.attributes 00000030 00000000 00000000 00001478 2**0
CONTENTS, READONLY
13 .debug_info 000007b3 00000000 00000000 000014a8 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
14 .debug_abbrev 00000279 00000000 00000000 00001c5b 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
15 .debug_aranges 00000078 00000000 00000000 00001ed8 2**3
CONTENTS, READONLY, DEBUGGING, OCTETS
16 .debug_rnglists 00000039 00000000 00000000 00001f50 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
17 .debug_macro 00013740 00000000 00000000 00001f89 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
18 .debug_line 00000953 00000000 00000000 000156c9 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
19 .debug_str 0006f80d 00000000 00000000 0001601c 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
20 .comment 00000043 00000000 00000000 00085829 2**0
CONTENTS, READONLY
21 .debug_frame 000000e0 00000000 00000000 0008586c 2**2
CONTENTS, READONLY, DEBUGGING, OCTETS
22 .debug_line_str 0000007a 00000000 00000000 0008594c 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
Disassembly of section .text:
080001d8 <__do_global_dtors_aux>:
80001d8: b510 push {r4, lr}
80001da: 4c05 ldr r4, [pc, #20] @ (80001f0 <__do_global_dtors_aux+0x18>)
80001dc: 7823 ldrb r3, [r4, #0]
80001de: b933 cbnz r3, 80001ee <__do_global_dtors_aux+0x16>
80001e0: 4b04 ldr r3, [pc, #16] @ (80001f4 <__do_global_dtors_aux+0x1c>)
80001e2: b113 cbz r3, 80001ea <__do_global_dtors_aux+0x12>
80001e4: 4804 ldr r0, [pc, #16] @ (80001f8 <__do_global_dtors_aux+0x20>)
80001e6: f3af 8000 nop.w
80001ea: 2301 movs r3, #1
80001ec: 7023 strb r3, [r4, #0]
80001ee: bd10 pop {r4, pc}
80001f0: 20000000 .word 0x20000000
80001f4: 00000000 .word 0x00000000
80001f8: 08000458 .word 0x08000458
080001fc <frame_dummy>:
80001fc: b508 push {r3, lr}
80001fe: 4b03 ldr r3, [pc, #12] @ (800020c <frame_dummy+0x10>)
8000200: b11b cbz r3, 800020a <frame_dummy+0xe>
8000202: 4903 ldr r1, [pc, #12] @ (8000210 <frame_dummy+0x14>)
8000204: 4803 ldr r0, [pc, #12] @ (8000214 <frame_dummy+0x18>)
8000206: f3af 8000 nop.w
800020a: bd08 pop {r3, pc}
800020c: 00000000 .word 0x00000000
8000210: 20000004 .word 0x20000004
8000214: 08000458 .word 0x08000458
08000218 <main>:
static void delay(const uint16_t ms);
/* ------------------------------------ M A I N --------------------------------------- */
int main(void)
{
8000218: b580 push {r7, lr}
800021a: af00 add r7, sp, #0
\details Disables IRQ interrupts by setting the I-bit in the CPSR.
Can only be executed in Privileged modes.
*/
__STATIC_FORCEINLINE void __disable_irq(void)
{
__ASM volatile ("cpsid i" : : : "memory");
800021c: b672 cpsid i
}
800021e: bf00 nop
/* --- initialization --- */
__disable_irq(); // disable interrupts globally
GPIO_init();
8000220: f000 f83a bl 8000298 <GPIO_init>
__ASM volatile ("cpsie i" : : : "memory");
8000224: b662 cpsie i
}
8000226: bf00 nop
/* --- infinite processing loop --- */
while (1)
{
/* ... add your code to implement the lab assignment ... */
switch (state) {
8000228: 4b1a ldr r3, [pc, #104] @ (8000294 <main+0x7c>)
800022a: 681b ldr r3, [r3, #0]
800022c: 2b02 cmp r3, #2
800022e: d01e beq.n 800026e <main+0x56>
8000230: 2b02 cmp r3, #2
8000232: dc2c bgt.n 800028e <main+0x76>
8000234: 2b00 cmp r3, #0
8000236: d002 beq.n 800023e <main+0x26>
8000238: 2b01 cmp r3, #1
800023a: d00e beq.n 800025a <main+0x42>
GPIOA->ODR |= (1 << 0); // LED0 off
delay(WAITTIME); // wait
state = 0;
break;
default:
break;
800023c: e027 b.n 800028e <main+0x76>
GPIOA->ODR &= ~(1 << 0); // LED0 on
800023e: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
8000242: 695b ldr r3, [r3, #20]
8000244: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
8000248: f023 0301 bic.w r3, r3, #1
800024c: 6153 str r3, [r2, #20]
state++;
800024e: 4b11 ldr r3, [pc, #68] @ (8000294 <main+0x7c>)
8000250: 681b ldr r3, [r3, #0]
8000252: 3301 adds r3, #1
8000254: 4a0f ldr r2, [pc, #60] @ (8000294 <main+0x7c>)
8000256: 6013 str r3, [r2, #0]
break;
8000258: e01a b.n 8000290 <main+0x78>
delay(WAITTIME); // wait
800025a: f44f 70fa mov.w r0, #500 @ 0x1f4
800025e: f000 f843 bl 80002e8 <delay>
state++;
8000262: 4b0c ldr r3, [pc, #48] @ (8000294 <main+0x7c>)
8000264: 681b ldr r3, [r3, #0]
8000266: 3301 adds r3, #1
8000268: 4a0a ldr r2, [pc, #40] @ (8000294 <main+0x7c>)
800026a: 6013 str r3, [r2, #0]
break;
800026c: e010 b.n 8000290 <main+0x78>
GPIOA->ODR |= (1 << 0); // LED0 off
800026e: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
8000272: 695b ldr r3, [r3, #20]
8000274: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
8000278: f043 0301 orr.w r3, r3, #1
800027c: 6153 str r3, [r2, #20]
delay(WAITTIME); // wait
800027e: f44f 70fa mov.w r0, #500 @ 0x1f4
8000282: f000 f831 bl 80002e8 <delay>
state = 0;
8000286: 4b03 ldr r3, [pc, #12] @ (8000294 <main+0x7c>)
8000288: 2200 movs r2, #0
800028a: 601a str r2, [r3, #0]
break;
800028c: e000 b.n 8000290 <main+0x78>
break;
800028e: bf00 nop
switch (state) {
8000290: e7ca b.n 8000228 <main+0x10>
8000292: bf00 nop
8000294: 2000001c .word 0x2000001c
08000298 <GPIO_init>:
* requires: - nothing -
* parameters: - none -
* returns: - nothing -
\* ------------------------------------------------------------------------------------ */
static void GPIO_init(void)
{
8000298: b480 push {r7}
800029a: af00 add r7, sp, #0
/* enable port clocks */
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A
800029c: 4b11 ldr r3, [pc, #68] @ (80002e4 <GPIO_init+0x4c>)
800029e: 6cdb ldr r3, [r3, #76] @ 0x4c
80002a0: 4a10 ldr r2, [pc, #64] @ (80002e4 <GPIO_init+0x4c>)
80002a2: f043 0301 orr.w r3, r3, #1
80002a6: 64d3 str r3, [r2, #76] @ 0x4c
/* --- LEDs --- */
GPIOA->ODR |= MASK_LED_RED;
80002a8: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
80002ac: 695b ldr r3, [r3, #20]
80002ae: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
80002b2: f043 0301 orr.w r3, r3, #1
80002b6: 6153 str r3, [r2, #20]
//GPIOA->ODR |= MASK_LED_YELLOW;
GPIOA->MODER &= ~(3 << 0);
80002b8: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
80002bc: 681b ldr r3, [r3, #0]
80002be: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
80002c2: f023 0303 bic.w r3, r3, #3
80002c6: 6013 str r3, [r2, #0]
GPIOA->MODER |= (1 << 0); // set LED pin to output
80002c8: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
80002cc: 681b ldr r3, [r3, #0]
80002ce: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
80002d2: f043 0301 orr.w r3, r3, #1
80002d6: 6013 str r3, [r2, #0]
}
80002d8: bf00 nop
80002da: 46bd mov sp, r7
80002dc: f85d 7b04 ldr.w r7, [sp], #4
80002e0: 4770 bx lr
80002e2: bf00 nop
80002e4: 40021000 .word 0x40021000
080002e8 <delay>:
* requires: - nothing -
* parameters: ms - delay time in milliseconds
* returns: - nothing -
\* ------------------------------------------------------------------------------------ */
static void delay(const uint16_t ms)
{
80002e8: b480 push {r7}
80002ea: b085 sub sp, #20
80002ec: af00 add r7, sp, #0
80002ee: 4603 mov r3, r0
80002f0: 80fb strh r3, [r7, #6]
for (uint16_t i = 0; i < ms; ++i)
80002f2: 2300 movs r3, #0
80002f4: 81fb strh r3, [r7, #14]
80002f6: e00e b.n 8000316 <delay+0x2e>
{
for (uint16_t j = 0; j < LOOPS_PER_MS; ++j)
80002f8: 2300 movs r3, #0
80002fa: 81bb strh r3, [r7, #12]
80002fc: e003 b.n 8000306 <delay+0x1e>
{
__asm("NOP");
80002fe: bf00 nop
for (uint16_t j = 0; j < LOOPS_PER_MS; ++j)
8000300: 89bb ldrh r3, [r7, #12]
8000302: 3301 adds r3, #1
8000304: 81bb strh r3, [r7, #12]
8000306: 89bb ldrh r3, [r7, #12]
8000308: f240 42db movw r2, #1243 @ 0x4db
800030c: 4293 cmp r3, r2
800030e: d9f6 bls.n 80002fe <delay+0x16>
for (uint16_t i = 0; i < ms; ++i)
8000310: 89fb ldrh r3, [r7, #14]
8000312: 3301 adds r3, #1
8000314: 81fb strh r3, [r7, #14]
8000316: 89fa ldrh r2, [r7, #14]
8000318: 88fb ldrh r3, [r7, #6]
800031a: 429a cmp r2, r3
800031c: d3ec bcc.n 80002f8 <delay+0x10>
}
}
}
800031e: bf00 nop
8000320: bf00 nop
8000322: 3714 adds r7, #20
8000324: 46bd mov sp, r7
8000326: f85d 7b04 ldr.w r7, [sp], #4
800032a: 4770 bx lr
0800032c <ISR_error>:
*
* Default interrupt handler for core interrupts.
* Enables the green and red LED on the STefi Light board.
\* ------------------------------------------------------------------------------------ */
void ISR_error(void)
{
800032c: b480 push {r7}
800032e: af00 add r7, sp, #0
/* init */
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // PA: clock on (LEDs)
8000330: 4b10 ldr r3, [pc, #64] @ (8000374 <ISR_error+0x48>)
8000332: 6cdb ldr r3, [r3, #76] @ 0x4c
8000334: 4a0f ldr r2, [pc, #60] @ (8000374 <ISR_error+0x48>)
8000336: f043 0301 orr.w r3, r3, #1
800033a: 64d3 str r3, [r2, #76] @ 0x4c
GPIOA->ODR |= MASK_LED_ALL;
800033c: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
8000340: 695b ldr r3, [r3, #20]
8000342: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
8000346: f043 030f orr.w r3, r3, #15
800034a: 6153 str r3, [r2, #20]
GPIOA->MODER = (GPIOA->MODER & 0xFFFFFF00) | 0x11;
800034c: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
8000350: 681b ldr r3, [r3, #0]
8000352: f023 03ff bic.w r3, r3, #255 @ 0xff
8000356: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
800035a: f043 0311 orr.w r3, r3, #17
800035e: 6013 str r3, [r2, #0]
while(1)
{ /* light up the LEDs permanently */
GPIOA->ODR &= ~(MASK_LED_GREEN | MASK_LED_RED);
8000360: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
8000364: 695b ldr r3, [r3, #20]
8000366: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
800036a: f023 0305 bic.w r3, r3, #5
800036e: 6153 str r3, [r2, #20]
8000370: e7f6 b.n 8000360 <ISR_error+0x34>
8000372: bf00 nop
8000374: 40021000 .word 0x40021000
08000378 <ISR_default>:
*
* Default interrupt handler for non-core interrupts.
* Enables the blue and yellow LED on the STefi Light board.
\* ------------------------------------------------------------------------------------ */
void ISR_default(void)
{
8000378: b480 push {r7}
800037a: af00 add r7, sp, #0
/* init */
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // PA: clock on (LEDs)
800037c: 4b10 ldr r3, [pc, #64] @ (80003c0 <ISR_default+0x48>)
800037e: 6cdb ldr r3, [r3, #76] @ 0x4c
8000380: 4a0f ldr r2, [pc, #60] @ (80003c0 <ISR_default+0x48>)
8000382: f043 0301 orr.w r3, r3, #1
8000386: 64d3 str r3, [r2, #76] @ 0x4c
GPIOA->ODR |= MASK_LED_ALL;
8000388: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
800038c: 695b ldr r3, [r3, #20]
800038e: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
8000392: f043 030f orr.w r3, r3, #15
8000396: 6153 str r3, [r2, #20]
GPIOA->MODER = (GPIOA->MODER & 0xFFFFFF00) | 0x44;
8000398: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
800039c: 681b ldr r3, [r3, #0]
800039e: f023 03ff bic.w r3, r3, #255 @ 0xff
80003a2: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
80003a6: f043 0344 orr.w r3, r3, #68 @ 0x44
80003aa: 6013 str r3, [r2, #0]
while(1)
{ /* light up the LEDs permanently */
GPIOA->ODR &= ~(MASK_LED_BLUE | MASK_LED_YELLOW);
80003ac: f04f 4390 mov.w r3, #1207959552 @ 0x48000000
80003b0: 695b ldr r3, [r3, #20]
80003b2: f04f 4290 mov.w r2, #1207959552 @ 0x48000000
80003b6: f023 030a bic.w r3, r3, #10
80003ba: 6153 str r3, [r2, #20]
80003bc: e7f6 b.n 80003ac <ISR_default+0x34>
80003be: bf00 nop
80003c0: 40021000 .word 0x40021000
080003c4 <Reset_Handler>:
.section .text.Reset_Handler
.weak Reset_Handler
.type Reset_Handler, %function
Reset_Handler:
ldr r0, =_estack
80003c4: 480c ldr r0, [pc, #48] @ (80003f8 <LoopForever+0x2>)
mov sp, r0 /* set stack pointer */
80003c6: 4685 mov sp, r0
/* Call the clock system initialization function.*/
// bl SystemInit
/* Copy the data segment initializers from flash to SRAM */
ldr r0, =_sdata
80003c8: 480c ldr r0, [pc, #48] @ (80003fc <LoopForever+0x6>)
ldr r1, =_edata
80003ca: 490d ldr r1, [pc, #52] @ (8000400 <LoopForever+0xa>)
ldr r2, =_sidata
80003cc: 4a0d ldr r2, [pc, #52] @ (8000404 <LoopForever+0xe>)
movs r3, #0
80003ce: 2300 movs r3, #0
b LoopCopyDataInit
80003d0: e002 b.n 80003d8 <LoopCopyDataInit>
080003d2 <CopyDataInit>:
CopyDataInit:
ldr r4, [r2, r3]
80003d2: 58d4 ldr r4, [r2, r3]
str r4, [r0, r3]
80003d4: 50c4 str r4, [r0, r3]
adds r3, r3, #4
80003d6: 3304 adds r3, #4
080003d8 <LoopCopyDataInit>:
LoopCopyDataInit:
adds r4, r0, r3
80003d8: 18c4 adds r4, r0, r3
cmp r4, r1
80003da: 428c cmp r4, r1
bcc CopyDataInit
80003dc: d3f9 bcc.n 80003d2 <CopyDataInit>
/* Zero fill the bss segment. */
ldr r2, =_sbss
80003de: 4a0a ldr r2, [pc, #40] @ (8000408 <LoopForever+0x12>)
ldr r4, =_ebss
80003e0: 4c0a ldr r4, [pc, #40] @ (800040c <LoopForever+0x16>)
movs r3, #0
80003e2: 2300 movs r3, #0
b LoopFillZerobss
80003e4: e001 b.n 80003ea <LoopFillZerobss>
080003e6 <FillZerobss>:
FillZerobss:
str r3, [r2]
80003e6: 6013 str r3, [r2, #0]
adds r2, r2, #4
80003e8: 3204 adds r2, #4
080003ea <LoopFillZerobss>:
LoopFillZerobss:
cmp r2, r4
80003ea: 42a2 cmp r2, r4
bcc FillZerobss
80003ec: d3fb bcc.n 80003e6 <FillZerobss>
/* Call static constructors */
bl __libc_init_array
80003ee: f000 f80f bl 8000410 <__libc_init_array>
/* Call the application's entry point.*/
bl main
80003f2: f7ff ff11 bl 8000218 <main>
080003f6 <LoopForever>:
LoopForever:
b LoopForever
80003f6: e7fe b.n 80003f6 <LoopForever>
ldr r0, =_estack
80003f8: 20008000 .word 0x20008000
ldr r0, =_sdata
80003fc: 20000000 .word 0x20000000
ldr r1, =_edata
8000400: 20000000 .word 0x20000000
ldr r2, =_sidata
8000404: 08000478 .word 0x08000478
ldr r2, =_sbss
8000408: 20000000 .word 0x20000000
ldr r4, =_ebss
800040c: 20000020 .word 0x20000020
08000410 <__libc_init_array>:
8000410: b570 push {r4, r5, r6, lr}
8000412: 4d0d ldr r5, [pc, #52] @ (8000448 <__libc_init_array+0x38>)
8000414: 4c0d ldr r4, [pc, #52] @ (800044c <__libc_init_array+0x3c>)
8000416: 1b64 subs r4, r4, r5
8000418: 10a4 asrs r4, r4, #2
800041a: 2600 movs r6, #0
800041c: 42a6 cmp r6, r4
800041e: d109 bne.n 8000434 <__libc_init_array+0x24>
8000420: 4d0b ldr r5, [pc, #44] @ (8000450 <__libc_init_array+0x40>)
8000422: 4c0c ldr r4, [pc, #48] @ (8000454 <__libc_init_array+0x44>)
8000424: f000 f818 bl 8000458 <_init>
8000428: 1b64 subs r4, r4, r5
800042a: 10a4 asrs r4, r4, #2
800042c: 2600 movs r6, #0
800042e: 42a6 cmp r6, r4
8000430: d105 bne.n 800043e <__libc_init_array+0x2e>
8000432: bd70 pop {r4, r5, r6, pc}
8000434: f855 3b04 ldr.w r3, [r5], #4
8000438: 4798 blx r3
800043a: 3601 adds r6, #1
800043c: e7ee b.n 800041c <__libc_init_array+0xc>
800043e: f855 3b04 ldr.w r3, [r5], #4
8000442: 4798 blx r3
8000444: 3601 adds r6, #1
8000446: e7f2 b.n 800042e <__libc_init_array+0x1e>
8000448: 08000470 .word 0x08000470
800044c: 08000470 .word 0x08000470
8000450: 08000470 .word 0x08000470
8000454: 08000474 .word 0x08000474
08000458 <_init>:
8000458: b5f8 push {r3, r4, r5, r6, r7, lr}
800045a: bf00 nop
800045c: bcf8 pop {r3, r4, r5, r6, r7}
800045e: bc08 pop {r3}
8000460: 469e mov lr, r3
8000462: 4770 bx lr
08000464 <_fini>:
8000464: b5f8 push {r3, r4, r5, r6, r7, lr}
8000466: bf00 nop
8000468: bcf8 pop {r3, r4, r5, r6, r7}
800046a: bc08 pop {r3}
800046c: 469e mov lr, r3
800046e: 4770 bx lr