Use USART2

This commit is contained in:
Alexander Heldt
2025-01-01 12:33:52 +01:00
parent 95455a7161
commit 55ee09eab8
6 changed files with 737 additions and 527 deletions

Binary file not shown.

View File

@@ -18,8 +18,7 @@ Discarded input sections
.text 0x00000000 0x0 build/gpio.o .text 0x00000000 0x0 build/gpio.o
.data 0x00000000 0x0 build/gpio.o .data 0x00000000 0x0 build/gpio.o
.bss 0x00000000 0x0 build/gpio.o .bss 0x00000000 0x0 build/gpio.o
.text.gpio_set_af .group 0x00000000 0xc build/main.o
0x00000000 0x98 build/gpio.o
.group 0x00000000 0xc build/main.o .group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o .group 0x00000000 0xc build/main.o
.group 0x00000000 0xc build/main.o .group 0x00000000 0xc build/main.o
@@ -117,21 +116,6 @@ Discarded input sections
.text 0x00000000 0x0 build/usart.o .text 0x00000000 0x0 build/usart.o
.data 0x00000000 0x0 build/usart.o .data 0x00000000 0x0 build/usart.o
.bss 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 0x22 build/usart.o
.debug_macro 0x00000000 0x75 build/usart.o .debug_macro 0x00000000 0x75 build/usart.o
.debug_macro 0x00000000 0x2a build/usart.o .debug_macro 0x00000000 0x2a build/usart.o
@@ -146,16 +130,7 @@ Discarded input sections
.debug_macro 0x00000000 0x4cc build/usart.o .debug_macro 0x00000000 0x4cc build/usart.o
.debug_macro 0x00000000 0x130 build/usart.o .debug_macro 0x00000000 0x130 build/usart.o
.debug_macro 0x00000000 0x22 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_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 Memory Configuration
@@ -182,126 +157,144 @@ LOAD build/usart.o
0x08000000 interrupt_vector_table 0x08000000 interrupt_vector_table
0x08000198 . = ALIGN (0x4) 0x08000198 . = ALIGN (0x4)
.text 0x08000198 0x34c .text 0x08000198 0x53c
0x08000198 . = ALIGN (0x4) 0x08000198 . = ALIGN (0x4)
*(.text) *(.text)
*(.text.*) *(.text.*)
.text.gpio_set_mode .text.gpio_set_mode
0x08000198 0x62 build/gpio.o 0x08000198 0x62 build/gpio.o
0x08000198 gpio_set_mode 0x08000198 gpio_set_mode
.text.gpio_set_af
0x080001fa 0x98 build/gpio.o
0x080001fa gpio_set_af
.text.gpio_write .text.gpio_write
0x080001fa 0x4c build/gpio.o 0x08000292 0x4c build/gpio.o
0x080001fa gpio_write 0x08000292 gpio_write
*fill* 0x08000246 0x2 *fill* 0x080002de 0x2
.text.system_clock_init .text.system_clock_init
0x08000248 0x138 build/main.o 0x080002e0 0x138 build/main.o
.text.main 0x08000380 0x88 build/main.o .text.main 0x08000418 0x9c build/main.o
0x08000380 main 0x08000418 main
.text.init_memory .text.init_memory
0x08000408 0x64 build/startup.o 0x080004b4 0x64 build/startup.o
0x08000408 init_memory 0x080004b4 init_memory
.text.reset 0x0800046c 0x10 build/startup.o .text.reset 0x08000518 0x10 build/startup.o
0x0800046c reset 0x08000518 reset
.text.default_handler .text.default_handler
0x0800047c 0x8 build/startup.o 0x08000528 0x8 build/startup.o
0x0800047c exti0 0x08000528 exti0
0x0800047c debug_monitor 0x08000528 debug_monitor
0x0800047c rcc 0x08000528 rcc
0x0800047c x 0x08000528 x
0x0800047c sdio 0x08000528 sdio
0x0800047c usage_fault 0x08000528 usage_fault
0x0800047c tim1_up_tim10 0x08000528 tim1_up_tim10
0x0800047c usart1 0x08000528 usart1
0x0800047c i2c3_er 0x08000528 i2c3_er
0x0800047c spi2 0x08000528 spi2
0x0800047c dma1_stream1 0x08000528 dma1_stream1
0x0800047c bus_fault 0x08000528 bus_fault
0x0800047c spi5 0x08000528 spi5
0x0800047c exti3 0x08000528 exti3
0x0800047c dma2_stream5 0x08000528 dma2_stream5
0x0800047c tim2 0x08000528 tim2
0x0800047c dma1_stream6 0x08000528 dma1_stream6
0x0800047c default_handler 0x08000528 default_handler
0x0800047c i2c1_er 0x08000528 i2c1_er
0x0800047c hard_fault 0x08000528 hard_fault
0x0800047c usart6 0x08000528 usart6
0x0800047c exti15_10 0x08000528 exti15_10
0x0800047c usart2 0x08000528 usart2
0x0800047c pend_sv 0x08000528 pend_sv
0x0800047c i2c1_ev 0x08000528 i2c1_ev
0x0800047c wwdg 0x08000528 wwdg
0x0800047c adc 0x08000528 adc
0x0800047c rtc_alarm 0x08000528 rtc_alarm
0x0800047c spi3 0x08000528 spi3
0x0800047c exti1 0x08000528 exti1
0x0800047c mem_manage 0x08000528 mem_manage
0x0800047c dma2_stream1 0x08000528 dma2_stream1
0x0800047c dma1_stream2 0x08000528 dma1_stream2
0x0800047c dma2_stream3 0x08000528 dma2_stream3
0x0800047c sv_call 0x08000528 sv_call
0x0800047c tim3 0x08000528 tim3
0x0800047c otg_fs 0x08000528 otg_fs
0x0800047c dma1_stream5 0x08000528 dma1_stream5
0x0800047c dma2_stream6 0x08000528 dma2_stream6
0x0800047c flash 0x08000528 flash
0x0800047c tamp_stamp 0x08000528 tamp_stamp
0x0800047c i2c3_ev 0x08000528 i2c3_ev
0x0800047c rtc_wkup 0x08000528 rtc_wkup
0x0800047c dma2_stream0 0x08000528 dma2_stream0
0x0800047c pvd 0x08000528 pvd
0x0800047c fpu 0x08000528 fpu
0x0800047c exti4 0x08000528 exti4
0x0800047c exti2 0x08000528 exti2
0x0800047c spi1 0x08000528 spi1
0x0800047c dma1_stream0 0x08000528 dma1_stream0
0x0800047c tim1_brk_tim9 0x08000528 tim1_brk_tim9
0x0800047c i2c2_ev 0x08000528 i2c2_ev
0x0800047c otg_fs_wkup 0x08000528 otg_fs_wkup
0x0800047c spi4 0x08000528 spi4
0x0800047c dma2_stream2 0x08000528 dma2_stream2
0x0800047c tim1_cc 0x08000528 tim1_cc
0x0800047c tim1_trg_com_tim11 0x08000528 tim1_trg_com_tim11
0x0800047c exti9_5 0x08000528 exti9_5
0x0800047c dma1_stream3 0x08000528 dma1_stream3
0x0800047c dma2_stream4 0x08000528 dma2_stream4
0x0800047c i2c2_er 0x08000528 i2c2_er
0x0800047c dma2_stream7 0x08000528 dma2_stream7
0x0800047c dma1_stream7 0x08000528 dma1_stream7
0x0800047c nmi 0x08000528 nmi
0x0800047c systick 0x08000528 systick
0x0800047c tim4 0x08000528 tim4
0x0800047c tim5 0x08000528 tim5
0x0800047c dma1_stream4 0x08000528 dma1_stream4
.text.tim4_init .text.tim4_init
0x08000484 0x40 build/timer.o 0x08000530 0x40 build/timer.o
0x08000484 tim4_init 0x08000530 tim4_init
.text.tim4_start .text.tim4_start
0x080004c4 0x20 build/timer.o 0x08000570 0x20 build/timer.o
0x080004c4 tim4_start 0x08000570 tim4_start
.text.usart2_init
0x08000590 0xb8 build/usart.o
0x08000590 usart2_init
.text.usart2_start
0x08000648 0x20 build/usart.o
0x08000648 usart2_start
.text.usart2_write_byte
0x08000668 0x30 build/usart.o
0x08000668 usart2_write_byte
.text.usart2_write
0x08000698 0x2a build/usart.o
0x08000698 usart2_write
*(.rodata) *(.rodata)
*fill* 0x080006c2 0x2
.rodata 0x080006c4 0xf build/main.o
*(.rodata.*) *(.rodata.*)
0x080004e4 . = ALIGN (0x4) 0x080006d4 . = ALIGN (0x4)
0x080004e4 _data_addr = LOADADDR (.data) *fill* 0x080006d3 0x1
0x080006d4 _data_addr = LOADADDR (.data)
.glue_7 0x080004e4 0x0 .glue_7 0x080006d4 0x0
.glue_7 0x080004e4 0x0 linker stubs .glue_7 0x080006d4 0x0 linker stubs
.glue_7t 0x080004e4 0x0 .glue_7t 0x080006d4 0x0
.glue_7t 0x080004e4 0x0 linker stubs .glue_7t 0x080006d4 0x0 linker stubs
.vfp11_veneer 0x080004e4 0x0 .vfp11_veneer 0x080006d4 0x0
.vfp11_veneer 0x080004e4 0x0 linker stubs .vfp11_veneer 0x080006d4 0x0 linker stubs
.v4_bx 0x080004e4 0x0 .v4_bx 0x080006d4 0x0
.v4_bx 0x080004e4 0x0 linker stubs .v4_bx 0x080006d4 0x0 linker stubs
.iplt 0x080004e4 0x0 .iplt 0x080006d4 0x0
.iplt 0x080004e4 0x0 build/main.o .iplt 0x080006d4 0x0 build/main.o
.rel.dyn 0x080004e4 0x0 .rel.dyn 0x080006d4 0x0
.rel.iplt 0x080004e4 0x0 build/main.o .rel.iplt 0x080006d4 0x0 build/main.o
.data 0x20000000 0x0 load address 0x080004e4 .data 0x20000000 0x0 load address 0x080006d4
0x20000000 . = ALIGN (0x4) 0x20000000 . = ALIGN (0x4)
0x20000000 _data_start = . 0x20000000 _data_start = .
*(.data) *(.data)
@@ -309,10 +302,10 @@ LOAD build/usart.o
0x20000000 . = ALIGN (0x4) 0x20000000 . = ALIGN (0x4)
0x20000000 _data_end = . 0x20000000 _data_end = .
.igot.plt 0x20000000 0x0 load address 0x080004e4 .igot.plt 0x20000000 0x0 load address 0x080006d4
.igot.plt 0x20000000 0x0 build/main.o .igot.plt 0x20000000 0x0 build/main.o
.bss 0x20000000 0x0 load address 0x080004e4 .bss 0x20000000 0x0 load address 0x080006d4
0x20000000 . = ALIGN (0x4) 0x20000000 . = ALIGN (0x4)
0x20000000 _bss_start = . 0x20000000 _bss_start = .
*(.bss) *(.bss)
@@ -322,19 +315,21 @@ LOAD build/usart.o
OUTPUT(build/final.elf elf32-littlearm) OUTPUT(build/final.elf elf32-littlearm)
LOAD linker stubs LOAD linker stubs
.debug_info 0x00000000 0xb6d .debug_info 0x00000000 0xf1e
.debug_info 0x00000000 0x262 build/gpio.o .debug_info 0x00000000 0x262 build/gpio.o
.debug_info 0x00000262 0x44e build/main.o .debug_info 0x00000262 0x47e build/main.o
.debug_info 0x000006b0 0x188 build/startup.o .debug_info 0x000006e0 0x188 build/startup.o
.debug_info 0x00000838 0x335 build/timer.o .debug_info 0x00000868 0x335 build/timer.o
.debug_info 0x00000b9d 0x381 build/usart.o
.debug_abbrev 0x00000000 0x43d .debug_abbrev 0x00000000 0x5ae
.debug_abbrev 0x00000000 0x11d build/gpio.o .debug_abbrev 0x00000000 0x11d build/gpio.o
.debug_abbrev 0x0000011d 0x144 build/main.o .debug_abbrev 0x0000011d 0x14b build/main.o
.debug_abbrev 0x00000261 0x127 build/startup.o .debug_abbrev 0x00000268 0x127 build/startup.o
.debug_abbrev 0x00000388 0xb5 build/timer.o .debug_abbrev 0x0000038f 0xb5 build/timer.o
.debug_abbrev 0x00000444 0x16a build/usart.o
.debug_aranges 0x00000000 0xb0 .debug_aranges 0x00000000 0xe8
.debug_aranges .debug_aranges
0x00000000 0x30 build/gpio.o 0x00000000 0x30 build/gpio.o
.debug_aranges .debug_aranges
@@ -343,9 +338,11 @@ LOAD linker stubs
0x00000058 0x30 build/startup.o 0x00000058 0x30 build/startup.o
.debug_aranges .debug_aranges
0x00000088 0x28 build/timer.o 0x00000088 0x28 build/timer.o
.debug_aranges
0x000000b0 0x38 build/usart.o
.debug_rnglists .debug_rnglists
0x00000000 0x73 0x00000000 0x99
.debug_rnglists .debug_rnglists
0x00000000 0x20 build/gpio.o 0x00000000 0x20 build/gpio.o
.debug_rnglists .debug_rnglists
@@ -354,8 +351,10 @@ LOAD linker stubs
0x0000003b 0x1f build/startup.o 0x0000003b 0x1f build/startup.o
.debug_rnglists .debug_rnglists
0x0000005a 0x19 build/timer.o 0x0000005a 0x19 build/timer.o
.debug_rnglists
0x00000073 0x26 build/usart.o
.debug_macro 0x00000000 0x3bc4 .debug_macro 0x00000000 0x47d9
.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
@@ -371,32 +370,38 @@ LOAD linker stubs
.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 0x40 build/gpio.o
.debug_macro 0x00001643 0xb80 build/main.o .debug_macro 0x00001643 0xb89 build/main.o
.debug_macro 0x000021c3 0x136 build/main.o .debug_macro 0x000021cc 0x136 build/main.o
.debug_macro 0x000022f9 0x46 build/main.o .debug_macro 0x00002302 0x46 build/main.o
.debug_macro 0x0000233f 0x2e build/main.o .debug_macro 0x00002348 0x2e build/main.o
.debug_macro 0x0000236d 0x22 build/main.o .debug_macro 0x00002376 0x22 build/main.o
.debug_macro 0x0000238f 0xb02 build/startup.o .debug_macro 0x00002398 0x5e build/main.o
.debug_macro 0x00002e91 0x56 build/startup.o .debug_macro 0x000023f6 0xb02 build/startup.o
.debug_macro 0x00002ee7 0x51 build/startup.o .debug_macro 0x00002ef8 0x56 build/startup.o
.debug_macro 0x00002f38 0xb5c build/timer.o .debug_macro 0x00002f4e 0x51 build/startup.o
.debug_macro 0x00003a94 0x130 build/timer.o .debug_macro 0x00002f9f 0xb5c build/timer.o
.debug_macro 0x00003afb 0x130 build/timer.o
.debug_macro 0x00003c2b 0xb74 build/usart.o
.debug_macro 0x0000479f 0x3a build/usart.o
.debug_line 0x00000000 0x516 .debug_line 0x00000000 0x699
.debug_line 0x00000000 0x179 build/gpio.o .debug_line 0x00000000 0x179 build/gpio.o
.debug_line 0x00000179 0x1d4 build/main.o .debug_line 0x00000179 0x1de build/main.o
.debug_line 0x0000034d 0xea build/startup.o .debug_line 0x00000357 0xea build/startup.o
.debug_line 0x00000437 0xdf build/timer.o .debug_line 0x00000441 0xdf build/timer.o
.debug_line 0x00000520 0x179 build/usart.o
.debug_str 0x00000000 0x5f5e .debug_str 0x00000000 0x6185
.debug_str 0x00000000 0x53c1 build/gpio.o .debug_str 0x00000000 0x53c1 build/gpio.o
0x5571 (size before relaxing) 0x5571 (size before relaxing)
.debug_str 0x000053c1 0xb09 build/main.o .debug_str 0x000053c1 0xcfb build/main.o
0x600c (size before relaxing) 0x61fe (size before relaxing)
.debug_str 0x00005eca 0x88 build/startup.o .debug_str 0x000060bc 0x88 build/startup.o
0x3cdc (size before relaxing) 0x3cdc (size before relaxing)
.debug_str 0x00005f52 0xc build/timer.o .debug_str 0x00006144 0xc build/timer.o
0x5b6e (size before relaxing) 0x5b6e (size before relaxing)
.debug_str 0x00006150 0x35 build/usart.o
0x5ec2 (size before relaxing)
.comment 0x00000000 0x45 .comment 0x00000000 0x45
.comment 0x00000000 0x45 build/gpio.o .comment 0x00000000 0x45 build/gpio.o
@@ -404,6 +409,7 @@ LOAD linker stubs
.comment 0x00000045 0x46 build/main.o .comment 0x00000045 0x46 build/main.o
.comment 0x00000045 0x46 build/startup.o .comment 0x00000045 0x46 build/startup.o
.comment 0x00000045 0x46 build/timer.o .comment 0x00000045 0x46 build/timer.o
.comment 0x00000045 0x46 build/usart.o
.ARM.attributes .ARM.attributes
0x00000000 0x34 0x00000000 0x34
@@ -415,24 +421,30 @@ LOAD linker stubs
0x00000068 0x34 build/startup.o 0x00000068 0x34 build/startup.o
.ARM.attributes .ARM.attributes
0x0000009c 0x34 build/timer.o 0x0000009c 0x34 build/timer.o
.ARM.attributes
0x000000d0 0x34 build/usart.o
.debug_line_str .debug_line_str
0x00000000 0x280 0x00000000 0x290
.debug_line_str .debug_line_str
0x00000000 0x24b build/gpio.o 0x00000000 0x24b build/gpio.o
0x25d (size before relaxing) 0x25d (size before relaxing)
.debug_line_str .debug_line_str
0x0000024b 0x23 build/main.o 0x0000024b 0x2b build/main.o
0x279 (size before relaxing) 0x281 (size before relaxing)
.debug_line_str .debug_line_str
0x0000026e 0xa build/startup.o 0x00000276 0xa build/startup.o
0x218 (size before relaxing) 0x218 (size before relaxing)
.debug_line_str .debug_line_str
0x00000278 0x8 build/timer.o 0x00000280 0x8 build/timer.o
0x25b (size before relaxing) 0x25b (size before relaxing)
.debug_line_str
0x00000288 0x8 build/usart.o
0x26c (size before relaxing)
.debug_frame 0x00000000 0x194 .debug_frame 0x00000000 0x234
.debug_frame 0x00000000 0x88 build/gpio.o .debug_frame 0x00000000 0x88 build/gpio.o
.debug_frame 0x00000088 0x50 build/main.o .debug_frame 0x00000088 0x50 build/main.o
.debug_frame 0x000000d8 0x6c build/startup.o .debug_frame 0x000000d8 0x6c build/startup.o
.debug_frame 0x00000144 0x50 build/timer.o .debug_frame 0x00000144 0x50 build/timer.o
.debug_frame 0x00000194 0xa0 build/usart.o

File diff suppressed because it is too large Load Diff

View File

@@ -2252,6 +2252,56 @@ struct timer {
void tim4_init(void); void tim4_init(void);
void tim4_start(void); void tim4_start(void);
# 9 "src/main.c" 2 # 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_SR_TC_BIT 6
#define USART_SR_TC_COMPLETED (1 << USART_SR_TC_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);
void usart2_write_byte(uint8_t byte);
void usart2_write(char *buf);
# 10 "src/main.c" 2
#define exit 42 #define exit 42
@@ -2321,8 +2371,10 @@ static void system_clock_init(void) {
int main(void) { int main(void) {
(void) system_clock_init(); (void) system_clock_init();
(void) tim4_init(); (void) tim4_init();
(void) usart2_init();
(void) tim4_start(); (void) tim4_start();
(void) usart2_start();
uint16_t led = (((('C') - 'A') << 8) | 13); uint16_t led = (((('C') - 'A') << 8) | 13);
((struct rcc *) (0x40023800U))->AHB1ENR |= (1 << (led >> 8)); ((struct rcc *) (0x40023800U))->AHB1ENR |= (1 << (led >> 8));
@@ -2330,19 +2382,21 @@ int main(void) {
uint16_t counter = ((struct timer *) (0x40000800U))->CNT; uint16_t counter = ((struct timer *) (0x40000800U))->CNT;
# 86 "src/main.c" 3 4 # 89 "src/main.c" 3 4
_Bool _Bool
# 86 "src/main.c" # 89 "src/main.c"
led_on = led_on =
# 86 "src/main.c" 3 4 # 89 "src/main.c" 3 4
((_Bool)+0u) ((_Bool)+0u)
# 86 "src/main.c" # 89 "src/main.c"
; ;
while(1) { while(1) {
if ((((struct timer *) (0x40000800U))->CNT - counter) >= 250) { if ((((struct timer *) (0x40000800U))->CNT - counter) >= 250) {
led_on = !led_on; led_on = !led_on;
gpio_write(led, led_on); gpio_write(led, led_on);
usart2_write("hello, world!\n");
counter = ((struct timer *) (0x40000800U))->CNT; counter = ((struct timer *) (0x40000800U))->CNT;
} }
}; };

Binary file not shown.

View File

@@ -6,6 +6,7 @@
#include "flash.h" #include "flash.h"
#include "pwr.h" #include "pwr.h"
#include "timer.h" #include "timer.h"
#include "usart.h"
#define exit 42 #define exit 42
@@ -75,8 +76,10 @@ static void system_clock_init(void) {
int main(void) { int main(void) {
(void) system_clock_init(); (void) system_clock_init();
(void) tim4_init(); (void) tim4_init();
(void) usart2_init();
(void) tim4_start(); (void) tim4_start();
(void) usart2_start();
uint16_t led = PIN('C', 13); // Blue LED uint16_t led = PIN('C', 13); // Blue LED
RCC->AHB1ENR |= (1 << PINPORT(led)); // Enable GPIO clock for LED RCC->AHB1ENR |= (1 << PINPORT(led)); // Enable GPIO clock for LED
@@ -89,6 +92,8 @@ int main(void) {
led_on = !led_on; led_on = !led_on;
gpio_write(led, led_on); gpio_write(led, led_on);
usart2_write("hello, world!\n");
counter = TIM4->CNT; counter = TIM4->CNT;
} }
}; };