This commit is contained in:
Alexander Heldt
2024-08-11 17:37:17 +02:00
parent a3c1de878a
commit 2fc8ee4f92
23 changed files with 9613 additions and 839 deletions

Binary file not shown.

View File

@@ -36,6 +36,7 @@ Discarded input sections
.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
@@ -52,7 +53,7 @@ Discarded input sections
.debug_macro 0x00000000 0x89 build/main.o
.debug_macro 0x00000000 0x4cc build/main.o
.debug_macro 0x00000000 0x22 build/main.o
.debug_macro 0x00000000 0x34 build/main.o
.debug_macro 0x00000000 0x88 build/main.o
.group 0x00000000 0xc build/startup.o
.group 0x00000000 0xc build/startup.o
.group 0x00000000 0xc build/startup.o
@@ -96,6 +97,42 @@ Discarded input sections
.debug_macro 0x00000000 0x89 build/timer.o
.debug_macro 0x00000000 0x4cc build/timer.o
.debug_macro 0x00000000 0x22 build/timer.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.group 0x00000000 0xc build/usart.o
.text 0x00000000 0x0 build/usart.o
.data 0x00000000 0x0 build/usart.o
.bss 0x00000000 0x0 build/usart.o
.text.usart2_start
0x00000000 0x20 build/usart.o
.debug_macro 0x00000000 0x22 build/usart.o
.debug_macro 0x00000000 0x75 build/usart.o
.debug_macro 0x00000000 0x2a build/usart.o
.debug_macro 0x00000000 0x5c build/usart.o
.debug_macro 0x00000000 0x3c build/usart.o
.debug_macro 0x00000000 0x103 build/usart.o
.debug_macro 0x00000000 0x3a build/usart.o
.debug_macro 0x00000000 0x57 build/usart.o
.debug_macro 0x00000000 0x6a build/usart.o
.debug_macro 0x00000000 0x1df build/usart.o
.debug_macro 0x00000000 0x89 build/usart.o
.debug_macro 0x00000000 0x4cc build/usart.o
.debug_macro 0x00000000 0x13e build/usart.o
.debug_macro 0x00000000 0x22 build/usart.o
.debug_macro 0x00000000 0x5e build/usart.o
Memory Configuration
@@ -112,6 +149,7 @@ LOAD build/gpio.o
LOAD build/main.o
LOAD build/startup.o
LOAD build/timer.o
LOAD build/usart.o
0x20020000 stack_start = (ORIGIN (sram) + LENGTH (sram))
.isr_vector 0x08000000 0x198
@@ -121,7 +159,7 @@ LOAD build/timer.o
0x08000000 interrupt_vector_table
0x08000198 . = ALIGN (0x4)
.text 0x08000198 0x358
.text 0x08000198 0x458
0x08000198 . = ALIGN (0x4)
*(.text)
*(.text.*)
@@ -134,113 +172,116 @@ LOAD build/timer.o
*fill* 0x08000246 0x2
.text.system_clock_init
0x08000248 0x144 build/main.o
.text.main 0x0800038c 0x88 build/main.o
.text.main 0x0800038c 0x90 build/main.o
0x0800038c main
.text.init_memory
0x08000414 0x64 build/startup.o
0x08000414 init_memory
.text.reset 0x08000478 0x10 build/startup.o
0x08000478 reset
0x0800041c 0x64 build/startup.o
0x0800041c init_memory
.text.reset 0x08000480 0x10 build/startup.o
0x08000480 reset
.text.default_handler
0x08000488 0x8 build/startup.o
0x08000488 exti0
0x08000488 debug_monitor
0x08000488 rcc
0x08000488 x
0x08000488 sdio
0x08000488 usage_fault
0x08000488 tim1_up_tim10
0x08000488 usart1
0x08000488 i2c3_er
0x08000488 spi2
0x08000488 dma1_stream1
0x08000488 bus_fault
0x08000488 spi5
0x08000488 exti3
0x08000488 dma2_stream5
0x08000488 tim2
0x08000488 dma1_stream6
0x08000488 default_handler
0x08000488 i2c1_er
0x08000488 hard_fault
0x08000488 usart6
0x08000488 exti15_10
0x08000488 usart2
0x08000488 pend_sv
0x08000488 i2c1_ev
0x08000488 wwdg
0x08000488 adc
0x08000488 rtc_alarm
0x08000488 spi3
0x08000488 exti1
0x08000488 mem_manage
0x08000488 dma2_stream1
0x08000488 dma1_stream2
0x08000488 dma2_stream3
0x08000488 sv_call
0x08000488 tim3
0x08000488 otg_fs
0x08000488 dma1_stream5
0x08000488 dma2_stream6
0x08000488 flash
0x08000488 tamp_stamp
0x08000488 i2c3_ev
0x08000488 rtc_wkup
0x08000488 dma2_stream0
0x08000488 pvd
0x08000488 fpu
0x08000488 exti4
0x08000488 exti2
0x08000488 spi1
0x08000488 dma1_stream0
0x08000488 tim1_brk_tim9
0x08000488 i2c2_ev
0x08000488 otg_fs_wkup
0x08000488 spi4
0x08000488 dma2_stream2
0x08000488 tim1_cc
0x08000488 tim1_trg_com_tim11
0x08000488 exti9_5
0x08000488 dma1_stream3
0x08000488 dma2_stream4
0x08000488 i2c2_er
0x08000488 dma2_stream7
0x08000488 dma1_stream7
0x08000488 nmi
0x08000488 systick
0x08000488 tim4
0x08000488 tim5
0x08000488 dma1_stream4
0x08000490 0x8 build/startup.o
0x08000490 exti0
0x08000490 debug_monitor
0x08000490 rcc
0x08000490 x
0x08000490 sdio
0x08000490 usage_fault
0x08000490 tim1_up_tim10
0x08000490 usart1
0x08000490 i2c3_er
0x08000490 spi2
0x08000490 dma1_stream1
0x08000490 bus_fault
0x08000490 spi5
0x08000490 exti3
0x08000490 dma2_stream5
0x08000490 tim2
0x08000490 dma1_stream6
0x08000490 default_handler
0x08000490 i2c1_er
0x08000490 hard_fault
0x08000490 usart6
0x08000490 exti15_10
0x08000490 usart2
0x08000490 pend_sv
0x08000490 i2c1_ev
0x08000490 wwdg
0x08000490 adc
0x08000490 rtc_alarm
0x08000490 spi3
0x08000490 exti1
0x08000490 mem_manage
0x08000490 dma2_stream1
0x08000490 dma1_stream2
0x08000490 dma2_stream3
0x08000490 sv_call
0x08000490 tim3
0x08000490 otg_fs
0x08000490 dma1_stream5
0x08000490 dma2_stream6
0x08000490 flash
0x08000490 tamp_stamp
0x08000490 i2c3_ev
0x08000490 rtc_wkup
0x08000490 dma2_stream0
0x08000490 pvd
0x08000490 fpu
0x08000490 exti4
0x08000490 exti2
0x08000490 spi1
0x08000490 dma1_stream0
0x08000490 tim1_brk_tim9
0x08000490 i2c2_ev
0x08000490 otg_fs_wkup
0x08000490 spi4
0x08000490 dma2_stream2
0x08000490 tim1_cc
0x08000490 tim1_trg_com_tim11
0x08000490 exti9_5
0x08000490 dma1_stream3
0x08000490 dma2_stream4
0x08000490 i2c2_er
0x08000490 dma2_stream7
0x08000490 dma1_stream7
0x08000490 nmi
0x08000490 systick
0x08000490 tim4
0x08000490 tim5
0x08000490 dma1_stream4
.text.tim4_init
0x08000490 0x40 build/timer.o
0x08000490 tim4_init
0x08000498 0x40 build/timer.o
0x08000498 tim4_init
.text.tim4_start
0x080004d0 0x20 build/timer.o
0x080004d0 tim4_start
0x080004d8 0x20 build/timer.o
0x080004d8 tim4_start
.text.usart2_init
0x080004f8 0xf8 build/usart.o
0x080004f8 usart2_init
*(.rodata)
*(.rodata.*)
0x080004f0 . = ALIGN (0x4)
0x080004f0 _data_addr = LOADADDR (.data)
0x080005f0 . = ALIGN (0x4)
0x080005f0 _data_addr = LOADADDR (.data)
.glue_7 0x080004f0 0x0
.glue_7 0x080004f0 0x0 linker stubs
.glue_7 0x080005f0 0x0
.glue_7 0x080005f0 0x0 linker stubs
.glue_7t 0x080004f0 0x0
.glue_7t 0x080004f0 0x0 linker stubs
.glue_7t 0x080005f0 0x0
.glue_7t 0x080005f0 0x0 linker stubs
.vfp11_veneer 0x080004f0 0x0
.vfp11_veneer 0x080004f0 0x0 linker stubs
.vfp11_veneer 0x080005f0 0x0
.vfp11_veneer 0x080005f0 0x0 linker stubs
.v4_bx 0x080004f0 0x0
.v4_bx 0x080004f0 0x0 linker stubs
.v4_bx 0x080005f0 0x0
.v4_bx 0x080005f0 0x0 linker stubs
.iplt 0x080004f0 0x0
.iplt 0x080004f0 0x0 build/main.o
.iplt 0x080005f0 0x0
.iplt 0x080005f0 0x0 build/main.o
.rel.dyn 0x080004f0 0x0
.rel.iplt 0x080004f0 0x0 build/main.o
.rel.dyn 0x080005f0 0x0
.rel.iplt 0x080005f0 0x0 build/main.o
.data 0x20000000 0x0 load address 0x080004f0
.data 0x20000000 0x0 load address 0x080005f0
0x20000000 . = ALIGN (0x4)
0x20000000 _data_start = .
*(.data)
@@ -248,10 +289,10 @@ LOAD build/timer.o
0x20000000 . = ALIGN (0x4)
0x20000000 _data_end = .
.igot.plt 0x20000000 0x0 load address 0x080004f0
.igot.plt 0x20000000 0x0 load address 0x080005f0
.igot.plt 0x20000000 0x0 build/main.o
.bss 0x20000000 0x0 load address 0x080004f0
.bss 0x20000000 0x0 load address 0x080005f0
0x20000000 . = ALIGN (0x4)
0x20000000 _bss_start = .
*(.bss)
@@ -261,19 +302,21 @@ LOAD build/timer.o
OUTPUT(build/final.elf elf32-littlearm)
LOAD linker stubs
.debug_info 0x00000000 0xb25
.debug_info 0x00000000 0x21a build/gpio.o
.debug_info 0x0000021a 0x44e build/main.o
.debug_info 0x00000668 0x188 build/startup.o
.debug_info 0x000007f0 0x335 build/timer.o
.debug_info 0x00000000 0xe1d
.debug_info 0x00000000 0x205 build/gpio.o
.debug_info 0x00000205 0x457 build/main.o
.debug_info 0x0000065c 0x188 build/startup.o
.debug_info 0x000007e4 0x335 build/timer.o
.debug_info 0x00000b19 0x304 build/usart.o
.debug_abbrev 0x00000000 0x44b
.debug_abbrev 0x00000000 0x12b build/gpio.o
.debug_abbrev 0x0000012b 0x144 build/main.o
.debug_abbrev 0x0000026f 0x127 build/startup.o
.debug_abbrev 0x00000396 0xb5 build/timer.o
.debug_abbrev 0x00000000 0x4ee
.debug_abbrev 0x00000000 0x119 build/gpio.o
.debug_abbrev 0x00000119 0x143 build/main.o
.debug_abbrev 0x0000025c 0x127 build/startup.o
.debug_abbrev 0x00000383 0xb5 build/timer.o
.debug_abbrev 0x00000438 0xb6 build/usart.o
.debug_aranges 0x00000000 0xa8
.debug_aranges 0x00000000 0xd0
.debug_aranges
0x00000000 0x28 build/gpio.o
.debug_aranges
@@ -282,9 +325,11 @@ LOAD linker stubs
0x00000050 0x30 build/startup.o
.debug_aranges
0x00000080 0x28 build/timer.o
.debug_aranges
0x000000a8 0x28 build/usart.o
.debug_rnglists
0x00000000 0x6c
0x00000000 0x86
.debug_rnglists
0x00000000 0x19 build/gpio.o
.debug_rnglists
@@ -293,8 +338,10 @@ LOAD linker stubs
0x00000034 0x1f build/startup.o
.debug_rnglists
0x00000053 0x19 build/timer.o
.debug_rnglists
0x0000006c 0x1a build/usart.o
.debug_macro 0x00000000 0x3ba0
.debug_macro 0x00000000 0x4885
.debug_macro 0x00000000 0xb56 build/gpio.o
.debug_macro 0x00000b56 0x22 build/gpio.o
.debug_macro 0x00000b78 0x75 build/gpio.o
@@ -309,33 +356,39 @@ LOAD linker stubs
.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 0xb80 build/main.o
.debug_macro 0x000021b7 0x12a build/main.o
.debug_macro 0x000022e1 0x46 build/main.o
.debug_macro 0x00002327 0x2e build/main.o
.debug_macro 0x00002355 0x22 build/main.o
.debug_macro 0x00002377 0xb02 build/startup.o
.debug_macro 0x00002e79 0x56 build/startup.o
.debug_macro 0x00002ecf 0x51 build/startup.o
.debug_macro 0x00002f20 0xb5c build/timer.o
.debug_macro 0x00003a7c 0x124 build/timer.o
.debug_macro 0x00001603 0x88 build/gpio.o
.debug_macro 0x0000168b 0xb89 build/main.o
.debug_macro 0x00002214 0x144 build/main.o
.debug_macro 0x00002358 0x46 build/main.o
.debug_macro 0x0000239e 0x2e build/main.o
.debug_macro 0x000023cc 0x22 build/main.o
.debug_macro 0x000023ee 0x5e build/main.o
.debug_macro 0x0000244c 0xb02 build/startup.o
.debug_macro 0x00002f4e 0x56 build/startup.o
.debug_macro 0x00002fa4 0x51 build/startup.o
.debug_macro 0x00002ff5 0xb5c build/timer.o
.debug_macro 0x00003b51 0x13e build/timer.o
.debug_macro 0x00003c8f 0xb74 build/usart.o
.debug_macro 0x00004803 0x82 build/usart.o
.debug_line 0x00000000 0x4b9
.debug_line 0x00000000 0x605
.debug_line 0x00000000 0x116 build/gpio.o
.debug_line 0x00000116 0x1da build/main.o
.debug_line 0x000002f0 0xea build/startup.o
.debug_line 0x000003da 0xdf build/timer.o
.debug_line 0x00000116 0x1e1 build/main.o
.debug_line 0x000002f7 0xea build/startup.o
.debug_line 0x000003e1 0xdf build/timer.o
.debug_line 0x000004c0 0x145 build/usart.o
.debug_str 0x00000000 0x5eb8
.debug_str 0x00000000 0x5372 build/gpio.o
0x551a (size before relaxing)
.debug_str 0x00005372 0xab2 build/main.o
0x5f7c (size before relaxing)
.debug_str 0x00005e24 0x88 build/startup.o
.debug_str 0x00000000 0x62fd
.debug_str 0x00000000 0x550b build/gpio.o
0x56b3 (size before relaxing)
.debug_str 0x0000550b 0xd3a build/main.o
0x639d (size before relaxing)
.debug_str 0x00006245 0x88 build/startup.o
0x3cdf (size before relaxing)
.debug_str 0x00005eac 0xc build/timer.o
0x5b1a (size before relaxing)
.debug_str 0x000062cd 0xc build/timer.o
0x5bc5 (size before relaxing)
.debug_str 0x000062d9 0x24 build/usart.o
0x5ffb (size before relaxing)
.comment 0x00000000 0x45
.comment 0x00000000 0x45 build/gpio.o
@@ -343,6 +396,7 @@ LOAD linker stubs
.comment 0x00000045 0x46 build/main.o
.comment 0x00000045 0x46 build/startup.o
.comment 0x00000045 0x46 build/timer.o
.comment 0x00000045 0x46 build/usart.o
.ARM.attributes
0x00000000 0x34
@@ -354,24 +408,30 @@ LOAD linker stubs
0x00000068 0x34 build/startup.o
.ARM.attributes
0x0000009c 0x34 build/timer.o
.ARM.attributes
0x000000d0 0x34 build/usart.o
.debug_line_str
0x00000000 0x283
0x00000000 0x293
.debug_line_str
0x00000000 0x24e build/gpio.o
0x260 (size before relaxing)
.debug_line_str
0x0000024e 0x23 build/main.o
0x27c (size before relaxing)
0x0000024e 0x2b build/main.o
0x284 (size before relaxing)
.debug_line_str
0x00000271 0xa build/startup.o
0x00000279 0xa build/startup.o
0x21b (size before relaxing)
.debug_line_str
0x0000027b 0x8 build/timer.o
0x00000283 0x8 build/timer.o
0x25e (size before relaxing)
.debug_line_str
0x0000028b 0x8 build/usart.o
0x26f (size before relaxing)
.debug_frame 0x00000000 0x16c
.debug_frame 0x00000000 0x1bc
.debug_frame 0x00000000 0x60 build/gpio.o
.debug_frame 0x00000060 0x50 build/main.o
.debug_frame 0x000000b0 0x6c build/startup.o
.debug_frame 0x0000011c 0x50 build/timer.o
.debug_frame 0x0000016c 0x50 build/usart.o

View File

@@ -182,16 +182,16 @@ gpio_write:
.file 4 "src/gpio.h"
.section .debug_info,"",%progbits
.Ldebug_info0:
.4byte 0x216
.4byte 0x201
.2byte 0x5
.byte 0x1
.byte 0x4
.4byte .Ldebug_abbrev0
.uleb128 0x9
.4byte .LASF894
.uleb128 0x8
.4byte .LASF908
.byte 0x1d
.4byte .LASF895
.4byte .LASF896
.4byte .LASF909
.4byte .LASF910
.4byte .LLRL0
.4byte 0
.4byte .Ldebug_line0
@@ -199,17 +199,17 @@ gpio_write:
.uleb128 0x1
.byte 0x1
.byte 0x6
.4byte .LASF863
.4byte .LASF877
.uleb128 0x1
.byte 0x1
.byte 0x8
.4byte .LASF864
.4byte .LASF878
.uleb128 0x1
.byte 0x2
.byte 0x5
.4byte .LASF865
.4byte .LASF879
.uleb128 0x3
.4byte .LASF868
.4byte .LASF882
.byte 0x2
.byte 0x39
.byte 0x1c
@@ -217,13 +217,13 @@ gpio_write:
.uleb128 0x1
.byte 0x2
.byte 0x7
.4byte .LASF866
.4byte .LASF880
.uleb128 0x1
.byte 0x4
.byte 0x5
.4byte .LASF867
.4byte .LASF881
.uleb128 0x3
.4byte .LASF869
.4byte .LASF883
.byte 0x2
.byte 0x4f
.byte 0x1b
@@ -231,21 +231,21 @@ gpio_write:
.uleb128 0x1
.byte 0x4
.byte 0x7
.4byte .LASF870
.4byte .LASF884
.uleb128 0x1
.byte 0x8
.byte 0x5
.4byte .LASF871
.4byte .LASF885
.uleb128 0x1
.byte 0x8
.byte 0x7
.4byte .LASF872
.uleb128 0xa
.4byte .LASF886
.uleb128 0x9
.byte 0x4
.byte 0x5
.ascii "int\000"
.uleb128 0x3
.4byte .LASF873
.4byte .LASF887
.byte 0x2
.byte 0xe8
.byte 0x16
@@ -253,123 +253,114 @@ gpio_write:
.uleb128 0x1
.byte 0x4
.byte 0x7
.4byte .LASF874
.4byte .LASF888
.uleb128 0x3
.4byte .LASF875
.4byte .LASF889
.byte 0x3
.byte 0x24
.byte 0x14
.4byte 0x3f
.uleb128 0x3
.4byte .LASF876
.4byte .LASF890
.byte 0x3
.byte 0x30
.byte 0x14
.4byte 0x59
.uleb128 0x6
.uleb128 0xa
.4byte 0xa0
.uleb128 0x3
.4byte .LASF877
.4byte .LASF891
.byte 0x3
.byte 0x52
.byte 0x15
.4byte 0x81
.uleb128 0xb
.4byte .LASF893
.byte 0x30
.4byte .LASF907
.byte 0x28
.byte 0x4
.byte 0x7
.byte 0x8
.4byte 0x139
.uleb128 0x2
.4byte .LASF878
.4byte .LASF892
.byte 0x8
.4byte 0xac
.byte 0
.uleb128 0x2
.4byte .LASF879
.4byte .LASF893
.byte 0x9
.4byte 0xac
.byte 0x4
.uleb128 0x2
.4byte .LASF880
.4byte .LASF894
.byte 0xa
.4byte 0xac
.byte 0x8
.uleb128 0x2
.4byte .LASF881
.4byte .LASF895
.byte 0xb
.4byte 0xac
.byte 0xc
.uleb128 0x7
.uleb128 0x6
.ascii "IDR\000"
.byte 0xc
.4byte 0xac
.byte 0x10
.uleb128 0x7
.uleb128 0x6
.ascii "ODR\000"
.byte 0xd
.4byte 0xac
.byte 0x14
.uleb128 0x2
.4byte .LASF882
.4byte .LASF896
.byte 0xe
.4byte 0xac
.byte 0x18
.uleb128 0x2
.4byte .LASF883
.4byte .LASF897
.byte 0xf
.4byte 0xac
.byte 0x1c
.uleb128 0x2
.4byte .LASF884
.4byte .LASF898
.byte 0x10
.4byte 0x149
.4byte 0xac
.byte 0x20
.uleb128 0x2
.4byte .LASF885
.4byte .LASF899
.byte 0x11
.4byte 0x149
.byte 0x28
.4byte 0xac
.byte 0x24
.byte 0
.uleb128 0xc
.4byte 0xac
.4byte 0x149
.uleb128 0xd
.4byte 0x8d
.byte 0x1
.byte 0
.uleb128 0x6
.4byte 0x139
.uleb128 0xe
.byte 0x7
.byte 0x1
.4byte 0x31
.byte 0x4
.byte 0x20
.byte 0x3a
.byte 0xe
.4byte 0x175
.4byte 0x160
.uleb128 0x4
.4byte .LASF886
.4byte .LASF900
.byte 0
.uleb128 0x4
.4byte .LASF887
.4byte .LASF901
.byte 0x1
.uleb128 0x4
.4byte .LASF888
.4byte .LASF902
.byte 0x2
.uleb128 0x4
.4byte .LASF889
.4byte .LASF903
.byte 0x3
.byte 0
.uleb128 0x3
.4byte .LASF890
.4byte .LASF904
.byte 0x4
.byte 0x25
.byte 0x3f
.byte 0x3
.4byte 0x14e
.uleb128 0xf
.4byte .LASF897
.4byte 0x139
.uleb128 0xd
.4byte .LASF911
.byte 0x1
.byte 0xd
.byte 0x6
@@ -377,7 +368,7 @@ gpio_write:
.4byte .LFE1-.LFB1
.uleb128 0x1
.byte 0x9c
.4byte 0x1c1
.4byte 0x1ac
.uleb128 0x5
.ascii "pin\000"
.byte 0xd
@@ -390,14 +381,14 @@ gpio_write:
.ascii "val\000"
.byte 0xd
.byte 0x23
.4byte 0x1c1
.4byte 0x1ac
.uleb128 0x2
.byte 0x91
.sleb128 -19
.uleb128 0x8
.4byte .LASF893
.uleb128 0x7
.4byte .LASF907
.byte 0xe
.4byte 0x1c8
.4byte 0x1b3
.uleb128 0x2
.byte 0x91
.sleb128 -12
@@ -405,12 +396,12 @@ gpio_write:
.uleb128 0x1
.byte 0x1
.byte 0x2
.4byte .LASF891
.uleb128 0x10
.4byte .LASF905
.uleb128 0xe
.byte 0x4
.4byte 0xbd
.uleb128 0x11
.4byte .LASF898
.uleb128 0xf
.4byte .LASF912
.byte 0x1
.byte 0x6
.byte 0x6
@@ -426,23 +417,23 @@ gpio_write:
.uleb128 0x2
.byte 0x91
.sleb128 -18
.uleb128 0x12
.4byte .LASF892
.uleb128 0x10
.4byte .LASF906
.byte 0x1
.byte 0x6
.byte 0x2c
.4byte 0x175
.4byte 0x160
.uleb128 0x2
.byte 0x91
.sleb128 -19
.uleb128 0x8
.4byte .LASF893
.uleb128 0x7
.4byte .LASF907
.byte 0x7
.4byte 0x1c8
.4byte 0x1b3
.uleb128 0x2
.byte 0x91
.sleb128 -12
.uleb128 0x13
.uleb128 0x11
.ascii "pn\000"
.byte 0x1
.byte 0x8
@@ -528,13 +519,6 @@ gpio_write:
.byte 0
.byte 0
.uleb128 0x6
.uleb128 0x35
.byte 0
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x7
.uleb128 0xd
.byte 0
.uleb128 0x3
@@ -553,7 +537,7 @@ gpio_write:
.uleb128 0xb
.byte 0
.byte 0
.uleb128 0x8
.uleb128 0x7
.uleb128 0x34
.byte 0
.uleb128 0x3
@@ -572,7 +556,7 @@ gpio_write:
.uleb128 0x18
.byte 0
.byte 0
.uleb128 0x9
.uleb128 0x8
.uleb128 0x11
.byte 0x1
.uleb128 0x25
@@ -593,7 +577,7 @@ gpio_write:
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0xa
.uleb128 0x9
.uleb128 0x24
.byte 0
.uleb128 0xb
@@ -604,6 +588,13 @@ gpio_write:
.uleb128 0x8
.byte 0
.byte 0
.uleb128 0xa
.uleb128 0x35
.byte 0
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xb
.uleb128 0x13
.byte 0x1
@@ -622,24 +613,6 @@ gpio_write:
.byte 0
.byte 0
.uleb128 0xc
.uleb128 0x1
.byte 0x1
.uleb128 0x49
.uleb128 0x13
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xd
.uleb128 0x21
.byte 0
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2f
.uleb128 0xb
.byte 0
.byte 0
.uleb128 0xe
.uleb128 0x4
.byte 0x1
.uleb128 0x3e
@@ -658,7 +631,7 @@ gpio_write:
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xf
.uleb128 0xd
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
@@ -685,7 +658,7 @@ gpio_write:
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x10
.uleb128 0xe
.uleb128 0xf
.byte 0
.uleb128 0xb
@@ -694,7 +667,7 @@ gpio_write:
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x11
.uleb128 0xf
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
@@ -719,7 +692,7 @@ gpio_write:
.uleb128 0x19
.byte 0
.byte 0
.uleb128 0x12
.uleb128 0x10
.uleb128 0x5
.byte 0
.uleb128 0x3
@@ -736,7 +709,7 @@ gpio_write:
.uleb128 0x18
.byte 0
.byte 0
.uleb128 0x13
.uleb128 0x11
.uleb128 0x34
.byte 0
.uleb128 0x3
@@ -3552,7 +3525,7 @@ gpio_write:
.uleb128 0x32
.4byte .LASF854
.byte 0
.section .debug_macro,"G",%progbits,wm4.gpio.h.2.d78c96d470f4347bf35ed0e3d72ef81e,comdat
.section .debug_macro,"G",%progbits,wm4.gpio.h.2.618f9f202e3921ef232a09b28d15fb8b,comdat
.Ldebug_macro15:
.2byte 0x5
.byte 0
@@ -3566,10 +3539,10 @@ gpio_write:
.uleb128 0x15
.4byte .LASF857
.byte 0x5
.uleb128 0x16
.uleb128 0x18
.4byte .LASF858
.byte 0x5
.uleb128 0x18
.uleb128 0x19
.4byte .LASF859
.byte 0x5
.uleb128 0x1a
@@ -3578,8 +3551,50 @@ gpio_write:
.uleb128 0x1c
.4byte .LASF861
.byte 0x5
.uleb128 0x1e
.uleb128 0x1d
.4byte .LASF862
.byte 0x5
.uleb128 0x1e
.4byte .LASF863
.byte 0x5
.uleb128 0x21
.4byte .LASF864
.byte 0x5
.uleb128 0x22
.4byte .LASF865
.byte 0x5
.uleb128 0x23
.4byte .LASF866
.byte 0x5
.uleb128 0x25
.4byte .LASF867
.byte 0x5
.uleb128 0x26
.4byte .LASF868
.byte 0x5
.uleb128 0x27
.4byte .LASF869
.byte 0x5
.uleb128 0x2e
.4byte .LASF870
.byte 0x5
.uleb128 0x2f
.4byte .LASF871
.byte 0x5
.uleb128 0x30
.4byte .LASF872
.byte 0x5
.uleb128 0x32
.4byte .LASF873
.byte 0x5
.uleb128 0x34
.4byte .LASF874
.byte 0x5
.uleb128 0x36
.4byte .LASF875
.byte 0x5
.uleb128 0x38
.4byte .LASF876
.byte 0
.section .debug_line,"",%progbits
.Ldebug_line0:
@@ -3624,7 +3639,7 @@ gpio_write:
.ascii "__PTRDIFF_MAX__ 0x7fffffff\000"
.LASF541:
.ascii "_LONG_DOUBLE long double\000"
.LASF893:
.LASF907:
.ascii "gpio\000"
.LASF591:
.ascii "INT_LEAST8_MIN (-__INT_LEAST8_MAX__ - 1)\000"
@@ -3632,7 +3647,7 @@ gpio_write:
.ascii "_UINT32_T_DECLARED \000"
.LASF90:
.ascii "__INTMAX_MAX__ 0x7fffffffffffffffLL\000"
.LASF888:
.LASF902:
.ascii "GPIO_MODE_AF\000"
.LASF335:
.ascii "__TQ_IBIT__ 0\000"
@@ -3696,6 +3711,8 @@ gpio_write:
.ascii "PRIXFAST32 __PRI32FAST(X)\000"
.LASF525:
.ascii "__INT8 \"hh\"\000"
.LASF860:
.ascii "GPIO_MODER_MODER3_AF (0b10)\000"
.LASF47:
.ascii "__UINT8_TYPE__ unsigned char\000"
.LASF368:
@@ -3704,6 +3721,8 @@ gpio_write:
.ascii "INT_LEAST16_MAX (__INT_LEAST16_MAX__)\000"
.LASF703:
.ascii "SCNiFAST8 __SCN8FAST(i)\000"
.LASF856:
.ascii "GPIOA_BASE_ADDR (0x40020000U)\000"
.LASF120:
.ascii "__UINT_LEAST16_MAX__ 0xffff\000"
.LASF616:
@@ -3746,11 +3765,13 @@ gpio_write:
.ascii "__need_wchar_t\000"
.LASF199:
.ascii "__FLT32_MIN_EXP__ (-125)\000"
.LASF894:
.LASF908:
.ascii "GNU C2X 12.3.1 20230626 -mcpu=cortex-m4 -mthumb -mf"
.ascii "loat-abi=hard -mfpu=fpv4-sp-d16 -march=armv7e-m+fp "
.ascii "-g3 -ggdb -O0 -std=c2x -ffunction-sections -fdata-s"
.ascii "ections -fno-builtin -fno-common\000"
.LASF864:
.ascii "GPIO_AFRL_AFRL3_BIT 12\000"
.LASF595:
.ascii "INT16_MAX (__INT16_MAX__)\000"
.LASF502:
@@ -3831,7 +3852,7 @@ gpio_write:
.ascii "__INT64 \"ll\"\000"
.LASF138:
.ascii "__INTPTR_MAX__ 0x7fffffff\000"
.LASF858:
.LASF872:
.ascii "GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADD"
.ascii "R + (GPIO_PORT_OFFSET * port)))\000"
.LASF499:
@@ -3867,7 +3888,7 @@ gpio_write:
.ascii "PRId64 __PRI64(d)\000"
.LASF302:
.ascii "__UACCUM_IBIT__ 16\000"
.LASF867:
.LASF881:
.ascii "long int\000"
.LASF818:
.ascii "PRIXFAST64 __PRI64FAST(X)\000"
@@ -3903,6 +3924,8 @@ gpio_write:
.ascii "__GCC_ATOMIC_BOOL_LOCK_FREE 2\000"
.LASF554:
.ascii "___int64_t_defined 1\000"
.LASF863:
.ascii "GPIO_MODER_MODER2_AF (0b10)\000"
.LASF432:
.ascii "__ARM_NEON__\000"
.LASF587:
@@ -3963,7 +3986,7 @@ gpio_write:
.ascii "PRIoLEAST16 __PRI16LEAST(o)\000"
.LASF458:
.ascii "__NEWLIB__ 4\000"
.LASF886:
.LASF900:
.ascii "GPIO_MODE_INPUT\000"
.LASF720:
.ascii "SCNi16 __SCN16(i)\000"
@@ -3973,7 +3996,7 @@ gpio_write:
.ascii "__FLT_DECIMAL_DIG__ 9\000"
.LASF562:
.ascii "_UINT8_T_DECLARED \000"
.LASF863:
.LASF877:
.ascii "signed char\000"
.LASF805:
.ascii "PRIuLEAST64 __PRI64LEAST(u)\000"
@@ -3985,7 +4008,7 @@ gpio_write:
.ascii "__ARM_FEATURE_FMA 1\000"
.LASF364:
.ascii "__GNUC_STDC_INLINE__ 1\000"
.LASF890:
.LASF904:
.ascii "GPIO_MODE\000"
.LASF256:
.ascii "__FRACT_FBIT__ 15\000"
@@ -4007,9 +4030,11 @@ gpio_write:
.ascii "__SACCUM_MAX__ 0X7FFFP-7HK\000"
.LASF219:
.ascii "__FLT64_MAX_10_EXP__ 308\000"
.LASF868:
.ascii "GPIO_AFRL_AFRL2_MASK (0b1111)\000"
.LASF65:
.ascii "__UINT_FAST32_TYPE__ unsigned int\000"
.LASF864:
.LASF878:
.ascii "unsigned char\000"
.LASF3:
.ascii "__STDC_UTF_32__ 1\000"
@@ -4057,13 +4082,13 @@ gpio_write:
.ascii "__int_fast64_t_defined 1\000"
.LASF837:
.ascii "__PRIPTR(x) __STRINGIFY(x)\000"
.LASF875:
.LASF889:
.ascii "uint16_t\000"
.LASF417:
.ascii "__thumb2__ 1\000"
.LASF321:
.ascii "__ULLACCUM_FBIT__ 32\000"
.LASF891:
.LASF905:
.ascii "_Bool\000"
.LASF366:
.ascii "__STRICT_ANSI__ 1\000"
@@ -4081,7 +4106,7 @@ gpio_write:
.ascii "__PRAGMA_REDEFINE_EXTNAME 1\000"
.LASF36:
.ascii "__WCHAR_TYPE__ unsigned int\000"
.LASF887:
.LASF901:
.ascii "GPIO_MODE_OUTPUT\000"
.LASF357:
.ascii "__USA_IBIT__ 16\000"
@@ -4119,7 +4144,7 @@ gpio_write:
.ascii "__SCN64(x) __INT64 __STRINGIFY(x)\000"
.LASF646:
.ascii "_GCC_WRAP_STDINT_H \000"
.LASF868:
.LASF882:
.ascii "__uint16_t\000"
.LASF224:
.ascii "__FLT64_EPSILON__ 2.2204460492503131e-16F64\000"
@@ -4147,7 +4172,7 @@ gpio_write:
.ascii "INTMAX_MAX (__INTMAX_MAX__)\000"
.LASF601:
.ascii "INT32_MAX (__INT32_MAX__)\000"
.LASF859:
.LASF873:
.ascii "BIT(x) (1 << x)\000"
.LASF469:
.ascii "_MB_LEN_MAX 8\000"
@@ -4165,6 +4190,8 @@ gpio_write:
.ascii "_END_STD_C \000"
.LASF852:
.ascii "true ((_Bool)+1u)\000"
.LASF865:
.ascii "GPIO_AFRL_AFRL3_MASK (0b1111)\000"
.LASF599:
.ascii "UINT_LEAST16_MAX (__UINT_LEAST16_MAX__)\000"
.LASF123:
@@ -4177,7 +4204,7 @@ gpio_write:
.ascii "__FLT_EPSILON__ 1.1920928955078125e-7F\000"
.LASF376:
.ascii "__GCC_ATOMIC_SHORT_LOCK_FREE 2\000"
.LASF860:
.LASF874:
.ascii "PIN(port,num) ((((port) - 'A') << 8) | num)\000"
.LASF806:
.ascii "PRIxLEAST64 __PRI64LEAST(x)\000"
@@ -4243,6 +4270,8 @@ gpio_write:
.ascii "__FP_FAST_FMAF 1\000"
.LASF628:
.ascii "SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)\000"
.LASF869:
.ascii "GPIO_AFRL_AFRL2_USART2_TX (0b0111)\000"
.LASF564:
.ascii "_INT16_T_DECLARED \000"
.LASF245:
@@ -4285,6 +4314,8 @@ gpio_write:
.ascii "INT64_C(x) __INT64_C(x)\000"
.LASF615:
.ascii "INT_FAST16_MIN (-__INT_FAST16_MAX__ - 1)\000"
.LASF862:
.ascii "GPIO_MODER_MODER2_MASK (0b11)\000"
.LASF106:
.ascii "__INT_LEAST8_MAX__ 0x7f\000"
.LASF383:
@@ -4333,7 +4364,7 @@ gpio_write:
.ascii "___int8_t_defined 1\000"
.LASF248:
.ascii "__SFRACT_MIN__ (-0.5HR-0.5HR)\000"
.LASF870:
.LASF884:
.ascii "long unsigned int\000"
.LASF349:
.ascii "__SA_IBIT__ 16\000"
@@ -4349,7 +4380,7 @@ gpio_write:
.ascii "__ARM_FP16_FORMAT_IEEE\000"
.LASF48:
.ascii "__UINT16_TYPE__ short unsigned int\000"
.LASF897:
.LASF911:
.ascii "gpio_write\000"
.LASF569:
.ascii "__int32_t_defined 1\000"
@@ -4361,7 +4392,7 @@ gpio_write:
.ascii "__FLT_EVAL_METHOD_TS_18661_3__ 0\000"
.LASF521:
.ascii "int +2\000"
.LASF896:
.LASF910:
.ascii "/home/alex/code/own/c-compile-experiments\000"
.LASF636:
.ascii "INT8_C(x) __INT8_C(x)\000"
@@ -4395,7 +4426,7 @@ gpio_write:
.ascii "SCNx8 __SCN8(x)\000"
.LASF208:
.ascii "__FLT32_DENORM_MIN__ 1.4012984643248171e-45F32\000"
.LASF898:
.LASF912:
.ascii "gpio_set_mode\000"
.LASF125:
.ascii "__UINT64_C(c) c ## ULL\000"
@@ -4407,6 +4438,8 @@ gpio_write:
.ascii "__USFRACT_FBIT__ 8\000"
.LASF191:
.ascii "__LDBL_EPSILON__ 2.2204460492503131e-16L\000"
.LASF857:
.ascii "GPIOA ((struct gpio *) GPIOA_BASE_ADDR)\000"
.LASF729:
.ascii "PRIXLEAST16 __PRI16LEAST(X)\000"
.LASF622:
@@ -4415,7 +4448,7 @@ gpio_write:
.ascii "__GCC_ATOMIC_CHAR16_T_LOCK_FREE 2\000"
.LASF789:
.ascii "__PRI64FAST(x) __FAST64 __STRINGIFY(x)\000"
.LASF877:
.LASF891:
.ascii "uintptr_t\000"
.LASF168:
.ascii "__DBL_MAX_EXP__ 1024\000"
@@ -4463,7 +4496,7 @@ gpio_write:
.ascii "PRIX32 __PRI32(X)\000"
.LASF773:
.ascii "SCNxLEAST32 __SCN32LEAST(x)\000"
.LASF880:
.LASF894:
.ascii "OSPEEDR\000"
.LASF711:
.ascii "__SCN16LEAST(x) __LEAST16 __STRINGIFY(x)\000"
@@ -4493,7 +4526,7 @@ gpio_write:
.ascii "__ULACCUM_MIN__ 0.0ULK\000"
.LASF461:
.ascii "_ATEXIT_DYNAMIC_ALLOC 1\000"
.LASF869:
.LASF883:
.ascii "__uint32_t\000"
.LASF188:
.ascii "__LDBL_MAX__ 1.7976931348623157e+308L\000"
@@ -4503,7 +4536,7 @@ gpio_write:
.ascii "__FLT_RADIX__ 2\000"
.LASF454:
.ascii "_INTTYPES_H \000"
.LASF871:
.LASF885:
.ascii "long long int\000"
.LASF401:
.ascii "__ARM_FEATURE_CMSE\000"
@@ -4539,6 +4572,8 @@ gpio_write:
.ascii "__WCHAR_T \000"
.LASF223:
.ascii "__FLT64_MIN__ 2.2250738585072014e-308F64\000"
.LASF866:
.ascii "GPIO_AFRL_AFRL3_USART2_RX (0b0111)\000"
.LASF553:
.ascii "___int32_t_defined 1\000"
.LASF83:
@@ -4608,7 +4643,7 @@ gpio_write:
.ascii "\000"
.LASF582:
.ascii "__int_fast16_t_defined 1\000"
.LASF878:
.LASF892:
.ascii "MODER\000"
.LASF482:
.ascii "__FLOAT_TYPE float\000"
@@ -4619,9 +4654,9 @@ gpio_write:
.ascii "L)\000"
.LASF607:
.ascii "INT64_MAX (__INT64_MAX__)\000"
.LASF874:
.LASF888:
.ascii "unsigned int\000"
.LASF873:
.LASF887:
.ascii "__uintptr_t\000"
.LASF459:
.ascii "__NEWLIB_MINOR__ 3\000"
@@ -4653,7 +4688,7 @@ gpio_write:
.ascii "__CHAR_BIT__ 8\000"
.LASF143:
.ascii "__FLT_EVAL_METHOD__ 0\000"
.LASF865:
.LASF879:
.ascii "short int\000"
.LASF685:
.ascii "PRIdLEAST8 __PRI8LEAST(d)\000"
@@ -4779,6 +4814,8 @@ gpio_write:
.ascii "__UFRACT_IBIT__ 0\000"
.LASF399:
.ascii "__ARM_32BIT_STATE 1\000"
.LASF861:
.ascii "GPIO_MODER_MODER2_BIT 4\000"
.LASF107:
.ascii "__INT8_C(c) c\000"
.LASF267:
@@ -4791,12 +4828,14 @@ gpio_write:
.ascii "SCNuFAST16 __SCN16FAST(u)\000"
.LASF801:
.ascii "SCNx64 __SCN64(x)\000"
.LASF862:
.LASF876:
.ascii "PINPORT(pin) (pin >> 8)\000"
.LASF198:
.ascii "__FLT32_DIG__ 6\000"
.LASF645:
.ascii "UINTMAX_C(x) __UINTMAX_C(x)\000"
.LASF859:
.ascii "GPIO_MODER_MODER3_MASK (0b11)\000"
.LASF623:
.ascii "UINT_FAST64_MAX (__UINT_FAST64_MAX__)\000"
.LASF515:
@@ -4839,7 +4878,7 @@ gpio_write:
.ascii "__ORDER_LITTLE_ENDIAN__ 1234\000"
.LASF155:
.ascii "__FLT_NORM_MAX__ 3.4028234663852886e+38F\000"
.LASF872:
.LASF886:
.ascii "long long unsigned int\000"
.LASF611:
.ascii "UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)\000"
@@ -4869,6 +4908,8 @@ gpio_write:
.ascii "SCNdFAST32 __SCN32FAST(d)\000"
.LASF339:
.ascii "__UHQ_IBIT__ 0\000"
.LASF858:
.ascii "GPIO_MODER_MODER3_BIT 7\000"
.LASF60:
.ascii "__INT_FAST16_TYPE__ int\000"
.LASF631:
@@ -4917,11 +4958,11 @@ gpio_write:
.ascii "SCNdFAST8 __SCN8FAST(d)\000"
.LASF576:
.ascii "_UINTPTR_T_DECLARED \000"
.LASF885:
.LASF899:
.ascii "AFRH\000"
.LASF314:
.ascii "__ULACCUM_MAX__ 0XFFFFFFFFFFFFFFFFP-32ULK\000"
.LASF884:
.LASF898:
.ascii "AFRL\000"
.LASF273:
.ascii "__ULFRACT_MIN__ 0.0ULR\000"
@@ -4935,7 +4976,7 @@ gpio_write:
.ascii "__INT32_TYPE__ long int\000"
.LASF118:
.ascii "__UINT_LEAST8_MAX__ 0xff\000"
.LASF883:
.LASF897:
.ascii "LCKR\000"
.LASF520:
.ascii "__int20__ +2\000"
@@ -4981,7 +5022,7 @@ gpio_write:
.ascii "__QQ_IBIT__ 0\000"
.LASF763:
.ascii "PRIdLEAST32 __PRI32LEAST(d)\000"
.LASF879:
.LASF893:
.ascii "OTYPER\000"
.LASF811:
.ascii "SCNuLEAST64 __SCN64LEAST(u)\000"
@@ -5001,11 +5042,11 @@ gpio_write:
.ascii "__GNUC_MINOR__ 3\000"
.LASF57:
.ascii "__UINT_LEAST32_TYPE__ long unsigned int\000"
.LASF895:
.LASF909:
.ascii "src/gpio.c\000"
.LASF405:
.ascii "__ARM_FEATURE_NUMERIC_MAXMIN\000"
.LASF856:
.LASF870:
.ascii "GPIO_BASE_ADDR (0x40020000U)\000"
.LASF38:
.ascii "__INTMAX_TYPE__ long long int\000"
@@ -5057,7 +5098,7 @@ gpio_write:
.ascii "__SCN8(x) __INT8 __STRINGIFY(x)\000"
.LASF23:
.ascii "__SIZEOF_SIZE_T__ 4\000"
.LASF857:
.LASF871:
.ascii "GPIO_PORT_OFFSET (0x400U)\000"
.LASF50:
.ascii "__UINT64_TYPE__ long long unsigned int\000"
@@ -5067,6 +5108,8 @@ gpio_write:
.ascii "__INT64_C(c) c ## LL\000"
.LASF699:
.ascii "PRIuFAST8 __PRI8FAST(u)\000"
.LASF867:
.ascii "GPIO_AFRL_AFRL2_BIT 8\000"
.LASF190:
.ascii "__LDBL_MIN__ 2.2250738585072014e-308L\000"
.LASF445:
@@ -5075,7 +5118,7 @@ gpio_write:
.ascii "__ACCUM_IBIT__ 16\000"
.LASF509:
.ascii "unsigned\000"
.LASF881:
.LASF895:
.ascii "PUPDR\000"
.LASF835:
.ascii "SCNuMAX __SCNMAX(u)\000"
@@ -5085,7 +5128,7 @@ gpio_write:
.ascii "_ATTRIBUTE(attrs) __attribute__ (attrs)\000"
.LASF359:
.ascii "__UDA_IBIT__ 32\000"
.LASF892:
.LASF906:
.ascii "mode\000"
.LASF586:
.ascii "INTPTR_MAX (__INTPTR_MAX__)\000"
@@ -5099,7 +5142,7 @@ gpio_write:
.ascii "__UHQ_FBIT__ 16\000"
.LASF443:
.ascii "__ARM_FEATURE_COPROC\000"
.LASF889:
.LASF903:
.ascii "GPIO_MODE_ANALOG\000"
.LASF177:
.ascii "__DBL_HAS_INFINITY__ 1\000"
@@ -5137,7 +5180,7 @@ gpio_write:
.ascii "__FAST8 \000"
.LASF496:
.ascii "__XSI_VISIBLE 0\000"
.LASF882:
.LASF896:
.ascii "BSRR\000"
.LASF794:
.ascii "PRIu64 __PRI64(u)\000"
@@ -5225,7 +5268,7 @@ gpio_write:
.ascii "PRIx32 __PRI32(x)\000"
.LASF278:
.ascii "__LLFRACT_MIN__ (-0.5LLR-0.5LLR)\000"
.LASF876:
.LASF890:
.ascii "uint32_t\000"
.LASF689:
.ascii "PRIxLEAST8 __PRI8LEAST(x)\000"
@@ -5273,13 +5316,13 @@ gpio_write:
.ascii "__INT_LEAST16_TYPE__ short int\000"
.LASF326:
.ascii "__QQ_FBIT__ 7\000"
.LASF861:
.LASF875:
.ascii "PINNUM(pin) (pin & 0b1111)\000"
.LASF768:
.ascii "PRIXLEAST32 __PRI32LEAST(X)\000"
.LASF171:
.ascii "__DBL_MAX__ ((double)1.7976931348623157e+308L)\000"
.LASF866:
.LASF880:
.ascii "short unsigned int\000"
.LASF276:
.ascii "__LLFRACT_FBIT__ 63\000"

View File

@@ -1995,10 +1995,36 @@ struct gpio {
volatile uint32_t ODR;
volatile uint32_t BSRR;
volatile uint32_t LCKR;
volatile uint32_t AFRL[2];
volatile uint32_t AFRH[2];
volatile uint32_t AFRL;
volatile uint32_t AFRH;
};
#define GPIOA_BASE_ADDR (0x40020000U)
#define GPIOA ((struct gpio *) GPIOA_BASE_ADDR)
#define GPIO_MODER_MODER3_BIT 7
#define GPIO_MODER_MODER3_MASK (0b11)
#define GPIO_MODER_MODER3_AF (0b10)
#define GPIO_MODER_MODER2_BIT 4
#define GPIO_MODER_MODER2_MASK (0b11)
#define GPIO_MODER_MODER2_AF (0b10)
#define GPIO_AFRL_AFRL3_BIT 12
#define GPIO_AFRL_AFRL3_MASK (0b1111)
#define GPIO_AFRL_AFRL3_USART2_RX (0b0111)
#define GPIO_AFRL_AFRL2_BIT 8
#define GPIO_AFRL_AFRL2_MASK (0b1111)
#define GPIO_AFRL_AFRL2_USART2_TX (0b0111)
#define GPIO_BASE_ADDR (0x40020000U)
#define GPIO_PORT_OFFSET (0x400U)
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))
@@ -2020,9 +2046,9 @@ typedef enum {
void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
void gpio_write(uint16_t pin,
# 40 "src/gpio.h" 3 4
# 66 "src/gpio.h" 3 4
_Bool
# 40 "src/gpio.h"
# 66 "src/gpio.h"
val);
# 5 "src/gpio.c" 2

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -2097,9 +2097,17 @@ struct rcc {
#define RCC_CFGR_SW(clock) ((clock & RCC_CFGR_SW_MASK) << RCC_CFGR_SW_BIT)
#define RCC_AHB1ENR_GPIOAEN_BIT 0
#define RCC_AHB1ENR_GPIOAEN_ENABLE (1 << RCC_AHB1ENR_GPIOAEN_BIT)
#define RCC_APB1ENR_PWREN_BIT 28
#define RCC_APB1ENR_PWREN_CLOCK_ENABLE (1 << RCC_APB1ENR_PWREN_BIT)
#define RCC_APB1ENR_USART2EN_BIT 17
#define RCC_APB1ENR_USART2EN_ENABLE (1 << RCC_APB1ENR_USART2EN_BIT)
#define RCC_APB1ENR_TIM4_BIT 2
#define RCC_APB1ENR_TIM4_ENABLE (1 << RCC_APB1ENR_TIM4_BIT)
# 5 "src/main.c" 2
@@ -2119,10 +2127,36 @@ struct gpio {
volatile uint32_t ODR;
volatile uint32_t BSRR;
volatile uint32_t LCKR;
volatile uint32_t AFRL[2];
volatile uint32_t AFRH[2];
volatile uint32_t AFRL;
volatile uint32_t AFRH;
};
#define GPIOA_BASE_ADDR (0x40020000U)
#define GPIOA ((struct gpio *) GPIOA_BASE_ADDR)
#define GPIO_MODER_MODER3_BIT 7
#define GPIO_MODER_MODER3_MASK (0b11)
#define GPIO_MODER_MODER3_AF (0b10)
#define GPIO_MODER_MODER2_BIT 4
#define GPIO_MODER_MODER2_MASK (0b11)
#define GPIO_MODER_MODER2_AF (0b10)
#define GPIO_AFRL_AFRL3_BIT 12
#define GPIO_AFRL_AFRL3_MASK (0b1111)
#define GPIO_AFRL_AFRL3_USART2_RX (0b0111)
#define GPIO_AFRL_AFRL2_BIT 8
#define GPIO_AFRL_AFRL2_MASK (0b1111)
#define GPIO_AFRL_AFRL2_USART2_TX (0b0111)
#define GPIO_BASE_ADDR (0x40020000U)
#define GPIO_PORT_OFFSET (0x400U)
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))
@@ -2144,9 +2178,9 @@ typedef enum {
void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
void gpio_write(uint16_t pin,
# 40 "src/gpio.h" 3 4
# 66 "src/gpio.h" 3 4
_Bool
# 40 "src/gpio.h"
# 66 "src/gpio.h"
val);
# 6 "src/main.c" 2
# 1 "src/flash.h" 1
@@ -2237,12 +2271,58 @@ struct timer {
#define TIM4_BASE_ADDR (0x40000800U)
#define TIM4 ((struct timer *) TIM4_BASE_ADDR)
#define TIM4_CR_CEN_BIT 0
#define TIM4_ENABLE (1 << TIM4_CR_CEN_BIT)
#define TIM_CR1_CEN_BIT 0
#define TIM_ENABLE (1 << TIM_CR1_CEN_BIT)
void tim4_init(void);
void tim4_start(void);
# 9 "src/main.c" 2
# 1 "src/usart.h" 1
#define USART_H_
struct usart {
volatile uint32_t SR;
volatile uint32_t DR;
volatile uint32_t BRR;
volatile uint32_t CR1;
volatile uint32_t CR2;
volatile uint32_t CR3;
volatile uint32_t GTPR;
};
#define USART2_BASE_ADDR (0x40004400U)
#define USART2 ((struct usart *) USART2_BASE_ADDR)
#define USART_CR1_OVER8_BIT 15
#define USART_CR1_OVER8_8 (1 << USART_CR1_OVER8_BIT)
#define USART_CR1_UE_BIT 13
#define USART_CR1_UE_ENABLE (1 << USART_CR1_UE_BIT)
#define USART_CR1_TE_BIT 3
#define USART_CR1_TE_ENABLE (1 << USART_CR1_TE_BIT)
#define USART_CR1_RE_BIT 2
#define USART_CR1_RE_ENABLE (1 << USART_CR1_RE_BIT)
#define USART_BRR_MANTISSA_BIT 4
#define USART_BRR_MANTISSA_MASK (0b111111111111)
#define USART_BRR_FRACTION_BIT 0
#define USART_BRR_FRACTION_MASK (0b111)
void usart2_init(void);
void usart2_start(void);
# 10 "src/main.c" 2
#define exit 42
@@ -2313,7 +2393,9 @@ static void system_clock_init(void) {
int main(void) {
(void) system_clock_init();
(void) tim4_init();
(void) usart2_init();
(void) tim4_start();
(void) tim4_start();
uint16_t led = (((('C') - 'A') << 8) | 13);
@@ -2322,13 +2404,13 @@ int main(void) {
uint16_t counter = ((struct timer *) (0x40000800U))->CNT;
# 87 "src/main.c" 3 4
# 90 "src/main.c" 3 4
_Bool
# 87 "src/main.c"
# 90 "src/main.c"
led_on =
# 87 "src/main.c" 3 4
# 90 "src/main.c" 3 4
((_Bool)+0u)
# 87 "src/main.c"
# 90 "src/main.c"
;
while(1) {
if ((((struct timer *) (0x40000800U))->CNT - counter) >= 250) {

Binary file not shown.

View File

@@ -136,10 +136,10 @@ tim4_start:
.byte 0x4
.4byte .Ldebug_abbrev0
.uleb128 0x7
.4byte .LASF956
.4byte .LASF960
.byte 0x1d
.4byte .LASF957
.4byte .LASF958
.4byte .LASF961
.4byte .LASF962
.4byte .LLRL0
.4byte 0
.4byte .Ldebug_line0
@@ -147,17 +147,17 @@ tim4_start:
.uleb128 0x3
.byte 0x1
.byte 0x6
.4byte .LASF904
.4byte .LASF908
.uleb128 0x3
.byte 0x1
.byte 0x8
.4byte .LASF905
.4byte .LASF909
.uleb128 0x3
.byte 0x2
.byte 0x5
.4byte .LASF906
.4byte .LASF910
.uleb128 0x4
.4byte .LASF909
.4byte .LASF913
.byte 0x2
.byte 0x39
.byte 0x1c
@@ -165,13 +165,13 @@ tim4_start:
.uleb128 0x3
.byte 0x2
.byte 0x7
.4byte .LASF907
.4byte .LASF911
.uleb128 0x3
.byte 0x4
.byte 0x5
.4byte .LASF908
.4byte .LASF912
.uleb128 0x4
.4byte .LASF910
.4byte .LASF914
.byte 0x2
.byte 0x4f
.byte 0x1b
@@ -179,15 +179,15 @@ tim4_start:
.uleb128 0x3
.byte 0x4
.byte 0x7
.4byte .LASF911
.4byte .LASF915
.uleb128 0x3
.byte 0x8
.byte 0x5
.4byte .LASF912
.4byte .LASF916
.uleb128 0x3
.byte 0x8
.byte 0x7
.4byte .LASF913
.4byte .LASF917
.uleb128 0x8
.byte 0x4
.byte 0x5
@@ -195,15 +195,15 @@ tim4_start:
.uleb128 0x3
.byte 0x4
.byte 0x7
.4byte .LASF914
.4byte .LASF918
.uleb128 0x4
.4byte .LASF915
.4byte .LASF919
.byte 0x3
.byte 0x24
.byte 0x14
.4byte 0x3f
.uleb128 0x4
.4byte .LASF916
.4byte .LASF920
.byte 0x3
.byte 0x30
.byte 0x14
@@ -224,13 +224,13 @@ tim4_start:
.4byte 0xa0
.byte 0
.uleb128 0x1
.4byte .LASF917
.4byte .LASF921
.byte 0x4
.byte 0x8
.4byte 0xa0
.byte 0x4
.uleb128 0x1
.4byte .LASF918
.4byte .LASF922
.byte 0x4
.byte 0x9
.4byte 0xa0
@@ -242,115 +242,115 @@ tim4_start:
.4byte 0xa0
.byte 0xc
.uleb128 0x1
.4byte .LASF919
.4byte .LASF923
.byte 0x4
.byte 0xb
.4byte 0xa0
.byte 0x10
.uleb128 0x1
.4byte .LASF920
.4byte .LASF924
.byte 0x4
.byte 0xc
.4byte 0xa0
.byte 0x14
.uleb128 0x1
.4byte .LASF921
.4byte .LASF925
.byte 0x4
.byte 0xd
.4byte 0x212
.byte 0x18
.uleb128 0x1
.4byte .LASF922
.4byte .LASF926
.byte 0x4
.byte 0xe
.4byte 0xa0
.byte 0x20
.uleb128 0x1
.4byte .LASF923
.4byte .LASF927
.byte 0x4
.byte 0xf
.4byte 0xa0
.byte 0x24
.uleb128 0x1
.4byte .LASF924
.4byte .LASF928
.byte 0x4
.byte 0x10
.4byte 0x212
.byte 0x28
.uleb128 0x1
.4byte .LASF925
.4byte .LASF929
.byte 0x4
.byte 0x11
.4byte 0xa0
.byte 0x30
.uleb128 0x1
.4byte .LASF926
.4byte .LASF930
.byte 0x4
.byte 0x12
.4byte 0xa0
.byte 0x34
.uleb128 0x1
.4byte .LASF927
.4byte .LASF931
.byte 0x4
.byte 0x13
.4byte 0x212
.byte 0x38
.uleb128 0x1
.4byte .LASF928
.4byte .LASF932
.byte 0x4
.byte 0x14
.4byte 0xa0
.byte 0x40
.uleb128 0x1
.4byte .LASF929
.4byte .LASF933
.byte 0x4
.byte 0x15
.4byte 0xa0
.byte 0x44
.uleb128 0x1
.4byte .LASF930
.4byte .LASF934
.byte 0x4
.byte 0x16
.4byte 0x212
.byte 0x48
.uleb128 0x1
.4byte .LASF931
.4byte .LASF935
.byte 0x4
.byte 0x17
.4byte 0xa0
.byte 0x50
.uleb128 0x1
.4byte .LASF932
.4byte .LASF936
.byte 0x4
.byte 0x18
.4byte 0xa0
.byte 0x54
.uleb128 0x1
.4byte .LASF933
.4byte .LASF937
.byte 0x4
.byte 0x19
.4byte 0x212
.byte 0x58
.uleb128 0x1
.4byte .LASF934
.4byte .LASF938
.byte 0x4
.byte 0x1a
.4byte 0xa0
.byte 0x60
.uleb128 0x1
.4byte .LASF935
.4byte .LASF939
.byte 0x4
.byte 0x1b
.4byte 0xa0
.byte 0x64
.uleb128 0x1
.4byte .LASF936
.4byte .LASF940
.byte 0x4
.byte 0x1c
.4byte 0x212
.byte 0x68
.uleb128 0x1
.4byte .LASF937
.4byte .LASF941
.byte 0x4
.byte 0x1d
.4byte 0xa0
@@ -362,25 +362,25 @@ tim4_start:
.4byte 0xa0
.byte 0x74
.uleb128 0x1
.4byte .LASF938
.4byte .LASF942
.byte 0x4
.byte 0x1f
.4byte 0x212
.byte 0x78
.uleb128 0x1
.4byte .LASF939
.4byte .LASF943
.byte 0x4
.byte 0x20
.4byte 0xa0
.byte 0x80
.uleb128 0x1
.4byte .LASF940
.4byte .LASF944
.byte 0x4
.byte 0x21
.4byte 0xa0
.byte 0x84
.uleb128 0x1
.4byte .LASF941
.4byte .LASF945
.byte 0x4
.byte 0x22
.4byte 0xa0
@@ -396,7 +396,7 @@ tim4_start:
.uleb128 0x5
.4byte 0x202
.uleb128 0xc
.4byte .LASF942
.4byte .LASF946
.byte 0x50
.byte 0x5
.byte 0x6
@@ -415,13 +415,13 @@ tim4_start:
.4byte 0xa0
.byte 0x4
.uleb128 0x1
.4byte .LASF943
.4byte .LASF947
.byte 0x5
.byte 0x9
.4byte 0xa0
.byte 0x8
.uleb128 0x1
.4byte .LASF944
.4byte .LASF948
.byte 0x5
.byte 0xa
.4byte 0xa0
@@ -439,19 +439,19 @@ tim4_start:
.4byte 0xa0
.byte 0x14
.uleb128 0x1
.4byte .LASF945
.4byte .LASF949
.byte 0x5
.byte 0xd
.4byte 0xa0
.byte 0x18
.uleb128 0x1
.4byte .LASF946
.4byte .LASF950
.byte 0x5
.byte 0xe
.4byte 0xa0
.byte 0x1c
.uleb128 0x1
.4byte .LASF947
.4byte .LASF951
.byte 0x5
.byte 0xf
.4byte 0xa0
@@ -481,31 +481,31 @@ tim4_start:
.4byte 0xa0
.byte 0x30
.uleb128 0x1
.4byte .LASF948
.4byte .LASF952
.byte 0x5
.byte 0x14
.4byte 0xa0
.byte 0x34
.uleb128 0x1
.4byte .LASF949
.4byte .LASF953
.byte 0x5
.byte 0x15
.4byte 0xa0
.byte 0x38
.uleb128 0x1
.4byte .LASF950
.4byte .LASF954
.byte 0x5
.byte 0x16
.4byte 0xa0
.byte 0x3c
.uleb128 0x1
.4byte .LASF951
.4byte .LASF955
.byte 0x5
.byte 0x17
.4byte 0xa0
.byte 0x40
.uleb128 0x1
.4byte .LASF952
.4byte .LASF956
.byte 0x5
.byte 0x18
.4byte 0xa0
@@ -517,21 +517,21 @@ tim4_start:
.4byte 0xa0
.byte 0x48
.uleb128 0x1
.4byte .LASF953
.4byte .LASF957
.byte 0x5
.byte 0x1a
.4byte 0xa0
.byte 0x4c
.byte 0
.uleb128 0x6
.4byte .LASF954
.4byte .LASF958
.byte 0x14
.4byte .LFB1
.4byte .LFE1-.LFB1
.uleb128 0x1
.byte 0x9c
.uleb128 0x6
.4byte .LASF955
.4byte .LASF959
.byte 0x4
.4byte .LFB0
.4byte .LFE0-.LFB0
@@ -3501,7 +3501,7 @@ tim4_start:
.uleb128 0x135
.4byte .LASF850
.byte 0
.section .debug_macro,"G",%progbits,wm4.rcc.h.37.7ab56e8f55874aebd4da18716582113c,comdat
.section .debug_macro,"G",%progbits,wm4.rcc.h.37.a17300cb822ec078eaa06c79bfd3d786,comdat
.Ldebug_macro14:
.2byte 0x5
.byte 0
@@ -3638,43 +3638,53 @@ tim4_start:
.uleb128 0x73
.4byte .LASF894
.byte 0x5
.uleb128 0x76
.uleb128 0x77
.4byte .LASF895
.byte 0x5
.uleb128 0x77
.uleb128 0x78
.4byte .LASF896
.byte 0x5
.uleb128 0x79
.uleb128 0x7b
.4byte .LASF897
.byte 0x5
.uleb128 0x7a
.uleb128 0x7c
.4byte .LASF898
.byte 0x5
.uleb128 0x7e
.4byte .LASF899
.byte 0x5
.uleb128 0x7f
.4byte .LASF900
.byte 0x5
.uleb128 0x81
.4byte .LASF901
.byte 0x5
.uleb128 0x82
.4byte .LASF902
.byte 0
.section .debug_macro,"G",%progbits,wm4.timer.h.2.a5bec0ee8e2998a7b121820fb4e4e9a6,comdat
.section .debug_macro,"G",%progbits,wm4.timer.h.2.2e929ede818fb0960868f1b0a08a1cbf,comdat
.Ldebug_macro15:
.2byte 0x5
.byte 0
.byte 0x5
.uleb128 0x2
.4byte .LASF899
.4byte .LASF903
.byte 0x5
.uleb128 0x1d
.4byte .LASF900
.4byte .LASF904
.byte 0x5
.uleb128 0x1e
.4byte .LASF901
.4byte .LASF905
.byte 0x5
.uleb128 0x20
.4byte .LASF902
.4byte .LASF906
.byte 0x5
.uleb128 0x21
.4byte .LASF903
.4byte .LASF907
.byte 0
.section .debug_line,"",%progbits
.Ldebug_line0:
.section .debug_str,"MS",%progbits,1
.LASF902:
.ascii "TIM4_CR_CEN_BIT 0\000"
.LASF735:
.ascii "SCNxLEAST16 __SCN16LEAST(x)\000"
.LASF636:
@@ -3685,7 +3695,7 @@ tim4_start:
.ascii "__UHA_FBIT__ 8\000"
.LASF815:
.ascii "PRIiFAST64 __PRI64FAST(i)\000"
.LASF905:
.LASF909:
.ascii "unsigned char\000"
.LASF225:
.ascii "__FLT64_DENORM_MIN__ 4.9406564584124654e-324F64\000"
@@ -3731,7 +3741,7 @@ tim4_start:
.ascii "__WCHAR_MAX__ 0xffffffffU\000"
.LASF514:
.ascii "__int20__\000"
.LASF897:
.LASF901:
.ascii "RCC_APB1ENR_TIM4_BIT 2\000"
.LASF18:
.ascii "__SIZEOF_LONG_LONG__ 8\000"
@@ -3757,7 +3767,7 @@ tim4_start:
.ascii "__ORDER_PDP_ENDIAN__ 3412\000"
.LASF34:
.ascii "__SIZE_TYPE__ unsigned int\000"
.LASF898:
.LASF902:
.ascii "RCC_APB1ENR_TIM4_ENABLE (1 << RCC_APB1ENR_TIM4_BIT)"
.ascii "\000"
.LASF621:
@@ -3846,7 +3856,7 @@ tim4_start:
.ascii "__need_wchar_t\000"
.LASF199:
.ascii "__FLT32_MIN_EXP__ (-125)\000"
.LASF956:
.LASF960:
.ascii "GNU C2X 12.3.1 20230626 -mcpu=cortex-m4 -mthumb -mf"
.ascii "loat-abi=hard -mfpu=fpv4-sp-d16 -march=armv7e-m+fp "
.ascii "-g3 -ggdb -O0 -std=c2x -ffunction-sections -fdata-s"
@@ -3865,7 +3875,7 @@ tim4_start:
.ascii "__int_fast32_t_defined 1\000"
.LASF133:
.ascii "__INT_FAST64_WIDTH__ 64\000"
.LASF953:
.LASF957:
.ascii "DMAR\000"
.LASF660:
.ascii "___int_wchar_t_h \000"
@@ -3916,13 +3926,13 @@ tim4_start:
.ascii "SCNo32 __SCN32(o)\000"
.LASF541:
.ascii "_NOTHROW \000"
.LASF948:
.LASF952:
.ascii "CCR1\000"
.LASF949:
.LASF953:
.ascii "CCR2\000"
.LASF950:
.LASF954:
.ascii "CCR3\000"
.LASF951:
.LASF955:
.ascii "CCR4\000"
.LASF307:
.ascii "__LACCUM_IBIT__ 32\000"
@@ -3946,7 +3956,7 @@ tim4_start:
.ascii "__INT64 \"ll\"\000"
.LASF138:
.ascii "__INTPTR_MAX__ 0x7fffffff\000"
.LASF932:
.LASF936:
.ascii "AHB2LPENR\000"
.LASF500:
.ascii "__RAND_MAX\000"
@@ -3956,7 +3966,7 @@ tim4_start:
.ascii "INT_LEAST64_MIN (-__INT_LEAST64_MAX__ - 1)\000"
.LASF614:
.ascii "INT_FAST8_MAX (__INT_FAST8_MAX__)\000"
.LASF896:
.LASF898:
.ascii "RCC_APB1ENR_PWREN_CLOCK_ENABLE (1 << RCC_APB1ENR_PW"
.ascii "REN_BIT)\000"
.LASF487:
@@ -3989,7 +3999,7 @@ tim4_start:
.ascii " RCC_PLLCFGR_PLLP_BIT)\000"
.LASF302:
.ascii "__UACCUM_IBIT__ 16\000"
.LASF908:
.LASF912:
.ascii "long int\000"
.LASF720:
.ascii "SCNd16 __SCN16(d)\000"
@@ -4066,7 +4076,7 @@ tim4_start:
.ascii "__SIZEOF_LONG__ 4\000"
.LASF754:
.ascii "PRIi32 __PRI32(i)\000"
.LASF929:
.LASF933:
.ascii "APB2ENR\000"
.LASF822:
.ascii "SCNoFAST64 __SCN64FAST(o)\000"
@@ -4080,7 +4090,7 @@ tim4_start:
.ascii "__FLT32X_MIN_EXP__ (-1021)\000"
.LASF816:
.ascii "PRIoFAST64 __PRI64FAST(o)\000"
.LASF931:
.LASF935:
.ascii "AHB1LPENR\000"
.LASF406:
.ascii "__ARM_FEATURE_SIMD32 1\000"
@@ -4092,7 +4102,7 @@ tim4_start:
.ascii "PRIoLEAST16 __PRI16LEAST(o)\000"
.LASF459:
.ascii "__NEWLIB__ 4\000"
.LASF941:
.LASF945:
.ascii "DCKCFGR\000"
.LASF721:
.ascii "SCNi16 __SCN16(i)\000"
@@ -4102,7 +4112,7 @@ tim4_start:
.ascii "__FLT_DECIMAL_DIG__ 9\000"
.LASF563:
.ascii "_UINT8_T_DECLARED \000"
.LASF904:
.LASF908:
.ascii "signed char\000"
.LASF806:
.ascii "PRIuLEAST64 __PRI64LEAST(u)\000"
@@ -4136,19 +4146,19 @@ tim4_start:
.ascii "__FLT64_MAX_10_EXP__ 308\000"
.LASF874:
.ascii "RCC_PLLCFGR_PLLN_MASK (0b111111111)\000"
.LASF957:
.LASF961:
.ascii "src/timer.c\000"
.LASF924:
.LASF928:
.ascii "RESERVED1\000"
.LASF927:
.LASF931:
.ascii "RESERVED2\000"
.LASF3:
.ascii "__STDC_UTF_32__ 1\000"
.LASF933:
.LASF937:
.ascii "RESERVED4\000"
.LASF241:
.ascii "__FLT32X_DENORM_MIN__ 4.9406564584124654e-324F32x\000"
.LASF938:
.LASF942:
.ascii "RESERVED6\000"
.LASF152:
.ascii "__FLT_MAX_10_EXP__ 38\000"
@@ -4168,6 +4178,8 @@ tim4_start:
.ascii "SCNoLEAST32 __SCN32LEAST(o)\000"
.LASF891:
.ascii "RCC_CFGR_SW_PLL (0b10)\000"
.LASF906:
.ascii "TIM_CR1_CEN_BIT 0\000"
.LASF798:
.ascii "SCNd64 __SCN64(d)\000"
.LASF828:
@@ -4186,33 +4198,36 @@ tim4_start:
.ascii "__int_fast64_t_defined 1\000"
.LASF838:
.ascii "__PRIPTR(x) __STRINGIFY(x)\000"
.LASF915:
.LASF919:
.ascii "uint16_t\000"
.LASF417:
.ascii "__thumb2__ 1\000"
.LASF321:
.ascii "__ULLACCUM_FBIT__ 32\000"
.LASF895:
.LASF897:
.ascii "RCC_APB1ENR_PWREN_BIT 28\000"
.LASF900:
.ascii "RCC_APB1ENR_USART2EN_ENABLE (1 << RCC_APB1ENR_USART"
.ascii "2EN_BIT)\000"
.LASF366:
.ascii "__STRICT_ANSI__ 1\000"
.LASF486:
.ascii "_SYS_FEATURES_H \000"
.LASF813:
.ascii "SCNxLEAST64 __SCN64LEAST(x)\000"
.LASF930:
.LASF934:
.ascii "RESERVED3\000"
.LASF22:
.ascii "__SIZEOF_LONG_DOUBLE__ 8\000"
.LASF936:
.LASF940:
.ascii "RESERVED5\000"
.LASF945:
.LASF949:
.ascii "CCMR1\000"
.LASF946:
.LASF950:
.ascii "CCMR2\000"
.LASF36:
.ascii "__WCHAR_TYPE__ unsigned int\000"
.LASF899:
.LASF903:
.ascii "TIMER_H_ \000"
.LASF470:
.ascii "_MB_LEN_MAX 8\000"
@@ -4256,9 +4271,9 @@ tim4_start:
.ascii "__SCN64(x) __INT64 __STRINGIFY(x)\000"
.LASF647:
.ascii "_GCC_WRAP_STDINT_H \000"
.LASF909:
.LASF913:
.ascii "__uint16_t\000"
.LASF926:
.LASF930:
.ascii "AHB2ENR\000"
.LASF805:
.ascii "PRIoLEAST64 __PRI64LEAST(o)\000"
@@ -4272,7 +4287,7 @@ tim4_start:
.ascii "__UINT8_MAX__ 0xff\000"
.LASF575:
.ascii "_UINTMAX_T_DECLARED \000"
.LASF942:
.LASF946:
.ascii "timer\000"
.LASF184:
.ascii "__LDBL_MAX_EXP__ 1024\000"
@@ -4316,7 +4331,7 @@ tim4_start:
.ascii "__FLT_EPSILON__ 1.1920928955078125e-7F\000"
.LASF770:
.ascii "SCNdLEAST32 __SCN32LEAST(d)\000"
.LASF921:
.LASF925:
.ascii "RESERVED0\000"
.LASF807:
.ascii "PRIxLEAST64 __PRI64LEAST(x)\000"
@@ -4352,7 +4367,7 @@ tim4_start:
.ascii "__MISC_VISIBLE 0\000"
.LASF306:
.ascii "__LACCUM_FBIT__ 31\000"
.LASF937:
.LASF941:
.ascii "BDCR\000"
.LASF211:
.ascii "__FLT32_HAS_QUIET_NAN__ 1\000"
@@ -4414,7 +4429,7 @@ tim4_start:
.ascii "RCC_CR_HSERDY_READY (1 << RCC_CR_HSERDY_BIT)\000"
.LASF763:
.ascii "SCNx32 __SCN32(x)\000"
.LASF918:
.LASF922:
.ascii "CFGR\000"
.LASF558:
.ascii "___int_least32_t_defined 1\000"
@@ -4484,7 +4499,7 @@ tim4_start:
.ascii "___int8_t_defined 1\000"
.LASF248:
.ascii "__SFRACT_MIN__ (-0.5HR-0.5HR)\000"
.LASF911:
.LASF915:
.ascii "long unsigned int\000"
.LASF349:
.ascii "__SA_IBIT__ 16\000"
@@ -4502,7 +4517,7 @@ tim4_start:
.ascii "__UINT16_TYPE__ short unsigned int\000"
.LASF868:
.ascii "RCC_PLLCFGR_PLLSRC_BIT 22\000"
.LASF944:
.LASF948:
.ascii "DIER\000"
.LASF657:
.ascii "_WCHAR_T_DEFINED_ \000"
@@ -4510,7 +4525,7 @@ tim4_start:
.ascii "__FLT_EVAL_METHOD_TS_18661_3__ 0\000"
.LASF522:
.ascii "int +2\000"
.LASF958:
.LASF962:
.ascii "/home/alex/code/own/c-compile-experiments\000"
.LASF637:
.ascii "INT8_C(x) __INT8_C(x)\000"
@@ -4608,11 +4623,11 @@ tim4_start:
.ascii "PRIX32 __PRI32(X)\000"
.LASF774:
.ascii "SCNxLEAST32 __SCN32LEAST(x)\000"
.LASF954:
.LASF958:
.ascii "tim4_start\000"
.LASF704:
.ascii "SCNiFAST8 __SCN8FAST(i)\000"
.LASF917:
.LASF921:
.ascii "PLLCFGR\000"
.LASF5:
.ascii "__GNUC__ 12\000"
@@ -4640,7 +4655,7 @@ tim4_start:
.ascii "__ULACCUM_MIN__ 0.0ULK\000"
.LASF462:
.ascii "_ATEXIT_DYNAMIC_ALLOC 1\000"
.LASF910:
.LASF914:
.ascii "__uint32_t\000"
.LASF188:
.ascii "__LDBL_MAX__ 1.7976931348623157e+308L\000"
@@ -4650,7 +4665,7 @@ tim4_start:
.ascii "__FLT_RADIX__ 2\000"
.LASF455:
.ascii "_INTTYPES_H \000"
.LASF912:
.LASF916:
.ascii "long long int\000"
.LASF401:
.ascii "__ARM_FEATURE_CMSE\000"
@@ -4670,7 +4685,7 @@ tim4_start:
.ascii "WINT_MAX (__WINT_MAX__)\000"
.LASF823:
.ascii "SCNuFAST64 __SCN64FAST(u)\000"
.LASF939:
.LASF943:
.ascii "SSCGR\000"
.LASF137:
.ascii "__UINT_FAST64_MAX__ 0xffffffffffffffffULL\000"
@@ -4698,7 +4713,7 @@ tim4_start:
.ascii "___int32_t_defined 1\000"
.LASF83:
.ascii "__INT_WIDTH__ 32\000"
.LASF923:
.LASF927:
.ascii "APB2RSTR\000"
.LASF409:
.ascii "__ARM_ARCH_PROFILE\000"
@@ -4750,15 +4765,17 @@ tim4_start:
.ascii "__ARM_NEON_FP\000"
.LASF280:
.ascii "__LLFRACT_EPSILON__ 0x1P-63LLR\000"
.LASF935:
.LASF939:
.ascii "APB2LPENR\000"
.LASF907:
.ascii "TIM_ENABLE (1 << TIM_CR1_CEN_BIT)\000"
.LASF821:
.ascii "SCNiFAST64 __SCN64FAST(i)\000"
.LASF538:
.ascii "_ANSIDECL_H_ \000"
.LASF684:
.ascii "SCNu8 __SCN8(u)\000"
.LASF900:
.LASF904:
.ascii "TIM4_BASE_ADDR (0x40000800U)\000"
.LASF261:
.ascii "__UFRACT_FBIT__ 16\000"
@@ -4778,7 +4795,7 @@ tim4_start:
.ascii "L)\000"
.LASF608:
.ascii "INT64_MAX (__INT64_MAX__)\000"
.LASF914:
.LASF918:
.ascii "unsigned int\000"
.LASF857:
.ascii "RCC_CR_HSERDY_BIT 17\000"
@@ -4864,7 +4881,7 @@ tim4_start:
.ascii "__STRINGIFY(a) #a\000"
.LASF356:
.ascii "__USA_FBIT__ 16\000"
.LASF934:
.LASF938:
.ascii "APB1LPENR\000"
.LASF480:
.ascii "__IEEE_LITTLE_ENDIAN \000"
@@ -4972,6 +4989,8 @@ tim4_start:
.ascii "SCNx64 __SCN64(x)\000"
.LASF198:
.ascii "__FLT32_DIG__ 6\000"
.LASF899:
.ascii "RCC_APB1ENR_USART2EN_BIT 17\000"
.LASF884:
.ascii "RCC_CFGR_PPRE1_MASK (0b111)\000"
.LASF646:
@@ -4990,13 +5009,13 @@ tim4_start:
.ascii "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1\000"
.LASF734:
.ascii "SCNuLEAST16 __SCN16LEAST(u)\000"
.LASF922:
.LASF926:
.ascii "APB1RSTR\000"
.LASF298:
.ascii "__ACCUM_MIN__ (-0X1P15K-0X1P15K)\000"
.LASF393:
.ascii "__ARM_FEATURE_CRYPTO\000"
.LASF928:
.LASF932:
.ascii "APB1ENR\000"
.LASF742:
.ascii "SCNdFAST16 __SCN16FAST(d)\000"
@@ -5026,7 +5045,7 @@ tim4_start:
.ascii ")\000"
.LASF155:
.ascii "__FLT_NORM_MAX__ 3.4028234663852886e+38F\000"
.LASF913:
.LASF917:
.ascii "long long unsigned int\000"
.LASF612:
.ascii "UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)\000"
@@ -5073,7 +5092,7 @@ tim4_start:
.ascii "__UINT_LEAST16_TYPE__ short unsigned int\000"
.LASF574:
.ascii "_INTMAX_T_DECLARED \000"
.LASF947:
.LASF951:
.ascii "CCER\000"
.LASF40:
.ascii "__CHAR16_TYPE__ short unsigned int\000"
@@ -5129,7 +5148,7 @@ tim4_start:
.ascii "__int20__ +2\000"
.LASF655:
.ascii "_WCHAR_T_ \000"
.LASF943:
.LASF947:
.ascii "SMCR\000"
.LASF829:
.ascii "PRIoMAX __PRIMAX(o)\000"
@@ -5137,6 +5156,8 @@ tim4_start:
.ascii "__SCN32(x) __INT32 __STRINGIFY(x)\000"
.LASF744:
.ascii "SCNoFAST16 __SCN16FAST(o)\000"
.LASF895:
.ascii "RCC_AHB1ENR_GPIOAEN_BIT 0\000"
.LASF345:
.ascii "__UTQ_IBIT__ 0\000"
.LASF348:
@@ -5199,7 +5220,7 @@ tim4_start:
.ascii "__ARM_ARCH_7EM__ 1\000"
.LASF428:
.ascii "__ARM_FEATURE_FP16_SCALAR_ARITHMETIC\000"
.LASF925:
.LASF929:
.ascii "AHB1ENR\000"
.LASF295:
.ascii "__USACCUM_EPSILON__ 0x1P-8UHK\000"
@@ -5239,7 +5260,7 @@ tim4_start:
.ascii "__DBL_DIG__ 15\000"
.LASF275:
.ascii "__ULFRACT_EPSILON__ 0x1P-32ULR\000"
.LASF920:
.LASF924:
.ascii "AHB2RSTR\000"
.LASF672:
.ascii "__SCN8(x) __INT8 __STRINGIFY(x)\000"
@@ -5269,14 +5290,12 @@ tim4_start:
.ascii "unsigned\000"
.LASF381:
.ascii "__GCC_DESTRUCTIVE_SIZE 64\000"
.LASF906:
.LASF910:
.ascii "short int\000"
.LASF836:
.ascii "SCNuMAX __SCNMAX(u)\000"
.LASF121:
.ascii "__UINT16_C(c) c\000"
.LASF903:
.ascii "TIM4_ENABLE (1 << TIM4_CR_CEN_BIT)\000"
.LASF359:
.ascii "__UDA_IBIT__ 32\000"
.LASF535:
@@ -5297,12 +5316,15 @@ tim4_start:
.ascii "__ARM_FEATURE_COPROC\000"
.LASF177:
.ascii "__DBL_HAS_INFINITY__ 1\000"
.LASF901:
.LASF905:
.ascii "TIM4 ((struct timer *) TIM4_BASE_ADDR)\000"
.LASF95:
.ascii "__SIG_ATOMIC_MAX__ 0x7fffffff\000"
.LASF609:
.ascii "UINT64_MAX (__UINT64_MAX__)\000"
.LASF896:
.ascii "RCC_AHB1ENR_GPIOAEN_ENABLE (1 << RCC_AHB1ENR_GPIOAE"
.ascii "N_BIT)\000"
.LASF472:
.ascii "_RETARGETABLE_LOCKING 1\000"
.LASF453:
@@ -5415,13 +5437,13 @@ tim4_start:
.ascii "__ULLFRACT_MIN__ 0.0ULLR\000"
.LASF652:
.ascii "_T_WCHAR_ \000"
.LASF952:
.LASF956:
.ascii "BDTR\000"
.LASF382:
.ascii "__GCC_CONSTRUCTIVE_SIZE 64\000"
.LASF665:
.ascii "_BSD_WCHAR_T_\000"
.LASF940:
.LASF944:
.ascii "PLLI2SCFGR\000"
.LASF277:
.ascii "__LLFRACT_IBIT__ 0\000"
@@ -5429,9 +5451,9 @@ tim4_start:
.ascii "UINT16_C(x) __UINT16_C(x)\000"
.LASF757:
.ascii "PRIx32 __PRI32(x)\000"
.LASF955:
.LASF959:
.ascii "tim4_init\000"
.LASF916:
.LASF920:
.ascii "uint32_t\000"
.LASF873:
.ascii "RCC_PLLCFGR_PLLN_BIT 6\000"
@@ -5491,7 +5513,7 @@ tim4_start:
.ascii "PRIXLEAST32 __PRI32LEAST(X)\000"
.LASF171:
.ascii "__DBL_MAX__ ((double)1.7976931348623157e+308L)\000"
.LASF907:
.LASF911:
.ascii "short unsigned int\000"
.LASF276:
.ascii "__LLFRACT_FBIT__ 63\000"
@@ -5531,7 +5553,7 @@ tim4_start:
.ascii "SCNuFAST32 __SCN32FAST(u)\000"
.LASF523:
.ascii "long +4\000"
.LASF919:
.LASF923:
.ascii "AHB1RSTR\000"
.LASF724:
.ascii "SCNx16 __SCN16(x)\000"

View File

@@ -2082,9 +2082,17 @@ struct rcc {
#define RCC_CFGR_SW(clock) ((clock & RCC_CFGR_SW_MASK) << RCC_CFGR_SW_BIT)
#define RCC_AHB1ENR_GPIOAEN_BIT 0
#define RCC_AHB1ENR_GPIOAEN_ENABLE (1 << RCC_AHB1ENR_GPIOAEN_BIT)
#define RCC_APB1ENR_PWREN_BIT 28
#define RCC_APB1ENR_PWREN_CLOCK_ENABLE (1 << RCC_APB1ENR_PWREN_BIT)
#define RCC_APB1ENR_USART2EN_BIT 17
#define RCC_APB1ENR_USART2EN_ENABLE (1 << RCC_APB1ENR_USART2EN_BIT)
#define RCC_APB1ENR_TIM4_BIT 2
#define RCC_APB1ENR_TIM4_ENABLE (1 << RCC_APB1ENR_TIM4_BIT)
# 2 "src/timer.c" 2
@@ -2120,8 +2128,8 @@ struct timer {
#define TIM4_BASE_ADDR (0x40000800U)
#define TIM4 ((struct timer *) TIM4_BASE_ADDR)
#define TIM4_CR_CEN_BIT 0
#define TIM4_ENABLE (1 << TIM4_CR_CEN_BIT)
#define TIM_CR1_CEN_BIT 0
#define TIM_ENABLE (1 << TIM_CR1_CEN_BIT)
void tim4_init(void);
void tim4_start(void);

Binary file not shown.

5919
build/usart.S Normal file

File diff suppressed because it is too large Load Diff

2268
build/usart.i Normal file

File diff suppressed because it is too large Load Diff

BIN
build/usart.o Normal file

Binary file not shown.

View File

@@ -16,7 +16,11 @@
devShells = nixpkgs.lib.genAttrs systems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
# pkgs = nixpkgs.legacyPackages.${system};
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in
{
default = pkgs.mkShell {
@@ -26,6 +30,7 @@
pkgs.stlink
pkgs.gdb
pkgs.openocd
pkgs.stm32cubemx
pkgs.gdbgui
];
};

View File

@@ -13,10 +13,36 @@ struct gpio {
volatile uint32_t ODR; // Port output data register
volatile uint32_t BSRR; // Port bit set/reset register
volatile uint32_t LCKR; // Port configuration lock register
volatile uint32_t AFRL[2]; // Alternative function low register
volatile uint32_t AFRH[2]; // Alternative function high register
volatile uint32_t AFRL; // Alternative function low register
volatile uint32_t AFRH; // Alternative function high register
};
#define GPIOA_BASE_ADDR (0x40020000U)
#define GPIOA ((struct gpio *) GPIOA_BASE_ADDR)
// MODER register
#define GPIO_MODER_MODER3_BIT 7 // Bits [7:6]
#define GPIO_MODER_MODER3_MASK (0b11)
#define GPIO_MODER_MODER3_AF (0b10)
#define GPIO_MODER_MODER2_BIT 4 // Bits [5:4]
#define GPIO_MODER_MODER2_MASK (0b11)
#define GPIO_MODER_MODER2_AF (0b10)
// AFRL register
#define GPIO_AFRL_AFRL3_BIT 12 // Bits [15:12]
#define GPIO_AFRL_AFRL3_MASK (0b1111)
#define GPIO_AFRL_AFRL3_USART2_RX (0b0111) // Alternative function 7
#define GPIO_AFRL_AFRL2_BIT 8 // Bits [11:8]
#define GPIO_AFRL_AFRL2_MASK (0b1111)
#define GPIO_AFRL_AFRL2_USART2_TX (0b0111) // Alternative function 7
#define GPIO_BASE_ADDR (0x40020000U)
#define GPIO_PORT_OFFSET (0x400U)
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))

View File

@@ -6,6 +6,7 @@
#include "flash.h"
#include "pwr.h"
#include "timer.h"
#include "usart.h"
#define exit 42
@@ -76,7 +77,9 @@ static void system_clock_init(void) {
int main(void) {
(void) system_clock_init();
(void) tim4_init();
(void) usart2_init();
(void) tim4_start();
(void) tim4_start();
uint16_t led = PIN('C', 13); // Blue LED
@@ -90,6 +93,9 @@ int main(void) {
led_on = !led_on;
gpio_write(led, led_on);
while ((USART2->ISR & USART_ISR_TC) != USART_ISR_TC);
USART2->TDR = '#';
counter = TIM4->CNT;
}
};

View File

@@ -114,10 +114,18 @@ struct rcc {
#define RCC_CFGR_SW_MASK (0b11)
#define RCC_CFGR_SW(clock) ((clock & RCC_CFGR_SW_MASK) << RCC_CFGR_SW_BIT)
// AHB1ENR Register
// GPIOA AHB1ENR
#define RCC_AHB1ENR_GPIOAEN_BIT 0
#define RCC_AHB1ENR_GPIOAEN_ENABLE (1 << RCC_AHB1ENR_GPIOAEN_BIT)
// APB1ENR Register
#define RCC_APB1ENR_PWREN_BIT 28
#define RCC_APB1ENR_PWREN_CLOCK_ENABLE (1 << RCC_APB1ENR_PWREN_BIT)
#define RCC_APB1ENR_USART2EN_BIT 17
#define RCC_APB1ENR_USART2EN_ENABLE (1 << RCC_APB1ENR_USART2EN_BIT)
#define RCC_APB1ENR_TIM4_BIT 2
#define RCC_APB1ENR_TIM4_ENABLE (1 << RCC_APB1ENR_TIM4_BIT)

View File

@@ -18,5 +18,5 @@ void tim4_init(void) {
}
void tim4_start(void) {
TIM4->CR1 |= TIM4_ENABLE;
TIM4->CR1 |= TIM_ENABLE;
}

View File

@@ -29,8 +29,8 @@ struct timer {
#define TIM4_BASE_ADDR (0x40000800U)
#define TIM4 ((struct timer *) TIM4_BASE_ADDR)
#define TIM4_CR_CEN_BIT 0
#define TIM4_ENABLE (1 << TIM4_CR_CEN_BIT)
#define TIM_CR1_CEN_BIT 0
#define TIM_ENABLE (1 << TIM_CR1_CEN_BIT)
void tim4_init(void);
void tim4_start(void);

63
src/usart.c Normal file
View File

@@ -0,0 +1,63 @@
#include "rcc.h"
#include "gpio.h"
#include "usart.h"
void usart2_init(void) {
// Enable clock for GPIOA
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN_ENABLE;
// Configure PA2 and PA3 (USART2 pins) to use alternative functions
GPIOA->MODER &= ~(GPIO_MODER_MODER2_MASK << GPIO_MODER_MODER2_BIT);
GPIOA->MODER |= (GPIO_MODER_MODER2_AF << GPIO_MODER_MODER2_BIT);
GPIOA->MODER &= ~(GPIO_MODER_MODER3_MASK << GPIO_MODER_MODER3_BIT);
GPIOA->MODER |= (GPIO_MODER_MODER3_AF << GPIO_MODER_MODER3_BIT);
// Set pin alternative modes to use USART
GPIOA->AFRL &= ~(GPIO_AFRL_AFRL2_MASK << GPIO_AFRL_AFRL2_BIT);
GPIOA->AFRL |= (GPIO_AFRL_AFRL2_USART2_TX << GPIO_AFRL_AFRL2_BIT);
GPIOA->AFRL &= ~(GPIO_AFRL_AFRL3_MASK << GPIO_AFRL_AFRL3_BIT);
GPIOA->AFRL |= (GPIO_AFRL_AFRL3_USART2_RX << GPIO_AFRL_AFRL3_BIT);
// Enable USART
RCC->AHB1ENR |= RCC_APB1ENR_USART2EN_ENABLE;
// Clear control registers
USART2->CR1 = 0;
USART2->CR2 = 0;
USART2->CR3 = 0;
// Calculate Baud rate:
// baud = f_clock / (8 * (2 - OVER8) * USARTDIV); =>
// (8 * (2 - OVER8) * USARTDIV) = f_clock / baud; =>
// USARTDIV = (f_clock / (baud * (8 * (2 - OVER8))); =>
// Target Baud rate = 115200, f_clock = 48MHz
// With OVER8 = 1 (oversampling by 8)
// USARTDIV = (48E6 / (115200 * (8 * (2 - 1))) = 52.083
// mantissa = 52
// fraction = 0.083 * 8 = 0.664 ~= 1
// rounding fraction up: USARTDIV = 53
// baud = 48E6 / (8 * (52 + 1)) = 113207.54716981133
// error of 0.1% (115200 / 113207.54716981133)
// rounding fraction down: USARTDIV = 52
// baud = 48E6 / (8 * 52) = 115384.61538461539
// error of 0.001% (115384.61538461539 / 115200)
USART2->CR1 |= USART_CR1_OVER8_8;
USART2->BRR &= ~(USART_BRR_MANTISSA_MASK << USART_BRR_MANTISSA_BIT);
USART2->BRR |= (52 << USART_BRR_MANTISSA_BIT);
USART2->BRR &= ~(USART_BRR_FRACTION_MASK << USART_BRR_FRACTION_BIT);
USART2->BRR |= (0 << USART_BRR_FRACTION_BIT);
// Enable transmitter and receiver
USART2->CR1 |= USART_CR1_TE_ENABLE;
USART2->CR1 |= USART_CR1_RE_ENABLE;
}
void usart2_start(void) {
USART2->CR1 |= USART_CR1_UE_ENABLE;
}

46
src/usart.h Normal file
View File

@@ -0,0 +1,46 @@
#ifndef USART_H_
#define USART_H_
#include <inttypes.h>
struct usart {
volatile uint32_t SR; // Status register
volatile uint32_t DR; // Data register
volatile uint32_t BRR; // Baud rate register
volatile uint32_t CR1; // Control register 1
volatile uint32_t CR2; // Control register 2
volatile uint32_t CR3; // Control register 3
volatile uint32_t GTPR; // Guard time and prescaler registe
};
#define USART2_BASE_ADDR (0x40004400U)
#define USART2 ((struct usart *) USART2_BASE_ADDR)
// CR Register
// Oversampling mode
#define USART_CR1_OVER8_BIT 15
#define USART_CR1_OVER8_8 (1 << USART_CR1_OVER8_BIT)
// USART enable
#define USART_CR1_UE_BIT 13
#define USART_CR1_UE_ENABLE (1 << USART_CR1_UE_BIT)
// Trasmitter enable
#define USART_CR1_TE_BIT 3
#define USART_CR1_TE_ENABLE (1 << USART_CR1_TE_BIT)
// Receiver enable
#define USART_CR1_RE_BIT 2
#define USART_CR1_RE_ENABLE (1 << USART_CR1_RE_BIT)
// BRR Register
#define USART_BRR_MANTISSA_BIT 4 // Bits [15:4]
#define USART_BRR_MANTISSA_MASK (0b111111111111) // Bits [15:4]
#define USART_BRR_FRACTION_BIT 0 // Bits [3:0]
#define USART_BRR_FRACTION_MASK (0b111) // Bits [3:0]
void usart2_init(void);
void usart2_start(void);
#endif

2
todo.txt Normal file
View File

@@ -0,0 +1,2 @@
- implement UART
- implement tim4 interrupt