Add usart.{h, c}

This commit is contained in:
Alexander Heldt
2025-01-01 12:30:57 +01:00
parent 992b3c5b97
commit 95455a7161
18 changed files with 9159 additions and 478 deletions
BIN
View File
Binary file not shown.
+80 -21
View File
@@ -54,7 +54,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 0x40 build/main.o
.group 0x00000000 0xc build/startup.o
.group 0x00000000 0xc build/startup.o
.group 0x00000000 0xc build/startup.o
@@ -98,6 +98,64 @@ 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_init
0x00000000 0xb8 build/usart.o
.text.usart2_start
0x00000000 0x20 build/usart.o
.text.usart2_write_byte
0x00000000 0x30 build/usart.o
.text.usart2_write
0x00000000 0x2a build/usart.o
.debug_info 0x00000000 0x381 build/usart.o
.debug_abbrev 0x00000000 0x16a build/usart.o
.debug_aranges
0x00000000 0x38 build/usart.o
.debug_rnglists
0x00000000 0x26 build/usart.o
.debug_macro 0x00000000 0xb74 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 0x130 build/usart.o
.debug_macro 0x00000000 0x22 build/usart.o
.debug_macro 0x00000000 0x3a build/usart.o
.debug_macro 0x00000000 0x5e build/usart.o
.debug_line 0x00000000 0x179 build/usart.o
.debug_str 0x00000000 0x5ec2 build/usart.o
.comment 0x00000000 0x46 build/usart.o
.debug_line_str
0x00000000 0x26c build/usart.o
.debug_frame 0x00000000 0xa0 build/usart.o
.ARM.attributes
0x00000000 0x34 build/usart.o
Memory Configuration
@@ -114,6 +172,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
@@ -296,7 +355,7 @@ LOAD linker stubs
.debug_rnglists
0x0000005a 0x19 build/timer.o
.debug_macro 0x00000000 0x3ba0
.debug_macro 0x00000000 0x3bc4
.debug_macro 0x00000000 0xb56 build/gpio.o
.debug_macro 0x00000b56 0x22 build/gpio.o
.debug_macro 0x00000b78 0x75 build/gpio.o
@@ -311,17 +370,17 @@ 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 0x40 build/gpio.o
.debug_macro 0x00001643 0xb80 build/main.o
.debug_macro 0x000021c3 0x136 build/main.o
.debug_macro 0x000022f9 0x46 build/main.o
.debug_macro 0x0000233f 0x2e build/main.o
.debug_macro 0x0000236d 0x22 build/main.o
.debug_macro 0x0000238f 0xb02 build/startup.o
.debug_macro 0x00002e91 0x56 build/startup.o
.debug_macro 0x00002ee7 0x51 build/startup.o
.debug_macro 0x00002f38 0xb5c build/timer.o
.debug_macro 0x00003a94 0x130 build/timer.o
.debug_line 0x00000000 0x516
.debug_line 0x00000000 0x179 build/gpio.o
@@ -329,15 +388,15 @@ LOAD linker stubs
.debug_line 0x0000034d 0xea build/startup.o
.debug_line 0x00000437 0xdf build/timer.o
.debug_str 0x00000000 0x5ed0
.debug_str 0x00000000 0x538b build/gpio.o
0x553b (size before relaxing)
.debug_str 0x0000538b 0xab1 build/main.o
0x5f7e (size before relaxing)
.debug_str 0x00005e3c 0x88 build/startup.o
.debug_str 0x00000000 0x5f5e
.debug_str 0x00000000 0x53c1 build/gpio.o
0x5571 (size before relaxing)
.debug_str 0x000053c1 0xb09 build/main.o
0x600c (size before relaxing)
.debug_str 0x00005eca 0x88 build/startup.o
0x3cdc (size before relaxing)
.debug_str 0x00005ec4 0xc build/timer.o
0x5b16 (size before relaxing)
.debug_str 0x00005f52 0xc build/timer.o
0x5b6e (size before relaxing)
.comment 0x00000000 0x45
.comment 0x00000000 0x45 build/gpio.o
+105 -95
View File
@@ -311,10 +311,10 @@ gpio_write:
.byte 0x4
.4byte .Ldebug_abbrev0
.uleb128 0xa
.4byte .LASF898
.byte 0x1d
.4byte .LASF899
.4byte .LASF900
.byte 0x1d
.4byte .LASF901
.4byte .LASF902
.4byte .LLRL0
.4byte 0
.4byte .Ldebug_line0
@@ -322,9 +322,9 @@ gpio_write:
.uleb128 0x1
.byte 0x1
.byte 0x6
.4byte .LASF863
.4byte .LASF865
.uleb128 0x2
.4byte .LASF866
.4byte .LASF868
.byte 0x2
.byte 0x2b
.byte 0x17
@@ -332,13 +332,13 @@ gpio_write:
.uleb128 0x1
.byte 0x1
.byte 0x8
.4byte .LASF864
.4byte .LASF866
.uleb128 0x1
.byte 0x2
.byte 0x5
.4byte .LASF865
.uleb128 0x2
.4byte .LASF867
.uleb128 0x2
.4byte .LASF869
.byte 0x2
.byte 0x39
.byte 0x1c
@@ -346,13 +346,13 @@ gpio_write:
.uleb128 0x1
.byte 0x2
.byte 0x7
.4byte .LASF868
.4byte .LASF870
.uleb128 0x1
.byte 0x4
.byte 0x5
.4byte .LASF869
.4byte .LASF871
.uleb128 0x2
.4byte .LASF870
.4byte .LASF872
.byte 0x2
.byte 0x4f
.byte 0x1b
@@ -360,21 +360,21 @@ gpio_write:
.uleb128 0x1
.byte 0x4
.byte 0x7
.4byte .LASF871
.4byte .LASF873
.uleb128 0x1
.byte 0x8
.byte 0x5
.4byte .LASF872
.4byte .LASF874
.uleb128 0x1
.byte 0x8
.byte 0x7
.4byte .LASF873
.4byte .LASF875
.uleb128 0xb
.byte 0x4
.byte 0x5
.ascii "int\000"
.uleb128 0x2
.4byte .LASF874
.4byte .LASF876
.byte 0x2
.byte 0xe8
.byte 0x16
@@ -382,21 +382,21 @@ gpio_write:
.uleb128 0x1
.byte 0x4
.byte 0x7
.4byte .LASF875
.4byte .LASF877
.uleb128 0x2
.4byte .LASF876
.4byte .LASF878
.byte 0x3
.byte 0x18
.byte 0x13
.4byte 0x31
.uleb128 0x2
.4byte .LASF877
.4byte .LASF879
.byte 0x3
.byte 0x24
.byte 0x14
.4byte 0x4b
.uleb128 0x2
.4byte .LASF878
.4byte .LASF880
.byte 0x3
.byte 0x30
.byte 0x14
@@ -404,35 +404,35 @@ gpio_write:
.uleb128 0xc
.4byte 0xb8
.uleb128 0x2
.4byte .LASF879
.4byte .LASF881
.byte 0x3
.byte 0x52
.byte 0x15
.4byte 0x8d
.uleb128 0xd
.4byte .LASF896
.4byte .LASF898
.byte 0x28
.byte 0x4
.byte 0x7
.byte 0x8
.4byte 0x151
.uleb128 0x3
.4byte .LASF880
.4byte .LASF882
.byte 0x8
.4byte 0xc4
.byte 0
.uleb128 0x3
.4byte .LASF881
.4byte .LASF883
.byte 0x9
.4byte 0xc4
.byte 0x4
.uleb128 0x3
.4byte .LASF882
.4byte .LASF884
.byte 0xa
.4byte 0xc4
.byte 0x8
.uleb128 0x3
.4byte .LASF883
.4byte .LASF885
.byte 0xb
.4byte 0xc4
.byte 0xc
@@ -447,22 +447,22 @@ gpio_write:
.4byte 0xc4
.byte 0x14
.uleb128 0x3
.4byte .LASF884
.4byte .LASF886
.byte 0xe
.4byte 0xc4
.byte 0x18
.uleb128 0x3
.4byte .LASF885
.4byte .LASF887
.byte 0xf
.4byte 0xc4
.byte 0x1c
.uleb128 0x3
.4byte .LASF886
.4byte .LASF888
.byte 0x10
.4byte 0xc4
.byte 0x20
.uleb128 0x3
.4byte .LASF887
.4byte .LASF889
.byte 0x11
.4byte 0xc4
.byte 0x24
@@ -472,30 +472,30 @@ gpio_write:
.byte 0x1
.4byte 0x3d
.byte 0x4
.byte 0x21
.byte 0x25
.byte 0xe
.4byte 0x178
.uleb128 0x5
.4byte .LASF888
.4byte .LASF890
.byte 0
.uleb128 0x5
.4byte .LASF889
.4byte .LASF891
.byte 0x1
.uleb128 0x5
.4byte .LASF890
.4byte .LASF892
.byte 0x2
.uleb128 0x5
.4byte .LASF891
.4byte .LASF893
.byte 0x3
.byte 0
.uleb128 0x2
.4byte .LASF892
.4byte .LASF894
.byte 0x4
.byte 0x26
.byte 0x2a
.byte 0x3
.4byte 0x151
.uleb128 0x8
.4byte .LASF894
.4byte .LASF896
.byte 0x19
.4byte .LFB2
.4byte .LFE2-.LFB2
@@ -519,7 +519,7 @@ gpio_write:
.byte 0x91
.sleb128 -19
.uleb128 0x6
.4byte .LASF896
.4byte .LASF898
.byte 0x1a
.4byte 0x1c9
.uleb128 0x2
@@ -529,12 +529,12 @@ gpio_write:
.uleb128 0x1
.byte 0x1
.byte 0x2
.4byte .LASF893
.4byte .LASF895
.uleb128 0xf
.byte 0x4
.4byte 0xd5
.uleb128 0x8
.4byte .LASF895
.4byte .LASF897
.byte 0xd
.4byte .LFB1
.4byte .LFE1-.LFB1
@@ -558,7 +558,7 @@ gpio_write:
.byte 0x91
.sleb128 -19
.uleb128 0x6
.4byte .LASF896
.4byte .LASF898
.byte 0xe
.4byte 0x1c9
.uleb128 0x2
@@ -573,7 +573,7 @@ gpio_write:
.sleb128 -16
.byte 0
.uleb128 0x10
.4byte .LASF901
.4byte .LASF903
.byte 0x1
.byte 0x6
.byte 0x6
@@ -590,7 +590,7 @@ gpio_write:
.byte 0x91
.sleb128 -18
.uleb128 0x11
.4byte .LASF897
.4byte .LASF899
.byte 0x1
.byte 0x6
.byte 0x2c
@@ -599,7 +599,7 @@ gpio_write:
.byte 0x91
.sleb128 -19
.uleb128 0x6
.4byte .LASF896
.4byte .LASF898
.byte 0x7
.4byte 0x1c9
.uleb128 0x2
@@ -3704,7 +3704,7 @@ gpio_write:
.uleb128 0x32
.4byte .LASF854
.byte 0
.section .debug_macro,"G",%progbits,wm4.gpio.h.2.3af2911851c1c29c51024d0f06788d31,comdat
.section .debug_macro,"G",%progbits,wm4.gpio.h.2.e8870d5e334b8cc926c6b43b65993420,comdat
.Ldebug_macro15:
.2byte 0x5
.byte 0
@@ -3712,19 +3712,19 @@ gpio_write:
.uleb128 0x2
.4byte .LASF855
.byte 0x5
.uleb128 0x14
.uleb128 0x15
.4byte .LASF856
.byte 0x5
.uleb128 0x15
.uleb128 0x16
.4byte .LASF857
.byte 0x5
.uleb128 0x16
.uleb128 0x18
.4byte .LASF858
.byte 0x5
.uleb128 0x19
.4byte .LASF859
.byte 0x5
.uleb128 0x1b
.uleb128 0x1a
.4byte .LASF860
.byte 0x5
.uleb128 0x1d
@@ -3732,6 +3732,12 @@ gpio_write:
.byte 0x5
.uleb128 0x1f
.4byte .LASF862
.byte 0x5
.uleb128 0x21
.4byte .LASF863
.byte 0x5
.uleb128 0x23
.4byte .LASF864
.byte 0
.section .debug_line,"",%progbits
.Ldebug_line0:
@@ -3776,7 +3782,7 @@ gpio_write:
.ascii "__PTRDIFF_MAX__ 0x7fffffff\000"
.LASF541:
.ascii "_LONG_DOUBLE long double\000"
.LASF896:
.LASF898:
.ascii "gpio\000"
.LASF591:
.ascii "INT_LEAST8_MIN (-__INT_LEAST8_MAX__ - 1)\000"
@@ -3784,7 +3790,7 @@ gpio_write:
.ascii "_UINT32_T_DECLARED \000"
.LASF90:
.ascii "__INTMAX_MAX__ 0x7fffffffffffffffLL\000"
.LASF890:
.LASF892:
.ascii "GPIO_MODE_AF\000"
.LASF335:
.ascii "__TQ_IBIT__ 0\000"
@@ -3898,7 +3904,7 @@ gpio_write:
.ascii "__need_wchar_t\000"
.LASF199:
.ascii "__FLT32_MIN_EXP__ (-125)\000"
.LASF898:
.LASF900:
.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"
@@ -3967,7 +3973,7 @@ gpio_write:
.ascii "__LACCUM_IBIT__ 32\000"
.LASF592:
.ascii "INT_LEAST8_MAX (__INT_LEAST8_MAX__)\000"
.LASF866:
.LASF868:
.ascii "__uint8_t\000"
.LASF81:
.ascii "__SCHAR_WIDTH__ 8\000"
@@ -3983,7 +3989,7 @@ gpio_write:
.ascii "__INT64 \"ll\"\000"
.LASF138:
.ascii "__INTPTR_MAX__ 0x7fffffff\000"
.LASF858:
.LASF860:
.ascii "GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADD"
.ascii "R + (GPIO_PORT_OFFSET * port)))\000"
.LASF499:
@@ -4009,6 +4015,8 @@ gpio_write:
.ascii "INT_FAST32_MIN (-__INT_FAST32_MAX__ - 1)\000"
.LASF672:
.ascii "__SCN8LEAST(x) __LEAST8 __STRINGIFY(x)\000"
.LASF857:
.ascii "GPIO_AF_USART2_TX (0b0111)\000"
.LASF55:
.ascii "__UINT_LEAST8_TYPE__ unsigned char\000"
.LASF727:
@@ -4017,7 +4025,7 @@ gpio_write:
.ascii "__ACCUM_FBIT__ 15\000"
.LASF791:
.ascii "PRId64 __PRI64(d)\000"
.LASF869:
.LASF871:
.ascii "long int\000"
.LASF818:
.ascii "PRIXFAST64 __PRI64FAST(X)\000"
@@ -4113,7 +4121,7 @@ gpio_write:
.ascii "PRIoLEAST16 __PRI16LEAST(o)\000"
.LASF458:
.ascii "__NEWLIB__ 4\000"
.LASF888:
.LASF890:
.ascii "GPIO_MODE_INPUT\000"
.LASF720:
.ascii "SCNi16 __SCN16(i)\000"
@@ -4123,11 +4131,11 @@ gpio_write:
.ascii "__FLT_DECIMAL_DIG__ 9\000"
.LASF562:
.ascii "_UINT8_T_DECLARED \000"
.LASF863:
.LASF865:
.ascii "signed char\000"
.LASF805:
.ascii "PRIuLEAST64 __PRI64LEAST(u)\000"
.LASF876:
.LASF878:
.ascii "uint8_t\000"
.LASF704:
.ascii "SCNoFAST8 __SCN8FAST(o)\000"
@@ -4137,7 +4145,7 @@ gpio_write:
.ascii "__ARM_FEATURE_FMA 1\000"
.LASF466:
.ascii "_HAVE_LONG_DOUBLE 1\000"
.LASF892:
.LASF894:
.ascii "GPIO_MODE\000"
.LASF256:
.ascii "__FRACT_FBIT__ 15\000"
@@ -4161,7 +4169,7 @@ gpio_write:
.ascii "__FLT64_MAX_10_EXP__ 308\000"
.LASF65:
.ascii "__UINT_FAST32_TYPE__ unsigned int\000"
.LASF864:
.LASF866:
.ascii "unsigned char\000"
.LASF3:
.ascii "__STDC_UTF_32__ 1\000"
@@ -4207,13 +4215,13 @@ gpio_write:
.ascii "__int_fast64_t_defined 1\000"
.LASF837:
.ascii "__PRIPTR(x) __STRINGIFY(x)\000"
.LASF877:
.LASF879:
.ascii "uint16_t\000"
.LASF417:
.ascii "__thumb2__ 1\000"
.LASF321:
.ascii "__ULLACCUM_FBIT__ 32\000"
.LASF893:
.LASF895:
.ascii "_Bool\000"
.LASF366:
.ascii "__STRICT_ANSI__ 1\000"
@@ -4231,9 +4239,9 @@ gpio_write:
.ascii "__PRAGMA_REDEFINE_EXTNAME 1\000"
.LASF36:
.ascii "__WCHAR_TYPE__ unsigned int\000"
.LASF859:
.LASF861:
.ascii "PORT(port) (((port) - 'A') << 8)\000"
.LASF889:
.LASF891:
.ascii "GPIO_MODE_OUTPUT\000"
.LASF357:
.ascii "__USA_IBIT__ 16\000"
@@ -4271,7 +4279,7 @@ gpio_write:
.ascii "__SCN64(x) __INT64 __STRINGIFY(x)\000"
.LASF646:
.ascii "_GCC_WRAP_STDINT_H \000"
.LASF867:
.LASF869:
.ascii "__uint16_t\000"
.LASF224:
.ascii "__FLT64_EPSILON__ 2.2204460492503131e-16F64\000"
@@ -4481,7 +4489,7 @@ gpio_write:
.ascii "___int8_t_defined 1\000"
.LASF248:
.ascii "__SFRACT_MIN__ (-0.5HR-0.5HR)\000"
.LASF871:
.LASF873:
.ascii "long unsigned int\000"
.LASF349:
.ascii "__SA_IBIT__ 16\000"
@@ -4497,7 +4505,9 @@ gpio_write:
.ascii "__ARM_FP16_FORMAT_IEEE\000"
.LASF48:
.ascii "__UINT16_TYPE__ short unsigned int\000"
.LASF894:
.LASF856:
.ascii "GPIO_AF_USART2_RX (0b0111)\000"
.LASF896:
.ascii "gpio_write\000"
.LASF569:
.ascii "__int32_t_defined 1\000"
@@ -4541,7 +4551,7 @@ gpio_write:
.ascii "SCNx8 __SCN8(x)\000"
.LASF208:
.ascii "__FLT32_DENORM_MIN__ 1.4012984643248171e-45F32\000"
.LASF901:
.LASF903:
.ascii "gpio_set_mode\000"
.LASF125:
.ascii "__UINT64_C(c) c ## ULL\000"
@@ -4561,7 +4571,7 @@ gpio_write:
.ascii "__GCC_ATOMIC_CHAR16_T_LOCK_FREE 2\000"
.LASF789:
.ascii "__PRI64FAST(x) __FAST64 __STRINGIFY(x)\000"
.LASF879:
.LASF881:
.ascii "uintptr_t\000"
.LASF168:
.ascii "__DBL_MAX_EXP__ 1024\000"
@@ -4609,7 +4619,7 @@ gpio_write:
.ascii "PRIX32 __PRI32(X)\000"
.LASF773:
.ascii "SCNxLEAST32 __SCN32LEAST(x)\000"
.LASF882:
.LASF884:
.ascii "OSPEEDR\000"
.LASF711:
.ascii "__SCN16LEAST(x) __LEAST16 __STRINGIFY(x)\000"
@@ -4639,7 +4649,7 @@ gpio_write:
.ascii "__ULACCUM_MIN__ 0.0ULK\000"
.LASF461:
.ascii "_ATEXIT_DYNAMIC_ALLOC 1\000"
.LASF870:
.LASF872:
.ascii "__uint32_t\000"
.LASF188:
.ascii "__LDBL_MAX__ 1.7976931348623157e+308L\000"
@@ -4649,7 +4659,7 @@ gpio_write:
.ascii "__FLT_RADIX__ 2\000"
.LASF454:
.ascii "_INTTYPES_H \000"
.LASF872:
.LASF874:
.ascii "long long int\000"
.LASF401:
.ascii "__ARM_FEATURE_CMSE\000"
@@ -4756,7 +4766,7 @@ gpio_write:
.ascii "\000"
.LASF582:
.ascii "__int_fast16_t_defined 1\000"
.LASF880:
.LASF882:
.ascii "MODER\000"
.LASF482:
.ascii "__FLOAT_TYPE float\000"
@@ -4767,9 +4777,9 @@ gpio_write:
.ascii "L)\000"
.LASF607:
.ascii "INT64_MAX (__INT64_MAX__)\000"
.LASF875:
.LASF877:
.ascii "unsigned int\000"
.LASF874:
.LASF876:
.ascii "__uintptr_t\000"
.LASF459:
.ascii "__NEWLIB_MINOR__ 3\000"
@@ -4799,7 +4809,7 @@ gpio_write:
.ascii "__CHAR_BIT__ 8\000"
.LASF143:
.ascii "__FLT_EVAL_METHOD__ 0\000"
.LASF865:
.LASF867:
.ascii "short int\000"
.LASF685:
.ascii "PRIdLEAST8 __PRI8LEAST(d)\000"
@@ -4843,7 +4853,7 @@ gpio_write:
.ascii "__ARM_FEATURE_COPROC 15\000"
.LASF483:
.ascii "__OBSOLETE_MATH_DEFAULT 1\000"
.LASF895:
.LASF897:
.ascii "gpio_set_af\000"
.LASF82:
.ascii "__SHRT_WIDTH__ 16\000"
@@ -4943,7 +4953,7 @@ gpio_write:
.ascii "SCNuFAST16 __SCN16FAST(u)\000"
.LASF801:
.ascii "SCNx64 __SCN64(x)\000"
.LASF862:
.LASF864:
.ascii "PINPORT(pin) (pin >> 8)\000"
.LASF198:
.ascii "__FLT32_DIG__ 6\000"
@@ -4991,7 +5001,7 @@ gpio_write:
.ascii "__ORDER_LITTLE_ENDIAN__ 1234\000"
.LASF155:
.ascii "__FLT_NORM_MAX__ 3.4028234663852886e+38F\000"
.LASF873:
.LASF875:
.ascii "long long unsigned int\000"
.LASF611:
.ascii "UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)\000"
@@ -5067,11 +5077,11 @@ gpio_write:
.ascii "SCNdFAST8 __SCN8FAST(d)\000"
.LASF576:
.ascii "_UINTPTR_T_DECLARED \000"
.LASF887:
.LASF889:
.ascii "AFRH\000"
.LASF314:
.ascii "__ULACCUM_MAX__ 0XFFFFFFFFFFFFFFFFP-32ULK\000"
.LASF886:
.LASF888:
.ascii "AFRL\000"
.LASF273:
.ascii "__ULFRACT_MIN__ 0.0ULR\000"
@@ -5085,7 +5095,7 @@ gpio_write:
.ascii "__INT32_TYPE__ long int\000"
.LASF118:
.ascii "__UINT_LEAST8_MAX__ 0xff\000"
.LASF885:
.LASF887:
.ascii "LCKR\000"
.LASF520:
.ascii "__int20__ +2\000"
@@ -5099,7 +5109,7 @@ gpio_write:
.ascii "__SCN32(x) __INT32 __STRINGIFY(x)\000"
.LASF743:
.ascii "SCNoFAST16 __SCN16FAST(o)\000"
.LASF860:
.LASF862:
.ascii "PIN(port,num) (PORT(port) | num)\000"
.LASF345:
.ascii "__UTQ_IBIT__ 0\000"
@@ -5135,7 +5145,7 @@ gpio_write:
.ascii "__QQ_IBIT__ 0\000"
.LASF763:
.ascii "PRIdLEAST32 __PRI32LEAST(d)\000"
.LASF881:
.LASF883:
.ascii "OTYPER\000"
.LASF811:
.ascii "SCNuLEAST64 __SCN64LEAST(u)\000"
@@ -5155,11 +5165,11 @@ gpio_write:
.ascii "__GNUC_MINOR__ 3\000"
.LASF57:
.ascii "__UINT_LEAST32_TYPE__ long unsigned int\000"
.LASF899:
.LASF901:
.ascii "src/gpio.c\000"
.LASF405:
.ascii "__ARM_FEATURE_NUMERIC_MAXMIN\000"
.LASF856:
.LASF858:
.ascii "GPIO_BASE_ADDR (0x40020000U)\000"
.LASF38:
.ascii "__INTMAX_TYPE__ long long int\000"
@@ -5211,7 +5221,7 @@ gpio_write:
.ascii "__SCN8(x) __INT8 __STRINGIFY(x)\000"
.LASF23:
.ascii "__SIZEOF_SIZE_T__ 4\000"
.LASF857:
.LASF859:
.ascii "GPIO_PORT_OFFSET (0x400U)\000"
.LASF50:
.ascii "__UINT64_TYPE__ long long unsigned int\000"
@@ -5231,7 +5241,7 @@ gpio_write:
.ascii "unsigned\000"
.LASF381:
.ascii "__GCC_DESTRUCTIVE_SIZE 64\000"
.LASF883:
.LASF885:
.ascii "PUPDR\000"
.LASF835:
.ascii "SCNuMAX __SCNMAX(u)\000"
@@ -5239,7 +5249,7 @@ gpio_write:
.ascii "__UINT16_C(c) c\000"
.LASF359:
.ascii "__UDA_IBIT__ 32\000"
.LASF897:
.LASF899:
.ascii "mode\000"
.LASF586:
.ascii "INTPTR_MAX (__INTPTR_MAX__)\000"
@@ -5253,7 +5263,7 @@ gpio_write:
.ascii "_ATTRIBUTE(attrs) __attribute__ (attrs)\000"
.LASF443:
.ascii "__ARM_FEATURE_COPROC\000"
.LASF891:
.LASF893:
.ascii "GPIO_MODE_ANALOG\000"
.LASF177:
.ascii "__DBL_HAS_INFINITY__ 1\000"
@@ -5291,7 +5301,7 @@ gpio_write:
.ascii "__FAST8 \000"
.LASF496:
.ascii "__XSI_VISIBLE 0\000"
.LASF884:
.LASF886:
.ascii "BSRR\000"
.LASF794:
.ascii "PRIu64 __PRI64(u)\000"
@@ -5379,7 +5389,7 @@ gpio_write:
.ascii "PRIx32 __PRI32(x)\000"
.LASF278:
.ascii "__LLFRACT_MIN__ (-0.5LLR-0.5LLR)\000"
.LASF878:
.LASF880:
.ascii "uint32_t\000"
.LASF689:
.ascii "PRIxLEAST8 __PRI8LEAST(x)\000"
@@ -5429,13 +5439,13 @@ gpio_write:
.ascii "__INT_LEAST16_TYPE__ short int\000"
.LASF326:
.ascii "__QQ_FBIT__ 7\000"
.LASF861:
.LASF863:
.ascii "PINNUM(pin) (pin & 0b1111)\000"
.LASF768:
.ascii "PRIXLEAST32 __PRI32LEAST(X)\000"
.LASF171:
.ascii "__DBL_MAX__ ((double)1.7976931348623157e+308L)\000"
.LASF868:
.LASF870:
.ascii "short unsigned int\000"
.LASF276:
.ascii "__LLFRACT_FBIT__ 63\000"
@@ -5483,7 +5493,7 @@ gpio_write:
.ascii "__SCN64LEAST(x) __LEAST64 __STRINGIFY(x)\000"
.LASF280:
.ascii "__LLFRACT_EPSILON__ 0x1P-63LLR\000"
.LASF900:
.LASF902:
.ascii "/home/alex/code/own/stm32-falling-sand\000"
.LASF249:
.ascii "__SFRACT_MAX__ 0X7FP-7HR\000"
+6 -2
View File
@@ -1999,6 +1999,10 @@ struct gpio {
volatile uint32_t AFRH;
};
#define GPIO_AF_USART2_RX (0b0111)
#define GPIO_AF_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)))
@@ -2022,9 +2026,9 @@ typedef enum {
void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
void gpio_set_af(uint16_t pin, uint8_t af);
void gpio_write(uint16_t pin,
# 42 "src/gpio.h" 3 4
# 46 "src/gpio.h" 3 4
_Bool
# 42 "src/gpio.h"
# 46 "src/gpio.h"
val);
# 5 "src/gpio.c" 2
BIN
View File
Binary file not shown.
+252 -231
View File
File diff suppressed because it is too large Load Diff
+9 -2
View File
@@ -2100,6 +2100,9 @@ struct rcc {
#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
@@ -2123,6 +2126,10 @@ struct gpio {
volatile uint32_t AFRH;
};
#define GPIO_AF_USART2_RX (0b0111)
#define GPIO_AF_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)))
@@ -2146,9 +2153,9 @@ typedef enum {
void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
void gpio_set_af(uint16_t pin, uint8_t af);
void gpio_write(uint16_t pin,
# 42 "src/gpio.h" 3 4
# 46 "src/gpio.h" 3 4
_Bool
# 42 "src/gpio.h"
# 46 "src/gpio.h"
val);
# 6 "src/main.c" 2
# 1 "src/flash.h" 1
BIN
View File
Binary file not shown.
+138 -127
View File
@@ -136,10 +136,10 @@ tim4_start:
.byte 0x4
.4byte .Ldebug_abbrev0
.uleb128 0x7
.4byte .LASF956
.byte 0x1d
.4byte .LASF957
.4byte .LASF958
.byte 0x1d
.4byte .LASF959
.4byte .LASF960
.4byte .LLRL0
.4byte 0
.4byte .Ldebug_line0
@@ -147,17 +147,17 @@ tim4_start:
.uleb128 0x3
.byte 0x1
.byte 0x6
.4byte .LASF904
.4byte .LASF906
.uleb128 0x3
.byte 0x1
.byte 0x8
.4byte .LASF905
.4byte .LASF907
.uleb128 0x3
.byte 0x2
.byte 0x5
.4byte .LASF906
.4byte .LASF908
.uleb128 0x4
.4byte .LASF909
.4byte .LASF911
.byte 0x2
.byte 0x39
.byte 0x1c
@@ -165,13 +165,13 @@ tim4_start:
.uleb128 0x3
.byte 0x2
.byte 0x7
.4byte .LASF907
.4byte .LASF909
.uleb128 0x3
.byte 0x4
.byte 0x5
.4byte .LASF908
.uleb128 0x4
.4byte .LASF910
.uleb128 0x4
.4byte .LASF912
.byte 0x2
.byte 0x4f
.byte 0x1b
@@ -179,15 +179,15 @@ tim4_start:
.uleb128 0x3
.byte 0x4
.byte 0x7
.4byte .LASF911
.4byte .LASF913
.uleb128 0x3
.byte 0x8
.byte 0x5
.4byte .LASF912
.4byte .LASF914
.uleb128 0x3
.byte 0x8
.byte 0x7
.4byte .LASF913
.4byte .LASF915
.uleb128 0x8
.byte 0x4
.byte 0x5
@@ -195,15 +195,15 @@ tim4_start:
.uleb128 0x3
.byte 0x4
.byte 0x7
.4byte .LASF914
.4byte .LASF916
.uleb128 0x4
.4byte .LASF915
.4byte .LASF917
.byte 0x3
.byte 0x24
.byte 0x14
.4byte 0x3f
.uleb128 0x4
.4byte .LASF916
.4byte .LASF918
.byte 0x3
.byte 0x30
.byte 0x14
@@ -224,13 +224,13 @@ tim4_start:
.4byte 0xa0
.byte 0
.uleb128 0x1
.4byte .LASF917
.4byte .LASF919
.byte 0x4
.byte 0x8
.4byte 0xa0
.byte 0x4
.uleb128 0x1
.4byte .LASF918
.4byte .LASF920
.byte 0x4
.byte 0x9
.4byte 0xa0
@@ -242,115 +242,115 @@ tim4_start:
.4byte 0xa0
.byte 0xc
.uleb128 0x1
.4byte .LASF919
.4byte .LASF921
.byte 0x4
.byte 0xb
.4byte 0xa0
.byte 0x10
.uleb128 0x1
.4byte .LASF920
.4byte .LASF922
.byte 0x4
.byte 0xc
.4byte 0xa0
.byte 0x14
.uleb128 0x1
.4byte .LASF921
.4byte .LASF923
.byte 0x4
.byte 0xd
.4byte 0x212
.byte 0x18
.uleb128 0x1
.4byte .LASF922
.4byte .LASF924
.byte 0x4
.byte 0xe
.4byte 0xa0
.byte 0x20
.uleb128 0x1
.4byte .LASF923
.4byte .LASF925
.byte 0x4
.byte 0xf
.4byte 0xa0
.byte 0x24
.uleb128 0x1
.4byte .LASF924
.4byte .LASF926
.byte 0x4
.byte 0x10
.4byte 0x212
.byte 0x28
.uleb128 0x1
.4byte .LASF925
.4byte .LASF927
.byte 0x4
.byte 0x11
.4byte 0xa0
.byte 0x30
.uleb128 0x1
.4byte .LASF926
.4byte .LASF928
.byte 0x4
.byte 0x12
.4byte 0xa0
.byte 0x34
.uleb128 0x1
.4byte .LASF927
.4byte .LASF929
.byte 0x4
.byte 0x13
.4byte 0x212
.byte 0x38
.uleb128 0x1
.4byte .LASF928
.4byte .LASF930
.byte 0x4
.byte 0x14
.4byte 0xa0
.byte 0x40
.uleb128 0x1
.4byte .LASF929
.4byte .LASF931
.byte 0x4
.byte 0x15
.4byte 0xa0
.byte 0x44
.uleb128 0x1
.4byte .LASF930
.4byte .LASF932
.byte 0x4
.byte 0x16
.4byte 0x212
.byte 0x48
.uleb128 0x1
.4byte .LASF931
.4byte .LASF933
.byte 0x4
.byte 0x17
.4byte 0xa0
.byte 0x50
.uleb128 0x1
.4byte .LASF932
.4byte .LASF934
.byte 0x4
.byte 0x18
.4byte 0xa0
.byte 0x54
.uleb128 0x1
.4byte .LASF933
.4byte .LASF935
.byte 0x4
.byte 0x19
.4byte 0x212
.byte 0x58
.uleb128 0x1
.4byte .LASF934
.4byte .LASF936
.byte 0x4
.byte 0x1a
.4byte 0xa0
.byte 0x60
.uleb128 0x1
.4byte .LASF935
.4byte .LASF937
.byte 0x4
.byte 0x1b
.4byte 0xa0
.byte 0x64
.uleb128 0x1
.4byte .LASF936
.4byte .LASF938
.byte 0x4
.byte 0x1c
.4byte 0x212
.byte 0x68
.uleb128 0x1
.4byte .LASF937
.4byte .LASF939
.byte 0x4
.byte 0x1d
.4byte 0xa0
@@ -362,25 +362,25 @@ tim4_start:
.4byte 0xa0
.byte 0x74
.uleb128 0x1
.4byte .LASF938
.4byte .LASF940
.byte 0x4
.byte 0x1f
.4byte 0x212
.byte 0x78
.uleb128 0x1
.4byte .LASF939
.4byte .LASF941
.byte 0x4
.byte 0x20
.4byte 0xa0
.byte 0x80
.uleb128 0x1
.4byte .LASF940
.4byte .LASF942
.byte 0x4
.byte 0x21
.4byte 0xa0
.byte 0x84
.uleb128 0x1
.4byte .LASF941
.4byte .LASF943
.byte 0x4
.byte 0x22
.4byte 0xa0
@@ -396,7 +396,7 @@ tim4_start:
.uleb128 0x5
.4byte 0x202
.uleb128 0xc
.4byte .LASF942
.4byte .LASF944
.byte 0x50
.byte 0x5
.byte 0x6
@@ -415,13 +415,13 @@ tim4_start:
.4byte 0xa0
.byte 0x4
.uleb128 0x1
.4byte .LASF943
.4byte .LASF945
.byte 0x5
.byte 0x9
.4byte 0xa0
.byte 0x8
.uleb128 0x1
.4byte .LASF944
.4byte .LASF946
.byte 0x5
.byte 0xa
.4byte 0xa0
@@ -439,19 +439,19 @@ tim4_start:
.4byte 0xa0
.byte 0x14
.uleb128 0x1
.4byte .LASF945
.4byte .LASF947
.byte 0x5
.byte 0xd
.4byte 0xa0
.byte 0x18
.uleb128 0x1
.4byte .LASF946
.4byte .LASF948
.byte 0x5
.byte 0xe
.4byte 0xa0
.byte 0x1c
.uleb128 0x1
.4byte .LASF947
.4byte .LASF949
.byte 0x5
.byte 0xf
.4byte 0xa0
@@ -481,31 +481,31 @@ tim4_start:
.4byte 0xa0
.byte 0x30
.uleb128 0x1
.4byte .LASF948
.4byte .LASF950
.byte 0x5
.byte 0x14
.4byte 0xa0
.byte 0x34
.uleb128 0x1
.4byte .LASF949
.4byte .LASF951
.byte 0x5
.byte 0x15
.4byte 0xa0
.byte 0x38
.uleb128 0x1
.4byte .LASF950
.4byte .LASF952
.byte 0x5
.byte 0x16
.4byte 0xa0
.byte 0x3c
.uleb128 0x1
.4byte .LASF951
.4byte .LASF953
.byte 0x5
.byte 0x17
.4byte 0xa0
.byte 0x40
.uleb128 0x1
.4byte .LASF952
.4byte .LASF954
.byte 0x5
.byte 0x18
.4byte 0xa0
@@ -517,21 +517,21 @@ tim4_start:
.4byte 0xa0
.byte 0x48
.uleb128 0x1
.4byte .LASF953
.4byte .LASF955
.byte 0x5
.byte 0x1a
.4byte 0xa0
.byte 0x4c
.byte 0
.uleb128 0x6
.4byte .LASF954
.4byte .LASF956
.byte 0x14
.4byte .LFB1
.4byte .LFE1-.LFB1
.uleb128 0x1
.byte 0x9c
.uleb128 0x6
.4byte .LASF955
.4byte .LASF957
.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.fc51eb78a9b2f3f5a4ab23580aa1aac2,comdat
.Ldebug_macro14:
.2byte 0x5
.byte 0
@@ -3649,6 +3649,12 @@ tim4_start:
.byte 0x5
.uleb128 0x7a
.4byte .LASF898
.byte 0x5
.uleb128 0x7c
.4byte .LASF899
.byte 0x5
.uleb128 0x7d
.4byte .LASF900
.byte 0
.section .debug_macro,"G",%progbits,wm4.timer.h.2.2e929ede818fb0960868f1b0a08a1cbf,comdat
.Ldebug_macro15:
@@ -3656,19 +3662,19 @@ tim4_start:
.byte 0
.byte 0x5
.uleb128 0x2
.4byte .LASF899
.byte 0x5
.uleb128 0x1d
.4byte .LASF900
.byte 0x5
.uleb128 0x1e
.4byte .LASF901
.byte 0x5
.uleb128 0x20
.uleb128 0x1d
.4byte .LASF902
.byte 0x5
.uleb128 0x21
.uleb128 0x1e
.4byte .LASF903
.byte 0x5
.uleb128 0x20
.4byte .LASF904
.byte 0x5
.uleb128 0x21
.4byte .LASF905
.byte 0
.section .debug_line,"",%progbits
.Ldebug_line0:
@@ -3683,7 +3689,7 @@ tim4_start:
.ascii "__UHA_FBIT__ 8\000"
.LASF815:
.ascii "PRIiFAST64 __PRI64FAST(i)\000"
.LASF905:
.LASF907:
.ascii "unsigned char\000"
.LASF225:
.ascii "__FLT64_DENORM_MIN__ 4.9406564584124654e-324F64\000"
@@ -3729,7 +3735,7 @@ tim4_start:
.ascii "__WCHAR_MAX__ 0xffffffffU\000"
.LASF514:
.ascii "__int20__\000"
.LASF897:
.LASF899:
.ascii "RCC_APB1ENR_TIM4_BIT 2\000"
.LASF18:
.ascii "__SIZEOF_LONG_LONG__ 8\000"
@@ -3755,7 +3761,7 @@ tim4_start:
.ascii "__ORDER_PDP_ENDIAN__ 3412\000"
.LASF34:
.ascii "__SIZE_TYPE__ unsigned int\000"
.LASF898:
.LASF900:
.ascii "RCC_APB1ENR_TIM4_ENABLE (1 << RCC_APB1ENR_TIM4_BIT)"
.ascii "\000"
.LASF621:
@@ -3842,7 +3848,7 @@ tim4_start:
.ascii "__need_wchar_t\000"
.LASF199:
.ascii "__FLT32_MIN_EXP__ (-125)\000"
.LASF956:
.LASF958:
.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"
@@ -3861,7 +3867,7 @@ tim4_start:
.ascii "__int_fast32_t_defined 1\000"
.LASF133:
.ascii "__INT_FAST64_WIDTH__ 64\000"
.LASF953:
.LASF955:
.ascii "DMAR\000"
.LASF660:
.ascii "___int_wchar_t_h \000"
@@ -3912,13 +3918,13 @@ tim4_start:
.ascii "SCNo32 __SCN32(o)\000"
.LASF541:
.ascii "_NOTHROW \000"
.LASF948:
.ascii "CCR1\000"
.LASF949:
.ascii "CCR2\000"
.LASF950:
.ascii "CCR3\000"
.ascii "CCR1\000"
.LASF951:
.ascii "CCR2\000"
.LASF952:
.ascii "CCR3\000"
.LASF953:
.ascii "CCR4\000"
.LASF307:
.ascii "__LACCUM_IBIT__ 32\000"
@@ -3942,7 +3948,7 @@ tim4_start:
.ascii "__INT64 \"ll\"\000"
.LASF138:
.ascii "__INTPTR_MAX__ 0x7fffffff\000"
.LASF932:
.LASF934:
.ascii "AHB2LPENR\000"
.LASF500:
.ascii "__RAND_MAX\000"
@@ -3985,7 +3991,7 @@ tim4_start:
.ascii " RCC_PLLCFGR_PLLP_BIT)\000"
.LASF302:
.ascii "__UACCUM_IBIT__ 16\000"
.LASF908:
.LASF910:
.ascii "long int\000"
.LASF720:
.ascii "SCNd16 __SCN16(d)\000"
@@ -4062,7 +4068,7 @@ tim4_start:
.ascii "__SIZEOF_LONG__ 4\000"
.LASF754:
.ascii "PRIi32 __PRI32(i)\000"
.LASF929:
.LASF931:
.ascii "APB2ENR\000"
.LASF822:
.ascii "SCNoFAST64 __SCN64FAST(o)\000"
@@ -4076,7 +4082,7 @@ tim4_start:
.ascii "__FLT32X_MIN_EXP__ (-1021)\000"
.LASF816:
.ascii "PRIoFAST64 __PRI64FAST(o)\000"
.LASF931:
.LASF933:
.ascii "AHB1LPENR\000"
.LASF406:
.ascii "__ARM_FEATURE_SIMD32 1\000"
@@ -4088,7 +4094,7 @@ tim4_start:
.ascii "PRIoLEAST16 __PRI16LEAST(o)\000"
.LASF459:
.ascii "__NEWLIB__ 4\000"
.LASF941:
.LASF943:
.ascii "DCKCFGR\000"
.LASF721:
.ascii "SCNi16 __SCN16(i)\000"
@@ -4098,7 +4104,7 @@ tim4_start:
.ascii "__FLT_DECIMAL_DIG__ 9\000"
.LASF563:
.ascii "_UINT8_T_DECLARED \000"
.LASF904:
.LASF906:
.ascii "signed char\000"
.LASF806:
.ascii "PRIuLEAST64 __PRI64LEAST(u)\000"
@@ -4132,19 +4138,19 @@ tim4_start:
.ascii "__FLT64_MAX_10_EXP__ 308\000"
.LASF874:
.ascii "RCC_PLLCFGR_PLLN_MASK (0b111111111)\000"
.LASF957:
.LASF959:
.ascii "src/timer.c\000"
.LASF924:
.LASF926:
.ascii "RESERVED1\000"
.LASF927:
.LASF929:
.ascii "RESERVED2\000"
.LASF3:
.ascii "__STDC_UTF_32__ 1\000"
.LASF933:
.LASF935:
.ascii "RESERVED4\000"
.LASF241:
.ascii "__FLT32X_DENORM_MIN__ 4.9406564584124654e-324F32x\000"
.LASF938:
.LASF940:
.ascii "RESERVED6\000"
.LASF152:
.ascii "__FLT_MAX_10_EXP__ 38\000"
@@ -4164,7 +4170,7 @@ tim4_start:
.ascii "SCNoLEAST32 __SCN32LEAST(o)\000"
.LASF891:
.ascii "RCC_CFGR_SW_PLL (0b10)\000"
.LASF902:
.LASF904:
.ascii "TIM_CR1_CEN_BIT 0\000"
.LASF798:
.ascii "SCNd64 __SCN64(d)\000"
@@ -4184,7 +4190,7 @@ tim4_start:
.ascii "__int_fast64_t_defined 1\000"
.LASF838:
.ascii "__PRIPTR(x) __STRINGIFY(x)\000"
.LASF915:
.LASF917:
.ascii "uint16_t\000"
.LASF417:
.ascii "__thumb2__ 1\000"
@@ -4192,25 +4198,28 @@ tim4_start:
.ascii "__ULLACCUM_FBIT__ 32\000"
.LASF895:
.ascii "RCC_APB1ENR_PWREN_BIT 28\000"
.LASF898:
.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:
.LASF932:
.ascii "RESERVED3\000"
.LASF22:
.ascii "__SIZEOF_LONG_DOUBLE__ 8\000"
.LASF936:
.LASF938:
.ascii "RESERVED5\000"
.LASF945:
.LASF947:
.ascii "CCMR1\000"
.LASF946:
.LASF948:
.ascii "CCMR2\000"
.LASF36:
.ascii "__WCHAR_TYPE__ unsigned int\000"
.LASF899:
.LASF901:
.ascii "TIMER_H_ \000"
.LASF470:
.ascii "_MB_LEN_MAX 8\000"
@@ -4254,9 +4263,9 @@ tim4_start:
.ascii "__SCN64(x) __INT64 __STRINGIFY(x)\000"
.LASF647:
.ascii "_GCC_WRAP_STDINT_H \000"
.LASF909:
.LASF911:
.ascii "__uint16_t\000"
.LASF926:
.LASF928:
.ascii "AHB2ENR\000"
.LASF805:
.ascii "PRIoLEAST64 __PRI64LEAST(o)\000"
@@ -4270,7 +4279,7 @@ tim4_start:
.ascii "__UINT8_MAX__ 0xff\000"
.LASF575:
.ascii "_UINTMAX_T_DECLARED \000"
.LASF942:
.LASF944:
.ascii "timer\000"
.LASF184:
.ascii "__LDBL_MAX_EXP__ 1024\000"
@@ -4314,7 +4323,7 @@ tim4_start:
.ascii "__FLT_EPSILON__ 1.1920928955078125e-7F\000"
.LASF770:
.ascii "SCNdLEAST32 __SCN32LEAST(d)\000"
.LASF921:
.LASF923:
.ascii "RESERVED0\000"
.LASF807:
.ascii "PRIxLEAST64 __PRI64LEAST(x)\000"
@@ -4352,7 +4361,7 @@ tim4_start:
.ascii "__LACCUM_FBIT__ 31\000"
.LASF689:
.ascii "PRIuLEAST8 __PRI8LEAST(u)\000"
.LASF937:
.LASF939:
.ascii "BDCR\000"
.LASF211:
.ascii "__FLT32_HAS_QUIET_NAN__ 1\000"
@@ -4414,7 +4423,7 @@ tim4_start:
.ascii "RCC_CR_HSERDY_READY (1 << RCC_CR_HSERDY_BIT)\000"
.LASF763:
.ascii "SCNx32 __SCN32(x)\000"
.LASF918:
.LASF920:
.ascii "CFGR\000"
.LASF558:
.ascii "___int_least32_t_defined 1\000"
@@ -4484,7 +4493,7 @@ tim4_start:
.ascii "___int8_t_defined 1\000"
.LASF248:
.ascii "__SFRACT_MIN__ (-0.5HR-0.5HR)\000"
.LASF911:
.LASF913:
.ascii "long unsigned int\000"
.LASF349:
.ascii "__SA_IBIT__ 16\000"
@@ -4502,7 +4511,7 @@ tim4_start:
.ascii "__UINT16_TYPE__ short unsigned int\000"
.LASF868:
.ascii "RCC_PLLCFGR_PLLSRC_BIT 22\000"
.LASF944:
.LASF946:
.ascii "DIER\000"
.LASF657:
.ascii "_WCHAR_T_DEFINED_ \000"
@@ -4606,11 +4615,11 @@ tim4_start:
.ascii "PRIX32 __PRI32(X)\000"
.LASF774:
.ascii "SCNxLEAST32 __SCN32LEAST(x)\000"
.LASF954:
.LASF956:
.ascii "tim4_start\000"
.LASF704:
.ascii "SCNiFAST8 __SCN8FAST(i)\000"
.LASF917:
.LASF919:
.ascii "PLLCFGR\000"
.LASF5:
.ascii "__GNUC__ 12\000"
@@ -4638,7 +4647,7 @@ tim4_start:
.ascii "__ULACCUM_MIN__ 0.0ULK\000"
.LASF462:
.ascii "_ATEXIT_DYNAMIC_ALLOC 1\000"
.LASF910:
.LASF912:
.ascii "__uint32_t\000"
.LASF188:
.ascii "__LDBL_MAX__ 1.7976931348623157e+308L\000"
@@ -4648,7 +4657,7 @@ tim4_start:
.ascii "__FLT_RADIX__ 2\000"
.LASF455:
.ascii "_INTTYPES_H \000"
.LASF912:
.LASF914:
.ascii "long long int\000"
.LASF401:
.ascii "__ARM_FEATURE_CMSE\000"
@@ -4668,7 +4677,7 @@ tim4_start:
.ascii "WINT_MAX (__WINT_MAX__)\000"
.LASF823:
.ascii "SCNuFAST64 __SCN64FAST(u)\000"
.LASF939:
.LASF941:
.ascii "SSCGR\000"
.LASF137:
.ascii "__UINT_FAST64_MAX__ 0xffffffffffffffffULL\000"
@@ -4696,7 +4705,7 @@ tim4_start:
.ascii "___int32_t_defined 1\000"
.LASF83:
.ascii "__INT_WIDTH__ 32\000"
.LASF923:
.LASF925:
.ascii "APB2RSTR\000"
.LASF409:
.ascii "__ARM_ARCH_PROFILE\000"
@@ -4748,9 +4757,9 @@ tim4_start:
.ascii "__ARM_NEON_FP\000"
.LASF280:
.ascii "__LLFRACT_EPSILON__ 0x1P-63LLR\000"
.LASF935:
.LASF937:
.ascii "APB2LPENR\000"
.LASF903:
.LASF905:
.ascii "TIM_ENABLE (1 << TIM_CR1_CEN_BIT)\000"
.LASF821:
.ascii "SCNiFAST64 __SCN64FAST(i)\000"
@@ -4758,7 +4767,7 @@ tim4_start:
.ascii "_ANSIDECL_H_ \000"
.LASF684:
.ascii "SCNu8 __SCN8(u)\000"
.LASF900:
.LASF902:
.ascii "TIM4_BASE_ADDR (0x40000800U)\000"
.LASF261:
.ascii "__UFRACT_FBIT__ 16\000"
@@ -4778,7 +4787,7 @@ tim4_start:
.ascii "L)\000"
.LASF608:
.ascii "INT64_MAX (__INT64_MAX__)\000"
.LASF914:
.LASF916:
.ascii "unsigned int\000"
.LASF857:
.ascii "RCC_CR_HSERDY_BIT 17\000"
@@ -4864,7 +4873,7 @@ tim4_start:
.ascii "__STRINGIFY(a) #a\000"
.LASF356:
.ascii "__USA_FBIT__ 16\000"
.LASF934:
.LASF936:
.ascii "APB1LPENR\000"
.LASF480:
.ascii "__IEEE_LITTLE_ENDIAN \000"
@@ -4972,6 +4981,8 @@ tim4_start:
.ascii "SCNx64 __SCN64(x)\000"
.LASF198:
.ascii "__FLT32_DIG__ 6\000"
.LASF897:
.ascii "RCC_APB1ENR_USART2EN_BIT 17\000"
.LASF884:
.ascii "RCC_CFGR_PPRE1_MASK (0b111)\000"
.LASF646:
@@ -4990,13 +5001,13 @@ tim4_start:
.ascii "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1\000"
.LASF734:
.ascii "SCNuLEAST16 __SCN16LEAST(u)\000"
.LASF922:
.LASF924:
.ascii "APB1RSTR\000"
.LASF298:
.ascii "__ACCUM_MIN__ (-0X1P15K-0X1P15K)\000"
.LASF393:
.ascii "__ARM_FEATURE_CRYPTO\000"
.LASF928:
.LASF930:
.ascii "APB1ENR\000"
.LASF742:
.ascii "SCNdFAST16 __SCN16FAST(d)\000"
@@ -5026,7 +5037,7 @@ tim4_start:
.ascii ")\000"
.LASF155:
.ascii "__FLT_NORM_MAX__ 3.4028234663852886e+38F\000"
.LASF913:
.LASF915:
.ascii "long long unsigned int\000"
.LASF612:
.ascii "UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)\000"
@@ -5073,7 +5084,7 @@ tim4_start:
.ascii "__UINT_LEAST16_TYPE__ short unsigned int\000"
.LASF574:
.ascii "_INTMAX_T_DECLARED \000"
.LASF947:
.LASF949:
.ascii "CCER\000"
.LASF40:
.ascii "__CHAR16_TYPE__ short unsigned int\000"
@@ -5129,7 +5140,7 @@ tim4_start:
.ascii "__int20__ +2\000"
.LASF655:
.ascii "_WCHAR_T_ \000"
.LASF943:
.LASF945:
.ascii "SMCR\000"
.LASF829:
.ascii "PRIoMAX __PRIMAX(o)\000"
@@ -5199,7 +5210,7 @@ tim4_start:
.ascii "__ARM_ARCH_7EM__ 1\000"
.LASF428:
.ascii "__ARM_FEATURE_FP16_SCALAR_ARITHMETIC\000"
.LASF925:
.LASF927:
.ascii "AHB1ENR\000"
.LASF295:
.ascii "__USACCUM_EPSILON__ 0x1P-8UHK\000"
@@ -5239,7 +5250,7 @@ tim4_start:
.ascii "__DBL_DIG__ 15\000"
.LASF275:
.ascii "__ULFRACT_EPSILON__ 0x1P-32ULR\000"
.LASF920:
.LASF922:
.ascii "AHB2RSTR\000"
.LASF672:
.ascii "__SCN8(x) __INT8 __STRINGIFY(x)\000"
@@ -5269,7 +5280,7 @@ tim4_start:
.ascii "unsigned\000"
.LASF381:
.ascii "__GCC_DESTRUCTIVE_SIZE 64\000"
.LASF906:
.LASF908:
.ascii "short int\000"
.LASF836:
.ascii "SCNuMAX __SCNMAX(u)\000"
@@ -5295,7 +5306,7 @@ tim4_start:
.ascii "__ARM_FEATURE_COPROC\000"
.LASF177:
.ascii "__DBL_HAS_INFINITY__ 1\000"
.LASF901:
.LASF903:
.ascii "TIM4 ((struct timer *) TIM4_BASE_ADDR)\000"
.LASF95:
.ascii "__SIG_ATOMIC_MAX__ 0x7fffffff\000"
@@ -5413,13 +5424,13 @@ tim4_start:
.ascii "__ULLFRACT_MIN__ 0.0ULLR\000"
.LASF652:
.ascii "_T_WCHAR_ \000"
.LASF952:
.LASF954:
.ascii "BDTR\000"
.LASF382:
.ascii "__GCC_CONSTRUCTIVE_SIZE 64\000"
.LASF665:
.ascii "_BSD_WCHAR_T_\000"
.LASF940:
.LASF942:
.ascii "PLLI2SCFGR\000"
.LASF277:
.ascii "__LLFRACT_IBIT__ 0\000"
@@ -5427,9 +5438,9 @@ tim4_start:
.ascii "UINT16_C(x) __UINT16_C(x)\000"
.LASF757:
.ascii "PRIx32 __PRI32(x)\000"
.LASF955:
.LASF957:
.ascii "tim4_init\000"
.LASF916:
.LASF918:
.ascii "uint32_t\000"
.LASF873:
.ascii "RCC_PLLCFGR_PLLN_BIT 6\000"
@@ -5489,7 +5500,7 @@ tim4_start:
.ascii "PRIXLEAST32 __PRI32LEAST(X)\000"
.LASF171:
.ascii "__DBL_MAX__ ((double)1.7976931348623157e+308L)\000"
.LASF907:
.LASF909:
.ascii "short unsigned int\000"
.LASF276:
.ascii "__LLFRACT_FBIT__ 63\000"
@@ -5529,7 +5540,7 @@ tim4_start:
.ascii "SCNuFAST32 __SCN32FAST(u)\000"
.LASF523:
.ascii "long +4\000"
.LASF919:
.LASF921:
.ascii "AHB1RSTR\000"
.LASF724:
.ascii "SCNx16 __SCN16(x)\000"
@@ -5539,7 +5550,7 @@ tim4_start:
.ascii "__SCN64LEAST(x) __LEAST64 __STRINGIFY(x)\000"
.LASF340:
.ascii "__USQ_FBIT__ 32\000"
.LASF958:
.LASF960:
.ascii "/home/alex/code/own/stm32-falling-sand\000"
.LASF797:
.ascii "PRIX64 __PRI64(X)\000"
+3
View File
@@ -2085,6 +2085,9 @@ struct rcc {
#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
BIN
View File
Binary file not shown.
+6189
View File
File diff suppressed because it is too large Load Diff
+2254
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+4
View File
@@ -17,6 +17,10 @@ struct gpio {
volatile uint32_t AFRH; // Alternative function high register
};
// AFRH, AFRL registers
#define GPIO_AF_USART2_RX (0b0111) // Alternative function 7 (AF7)
#define GPIO_AF_USART2_TX (0b0111) // Alternative function 7 (AF7)
#define GPIO_BASE_ADDR (0x40020000U)
#define GPIO_PORT_OFFSET (0x400U)
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))
+3
View File
@@ -118,6 +118,9 @@ struct rcc {
#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)
+66
View File
@@ -0,0 +1,66 @@
#include "rcc.h"
#include "gpio.h"
#include "usart.h"
void usart2_init(void) {
// Enable clock for GPIOA as USART2 is on PORT A pins
RCC->AHB1ENR |= (1 << PORT('A'));
// Configure PA2 and PA3 (USART2 pins) to use alternative functions
uint16_t txPin = PIN('A', 2);
gpio_set_mode(txPin, GPIO_MODE_AF);
gpio_set_af(txPin, GPIO_AF_USART2_TX);
uint16_t rxPin = PIN('A', 3);
gpio_set_mode(rxPin, GPIO_MODE_AF);
gpio_set_af(rxPin, GPIO_AF_USART2_RX);
// Enable USART
RCC->APB1ENR |= RCC_APB1ENR_USART2EN_ENABLE;
// Clear control registers
USART2->CR1 = 0;
USART2->CR2 = 0;
USART2->CR3 = 0;
// Calculate Baud rate:
// baud = f_clck / (8 * (2 - OVER8) * USARTDIV) =>
// (8 * (2 - OVER8) * USARTDIV) = f_clock / baud =>
// baud * (8 * (2 - OVER8) * USARTDIV) = f_clock =>
// USARTDIV = (f_clock / (baud * (8 * (2 - OVER8)))
// Target Baud rate = 115200, f_clock = 48MHz, OVER8 = 0
// USARTDIV = 48E6 / (115200 * 8 * 2) = 26.0416666
// mantissa = 26 = 0x1A
// fraction = 0.041666 * 16 = 0.666656 ~= 1
// baud = 48E6 / (8 * 2 * 26) = 115384.61538461539
// error of 0.16% (115384.61538461539 / 115200 ) = 1.001602564102564
//
// skipping fractional part as error rate is good.
USART2->BRR &= ~(USART_BRR_MANTISSA_MASK << USART_BRR_MANTISSA_BIT);
USART2->BRR |= (0x1A << USART_BRR_MANTISSA_BIT);
USART2->BRR &= ~(USART_BRR_FRACTION_MASK << USART_BRR_FRACTION_BIT);
USART2->BRR |= (0x0 << USART_BRR_MANTISSA_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;
}
void usart2_write_byte(uint8_t c) {
USART2->DR = c;
// Wait indefinitely for transmission to be ready for data
while (!(USART2->SR & USART_SR_TC_COMPLETED));
}
void usart2_write(char *buf) {
while (*buf) usart2_write_byte(*buf++);
}
+50
View File
@@ -0,0 +1,50 @@
#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 register
};
#define USART2_BASE_ADDR (0x40004400U)
#define USART2 ((struct usart *) USART2_BASE_ADDR)
// SR Register
// Transmission complete
#define USART_SR_TC_BIT 6
#define USART_SR_TC_COMPLETED (1 << USART_SR_TC_BIT)
// CR Register
// 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)
#define USART_BRR_FRACTION_BIT 0 // Bits [3:0]
#define USART_BRR_FRACTION_MASK (0b111)
void usart2_init(void);
void usart2_start(void);
void usart2_write_byte(uint8_t byte);
void usart2_write(char *buf);
#endif