Add USART support #1

Merged
alex merged 17 commits from uart into main 2025-01-01 12:52:15 +01:00
17 changed files with 1124 additions and 926 deletions
Showing only changes of commit 1ae81edf57 - Show all commits
BIN
View File
Binary file not shown.
+29 -29
View File
@@ -53,7 +53,7 @@ Discarded input sections
.debug_macro 0x00000000 0x89 build/main.o .debug_macro 0x00000000 0x89 build/main.o
.debug_macro 0x00000000 0x4cc build/main.o .debug_macro 0x00000000 0x4cc build/main.o
.debug_macro 0x00000000 0x22 build/main.o .debug_macro 0x00000000 0x22 build/main.o
.debug_macro 0x00000000 0x40 build/main.o .debug_macro 0x00000000 0x46 build/main.o
.group 0x00000000 0xc build/startup.o .group 0x00000000 0xc build/startup.o
.group 0x00000000 0xc build/startup.o .group 0x00000000 0xc build/startup.o
.group 0x00000000 0xc build/startup.o .group 0x00000000 0xc build/startup.o
@@ -128,7 +128,7 @@ Discarded input sections
.debug_macro 0x00000000 0x1df build/usart.o .debug_macro 0x00000000 0x1df build/usart.o
.debug_macro 0x00000000 0x89 build/usart.o .debug_macro 0x00000000 0x89 build/usart.o
.debug_macro 0x00000000 0x4cc build/usart.o .debug_macro 0x00000000 0x4cc build/usart.o
.debug_macro 0x00000000 0x130 build/usart.o .debug_macro 0x00000000 0x167 build/usart.o
.debug_macro 0x00000000 0x22 build/usart.o .debug_macro 0x00000000 0x22 build/usart.o
.debug_macro 0x00000000 0x5e build/usart.o .debug_macro 0x00000000 0x5e build/usart.o
@@ -354,7 +354,7 @@ LOAD linker stubs
.debug_rnglists .debug_rnglists
0x00000073 0x26 build/usart.o 0x00000073 0x26 build/usart.o
.debug_macro 0x00000000 0x47d9 .debug_macro 0x00000000 0x4853
.debug_macro 0x00000000 0xb56 build/gpio.o .debug_macro 0x00000000 0xb56 build/gpio.o
.debug_macro 0x00000b56 0x22 build/gpio.o .debug_macro 0x00000b56 0x22 build/gpio.o
.debug_macro 0x00000b78 0x75 build/gpio.o .debug_macro 0x00000b78 0x75 build/gpio.o
@@ -369,39 +369,39 @@ LOAD linker stubs
.debug_macro 0x0000108c 0x89 build/gpio.o .debug_macro 0x0000108c 0x89 build/gpio.o
.debug_macro 0x00001115 0x4cc build/gpio.o .debug_macro 0x00001115 0x4cc build/gpio.o
.debug_macro 0x000015e1 0x22 build/gpio.o .debug_macro 0x000015e1 0x22 build/gpio.o
.debug_macro 0x00001603 0x40 build/gpio.o .debug_macro 0x00001603 0x46 build/gpio.o
.debug_macro 0x00001643 0xb89 build/main.o .debug_macro 0x00001649 0xb89 build/main.o
.debug_macro 0x000021cc 0x136 build/main.o .debug_macro 0x000021d2 0x16d build/main.o
.debug_macro 0x00002302 0x46 build/main.o .debug_macro 0x0000233f 0x46 build/main.o
.debug_macro 0x00002348 0x2e build/main.o .debug_macro 0x00002385 0x2e build/main.o
.debug_macro 0x00002376 0x22 build/main.o .debug_macro 0x000023b3 0x22 build/main.o
.debug_macro 0x00002398 0x5e build/main.o .debug_macro 0x000023d5 0x5e build/main.o
.debug_macro 0x000023f6 0xb02 build/startup.o .debug_macro 0x00002433 0xb02 build/startup.o
.debug_macro 0x00002ef8 0x56 build/startup.o .debug_macro 0x00002f35 0x56 build/startup.o
.debug_macro 0x00002f4e 0x51 build/startup.o .debug_macro 0x00002f8b 0x51 build/startup.o
.debug_macro 0x00002f9f 0xb5c build/timer.o .debug_macro 0x00002fdc 0xb5c build/timer.o
.debug_macro 0x00003afb 0x130 build/timer.o .debug_macro 0x00003b38 0x167 build/timer.o
.debug_macro 0x00003c2b 0xb74 build/usart.o .debug_macro 0x00003c9f 0xb74 build/usart.o
.debug_macro 0x0000479f 0x3a build/usart.o .debug_macro 0x00004813 0x40 build/usart.o
.debug_line 0x00000000 0x699 .debug_line 0x00000000 0x69d
.debug_line 0x00000000 0x179 build/gpio.o .debug_line 0x00000000 0x179 build/gpio.o
.debug_line 0x00000179 0x1de build/main.o .debug_line 0x00000179 0x1de build/main.o
.debug_line 0x00000357 0xea build/startup.o .debug_line 0x00000357 0xea build/startup.o
.debug_line 0x00000441 0xdf build/timer.o .debug_line 0x00000441 0xdf build/timer.o
.debug_line 0x00000520 0x179 build/usart.o .debug_line 0x00000520 0x17d build/usart.o
.debug_str 0x00000000 0x6185 .debug_str 0x00000000 0x626f
.debug_str 0x00000000 0x53c1 build/gpio.o .debug_str 0x00000000 0x53d8 build/gpio.o
0x5571 (size before relaxing) 0x5588 (size before relaxing)
.debug_str 0x000053c1 0xcfb build/main.o .debug_str 0x000053d8 0xdce build/main.o
0x61fe (size before relaxing) 0x62e8 (size before relaxing)
.debug_str 0x000060bc 0x88 build/startup.o .debug_str 0x000061a6 0x88 build/startup.o
0x3cdc (size before relaxing) 0x3cdc (size before relaxing)
.debug_str 0x00006144 0xc build/timer.o .debug_str 0x0000622e 0xc build/timer.o
0x5b6e (size before relaxing) 0x5c41 (size before relaxing)
.debug_str 0x00006150 0x35 build/usart.o .debug_str 0x0000623a 0x35 build/usart.o
0x5ec2 (size before relaxing) 0x5fac (size before relaxing)
.comment 0x00000000 0x45 .comment 0x00000000 0x45
.comment 0x00000000 0x45 build/gpio.o .comment 0x00000000 0x45 build/gpio.o
+104 -99
View File
@@ -311,10 +311,10 @@ gpio_write:
.byte 0x4 .byte 0x4
.4byte .Ldebug_abbrev0 .4byte .Ldebug_abbrev0
.uleb128 0xa .uleb128 0xa
.4byte .LASF900
.byte 0x1d
.4byte .LASF901 .4byte .LASF901
.byte 0x1d
.4byte .LASF902 .4byte .LASF902
.4byte .LASF903
.4byte .LLRL0 .4byte .LLRL0
.4byte 0 .4byte 0
.4byte .Ldebug_line0 .4byte .Ldebug_line0
@@ -322,9 +322,9 @@ gpio_write:
.uleb128 0x1 .uleb128 0x1
.byte 0x1 .byte 0x1
.byte 0x6 .byte 0x6
.4byte .LASF865 .4byte .LASF866
.uleb128 0x2 .uleb128 0x2
.4byte .LASF868 .4byte .LASF869
.byte 0x2 .byte 0x2
.byte 0x2b .byte 0x2b
.byte 0x17 .byte 0x17
@@ -332,13 +332,13 @@ gpio_write:
.uleb128 0x1 .uleb128 0x1
.byte 0x1 .byte 0x1
.byte 0x8 .byte 0x8
.4byte .LASF866 .4byte .LASF867
.uleb128 0x1 .uleb128 0x1
.byte 0x2 .byte 0x2
.byte 0x5 .byte 0x5
.4byte .LASF867 .4byte .LASF868
.uleb128 0x2 .uleb128 0x2
.4byte .LASF869 .4byte .LASF870
.byte 0x2 .byte 0x2
.byte 0x39 .byte 0x39
.byte 0x1c .byte 0x1c
@@ -346,13 +346,13 @@ gpio_write:
.uleb128 0x1 .uleb128 0x1
.byte 0x2 .byte 0x2
.byte 0x7 .byte 0x7
.4byte .LASF870 .4byte .LASF871
.uleb128 0x1 .uleb128 0x1
.byte 0x4 .byte 0x4
.byte 0x5 .byte 0x5
.4byte .LASF871
.uleb128 0x2
.4byte .LASF872 .4byte .LASF872
.uleb128 0x2
.4byte .LASF873
.byte 0x2 .byte 0x2
.byte 0x4f .byte 0x4f
.byte 0x1b .byte 0x1b
@@ -360,21 +360,21 @@ gpio_write:
.uleb128 0x1 .uleb128 0x1
.byte 0x4 .byte 0x4
.byte 0x7 .byte 0x7
.4byte .LASF873
.uleb128 0x1
.byte 0x8
.byte 0x5
.4byte .LASF874 .4byte .LASF874
.uleb128 0x1 .uleb128 0x1
.byte 0x8 .byte 0x8
.byte 0x7 .byte 0x5
.4byte .LASF875 .4byte .LASF875
.uleb128 0x1
.byte 0x8
.byte 0x7
.4byte .LASF876
.uleb128 0xb .uleb128 0xb
.byte 0x4 .byte 0x4
.byte 0x5 .byte 0x5
.ascii "int\000" .ascii "int\000"
.uleb128 0x2 .uleb128 0x2
.4byte .LASF876 .4byte .LASF877
.byte 0x2 .byte 0x2
.byte 0xe8 .byte 0xe8
.byte 0x16 .byte 0x16
@@ -382,21 +382,21 @@ gpio_write:
.uleb128 0x1 .uleb128 0x1
.byte 0x4 .byte 0x4
.byte 0x7 .byte 0x7
.4byte .LASF877
.uleb128 0x2
.4byte .LASF878 .4byte .LASF878
.uleb128 0x2
.4byte .LASF879
.byte 0x3 .byte 0x3
.byte 0x18 .byte 0x18
.byte 0x13 .byte 0x13
.4byte 0x31 .4byte 0x31
.uleb128 0x2 .uleb128 0x2
.4byte .LASF879 .4byte .LASF880
.byte 0x3 .byte 0x3
.byte 0x24 .byte 0x24
.byte 0x14 .byte 0x14
.4byte 0x4b .4byte 0x4b
.uleb128 0x2 .uleb128 0x2
.4byte .LASF880 .4byte .LASF881
.byte 0x3 .byte 0x3
.byte 0x30 .byte 0x30
.byte 0x14 .byte 0x14
@@ -404,35 +404,35 @@ gpio_write:
.uleb128 0xc .uleb128 0xc
.4byte 0xb8 .4byte 0xb8
.uleb128 0x2 .uleb128 0x2
.4byte .LASF881 .4byte .LASF882
.byte 0x3 .byte 0x3
.byte 0x52 .byte 0x52
.byte 0x15 .byte 0x15
.4byte 0x8d .4byte 0x8d
.uleb128 0xd .uleb128 0xd
.4byte .LASF898 .4byte .LASF899
.byte 0x28 .byte 0x28
.byte 0x4 .byte 0x4
.byte 0x7 .byte 0x7
.byte 0x8 .byte 0x8
.4byte 0x151 .4byte 0x151
.uleb128 0x3 .uleb128 0x3
.4byte .LASF882 .4byte .LASF883
.byte 0x8 .byte 0x8
.4byte 0xc4 .4byte 0xc4
.byte 0 .byte 0
.uleb128 0x3 .uleb128 0x3
.4byte .LASF883 .4byte .LASF884
.byte 0x9 .byte 0x9
.4byte 0xc4 .4byte 0xc4
.byte 0x4 .byte 0x4
.uleb128 0x3 .uleb128 0x3
.4byte .LASF884 .4byte .LASF885
.byte 0xa .byte 0xa
.4byte 0xc4 .4byte 0xc4
.byte 0x8 .byte 0x8
.uleb128 0x3 .uleb128 0x3
.4byte .LASF885 .4byte .LASF886
.byte 0xb .byte 0xb
.4byte 0xc4 .4byte 0xc4
.byte 0xc .byte 0xc
@@ -447,22 +447,22 @@ gpio_write:
.4byte 0xc4 .4byte 0xc4
.byte 0x14 .byte 0x14
.uleb128 0x3 .uleb128 0x3
.4byte .LASF886 .4byte .LASF887
.byte 0xe .byte 0xe
.4byte 0xc4 .4byte 0xc4
.byte 0x18 .byte 0x18
.uleb128 0x3 .uleb128 0x3
.4byte .LASF887 .4byte .LASF888
.byte 0xf .byte 0xf
.4byte 0xc4 .4byte 0xc4
.byte 0x1c .byte 0x1c
.uleb128 0x3 .uleb128 0x3
.4byte .LASF888 .4byte .LASF889
.byte 0x10 .byte 0x10
.4byte 0xc4 .4byte 0xc4
.byte 0x20 .byte 0x20
.uleb128 0x3 .uleb128 0x3
.4byte .LASF889 .4byte .LASF890
.byte 0x11 .byte 0x11
.4byte 0xc4 .4byte 0xc4
.byte 0x24 .byte 0x24
@@ -472,30 +472,30 @@ gpio_write:
.byte 0x1 .byte 0x1
.4byte 0x3d .4byte 0x3d
.byte 0x4 .byte 0x4
.byte 0x25 .byte 0x26
.byte 0xe .byte 0xe
.4byte 0x178 .4byte 0x178
.uleb128 0x5 .uleb128 0x5
.4byte .LASF890 .4byte .LASF891
.byte 0 .byte 0
.uleb128 0x5 .uleb128 0x5
.4byte .LASF891 .4byte .LASF892
.byte 0x1 .byte 0x1
.uleb128 0x5 .uleb128 0x5
.4byte .LASF892 .4byte .LASF893
.byte 0x2 .byte 0x2
.uleb128 0x5 .uleb128 0x5
.4byte .LASF893 .4byte .LASF894
.byte 0x3 .byte 0x3
.byte 0 .byte 0
.uleb128 0x2 .uleb128 0x2
.4byte .LASF894 .4byte .LASF895
.byte 0x4 .byte 0x4
.byte 0x2a .byte 0x2b
.byte 0x3 .byte 0x3
.4byte 0x151 .4byte 0x151
.uleb128 0x8 .uleb128 0x8
.4byte .LASF896 .4byte .LASF897
.byte 0x19 .byte 0x19
.4byte .LFB2 .4byte .LFB2
.4byte .LFE2-.LFB2 .4byte .LFE2-.LFB2
@@ -519,7 +519,7 @@ gpio_write:
.byte 0x91 .byte 0x91
.sleb128 -19 .sleb128 -19
.uleb128 0x6 .uleb128 0x6
.4byte .LASF898 .4byte .LASF899
.byte 0x1a .byte 0x1a
.4byte 0x1c9 .4byte 0x1c9
.uleb128 0x2 .uleb128 0x2
@@ -529,12 +529,12 @@ gpio_write:
.uleb128 0x1 .uleb128 0x1
.byte 0x1 .byte 0x1
.byte 0x2 .byte 0x2
.4byte .LASF895 .4byte .LASF896
.uleb128 0xf .uleb128 0xf
.byte 0x4 .byte 0x4
.4byte 0xd5 .4byte 0xd5
.uleb128 0x8 .uleb128 0x8
.4byte .LASF897 .4byte .LASF898
.byte 0xd .byte 0xd
.4byte .LFB1 .4byte .LFB1
.4byte .LFE1-.LFB1 .4byte .LFE1-.LFB1
@@ -558,7 +558,7 @@ gpio_write:
.byte 0x91 .byte 0x91
.sleb128 -19 .sleb128 -19
.uleb128 0x6 .uleb128 0x6
.4byte .LASF898 .4byte .LASF899
.byte 0xe .byte 0xe
.4byte 0x1c9 .4byte 0x1c9
.uleb128 0x2 .uleb128 0x2
@@ -573,7 +573,7 @@ gpio_write:
.sleb128 -16 .sleb128 -16
.byte 0 .byte 0
.uleb128 0x10 .uleb128 0x10
.4byte .LASF903 .4byte .LASF904
.byte 0x1 .byte 0x1
.byte 0x6 .byte 0x6
.byte 0x6 .byte 0x6
@@ -590,7 +590,7 @@ gpio_write:
.byte 0x91 .byte 0x91
.sleb128 -18 .sleb128 -18
.uleb128 0x11 .uleb128 0x11
.4byte .LASF899 .4byte .LASF900
.byte 0x1 .byte 0x1
.byte 0x6 .byte 0x6
.byte 0x2c .byte 0x2c
@@ -599,7 +599,7 @@ gpio_write:
.byte 0x91 .byte 0x91
.sleb128 -19 .sleb128 -19
.uleb128 0x6 .uleb128 0x6
.4byte .LASF898 .4byte .LASF899
.byte 0x7 .byte 0x7
.4byte 0x1c9 .4byte 0x1c9
.uleb128 0x2 .uleb128 0x2
@@ -3704,7 +3704,7 @@ gpio_write:
.uleb128 0x32 .uleb128 0x32
.4byte .LASF854 .4byte .LASF854
.byte 0 .byte 0
.section .debug_macro,"G",%progbits,wm4.gpio.h.2.e8870d5e334b8cc926c6b43b65993420,comdat .section .debug_macro,"G",%progbits,wm4.gpio.h.2.e8e8ad5caa641b1849e6396c88187098,comdat
.Ldebug_macro15: .Ldebug_macro15:
.2byte 0x5 .2byte 0x5
.byte 0 .byte 0
@@ -3718,7 +3718,7 @@ gpio_write:
.uleb128 0x16 .uleb128 0x16
.4byte .LASF857 .4byte .LASF857
.byte 0x5 .byte 0x5
.uleb128 0x18 .uleb128 0x17
.4byte .LASF858 .4byte .LASF858
.byte 0x5 .byte 0x5
.uleb128 0x19 .uleb128 0x19
@@ -3727,17 +3727,20 @@ gpio_write:
.uleb128 0x1a .uleb128 0x1a
.4byte .LASF860 .4byte .LASF860
.byte 0x5 .byte 0x5
.uleb128 0x1d .uleb128 0x1b
.4byte .LASF861 .4byte .LASF861
.byte 0x5 .byte 0x5
.uleb128 0x1f .uleb128 0x1e
.4byte .LASF862 .4byte .LASF862
.byte 0x5 .byte 0x5
.uleb128 0x21 .uleb128 0x20
.4byte .LASF863 .4byte .LASF863
.byte 0x5 .byte 0x5
.uleb128 0x23 .uleb128 0x22
.4byte .LASF864 .4byte .LASF864
.byte 0x5
.uleb128 0x24
.4byte .LASF865
.byte 0 .byte 0
.section .debug_line,"",%progbits .section .debug_line,"",%progbits
.Ldebug_line0: .Ldebug_line0:
@@ -3782,7 +3785,7 @@ gpio_write:
.ascii "__PTRDIFF_MAX__ 0x7fffffff\000" .ascii "__PTRDIFF_MAX__ 0x7fffffff\000"
.LASF541: .LASF541:
.ascii "_LONG_DOUBLE long double\000" .ascii "_LONG_DOUBLE long double\000"
.LASF898: .LASF899:
.ascii "gpio\000" .ascii "gpio\000"
.LASF591: .LASF591:
.ascii "INT_LEAST8_MIN (-__INT_LEAST8_MAX__ - 1)\000" .ascii "INT_LEAST8_MIN (-__INT_LEAST8_MAX__ - 1)\000"
@@ -3790,7 +3793,7 @@ gpio_write:
.ascii "_UINT32_T_DECLARED \000" .ascii "_UINT32_T_DECLARED \000"
.LASF90: .LASF90:
.ascii "__INTMAX_MAX__ 0x7fffffffffffffffLL\000" .ascii "__INTMAX_MAX__ 0x7fffffffffffffffLL\000"
.LASF892: .LASF893:
.ascii "GPIO_MODE_AF\000" .ascii "GPIO_MODE_AF\000"
.LASF335: .LASF335:
.ascii "__TQ_IBIT__ 0\000" .ascii "__TQ_IBIT__ 0\000"
@@ -3904,7 +3907,7 @@ gpio_write:
.ascii "__need_wchar_t\000" .ascii "__need_wchar_t\000"
.LASF199: .LASF199:
.ascii "__FLT32_MIN_EXP__ (-125)\000" .ascii "__FLT32_MIN_EXP__ (-125)\000"
.LASF900: .LASF901:
.ascii "GNU C2X 12.3.1 20230626 -mcpu=cortex-m4 -mthumb -mf" .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 "loat-abi=hard -mfpu=fpv4-sp-d16 -march=armv7e-m+fp "
.ascii "-g3 -ggdb -O0 -std=c2x -ffunction-sections -fdata-s" .ascii "-g3 -ggdb -O0 -std=c2x -ffunction-sections -fdata-s"
@@ -3973,7 +3976,7 @@ gpio_write:
.ascii "__LACCUM_IBIT__ 32\000" .ascii "__LACCUM_IBIT__ 32\000"
.LASF592: .LASF592:
.ascii "INT_LEAST8_MAX (__INT_LEAST8_MAX__)\000" .ascii "INT_LEAST8_MAX (__INT_LEAST8_MAX__)\000"
.LASF868: .LASF869:
.ascii "__uint8_t\000" .ascii "__uint8_t\000"
.LASF81: .LASF81:
.ascii "__SCHAR_WIDTH__ 8\000" .ascii "__SCHAR_WIDTH__ 8\000"
@@ -3989,7 +3992,7 @@ gpio_write:
.ascii "__INT64 \"ll\"\000" .ascii "__INT64 \"ll\"\000"
.LASF138: .LASF138:
.ascii "__INTPTR_MAX__ 0x7fffffff\000" .ascii "__INTPTR_MAX__ 0x7fffffff\000"
.LASF860: .LASF861:
.ascii "GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADD" .ascii "GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADD"
.ascii "R + (GPIO_PORT_OFFSET * port)))\000" .ascii "R + (GPIO_PORT_OFFSET * port)))\000"
.LASF499: .LASF499:
@@ -4015,7 +4018,7 @@ gpio_write:
.ascii "INT_FAST32_MIN (-__INT_FAST32_MAX__ - 1)\000" .ascii "INT_FAST32_MIN (-__INT_FAST32_MAX__ - 1)\000"
.LASF672: .LASF672:
.ascii "__SCN8LEAST(x) __LEAST8 __STRINGIFY(x)\000" .ascii "__SCN8LEAST(x) __LEAST8 __STRINGIFY(x)\000"
.LASF857: .LASF858:
.ascii "GPIO_AF_USART2_TX (0b0111)\000" .ascii "GPIO_AF_USART2_TX (0b0111)\000"
.LASF55: .LASF55:
.ascii "__UINT_LEAST8_TYPE__ unsigned char\000" .ascii "__UINT_LEAST8_TYPE__ unsigned char\000"
@@ -4025,7 +4028,7 @@ gpio_write:
.ascii "__ACCUM_FBIT__ 15\000" .ascii "__ACCUM_FBIT__ 15\000"
.LASF791: .LASF791:
.ascii "PRId64 __PRI64(d)\000" .ascii "PRId64 __PRI64(d)\000"
.LASF871: .LASF872:
.ascii "long int\000" .ascii "long int\000"
.LASF818: .LASF818:
.ascii "PRIXFAST64 __PRI64FAST(X)\000" .ascii "PRIXFAST64 __PRI64FAST(X)\000"
@@ -4121,7 +4124,7 @@ gpio_write:
.ascii "PRIoLEAST16 __PRI16LEAST(o)\000" .ascii "PRIoLEAST16 __PRI16LEAST(o)\000"
.LASF458: .LASF458:
.ascii "__NEWLIB__ 4\000" .ascii "__NEWLIB__ 4\000"
.LASF890: .LASF891:
.ascii "GPIO_MODE_INPUT\000" .ascii "GPIO_MODE_INPUT\000"
.LASF720: .LASF720:
.ascii "SCNi16 __SCN16(i)\000" .ascii "SCNi16 __SCN16(i)\000"
@@ -4131,11 +4134,11 @@ gpio_write:
.ascii "__FLT_DECIMAL_DIG__ 9\000" .ascii "__FLT_DECIMAL_DIG__ 9\000"
.LASF562: .LASF562:
.ascii "_UINT8_T_DECLARED \000" .ascii "_UINT8_T_DECLARED \000"
.LASF865: .LASF866:
.ascii "signed char\000" .ascii "signed char\000"
.LASF805: .LASF805:
.ascii "PRIuLEAST64 __PRI64LEAST(u)\000" .ascii "PRIuLEAST64 __PRI64LEAST(u)\000"
.LASF878: .LASF879:
.ascii "uint8_t\000" .ascii "uint8_t\000"
.LASF704: .LASF704:
.ascii "SCNoFAST8 __SCN8FAST(o)\000" .ascii "SCNoFAST8 __SCN8FAST(o)\000"
@@ -4145,7 +4148,7 @@ gpio_write:
.ascii "__ARM_FEATURE_FMA 1\000" .ascii "__ARM_FEATURE_FMA 1\000"
.LASF466: .LASF466:
.ascii "_HAVE_LONG_DOUBLE 1\000" .ascii "_HAVE_LONG_DOUBLE 1\000"
.LASF894: .LASF895:
.ascii "GPIO_MODE\000" .ascii "GPIO_MODE\000"
.LASF256: .LASF256:
.ascii "__FRACT_FBIT__ 15\000" .ascii "__FRACT_FBIT__ 15\000"
@@ -4169,7 +4172,7 @@ gpio_write:
.ascii "__FLT64_MAX_10_EXP__ 308\000" .ascii "__FLT64_MAX_10_EXP__ 308\000"
.LASF65: .LASF65:
.ascii "__UINT_FAST32_TYPE__ unsigned int\000" .ascii "__UINT_FAST32_TYPE__ unsigned int\000"
.LASF866: .LASF867:
.ascii "unsigned char\000" .ascii "unsigned char\000"
.LASF3: .LASF3:
.ascii "__STDC_UTF_32__ 1\000" .ascii "__STDC_UTF_32__ 1\000"
@@ -4215,13 +4218,13 @@ gpio_write:
.ascii "__int_fast64_t_defined 1\000" .ascii "__int_fast64_t_defined 1\000"
.LASF837: .LASF837:
.ascii "__PRIPTR(x) __STRINGIFY(x)\000" .ascii "__PRIPTR(x) __STRINGIFY(x)\000"
.LASF879: .LASF880:
.ascii "uint16_t\000" .ascii "uint16_t\000"
.LASF417: .LASF417:
.ascii "__thumb2__ 1\000" .ascii "__thumb2__ 1\000"
.LASF321: .LASF321:
.ascii "__ULLACCUM_FBIT__ 32\000" .ascii "__ULLACCUM_FBIT__ 32\000"
.LASF895: .LASF896:
.ascii "_Bool\000" .ascii "_Bool\000"
.LASF366: .LASF366:
.ascii "__STRICT_ANSI__ 1\000" .ascii "__STRICT_ANSI__ 1\000"
@@ -4239,9 +4242,9 @@ gpio_write:
.ascii "__PRAGMA_REDEFINE_EXTNAME 1\000" .ascii "__PRAGMA_REDEFINE_EXTNAME 1\000"
.LASF36: .LASF36:
.ascii "__WCHAR_TYPE__ unsigned int\000" .ascii "__WCHAR_TYPE__ unsigned int\000"
.LASF861: .LASF862:
.ascii "PORT(port) (((port) - 'A') << 8)\000" .ascii "PORT(port) (((port) - 'A') << 8)\000"
.LASF891: .LASF892:
.ascii "GPIO_MODE_OUTPUT\000" .ascii "GPIO_MODE_OUTPUT\000"
.LASF357: .LASF357:
.ascii "__USA_IBIT__ 16\000" .ascii "__USA_IBIT__ 16\000"
@@ -4279,7 +4282,7 @@ gpio_write:
.ascii "__SCN64(x) __INT64 __STRINGIFY(x)\000" .ascii "__SCN64(x) __INT64 __STRINGIFY(x)\000"
.LASF646: .LASF646:
.ascii "_GCC_WRAP_STDINT_H \000" .ascii "_GCC_WRAP_STDINT_H \000"
.LASF869: .LASF870:
.ascii "__uint16_t\000" .ascii "__uint16_t\000"
.LASF224: .LASF224:
.ascii "__FLT64_EPSILON__ 2.2204460492503131e-16F64\000" .ascii "__FLT64_EPSILON__ 2.2204460492503131e-16F64\000"
@@ -4489,7 +4492,7 @@ gpio_write:
.ascii "___int8_t_defined 1\000" .ascii "___int8_t_defined 1\000"
.LASF248: .LASF248:
.ascii "__SFRACT_MIN__ (-0.5HR-0.5HR)\000" .ascii "__SFRACT_MIN__ (-0.5HR-0.5HR)\000"
.LASF873: .LASF874:
.ascii "long unsigned int\000" .ascii "long unsigned int\000"
.LASF349: .LASF349:
.ascii "__SA_IBIT__ 16\000" .ascii "__SA_IBIT__ 16\000"
@@ -4505,9 +4508,9 @@ gpio_write:
.ascii "__ARM_FP16_FORMAT_IEEE\000" .ascii "__ARM_FP16_FORMAT_IEEE\000"
.LASF48: .LASF48:
.ascii "__UINT16_TYPE__ short unsigned int\000" .ascii "__UINT16_TYPE__ short unsigned int\000"
.LASF856: .LASF857:
.ascii "GPIO_AF_USART2_RX (0b0111)\000" .ascii "GPIO_AF_USART2_RX (0b0111)\000"
.LASF896: .LASF897:
.ascii "gpio_write\000" .ascii "gpio_write\000"
.LASF569: .LASF569:
.ascii "__int32_t_defined 1\000" .ascii "__int32_t_defined 1\000"
@@ -4551,7 +4554,7 @@ gpio_write:
.ascii "SCNx8 __SCN8(x)\000" .ascii "SCNx8 __SCN8(x)\000"
.LASF208: .LASF208:
.ascii "__FLT32_DENORM_MIN__ 1.4012984643248171e-45F32\000" .ascii "__FLT32_DENORM_MIN__ 1.4012984643248171e-45F32\000"
.LASF903: .LASF904:
.ascii "gpio_set_mode\000" .ascii "gpio_set_mode\000"
.LASF125: .LASF125:
.ascii "__UINT64_C(c) c ## ULL\000" .ascii "__UINT64_C(c) c ## ULL\000"
@@ -4571,7 +4574,7 @@ gpio_write:
.ascii "__GCC_ATOMIC_CHAR16_T_LOCK_FREE 2\000" .ascii "__GCC_ATOMIC_CHAR16_T_LOCK_FREE 2\000"
.LASF789: .LASF789:
.ascii "__PRI64FAST(x) __FAST64 __STRINGIFY(x)\000" .ascii "__PRI64FAST(x) __FAST64 __STRINGIFY(x)\000"
.LASF881: .LASF882:
.ascii "uintptr_t\000" .ascii "uintptr_t\000"
.LASF168: .LASF168:
.ascii "__DBL_MAX_EXP__ 1024\000" .ascii "__DBL_MAX_EXP__ 1024\000"
@@ -4619,7 +4622,7 @@ gpio_write:
.ascii "PRIX32 __PRI32(X)\000" .ascii "PRIX32 __PRI32(X)\000"
.LASF773: .LASF773:
.ascii "SCNxLEAST32 __SCN32LEAST(x)\000" .ascii "SCNxLEAST32 __SCN32LEAST(x)\000"
.LASF884: .LASF885:
.ascii "OSPEEDR\000" .ascii "OSPEEDR\000"
.LASF711: .LASF711:
.ascii "__SCN16LEAST(x) __LEAST16 __STRINGIFY(x)\000" .ascii "__SCN16LEAST(x) __LEAST16 __STRINGIFY(x)\000"
@@ -4649,7 +4652,7 @@ gpio_write:
.ascii "__ULACCUM_MIN__ 0.0ULK\000" .ascii "__ULACCUM_MIN__ 0.0ULK\000"
.LASF461: .LASF461:
.ascii "_ATEXIT_DYNAMIC_ALLOC 1\000" .ascii "_ATEXIT_DYNAMIC_ALLOC 1\000"
.LASF872: .LASF873:
.ascii "__uint32_t\000" .ascii "__uint32_t\000"
.LASF188: .LASF188:
.ascii "__LDBL_MAX__ 1.7976931348623157e+308L\000" .ascii "__LDBL_MAX__ 1.7976931348623157e+308L\000"
@@ -4659,7 +4662,7 @@ gpio_write:
.ascii "__FLT_RADIX__ 2\000" .ascii "__FLT_RADIX__ 2\000"
.LASF454: .LASF454:
.ascii "_INTTYPES_H \000" .ascii "_INTTYPES_H \000"
.LASF874: .LASF875:
.ascii "long long int\000" .ascii "long long int\000"
.LASF401: .LASF401:
.ascii "__ARM_FEATURE_CMSE\000" .ascii "__ARM_FEATURE_CMSE\000"
@@ -4691,6 +4694,8 @@ gpio_write:
.ascii "__GCC_ATOMIC_LLONG_LOCK_FREE 1\000" .ascii "__GCC_ATOMIC_LLONG_LOCK_FREE 1\000"
.LASF239: .LASF239:
.ascii "__FLT32X_MIN__ 2.2250738585072014e-308F32x\000" .ascii "__FLT32X_MIN__ 2.2250738585072014e-308F32x\000"
.LASF856:
.ascii "GPIO_AF_MCO_1 (0b0000)\000"
.LASF218: .LASF218:
.ascii "__FLT64_MAX_EXP__ 1024\000" .ascii "__FLT64_MAX_EXP__ 1024\000"
.LASF653: .LASF653:
@@ -4766,7 +4771,7 @@ gpio_write:
.ascii "\000" .ascii "\000"
.LASF582: .LASF582:
.ascii "__int_fast16_t_defined 1\000" .ascii "__int_fast16_t_defined 1\000"
.LASF882: .LASF883:
.ascii "MODER\000" .ascii "MODER\000"
.LASF482: .LASF482:
.ascii "__FLOAT_TYPE float\000" .ascii "__FLOAT_TYPE float\000"
@@ -4777,9 +4782,9 @@ gpio_write:
.ascii "L)\000" .ascii "L)\000"
.LASF607: .LASF607:
.ascii "INT64_MAX (__INT64_MAX__)\000" .ascii "INT64_MAX (__INT64_MAX__)\000"
.LASF877: .LASF878:
.ascii "unsigned int\000" .ascii "unsigned int\000"
.LASF876: .LASF877:
.ascii "__uintptr_t\000" .ascii "__uintptr_t\000"
.LASF459: .LASF459:
.ascii "__NEWLIB_MINOR__ 3\000" .ascii "__NEWLIB_MINOR__ 3\000"
@@ -4809,7 +4814,7 @@ gpio_write:
.ascii "__CHAR_BIT__ 8\000" .ascii "__CHAR_BIT__ 8\000"
.LASF143: .LASF143:
.ascii "__FLT_EVAL_METHOD__ 0\000" .ascii "__FLT_EVAL_METHOD__ 0\000"
.LASF867: .LASF868:
.ascii "short int\000" .ascii "short int\000"
.LASF685: .LASF685:
.ascii "PRIdLEAST8 __PRI8LEAST(d)\000" .ascii "PRIdLEAST8 __PRI8LEAST(d)\000"
@@ -4853,7 +4858,7 @@ gpio_write:
.ascii "__ARM_FEATURE_COPROC 15\000" .ascii "__ARM_FEATURE_COPROC 15\000"
.LASF483: .LASF483:
.ascii "__OBSOLETE_MATH_DEFAULT 1\000" .ascii "__OBSOLETE_MATH_DEFAULT 1\000"
.LASF897: .LASF898:
.ascii "gpio_set_af\000" .ascii "gpio_set_af\000"
.LASF82: .LASF82:
.ascii "__SHRT_WIDTH__ 16\000" .ascii "__SHRT_WIDTH__ 16\000"
@@ -4953,7 +4958,7 @@ gpio_write:
.ascii "SCNuFAST16 __SCN16FAST(u)\000" .ascii "SCNuFAST16 __SCN16FAST(u)\000"
.LASF801: .LASF801:
.ascii "SCNx64 __SCN64(x)\000" .ascii "SCNx64 __SCN64(x)\000"
.LASF864: .LASF865:
.ascii "PINPORT(pin) (pin >> 8)\000" .ascii "PINPORT(pin) (pin >> 8)\000"
.LASF198: .LASF198:
.ascii "__FLT32_DIG__ 6\000" .ascii "__FLT32_DIG__ 6\000"
@@ -5001,7 +5006,7 @@ gpio_write:
.ascii "__ORDER_LITTLE_ENDIAN__ 1234\000" .ascii "__ORDER_LITTLE_ENDIAN__ 1234\000"
.LASF155: .LASF155:
.ascii "__FLT_NORM_MAX__ 3.4028234663852886e+38F\000" .ascii "__FLT_NORM_MAX__ 3.4028234663852886e+38F\000"
.LASF875: .LASF876:
.ascii "long long unsigned int\000" .ascii "long long unsigned int\000"
.LASF611: .LASF611:
.ascii "UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)\000" .ascii "UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)\000"
@@ -5077,11 +5082,11 @@ gpio_write:
.ascii "SCNdFAST8 __SCN8FAST(d)\000" .ascii "SCNdFAST8 __SCN8FAST(d)\000"
.LASF576: .LASF576:
.ascii "_UINTPTR_T_DECLARED \000" .ascii "_UINTPTR_T_DECLARED \000"
.LASF889: .LASF890:
.ascii "AFRH\000" .ascii "AFRH\000"
.LASF314: .LASF314:
.ascii "__ULACCUM_MAX__ 0XFFFFFFFFFFFFFFFFP-32ULK\000" .ascii "__ULACCUM_MAX__ 0XFFFFFFFFFFFFFFFFP-32ULK\000"
.LASF888: .LASF889:
.ascii "AFRL\000" .ascii "AFRL\000"
.LASF273: .LASF273:
.ascii "__ULFRACT_MIN__ 0.0ULR\000" .ascii "__ULFRACT_MIN__ 0.0ULR\000"
@@ -5095,7 +5100,7 @@ gpio_write:
.ascii "__INT32_TYPE__ long int\000" .ascii "__INT32_TYPE__ long int\000"
.LASF118: .LASF118:
.ascii "__UINT_LEAST8_MAX__ 0xff\000" .ascii "__UINT_LEAST8_MAX__ 0xff\000"
.LASF887: .LASF888:
.ascii "LCKR\000" .ascii "LCKR\000"
.LASF520: .LASF520:
.ascii "__int20__ +2\000" .ascii "__int20__ +2\000"
@@ -5109,7 +5114,7 @@ gpio_write:
.ascii "__SCN32(x) __INT32 __STRINGIFY(x)\000" .ascii "__SCN32(x) __INT32 __STRINGIFY(x)\000"
.LASF743: .LASF743:
.ascii "SCNoFAST16 __SCN16FAST(o)\000" .ascii "SCNoFAST16 __SCN16FAST(o)\000"
.LASF862: .LASF863:
.ascii "PIN(port,num) (PORT(port) | num)\000" .ascii "PIN(port,num) (PORT(port) | num)\000"
.LASF345: .LASF345:
.ascii "__UTQ_IBIT__ 0\000" .ascii "__UTQ_IBIT__ 0\000"
@@ -5145,7 +5150,7 @@ gpio_write:
.ascii "__QQ_IBIT__ 0\000" .ascii "__QQ_IBIT__ 0\000"
.LASF763: .LASF763:
.ascii "PRIdLEAST32 __PRI32LEAST(d)\000" .ascii "PRIdLEAST32 __PRI32LEAST(d)\000"
.LASF883: .LASF884:
.ascii "OTYPER\000" .ascii "OTYPER\000"
.LASF811: .LASF811:
.ascii "SCNuLEAST64 __SCN64LEAST(u)\000" .ascii "SCNuLEAST64 __SCN64LEAST(u)\000"
@@ -5165,11 +5170,11 @@ gpio_write:
.ascii "__GNUC_MINOR__ 3\000" .ascii "__GNUC_MINOR__ 3\000"
.LASF57: .LASF57:
.ascii "__UINT_LEAST32_TYPE__ long unsigned int\000" .ascii "__UINT_LEAST32_TYPE__ long unsigned int\000"
.LASF901: .LASF902:
.ascii "src/gpio.c\000" .ascii "src/gpio.c\000"
.LASF405: .LASF405:
.ascii "__ARM_FEATURE_NUMERIC_MAXMIN\000" .ascii "__ARM_FEATURE_NUMERIC_MAXMIN\000"
.LASF858: .LASF859:
.ascii "GPIO_BASE_ADDR (0x40020000U)\000" .ascii "GPIO_BASE_ADDR (0x40020000U)\000"
.LASF38: .LASF38:
.ascii "__INTMAX_TYPE__ long long int\000" .ascii "__INTMAX_TYPE__ long long int\000"
@@ -5221,7 +5226,7 @@ gpio_write:
.ascii "__SCN8(x) __INT8 __STRINGIFY(x)\000" .ascii "__SCN8(x) __INT8 __STRINGIFY(x)\000"
.LASF23: .LASF23:
.ascii "__SIZEOF_SIZE_T__ 4\000" .ascii "__SIZEOF_SIZE_T__ 4\000"
.LASF859: .LASF860:
.ascii "GPIO_PORT_OFFSET (0x400U)\000" .ascii "GPIO_PORT_OFFSET (0x400U)\000"
.LASF50: .LASF50:
.ascii "__UINT64_TYPE__ long long unsigned int\000" .ascii "__UINT64_TYPE__ long long unsigned int\000"
@@ -5241,7 +5246,7 @@ gpio_write:
.ascii "unsigned\000" .ascii "unsigned\000"
.LASF381: .LASF381:
.ascii "__GCC_DESTRUCTIVE_SIZE 64\000" .ascii "__GCC_DESTRUCTIVE_SIZE 64\000"
.LASF885: .LASF886:
.ascii "PUPDR\000" .ascii "PUPDR\000"
.LASF835: .LASF835:
.ascii "SCNuMAX __SCNMAX(u)\000" .ascii "SCNuMAX __SCNMAX(u)\000"
@@ -5249,7 +5254,7 @@ gpio_write:
.ascii "__UINT16_C(c) c\000" .ascii "__UINT16_C(c) c\000"
.LASF359: .LASF359:
.ascii "__UDA_IBIT__ 32\000" .ascii "__UDA_IBIT__ 32\000"
.LASF899: .LASF900:
.ascii "mode\000" .ascii "mode\000"
.LASF586: .LASF586:
.ascii "INTPTR_MAX (__INTPTR_MAX__)\000" .ascii "INTPTR_MAX (__INTPTR_MAX__)\000"
@@ -5263,7 +5268,7 @@ gpio_write:
.ascii "_ATTRIBUTE(attrs) __attribute__ (attrs)\000" .ascii "_ATTRIBUTE(attrs) __attribute__ (attrs)\000"
.LASF443: .LASF443:
.ascii "__ARM_FEATURE_COPROC\000" .ascii "__ARM_FEATURE_COPROC\000"
.LASF893: .LASF894:
.ascii "GPIO_MODE_ANALOG\000" .ascii "GPIO_MODE_ANALOG\000"
.LASF177: .LASF177:
.ascii "__DBL_HAS_INFINITY__ 1\000" .ascii "__DBL_HAS_INFINITY__ 1\000"
@@ -5301,7 +5306,7 @@ gpio_write:
.ascii "__FAST8 \000" .ascii "__FAST8 \000"
.LASF496: .LASF496:
.ascii "__XSI_VISIBLE 0\000" .ascii "__XSI_VISIBLE 0\000"
.LASF886: .LASF887:
.ascii "BSRR\000" .ascii "BSRR\000"
.LASF794: .LASF794:
.ascii "PRIu64 __PRI64(u)\000" .ascii "PRIu64 __PRI64(u)\000"
@@ -5389,7 +5394,7 @@ gpio_write:
.ascii "PRIx32 __PRI32(x)\000" .ascii "PRIx32 __PRI32(x)\000"
.LASF278: .LASF278:
.ascii "__LLFRACT_MIN__ (-0.5LLR-0.5LLR)\000" .ascii "__LLFRACT_MIN__ (-0.5LLR-0.5LLR)\000"
.LASF880: .LASF881:
.ascii "uint32_t\000" .ascii "uint32_t\000"
.LASF689: .LASF689:
.ascii "PRIxLEAST8 __PRI8LEAST(x)\000" .ascii "PRIxLEAST8 __PRI8LEAST(x)\000"
@@ -5439,13 +5444,13 @@ gpio_write:
.ascii "__INT_LEAST16_TYPE__ short int\000" .ascii "__INT_LEAST16_TYPE__ short int\000"
.LASF326: .LASF326:
.ascii "__QQ_FBIT__ 7\000" .ascii "__QQ_FBIT__ 7\000"
.LASF863: .LASF864:
.ascii "PINNUM(pin) (pin & 0b1111)\000" .ascii "PINNUM(pin) (pin & 0b1111)\000"
.LASF768: .LASF768:
.ascii "PRIXLEAST32 __PRI32LEAST(X)\000" .ascii "PRIXLEAST32 __PRI32LEAST(X)\000"
.LASF171: .LASF171:
.ascii "__DBL_MAX__ ((double)1.7976931348623157e+308L)\000" .ascii "__DBL_MAX__ ((double)1.7976931348623157e+308L)\000"
.LASF870: .LASF871:
.ascii "short unsigned int\000" .ascii "short unsigned int\000"
.LASF276: .LASF276:
.ascii "__LLFRACT_FBIT__ 63\000" .ascii "__LLFRACT_FBIT__ 63\000"
@@ -5493,7 +5498,7 @@ gpio_write:
.ascii "__SCN64LEAST(x) __LEAST64 __STRINGIFY(x)\000" .ascii "__SCN64LEAST(x) __LEAST64 __STRINGIFY(x)\000"
.LASF280: .LASF280:
.ascii "__LLFRACT_EPSILON__ 0x1P-63LLR\000" .ascii "__LLFRACT_EPSILON__ 0x1P-63LLR\000"
.LASF902: .LASF903:
.ascii "/home/alex/code/own/stm32-falling-sand\000" .ascii "/home/alex/code/own/stm32-falling-sand\000"
.LASF249: .LASF249:
.ascii "__SFRACT_MAX__ 0X7FP-7HR\000" .ascii "__SFRACT_MAX__ 0X7FP-7HR\000"
+3 -2
View File
@@ -2000,6 +2000,7 @@ struct gpio {
}; };
#define GPIO_AF_MCO_1 (0b0000)
#define GPIO_AF_USART2_RX (0b0111) #define GPIO_AF_USART2_RX (0b0111)
#define GPIO_AF_USART2_TX (0b0111) #define GPIO_AF_USART2_TX (0b0111)
@@ -2026,9 +2027,9 @@ typedef enum {
void gpio_set_mode(uint16_t pin, GPIO_MODE mode); void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
void gpio_set_af(uint16_t pin, uint8_t af); void gpio_set_af(uint16_t pin, uint8_t af);
void gpio_write(uint16_t pin, void gpio_write(uint16_t pin,
# 46 "src/gpio.h" 3 4 # 47 "src/gpio.h" 3 4
_Bool _Bool
# 46 "src/gpio.h" # 47 "src/gpio.h"
val); val);
# 5 "src/gpio.c" 2 # 5 "src/gpio.c" 2
BIN
View File
Binary file not shown.
+386 -341
View File
File diff suppressed because it is too large Load Diff
+16 -2
View File
@@ -2070,6 +2070,19 @@ struct rcc {
#define RCC_CFGR_PPRE_DIV_2 (0b100) #define RCC_CFGR_PPRE_DIV_2 (0b100)
#define RCC_CFGR_MCO1_HSE (0b10)
#define RCC_CFGR_MCO1_PLL (0b11)
#define RCC_CFGR_MCO1_BIT 21
#define RCC_CFGR_MCO1_MASK (0b11)
#define RCC_CFGR_MCO1PRE_DIV4 (0b110)
#define RCC_CFGR_MCO1PRE_DIV2 (0b100)
#define RCC_CFGR_MCO1PRE_BIT 24
#define RCC_CFGR_MCO1PRE_MASK (0b111)
#define RCC_CFGR_PPRE2_BIT 13 #define RCC_CFGR_PPRE2_BIT 13
#define RCC_CFGR_PPRE2_MASK (0b111) #define RCC_CFGR_PPRE2_MASK (0b111)
@@ -2127,6 +2140,7 @@ struct gpio {
}; };
#define GPIO_AF_MCO_1 (0b0000)
#define GPIO_AF_USART2_RX (0b0111) #define GPIO_AF_USART2_RX (0b0111)
#define GPIO_AF_USART2_TX (0b0111) #define GPIO_AF_USART2_TX (0b0111)
@@ -2153,9 +2167,9 @@ typedef enum {
void gpio_set_mode(uint16_t pin, GPIO_MODE mode); void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
void gpio_set_af(uint16_t pin, uint8_t af); void gpio_set_af(uint16_t pin, uint8_t af);
void gpio_write(uint16_t pin, void gpio_write(uint16_t pin,
# 46 "src/gpio.h" 3 4 # 47 "src/gpio.h" 3 4
_Bool _Bool
# 46 "src/gpio.h" # 47 "src/gpio.h"
val); val);
# 6 "src/main.c" 2 # 6 "src/main.c" 2
# 1 "src/flash.h" 1 # 1 "src/flash.h" 1
BIN
View File
Binary file not shown.
+200 -160
View File
File diff suppressed because it is too large Load Diff
+13
View File
@@ -2055,6 +2055,19 @@ struct rcc {
#define RCC_CFGR_PPRE_DIV_2 (0b100) #define RCC_CFGR_PPRE_DIV_2 (0b100)
#define RCC_CFGR_MCO1_HSE (0b10)
#define RCC_CFGR_MCO1_PLL (0b11)
#define RCC_CFGR_MCO1_BIT 21
#define RCC_CFGR_MCO1_MASK (0b11)
#define RCC_CFGR_MCO1PRE_DIV4 (0b110)
#define RCC_CFGR_MCO1PRE_DIV2 (0b100)
#define RCC_CFGR_MCO1PRE_BIT 24
#define RCC_CFGR_MCO1PRE_MASK (0b111)
#define RCC_CFGR_PPRE2_BIT 13 #define RCC_CFGR_PPRE2_BIT 13
#define RCC_CFGR_PPRE2_MASK (0b111) #define RCC_CFGR_PPRE2_MASK (0b111)
BIN
View File
Binary file not shown.
+332 -287
View File
File diff suppressed because it is too large Load Diff
+18 -6
View File
@@ -2055,6 +2055,19 @@ struct rcc {
#define RCC_CFGR_PPRE_DIV_2 (0b100) #define RCC_CFGR_PPRE_DIV_2 (0b100)
#define RCC_CFGR_MCO1_HSE (0b10)
#define RCC_CFGR_MCO1_PLL (0b11)
#define RCC_CFGR_MCO1_BIT 21
#define RCC_CFGR_MCO1_MASK (0b11)
#define RCC_CFGR_MCO1PRE_DIV4 (0b110)
#define RCC_CFGR_MCO1PRE_DIV2 (0b100)
#define RCC_CFGR_MCO1PRE_BIT 24
#define RCC_CFGR_MCO1PRE_MASK (0b111)
#define RCC_CFGR_PPRE2_BIT 13 #define RCC_CFGR_PPRE2_BIT 13
#define RCC_CFGR_PPRE2_MASK (0b111) #define RCC_CFGR_PPRE2_MASK (0b111)
@@ -2124,6 +2137,7 @@ struct gpio {
}; };
#define GPIO_AF_MCO_1 (0b0000)
#define GPIO_AF_USART2_RX (0b0111) #define GPIO_AF_USART2_RX (0b0111)
#define GPIO_AF_USART2_TX (0b0111) #define GPIO_AF_USART2_TX (0b0111)
@@ -2150,9 +2164,9 @@ typedef enum {
void gpio_set_mode(uint16_t pin, GPIO_MODE mode); void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
void gpio_set_af(uint16_t pin, uint8_t af); void gpio_set_af(uint16_t pin, uint8_t af);
void gpio_write(uint16_t pin, void gpio_write(uint16_t pin,
# 46 "src/gpio.h" 3 4 # 47 "src/gpio.h" 3 4
_Bool _Bool
# 46 "src/gpio.h" # 47 "src/gpio.h"
val); val);
# 3 "src/usart.c" 2 # 3 "src/usart.c" 2
# 1 "src/usart.h" 1 # 1 "src/usart.h" 1
@@ -2218,16 +2232,14 @@ void usart2_init(void) {
uint16_t rxPin = (((('A') - 'A') << 8) | 3); uint16_t rxPin = (((('A') - 'A') << 8) | 3);
gpio_set_mode(rxPin, GPIO_MODE_AF); gpio_set_mode(rxPin, GPIO_MODE_AF);
gpio_set_af(rxPin, (0b0111)); gpio_set_af(rxPin, (0b0111));
# 29 "src/usart.c"
((struct rcc *) (0x40023800U))->APB1ENR |= (1 << 17); ((struct rcc *) (0x40023800U))->APB1ENR |= (1 << 17);
((struct usart *) (0x40004400U))->CR1 = 0; ((struct usart *) (0x40004400U))->CR1 = 0;
((struct usart *) (0x40004400U))->CR2 = 0; ((struct usart *) (0x40004400U))->CR2 = 0;
((struct usart *) (0x40004400U))->CR3 = 0; ((struct usart *) (0x40004400U))->CR3 = 0;
# 43 "src/usart.c" # 52 "src/usart.c"
((struct usart *) (0x40004400U))->BRR &= ~((0b111111111111) << 4); ((struct usart *) (0x40004400U))->BRR &= ~((0b111111111111) << 4);
((struct usart *) (0x40004400U))->BRR |= (0x1A << 4); ((struct usart *) (0x40004400U))->BRR |= (0x1A << 4);
((struct usart *) (0x40004400U))->BRR &= ~((0b111) << 0); ((struct usart *) (0x40004400U))->BRR &= ~((0b111) << 0);
BIN
View File
Binary file not shown.
+1
View File
@@ -18,6 +18,7 @@ struct gpio {
}; };
// AFRH, AFRL registers // AFRH, AFRL registers
#define GPIO_AF_MCO_1 (0b0000) // Alternative function 0 (AF0)
#define GPIO_AF_USART2_RX (0b0111) // Alternative function 7 (AF7) #define GPIO_AF_USART2_RX (0b0111) // Alternative function 7 (AF7)
#define GPIO_AF_USART2_TX (0b0111) // Alternative function 7 (AF7) #define GPIO_AF_USART2_TX (0b0111) // Alternative function 7 (AF7)
+13
View File
@@ -87,6 +87,19 @@ struct rcc {
#define RCC_CFGR_PPRE_DIV_NONE 0 #define RCC_CFGR_PPRE_DIV_NONE 0
#define RCC_CFGR_PPRE_DIV_2 (0b100) #define RCC_CFGR_PPRE_DIV_2 (0b100)
// Microcontroller clock output 1
#define RCC_CFGR_MCO1_HSE (0b10)
#define RCC_CFGR_MCO1_PLL (0b11)
#define RCC_CFGR_MCO1_BIT 21 // Bits [22:21]
#define RCC_CFGR_MCO1_MASK (0b11)
#define RCC_CFGR_MCO1PRE_DIV4 (0b110)
#define RCC_CFGR_MCO1PRE_DIV2 (0b100)
#define RCC_CFGR_MCO1PRE_BIT 24 // Bits [26:24]
#define RCC_CFGR_MCO1PRE_MASK (0b111)
// APB2 // APB2
#define RCC_CFGR_PPRE2_BIT 13 // Bits [15:13] #define RCC_CFGR_PPRE2_BIT 13 // Bits [15:13]
#define RCC_CFGR_PPRE2_MASK (0b111) #define RCC_CFGR_PPRE2_MASK (0b111)
+9
View File
@@ -15,6 +15,15 @@ void usart2_init(void) {
gpio_set_mode(rxPin, GPIO_MODE_AF); gpio_set_mode(rxPin, GPIO_MODE_AF);
gpio_set_af(rxPin, GPIO_AF_USART2_RX); gpio_set_af(rxPin, GPIO_AF_USART2_RX);
// Enable MC01; for debugging
/* uint16_t clockOutPin = PIN('A', 8); */
/* gpio_set_mode(clockOutPin, GPIO_MODE_AF); */
/* gpio_set_af(clockOutPin, GPIO_AF_MCO_1); */
/* RCC->CFGR &= ~(RCC_CFGR_MCO1_MASK << RCC_CFGR_MCO1_BIT); */
/* RCC->CFGR |= (RCC_CFGR_MCO1_HSE << RCC_CFGR_MCO1_BIT); */
/* RCC->CFGR |= (RCC_CFGR_MCO1_PLL << RCC_CFGR_MCO1_BIT); */
/* RCC->CFGR &= ~(RCC_CFGR_MCO1PRE_MASK << RCC_CFGR_MCO1PRE_BIT); */
/* RCC->CFGR |= (RCC_CFGR_MCO1PRE_DIV4 << RCC_CFGR_MCO1PRE_BIT); */
// Enable USART // Enable USART
RCC->APB1ENR |= RCC_APB1ENR_USART2EN_ENABLE; RCC->APB1ENR |= RCC_APB1ENR_USART2EN_ENABLE;