Add USART support #1

Merged
alex merged 17 commits from uart into main 2025-01-01 12:52:15 +01:00
7 changed files with 55 additions and 82 deletions
Showing only changes of commit 980b9a2d9b - Show all commits

Binary file not shown.

View File

@@ -261,17 +261,17 @@ LOAD build/timer.o
OUTPUT(build/final.elf elf32-littlearm) OUTPUT(build/final.elf elf32-littlearm)
LOAD linker stubs LOAD linker stubs
.debug_info 0x00000000 0xb25 .debug_info 0x00000000 0xb10
.debug_info 0x00000000 0x21a build/gpio.o .debug_info 0x00000000 0x205 build/gpio.o
.debug_info 0x0000021a 0x44e build/main.o .debug_info 0x00000205 0x44e build/main.o
.debug_info 0x00000668 0x188 build/startup.o .debug_info 0x00000653 0x188 build/startup.o
.debug_info 0x000007f0 0x335 build/timer.o .debug_info 0x000007db 0x335 build/timer.o
.debug_abbrev 0x00000000 0x44b .debug_abbrev 0x00000000 0x439
.debug_abbrev 0x00000000 0x12b build/gpio.o .debug_abbrev 0x00000000 0x119 build/gpio.o
.debug_abbrev 0x0000012b 0x144 build/main.o .debug_abbrev 0x00000119 0x144 build/main.o
.debug_abbrev 0x0000026f 0x127 build/startup.o .debug_abbrev 0x0000025d 0x127 build/startup.o
.debug_abbrev 0x00000396 0xb5 build/timer.o .debug_abbrev 0x00000384 0xb5 build/timer.o
.debug_aranges 0x00000000 0xa8 .debug_aranges 0x00000000 0xa8
.debug_aranges .debug_aranges

View File

@@ -182,12 +182,12 @@ gpio_write:
.file 4 "src/gpio.h" .file 4 "src/gpio.h"
.section .debug_info,"",%progbits .section .debug_info,"",%progbits
.Ldebug_info0: .Ldebug_info0:
.4byte 0x216 .4byte 0x201
.2byte 0x5 .2byte 0x5
.byte 0x1 .byte 0x1
.byte 0x4 .byte 0x4
.4byte .Ldebug_abbrev0 .4byte .Ldebug_abbrev0
.uleb128 0x9 .uleb128 0x8
.4byte .LASF894 .4byte .LASF894
.byte 0x1d .byte 0x1d
.4byte .LASF895 .4byte .LASF895
@@ -240,7 +240,7 @@ gpio_write:
.byte 0x8 .byte 0x8
.byte 0x7 .byte 0x7
.4byte .LASF872 .4byte .LASF872
.uleb128 0xa .uleb128 0x9
.byte 0x4 .byte 0x4
.byte 0x5 .byte 0x5
.ascii "int\000" .ascii "int\000"
@@ -266,7 +266,7 @@ gpio_write:
.byte 0x30 .byte 0x30
.byte 0x14 .byte 0x14
.4byte 0x59 .4byte 0x59
.uleb128 0x6 .uleb128 0xa
.4byte 0xa0 .4byte 0xa0
.uleb128 0x3 .uleb128 0x3
.4byte .LASF877 .4byte .LASF877
@@ -276,7 +276,7 @@ gpio_write:
.4byte 0x81 .4byte 0x81
.uleb128 0xb .uleb128 0xb
.4byte .LASF893 .4byte .LASF893
.byte 0x30 .byte 0x28
.byte 0x4 .byte 0x4
.byte 0x7 .byte 0x7
.byte 0x8 .byte 0x8
@@ -301,12 +301,12 @@ gpio_write:
.byte 0xb .byte 0xb
.4byte 0xac .4byte 0xac
.byte 0xc .byte 0xc
.uleb128 0x7 .uleb128 0x6
.ascii "IDR\000" .ascii "IDR\000"
.byte 0xc .byte 0xc
.4byte 0xac .4byte 0xac
.byte 0x10 .byte 0x10
.uleb128 0x7 .uleb128 0x6
.ascii "ODR\000" .ascii "ODR\000"
.byte 0xd .byte 0xd
.4byte 0xac .4byte 0xac
@@ -324,31 +324,22 @@ gpio_write:
.uleb128 0x2 .uleb128 0x2
.4byte .LASF884 .4byte .LASF884
.byte 0x10 .byte 0x10
.4byte 0x149 .4byte 0xac
.byte 0x20 .byte 0x20
.uleb128 0x2 .uleb128 0x2
.4byte .LASF885 .4byte .LASF885
.byte 0x11 .byte 0x11
.4byte 0x149 .4byte 0xac
.byte 0x28 .byte 0x24
.byte 0 .byte 0
.uleb128 0xc .uleb128 0xc
.4byte 0xac
.4byte 0x149
.uleb128 0xd
.4byte 0x8d
.byte 0x1
.byte 0
.uleb128 0x6
.4byte 0x139
.uleb128 0xe
.byte 0x7 .byte 0x7
.byte 0x1 .byte 0x1
.4byte 0x31 .4byte 0x31
.byte 0x4 .byte 0x4
.byte 0x20 .byte 0x20
.byte 0xe .byte 0xe
.4byte 0x175 .4byte 0x160
.uleb128 0x4 .uleb128 0x4
.4byte .LASF886 .4byte .LASF886
.byte 0 .byte 0
@@ -367,8 +358,8 @@ gpio_write:
.byte 0x4 .byte 0x4
.byte 0x25 .byte 0x25
.byte 0x3 .byte 0x3
.4byte 0x14e .4byte 0x139
.uleb128 0xf .uleb128 0xd
.4byte .LASF897 .4byte .LASF897
.byte 0x1 .byte 0x1
.byte 0xd .byte 0xd
@@ -377,7 +368,7 @@ gpio_write:
.4byte .LFE1-.LFB1 .4byte .LFE1-.LFB1
.uleb128 0x1 .uleb128 0x1
.byte 0x9c .byte 0x9c
.4byte 0x1c1 .4byte 0x1ac
.uleb128 0x5 .uleb128 0x5
.ascii "pin\000" .ascii "pin\000"
.byte 0xd .byte 0xd
@@ -390,14 +381,14 @@ gpio_write:
.ascii "val\000" .ascii "val\000"
.byte 0xd .byte 0xd
.byte 0x23 .byte 0x23
.4byte 0x1c1 .4byte 0x1ac
.uleb128 0x2 .uleb128 0x2
.byte 0x91 .byte 0x91
.sleb128 -19 .sleb128 -19
.uleb128 0x8 .uleb128 0x7
.4byte .LASF893 .4byte .LASF893
.byte 0xe .byte 0xe
.4byte 0x1c8 .4byte 0x1b3
.uleb128 0x2 .uleb128 0x2
.byte 0x91 .byte 0x91
.sleb128 -12 .sleb128 -12
@@ -406,10 +397,10 @@ gpio_write:
.byte 0x1 .byte 0x1
.byte 0x2 .byte 0x2
.4byte .LASF891 .4byte .LASF891
.uleb128 0x10 .uleb128 0xe
.byte 0x4 .byte 0x4
.4byte 0xbd .4byte 0xbd
.uleb128 0x11 .uleb128 0xf
.4byte .LASF898 .4byte .LASF898
.byte 0x1 .byte 0x1
.byte 0x6 .byte 0x6
@@ -426,23 +417,23 @@ gpio_write:
.uleb128 0x2 .uleb128 0x2
.byte 0x91 .byte 0x91
.sleb128 -18 .sleb128 -18
.uleb128 0x12 .uleb128 0x10
.4byte .LASF892 .4byte .LASF892
.byte 0x1 .byte 0x1
.byte 0x6 .byte 0x6
.byte 0x2c .byte 0x2c
.4byte 0x175 .4byte 0x160
.uleb128 0x2 .uleb128 0x2
.byte 0x91 .byte 0x91
.sleb128 -19 .sleb128 -19
.uleb128 0x8 .uleb128 0x7
.4byte .LASF893 .4byte .LASF893
.byte 0x7 .byte 0x7
.4byte 0x1c8 .4byte 0x1b3
.uleb128 0x2 .uleb128 0x2
.byte 0x91 .byte 0x91
.sleb128 -12 .sleb128 -12
.uleb128 0x13 .uleb128 0x11
.ascii "pn\000" .ascii "pn\000"
.byte 0x1 .byte 0x1
.byte 0x8 .byte 0x8
@@ -528,13 +519,6 @@ gpio_write:
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0x6 .uleb128 0x6
.uleb128 0x35
.byte 0
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x7
.uleb128 0xd .uleb128 0xd
.byte 0 .byte 0
.uleb128 0x3 .uleb128 0x3
@@ -553,7 +537,7 @@ gpio_write:
.uleb128 0xb .uleb128 0xb
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0x8 .uleb128 0x7
.uleb128 0x34 .uleb128 0x34
.byte 0 .byte 0
.uleb128 0x3 .uleb128 0x3
@@ -572,7 +556,7 @@ gpio_write:
.uleb128 0x18 .uleb128 0x18
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0x9 .uleb128 0x8
.uleb128 0x11 .uleb128 0x11
.byte 0x1 .byte 0x1
.uleb128 0x25 .uleb128 0x25
@@ -593,7 +577,7 @@ gpio_write:
.uleb128 0x17 .uleb128 0x17
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0xa .uleb128 0x9
.uleb128 0x24 .uleb128 0x24
.byte 0 .byte 0
.uleb128 0xb .uleb128 0xb
@@ -604,6 +588,13 @@ gpio_write:
.uleb128 0x8 .uleb128 0x8
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0xa
.uleb128 0x35
.byte 0
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xb .uleb128 0xb
.uleb128 0x13 .uleb128 0x13
.byte 0x1 .byte 0x1
@@ -622,24 +613,6 @@ gpio_write:
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0xc .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 .uleb128 0x4
.byte 0x1 .byte 0x1
.uleb128 0x3e .uleb128 0x3e
@@ -658,7 +631,7 @@ gpio_write:
.uleb128 0x13 .uleb128 0x13
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0xf .uleb128 0xd
.uleb128 0x2e .uleb128 0x2e
.byte 0x1 .byte 0x1
.uleb128 0x3f .uleb128 0x3f
@@ -685,7 +658,7 @@ gpio_write:
.uleb128 0x13 .uleb128 0x13
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0x10 .uleb128 0xe
.uleb128 0xf .uleb128 0xf
.byte 0 .byte 0
.uleb128 0xb .uleb128 0xb
@@ -694,7 +667,7 @@ gpio_write:
.uleb128 0x13 .uleb128 0x13
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0x11 .uleb128 0xf
.uleb128 0x2e .uleb128 0x2e
.byte 0x1 .byte 0x1
.uleb128 0x3f .uleb128 0x3f
@@ -719,7 +692,7 @@ gpio_write:
.uleb128 0x19 .uleb128 0x19
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0x12 .uleb128 0x10
.uleb128 0x5 .uleb128 0x5
.byte 0 .byte 0
.uleb128 0x3 .uleb128 0x3
@@ -736,7 +709,7 @@ gpio_write:
.uleb128 0x18 .uleb128 0x18
.byte 0 .byte 0
.byte 0 .byte 0
.uleb128 0x13 .uleb128 0x11
.uleb128 0x34 .uleb128 0x34
.byte 0 .byte 0
.uleb128 0x3 .uleb128 0x3

View File

@@ -1995,8 +1995,8 @@ struct gpio {
volatile uint32_t ODR; volatile uint32_t ODR;
volatile uint32_t BSRR; volatile uint32_t BSRR;
volatile uint32_t LCKR; volatile uint32_t LCKR;
volatile uint32_t AFRL[2]; volatile uint32_t AFRL;
volatile uint32_t AFRH[2]; volatile uint32_t AFRH;
}; };
#define GPIO_BASE_ADDR (0x40020000U) #define GPIO_BASE_ADDR (0x40020000U)

Binary file not shown.

View File

@@ -2119,8 +2119,8 @@ struct gpio {
volatile uint32_t ODR; volatile uint32_t ODR;
volatile uint32_t BSRR; volatile uint32_t BSRR;
volatile uint32_t LCKR; volatile uint32_t LCKR;
volatile uint32_t AFRL[2]; volatile uint32_t AFRL;
volatile uint32_t AFRH[2]; volatile uint32_t AFRH;
}; };
#define GPIO_BASE_ADDR (0x40020000U) #define GPIO_BASE_ADDR (0x40020000U)

View File

@@ -13,8 +13,8 @@ struct gpio {
volatile uint32_t ODR; // Port output data register volatile uint32_t ODR; // Port output data register
volatile uint32_t BSRR; // Port bit set/reset register volatile uint32_t BSRR; // Port bit set/reset register
volatile uint32_t LCKR; // Port configuration lock register volatile uint32_t LCKR; // Port configuration lock register
volatile uint32_t AFRL[2]; // Alternative function low register volatile uint32_t AFRL; // Alternative function low register
volatile uint32_t AFRH[2]; // Alternative function high register volatile uint32_t AFRH; // Alternative function high register
}; };
#define GPIO_BASE_ADDR (0x40020000U) #define GPIO_BASE_ADDR (0x40020000U)