Blink LED with spin function

This commit is contained in:
Alexander Heldt
2024-07-28 11:45:17 +02:00
parent a8a5e21b77
commit 5b5da238d5
6 changed files with 5295 additions and 1080 deletions

Binary file not shown.

View File

@@ -18,42 +18,37 @@ Discarded input sections
.text 0x00000000 0x0 build/gpio.o
.data 0x00000000 0x0 build/gpio.o
.bss 0x00000000 0x0 build/gpio.o
.text.gpio_set_mode
0x00000000 0x62 build/gpio.o
.text.gpio_write
0x00000000 0x4c build/gpio.o
.debug_info 0x00000000 0x21a build/gpio.o
.debug_abbrev 0x00000000 0x12b build/gpio.o
.debug_aranges
0x00000000 0x28 build/gpio.o
.debug_rnglists
0x00000000 0x19 build/gpio.o
.debug_macro 0x00000000 0xb56 build/gpio.o
.debug_macro 0x00000000 0x22 build/gpio.o
.debug_macro 0x00000000 0x75 build/gpio.o
.debug_macro 0x00000000 0x2a build/gpio.o
.debug_macro 0x00000000 0x5c build/gpio.o
.debug_macro 0x00000000 0x3c build/gpio.o
.debug_macro 0x00000000 0x103 build/gpio.o
.debug_macro 0x00000000 0x3a build/gpio.o
.debug_macro 0x00000000 0x57 build/gpio.o
.debug_macro 0x00000000 0x6a build/gpio.o
.debug_macro 0x00000000 0x1df build/gpio.o
.debug_macro 0x00000000 0x89 build/gpio.o
.debug_macro 0x00000000 0x4cc build/gpio.o
.debug_macro 0x00000000 0x22 build/gpio.o
.debug_macro 0x00000000 0x34 build/gpio.o
.debug_line 0x00000000 0x116 build/gpio.o
.debug_str 0x00000000 0x551a build/gpio.o
.comment 0x00000000 0x46 build/gpio.o
.debug_line_str
0x00000000 0x260 build/gpio.o
.debug_frame 0x00000000 0x60 build/gpio.o
.ARM.attributes
0x00000000 0x34 build/gpio.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o
.text 0x00000000 0x0 build/main.o
.data 0x00000000 0x0 build/main.o
.bss 0x00000000 0x0 build/main.o
.debug_macro 0x00000000 0x22 build/main.o
.debug_macro 0x00000000 0x75 build/main.o
.debug_macro 0x00000000 0x2a build/main.o
.debug_macro 0x00000000 0x5c build/main.o
.debug_macro 0x00000000 0x3c build/main.o
.debug_macro 0x00000000 0x103 build/main.o
.debug_macro 0x00000000 0x3a build/main.o
.debug_macro 0x00000000 0x57 build/main.o
.debug_macro 0x00000000 0x6a build/main.o
.debug_macro 0x00000000 0x1df build/main.o
.debug_macro 0x00000000 0x89 build/main.o
.debug_macro 0x00000000 0x4cc build/main.o
.debug_macro 0x00000000 0x22 build/main.o
.group 0x00000000 0xc build/startup.o
.group 0x00000000 0xc build/startup.o
.group 0x00000000 0xc build/startup.o
@@ -91,111 +86,118 @@ LOAD build/startup.o
0x08000000 interrupt_vector_table
0x08000198 . = ALIGN (0x4)
.text 0x08000198 0x8c
.text 0x08000198 0x1a8
0x08000198 . = ALIGN (0x4)
*(.text)
*(.text.*)
.text.main 0x08000198 0x10 build/main.o
0x08000198 main
.text.gpio_set_mode
0x08000198 0x62 build/gpio.o
0x08000198 gpio_set_mode
.text.gpio_write
0x080001fa 0x4c build/gpio.o
0x080001fa gpio_write
.text.spin 0x08000246 0x22 build/main.o
.text.main 0x08000268 0x5c build/main.o
0x08000268 main
.text.init_memory
0x080001a8 0x64 build/startup.o
0x080001a8 init_memory
.text.reset 0x0800020c 0x10 build/startup.o
0x0800020c reset
0x080002c4 0x64 build/startup.o
0x080002c4 init_memory
.text.reset 0x08000328 0x10 build/startup.o
0x08000328 reset
.text.default_handler
0x0800021c 0x8 build/startup.o
0x0800021c exti0
0x0800021c debug_monitor
0x0800021c rcc
0x0800021c x
0x0800021c sdio
0x0800021c usage_fault
0x0800021c tim1_up_tim10
0x0800021c usart1
0x0800021c i2c3_er
0x0800021c spi2
0x0800021c dma1_stream1
0x0800021c bus_fault
0x0800021c spi5
0x0800021c exti3
0x0800021c dma2_stream5
0x0800021c tim2
0x0800021c dma1_stream6
0x0800021c default_handler
0x0800021c i2c1_er
0x0800021c hard_fault
0x0800021c usart6
0x0800021c exti15_10
0x0800021c usart2
0x0800021c pend_sv
0x0800021c i2c1_ev
0x0800021c wwdg
0x0800021c adc
0x0800021c rtc_alarm
0x0800021c spi3
0x0800021c exti1
0x0800021c mem_manage
0x0800021c dma2_stream1
0x0800021c dma1_stream2
0x0800021c dma2_stream3
0x0800021c sv_call
0x0800021c tim3
0x0800021c otg_fs
0x0800021c dma1_stream5
0x0800021c dma2_stream6
0x0800021c flash
0x0800021c tamp_stamp
0x0800021c i2c3_ev
0x0800021c rtc_wkup
0x0800021c dma2_stream0
0x0800021c pvd
0x0800021c fpu
0x0800021c exti4
0x0800021c exti2
0x0800021c spi1
0x0800021c dma1_stream0
0x0800021c tim1_brk_tim9
0x0800021c i2c2_ev
0x0800021c otg_fs_wkup
0x0800021c spi4
0x0800021c dma2_stream2
0x0800021c tim1_cc
0x0800021c tim1_trg_com_tim11
0x0800021c exti9_5
0x0800021c dma1_stream3
0x0800021c dma2_stream4
0x0800021c i2c2_er
0x0800021c dma2_stream7
0x0800021c dma1_stream7
0x0800021c nmi
0x0800021c systick
0x0800021c tim4
0x0800021c tim5
0x0800021c dma1_stream4
0x08000338 0x8 build/startup.o
0x08000338 exti0
0x08000338 debug_monitor
0x08000338 rcc
0x08000338 x
0x08000338 sdio
0x08000338 usage_fault
0x08000338 tim1_up_tim10
0x08000338 usart1
0x08000338 i2c3_er
0x08000338 spi2
0x08000338 dma1_stream1
0x08000338 bus_fault
0x08000338 spi5
0x08000338 exti3
0x08000338 dma2_stream5
0x08000338 tim2
0x08000338 dma1_stream6
0x08000338 default_handler
0x08000338 i2c1_er
0x08000338 hard_fault
0x08000338 usart6
0x08000338 exti15_10
0x08000338 usart2
0x08000338 pend_sv
0x08000338 i2c1_ev
0x08000338 wwdg
0x08000338 adc
0x08000338 rtc_alarm
0x08000338 spi3
0x08000338 exti1
0x08000338 mem_manage
0x08000338 dma2_stream1
0x08000338 dma1_stream2
0x08000338 dma2_stream3
0x08000338 sv_call
0x08000338 tim3
0x08000338 otg_fs
0x08000338 dma1_stream5
0x08000338 dma2_stream6
0x08000338 flash
0x08000338 tamp_stamp
0x08000338 i2c3_ev
0x08000338 rtc_wkup
0x08000338 dma2_stream0
0x08000338 pvd
0x08000338 fpu
0x08000338 exti4
0x08000338 exti2
0x08000338 spi1
0x08000338 dma1_stream0
0x08000338 tim1_brk_tim9
0x08000338 i2c2_ev
0x08000338 otg_fs_wkup
0x08000338 spi4
0x08000338 dma2_stream2
0x08000338 tim1_cc
0x08000338 tim1_trg_com_tim11
0x08000338 exti9_5
0x08000338 dma1_stream3
0x08000338 dma2_stream4
0x08000338 i2c2_er
0x08000338 dma2_stream7
0x08000338 dma1_stream7
0x08000338 nmi
0x08000338 systick
0x08000338 tim4
0x08000338 tim5
0x08000338 dma1_stream4
*(.rodata)
*(.rodata.*)
0x08000224 . = ALIGN (0x4)
0x08000224 _data_addr = LOADADDR (.data)
0x08000340 . = ALIGN (0x4)
0x08000340 _data_addr = LOADADDR (.data)
.glue_7 0x08000224 0x0
.glue_7 0x08000224 0x0 linker stubs
.glue_7 0x08000340 0x0
.glue_7 0x08000340 0x0 linker stubs
.glue_7t 0x08000224 0x0
.glue_7t 0x08000224 0x0 linker stubs
.glue_7t 0x08000340 0x0
.glue_7t 0x08000340 0x0 linker stubs
.vfp11_veneer 0x08000224 0x0
.vfp11_veneer 0x08000224 0x0 linker stubs
.vfp11_veneer 0x08000340 0x0
.vfp11_veneer 0x08000340 0x0 linker stubs
.v4_bx 0x08000224 0x0
.v4_bx 0x08000224 0x0 linker stubs
.v4_bx 0x08000340 0x0
.v4_bx 0x08000340 0x0 linker stubs
.iplt 0x08000224 0x0
.iplt 0x08000224 0x0 build/startup.o
.iplt 0x08000340 0x0
.iplt 0x08000340 0x0 build/main.o
.rel.dyn 0x08000224 0x0
.rel.iplt 0x08000224 0x0 build/startup.o
.rel.dyn 0x08000340 0x0
.rel.iplt 0x08000340 0x0 build/main.o
.data 0x20000000 0x0 load address 0x08000224
.data 0x20000000 0x0 load address 0x08000340
0x20000000 . = ALIGN (0x4)
0x20000000 _data_start = .
*(.data)
@@ -203,10 +205,10 @@ LOAD build/startup.o
0x20000000 . = ALIGN (0x4)
0x20000000 _data_end = .
.igot.plt 0x20000000 0x0 load address 0x08000224
.igot.plt 0x20000000 0x0 build/startup.o
.igot.plt 0x20000000 0x0 load address 0x08000340
.igot.plt 0x20000000 0x0 build/main.o
.bss 0x20000000 0x0 load address 0x08000224
.bss 0x20000000 0x0 load address 0x08000340
0x20000000 . = ALIGN (0x4)
0x20000000 _bss_start = .
*(.bss)
@@ -216,62 +218,97 @@ LOAD build/startup.o
OUTPUT(build/final.elf elf32-littlearm)
LOAD linker stubs
.debug_info 0x00000000 0x1d0
.debug_info 0x00000000 0x48 build/main.o
.debug_info 0x00000048 0x188 build/startup.o
.debug_info 0x00000000 0x64e
.debug_info 0x00000000 0x21a build/gpio.o
.debug_info 0x0000021a 0x2ac build/main.o
.debug_info 0x000004c6 0x188 build/startup.o
.debug_abbrev 0x00000000 0x163
.debug_abbrev 0x00000000 0x3c build/main.o
.debug_abbrev 0x0000003c 0x127 build/startup.o
.debug_abbrev 0x00000000 0x36d
.debug_abbrev 0x00000000 0x12b build/gpio.o
.debug_abbrev 0x0000012b 0x11b build/main.o
.debug_abbrev 0x00000246 0x127 build/startup.o
.debug_aranges 0x00000000 0x50
.debug_aranges 0x00000000 0x80
.debug_aranges
0x00000000 0x20 build/main.o
0x00000000 0x28 build/gpio.o
.debug_aranges
0x00000020 0x30 build/startup.o
0x00000028 0x28 build/main.o
.debug_aranges
0x00000050 0x30 build/startup.o
.debug_rnglists
0x00000000 0x32
0x00000000 0x51
.debug_rnglists
0x00000000 0x13 build/main.o
0x00000000 0x19 build/gpio.o
.debug_rnglists
0x00000013 0x1f build/startup.o
0x00000019 0x19 build/main.o
.debug_rnglists
0x00000032 0x1f build/startup.o
.debug_macro 0x00000000 0x165f
.debug_macro 0x00000000 0xab6 build/main.o
.debug_macro 0x00000ab6 0xb02 build/startup.o
.debug_macro 0x000015b8 0x56 build/startup.o
.debug_macro 0x0000160e 0x51 build/startup.o
.debug_macro 0x00000000 0x2d8f
.debug_macro 0x00000000 0xb56 build/gpio.o
.debug_macro 0x00000b56 0x22 build/gpio.o
.debug_macro 0x00000b78 0x75 build/gpio.o
.debug_macro 0x00000bed 0x2a build/gpio.o
.debug_macro 0x00000c17 0x5c build/gpio.o
.debug_macro 0x00000c73 0x3c build/gpio.o
.debug_macro 0x00000caf 0x103 build/gpio.o
.debug_macro 0x00000db2 0x3a build/gpio.o
.debug_macro 0x00000dec 0x57 build/gpio.o
.debug_macro 0x00000e43 0x6a build/gpio.o
.debug_macro 0x00000ead 0x1df build/gpio.o
.debug_macro 0x0000108c 0x89 build/gpio.o
.debug_macro 0x00001115 0x4cc build/gpio.o
.debug_macro 0x000015e1 0x22 build/gpio.o
.debug_macro 0x00001603 0x34 build/gpio.o
.debug_macro 0x00001637 0xb6b build/main.o
.debug_macro 0x000021a2 0x16 build/main.o
.debug_macro 0x000021b8 0x2e build/main.o
.debug_macro 0x000021e6 0xb02 build/startup.o
.debug_macro 0x00002ce8 0x56 build/startup.o
.debug_macro 0x00002d3e 0x51 build/startup.o
.debug_line 0x00000000 0x139
.debug_line 0x00000000 0x4f build/main.o
.debug_line 0x0000004f 0xea build/startup.o
.debug_line 0x00000000 0x2fe
.debug_line 0x00000000 0x116 build/gpio.o
.debug_line 0x00000116 0xfe build/main.o
.debug_line 0x00000214 0xea build/startup.o
.debug_str 0x00000000 0x3b8e
.debug_str 0x00000000 0x2dcb build/main.o
.debug_str 0x00002dcb 0xdc3 build/startup.o
.debug_str 0x00000000 0x553c
.debug_str 0x00000000 0x5372 build/gpio.o
0x551a (size before relaxing)
.debug_str 0x00005372 0x142 build/main.o
0x5607 (size before relaxing)
.debug_str 0x000054b4 0x88 build/startup.o
0x3cdf (size before relaxing)
.comment 0x00000000 0x45
.comment 0x00000000 0x45 build/main.o
.comment 0x00000000 0x45 build/gpio.o
0x46 (size before relaxing)
.comment 0x00000045 0x46 build/main.o
.comment 0x00000045 0x46 build/startup.o
.ARM.attributes
0x00000000 0x34
.ARM.attributes
0x00000000 0x34 build/main.o
0x00000000 0x34 build/gpio.o
.ARM.attributes
0x00000034 0x34 build/startup.o
0x00000034 0x34 build/main.o
.ARM.attributes
0x00000068 0x34 build/startup.o
.debug_line_str
0x00000000 0x210
0x00000000 0x265
.debug_line_str
0x00000000 0x35 build/main.o
0x00000000 0x24e build/gpio.o
0x260 (size before relaxing)
.debug_line_str
0x00000035 0x1db build/startup.o
0x0000024e 0xd build/main.o
0x266 (size before relaxing)
.debug_line_str
0x0000025b 0xa build/startup.o
0x21b (size before relaxing)
.debug_frame 0x00000000 0x9c
.debug_frame 0x00000000 0x30 build/main.o
.debug_frame 0x00000030 0x6c build/startup.o
.debug_frame 0x00000000 0x124
.debug_frame 0x00000000 0x60 build/gpio.o
.debug_frame 0x00000060 0x58 build/main.o
.debug_frame 0x000000b8 0x6c build/startup.o

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -1,5 +1,23 @@
#include <inttypes.h>
#include "rcc.h"
#include "gpio.h"
#define exit 42
static inline void spin(volatile uint32_t count) {
while (count--) (void) 0;
}
int main(void) {
uint16_t led = PIN('C', 13); // Blue LED
RCC->AHB1ENR |= BIT(PINPORT(led)); // Enable GPIO clock for LED
gpio_set_mode(led, GPIO_MODE_OUTPUT); // Set blue LED to output mode
for (;;) {
gpio_write(led, true);
spin(999999);
gpio_write(led, false);
spin(999999);
};
return exit;
}