diff --git a/build/final.elf b/build/final.elf index 281f132..b6c46fb 100755 Binary files a/build/final.elf and b/build/final.elf differ diff --git a/build/final.elf.map b/build/final.elf.map index dbff8ae..8b5e41b 100644 --- a/build/final.elf.map +++ b/build/final.elf.map @@ -36,7 +36,7 @@ LOAD build/startup.o 0x08000000 interrupt_vector_table 0x08000198 . = ALIGN (0x4) -.text 0x08000198 0x84 +.text 0x08000198 0x8c 0x08000198 . = ALIGN (0x4) *(.text) *(.text.*) @@ -47,30 +47,100 @@ LOAD build/startup.o 0x080001a8 init_memory .text.reset 0x0800020c 0x10 build/startup.o 0x0800020c reset + .text.default_handler + 0x0800021c 0x8 build/startup.o + 0x0800021c exti0 + 0x0800021c debug_monitor + 0x0800021c rcc + 0x0800021c x + 0x0800021c sdio + 0x0800021c usage_fault + 0x0800021c tim1_up_tim10 + 0x0800021c usart1 + 0x0800021c i2c3_er + 0x0800021c spi2 + 0x0800021c dma1_stream1 + 0x0800021c bus_fault + 0x0800021c spi5 + 0x0800021c exti3 + 0x0800021c dma2_stream5 + 0x0800021c tim2 + 0x0800021c dma1_stream6 + 0x0800021c default_handler + 0x0800021c i2c1_er + 0x0800021c hard_fault + 0x0800021c usart6 + 0x0800021c exti15_10 + 0x0800021c usart2 + 0x0800021c pend_sv + 0x0800021c i2c1_ev + 0x0800021c wwdg + 0x0800021c adc + 0x0800021c rtc_alarm + 0x0800021c spi3 + 0x0800021c exti1 + 0x0800021c mem_manage + 0x0800021c dma2_stream1 + 0x0800021c dma1_stream2 + 0x0800021c dma2_stream3 + 0x0800021c sv_call + 0x0800021c tim3 + 0x0800021c otg_fs + 0x0800021c dma1_stream5 + 0x0800021c dma2_stream6 + 0x0800021c flash + 0x0800021c tamp_stamp + 0x0800021c i2c3_ev + 0x0800021c rtc_wkup + 0x0800021c dma2_stream0 + 0x0800021c pvd + 0x0800021c fpu + 0x0800021c exti4 + 0x0800021c exti2 + 0x0800021c spi1 + 0x0800021c dma1_stream0 + 0x0800021c tim1_brk_tim9 + 0x0800021c i2c2_ev + 0x0800021c otg_fs_wkup + 0x0800021c spi4 + 0x0800021c dma2_stream2 + 0x0800021c tim1_cc + 0x0800021c tim1_trg_com_tim11 + 0x0800021c exti9_5 + 0x0800021c dma1_stream3 + 0x0800021c dma2_stream4 + 0x0800021c i2c2_er + 0x0800021c dma2_stream7 + 0x0800021c dma1_stream7 + 0x0800021c nmi + 0x0800021c systick + 0x0800021c tim4 + 0x0800021c tim5 + 0x0800021c dma1_stream4 *(.rodata) *(.rodata.*) - 0x0800021c . = ALIGN (0x4) - 0x0800021c _data_addr = LOADADDR (.data) + 0x08000224 . = ALIGN (0x4) + 0x08000224 _data_addr = LOADADDR (.data) -.glue_7 0x0800021c 0x0 - .glue_7 0x0800021c 0x0 linker stubs +.glue_7 0x08000224 0x0 + .glue_7 0x08000224 0x0 linker stubs -.glue_7t 0x0800021c 0x0 - .glue_7t 0x0800021c 0x0 linker stubs +.glue_7t 0x08000224 0x0 + .glue_7t 0x08000224 0x0 linker stubs -.vfp11_veneer 0x0800021c 0x0 - .vfp11_veneer 0x0800021c 0x0 linker stubs +.vfp11_veneer 0x08000224 0x0 + .vfp11_veneer 0x08000224 0x0 linker stubs -.v4_bx 0x0800021c 0x0 - .v4_bx 0x0800021c 0x0 linker stubs +.v4_bx 0x08000224 0x0 + .v4_bx 0x08000224 0x0 linker stubs -.iplt 0x0800021c 0x0 - .iplt 0x0800021c 0x0 build/startup.o +.iplt 0x08000224 0x0 + .iplt 0x08000224 0x0 build/startup.o -.rel.dyn 0x0800021c 0x0 - .rel.iplt 0x0800021c 0x0 build/startup.o +.rel.dyn 0x08000224 0x0 + .rel.iplt 0x08000224 0x0 build/startup.o -.data 0x20000000 0x0 load address 0x0800021c +.data 0x20000000 0x0 load address 0x08000224 0x20000000 . = ALIGN (0x4) 0x20000000 _data_start = . *(.data) @@ -78,10 +148,10 @@ LOAD build/startup.o 0x20000000 . = ALIGN (0x4) 0x20000000 _data_end = . -.igot.plt 0x20000000 0x0 load address 0x0800021c +.igot.plt 0x20000000 0x0 load address 0x08000224 .igot.plt 0x20000000 0x0 build/startup.o -.bss 0x20000000 0x0 load address 0x0800021c +.bss 0x20000000 0x0 load address 0x08000224 0x20000000 . = ALIGN (0x4) 0x20000000 _bss_start = . *(.bss) @@ -91,26 +161,26 @@ LOAD build/startup.o OUTPUT(build/final.elf elf32-littlearm) LOAD linker stubs -.debug_info 0x00000000 0x1be +.debug_info 0x00000000 0x1d0 .debug_info 0x00000000 0x48 build/main.o - .debug_info 0x00000048 0x176 build/startup.o + .debug_info 0x00000048 0x188 build/startup.o -.debug_abbrev 0x00000000 0x14a +.debug_abbrev 0x00000000 0x163 .debug_abbrev 0x00000000 0x3c build/main.o - .debug_abbrev 0x0000003c 0x10e build/startup.o + .debug_abbrev 0x0000003c 0x127 build/startup.o -.debug_aranges 0x00000000 0x48 +.debug_aranges 0x00000000 0x50 .debug_aranges 0x00000000 0x20 build/main.o .debug_aranges - 0x00000020 0x28 build/startup.o + 0x00000020 0x30 build/startup.o .debug_rnglists - 0x00000000 0x2c + 0x00000000 0x32 .debug_rnglists 0x00000000 0x13 build/main.o .debug_rnglists - 0x00000013 0x19 build/startup.o + 0x00000013 0x1f build/startup.o .debug_macro 0x00000000 0x19f9 .debug_macro 0x00000000 0xab0 build/main.o @@ -122,14 +192,14 @@ LOAD linker stubs .debug_macro 0x000017b0 0x6a build/startup.o .debug_macro 0x0000181a 0x1df build/startup.o -.debug_line 0x00000000 0x120 +.debug_line 0x00000000 0x139 .debug_line 0x00000000 0x4f build/main.o - .debug_line 0x0000004f 0xd1 build/startup.o + .debug_line 0x0000004f 0xea build/startup.o -.debug_str 0x00000000 0x3bf0 +.debug_str 0x00000000 0x3c00 .debug_str 0x00000000 0x2db0 build/main.o - .debug_str 0x00002db0 0xe40 build/startup.o - 0x3d41 (size before relaxing) + .debug_str 0x00002db0 0xe50 build/startup.o + 0x3d51 (size before relaxing) .comment 0x00000000 0x45 .comment 0x00000000 0x45 build/main.o @@ -151,6 +221,6 @@ LOAD linker stubs 0x00000035 0x1db build/startup.o 0x21b (size before relaxing) -.debug_frame 0x00000000 0x84 +.debug_frame 0x00000000 0x9c .debug_frame 0x00000000 0x30 build/main.o - .debug_frame 0x00000030 0x54 build/startup.o + .debug_frame 0x00000030 0x6c build/startup.o diff --git a/build/startup.S b/build/startup.S index b6b3edf..564977d 100644 --- a/build/startup.S +++ b/build/startup.S @@ -121,7 +121,7 @@ init_memory: .type reset, %function reset: .LFB1: - .loc 1 20 18 + .loc 1 21 18 .cfi_startproc @ args = 0, pretend = 0, frame = 0 @ frame_needed = 1, uses_anonymous_args = 0 @@ -131,17 +131,177 @@ reset: .cfi_offset 14, -4 add r7, sp, #0 .cfi_def_cfa_register 7 - .loc 1 21 3 + .loc 1 22 3 bl init_memory - .loc 1 23 3 + .loc 1 24 3 bl main .L9: - .loc 1 26 12 discriminator 1 + .loc 1 27 12 discriminator 1 nop b .L9 .cfi_endproc .LFE1: .size reset, .-reset + .section .text.default_handler,"ax",%progbits + .align 1 + .global default_handler + .syntax unified + .thumb + .thumb_func + .type default_handler, %function +default_handler: +.LFB2: + .loc 1 99 28 + .cfi_startproc + @ args = 0, pretend = 0, frame = 0 + @ frame_needed = 1, uses_anonymous_args = 0 + @ link register save eliminated. + push {r7} + .cfi_def_cfa_offset 4 + .cfi_offset 7, -4 + add r7, sp, #0 + .cfi_def_cfa_register 7 +.L11: + .loc 1 100 12 discriminator 1 + nop + b .L11 + .cfi_endproc +.LFE2: + .size default_handler, .-default_handler + .weak spi5 + .thumb_set spi5,default_handler + .weak spi4 + .thumb_set spi4,default_handler + .weak fpu + .thumb_set fpu,default_handler + .weak i2c3_er + .thumb_set i2c3_er,default_handler + .weak i2c3_ev + .thumb_set i2c3_ev,default_handler + .weak usart6 + .thumb_set usart6,default_handler + .weak dma2_stream7 + .thumb_set dma2_stream7,default_handler + .weak dma2_stream6 + .thumb_set dma2_stream6,default_handler + .weak dma2_stream5 + .thumb_set dma2_stream5,default_handler + .weak otg_fs + .thumb_set otg_fs,default_handler + .weak dma2_stream4 + .thumb_set dma2_stream4,default_handler + .weak dma2_stream3 + .thumb_set dma2_stream3,default_handler + .weak dma2_stream2 + .thumb_set dma2_stream2,default_handler + .weak dma2_stream1 + .thumb_set dma2_stream1,default_handler + .weak dma2_stream0 + .thumb_set dma2_stream0,default_handler + .weak spi3 + .thumb_set spi3,default_handler + .weak tim5 + .thumb_set tim5,default_handler + .weak sdio + .thumb_set sdio,default_handler + .weak dma1_stream7 + .thumb_set dma1_stream7,default_handler + .weak otg_fs_wkup + .thumb_set otg_fs_wkup,default_handler + .weak rtc_alarm + .thumb_set rtc_alarm,default_handler + .weak exti15_10 + .thumb_set exti15_10,default_handler + .weak usart2 + .thumb_set usart2,default_handler + .weak usart1 + .thumb_set usart1,default_handler + .weak spi2 + .thumb_set spi2,default_handler + .weak spi1 + .thumb_set spi1,default_handler + .weak i2c2_er + .thumb_set i2c2_er,default_handler + .weak i2c2_ev + .thumb_set i2c2_ev,default_handler + .weak i2c1_er + .thumb_set i2c1_er,default_handler + .weak i2c1_ev + .thumb_set i2c1_ev,default_handler + .weak tim4 + .thumb_set tim4,default_handler + .weak tim3 + .thumb_set tim3,default_handler + .weak tim2 + .thumb_set tim2,default_handler + .weak tim1_cc + .thumb_set tim1_cc,default_handler + .weak tim1_trg_com_tim11 + .thumb_set tim1_trg_com_tim11,default_handler + .weak tim1_up_tim10 + .thumb_set tim1_up_tim10,default_handler + .weak tim1_brk_tim9 + .thumb_set tim1_brk_tim9,default_handler + .weak exti9_5 + .thumb_set exti9_5,default_handler + .weak adc + .thumb_set adc,default_handler + .weak dma1_stream6 + .thumb_set dma1_stream6,default_handler + .weak dma1_stream5 + .thumb_set dma1_stream5,default_handler + .weak dma1_stream4 + .thumb_set dma1_stream4,default_handler + .weak dma1_stream3 + .thumb_set dma1_stream3,default_handler + .weak dma1_stream2 + .thumb_set dma1_stream2,default_handler + .weak dma1_stream1 + .thumb_set dma1_stream1,default_handler + .weak dma1_stream0 + .thumb_set dma1_stream0,default_handler + .weak exti4 + .thumb_set exti4,default_handler + .weak exti3 + .thumb_set exti3,default_handler + .weak exti2 + .thumb_set exti2,default_handler + .weak exti1 + .thumb_set exti1,default_handler + .weak exti0 + .thumb_set exti0,default_handler + .weak rcc + .thumb_set rcc,default_handler + .weak flash + .thumb_set flash,default_handler + .weak rtc_wkup + .thumb_set rtc_wkup,default_handler + .weak tamp_stamp + .thumb_set tamp_stamp,default_handler + .weak pvd + .thumb_set pvd,default_handler + .weak wwdg + .thumb_set wwdg,default_handler + .weak systick + .thumb_set systick,default_handler + .weak pend_sv + .thumb_set pend_sv,default_handler + .weak debug_monitor + .thumb_set debug_monitor,default_handler + .weak x + .thumb_set x,default_handler + .weak sv_call + .thumb_set sv_call,default_handler + .weak usage_fault + .thumb_set usage_fault,default_handler + .weak bus_fault + .thumb_set bus_fault,default_handler + .weak mem_manage + .thumb_set mem_manage,default_handler + .weak hard_fault + .thumb_set hard_fault,default_handler + .weak nmi + .thumb_set nmi,default_handler .global interrupt_vector_table .section .isr_vector,"a" .align 2 @@ -150,23 +310,94 @@ reset: interrupt_vector_table: .word stack_start .word reset - .space 400 + .word nmi + .word hard_fault + .word mem_manage + .word bus_fault + .word usage_fault + .word 0 + .word 0 + .word 0 + .word 0 + .word sv_call + .word debug_monitor + .word 0 + .word pend_sv + .word systick + .word wwdg + .word pvd + .word tamp_stamp + .word rtc_wkup + .word flash + .word rcc + .word exti0 + .word exti1 + .word exti2 + .word exti3 + .word exti4 + .word dma1_stream0 + .word dma1_stream1 + .word dma1_stream2 + .word dma1_stream3 + .word dma1_stream4 + .word dma1_stream5 + .word dma1_stream6 + .word adc + .word exti9_5 + .word tim1_brk_tim9 + .word tim1_up_tim10 + .word tim1_trg_com_tim11 + .word tim1_cc + .word tim2 + .word tim3 + .word tim4 + .word i2c1_ev + .word i2c1_er + .word i2c2_ev + .word i2c2_er + .word spi1 + .word spi2 + .word usart1 + .word usart2 + .word exti15_10 + .word rtc_alarm + .word otg_fs_wkup + .word dma1_stream7 + .word sdio + .word tim5 + .word spi3 + .word dma2_stream0 + .word dma2_stream1 + .word dma2_stream2 + .word dma2_stream3 + .word dma2_stream4 + .word otg_fs + .word dma2_stream5 + .word dma2_stream6 + .word dma2_stream7 + .word usart6 + .word i2c3_ev + .word i2c3_er + .word fpu + .word spi4 + .word spi5 + .space 116 .text .Letext0: .file 2 "/nix/store/yr89i11mszv2az19r26l372zgaiivj1c-gcc-arm-embedded-12.3.rel1/arm-none-eabi/include/machine/_default_types.h" .file 3 "/nix/store/yr89i11mszv2az19r26l372zgaiivj1c-gcc-arm-embedded-12.3.rel1/arm-none-eabi/include/sys/_stdint.h" .section .debug_info,"",%progbits .Ldebug_info0: - .4byte 0x172 + .4byte 0x184 .2byte 0x5 .byte 0x1 .byte 0x4 .4byte .Ldebug_abbrev0 .uleb128 0x7 - .4byte .LASF628 - .byte 0x1d - .4byte .LASF629 .4byte .LASF630 + .byte 0x1d + .4byte .LASF631 + .4byte .LASF632 .4byte .LLRL0 .4byte 0 .4byte .Ldebug_line0 @@ -238,36 +469,45 @@ interrupt_vector_table: .4byte 0x9d .uleb128 0xb .uleb128 0xc - .4byte .LASF622 + .4byte .LASF624 .byte 0x1 - .byte 0x1f + .byte 0x69 .byte 0xe .4byte 0x98 .uleb128 0x5 .byte 0x3 .4byte interrupt_vector_table .uleb128 0xd - .4byte .LASF631 + .4byte .LASF633 .byte 0x1 .byte 0x3 .byte 0xd .uleb128 0xe - .4byte .LASF632 + .4byte .LASF634 .byte 0x1 .byte 0x4 .byte 0xc .4byte 0x6e .uleb128 0xf - .4byte .LASF633 + .4byte .LASF622 .byte 0x1 - .byte 0x14 + .byte 0x63 + .byte 0x6 + .4byte .LFB2 + .4byte .LFE2-.LFB2 + .uleb128 0x1 + .byte 0x9c + .uleb128 0x10 + .4byte .LASF623 + .byte 0x1 + .byte 0x15 .byte 0x6 .4byte .LFB1 .4byte .LFE1-.LFB1 .uleb128 0x1 .byte 0x9c - .uleb128 0x10 - .4byte .LASF634 + .uleb128 0x11 + .4byte .LASF635 .byte 0x1 .byte 0x6 .byte 0x6 @@ -275,41 +515,41 @@ interrupt_vector_table: .4byte .LFE0-.LFB0 .uleb128 0x1 .byte 0x9c - .4byte 0x170 + .4byte 0x182 .uleb128 0x2 - .4byte .LASF623 + .4byte .LASF625 .byte 0x8 .byte 0x13 .4byte 0x7c .uleb128 0x2 - .4byte .LASF624 + .4byte .LASF626 .byte 0x8 .byte 0x20 .4byte 0x7c .uleb128 0x2 - .4byte .LASF625 + .4byte .LASF627 .byte 0x8 .byte 0x2b .4byte 0x7c .uleb128 0x2 - .4byte .LASF626 + .4byte .LASF628 .byte 0xe .byte 0x13 .4byte 0x7c .uleb128 0x2 - .4byte .LASF627 + .4byte .LASF629 .byte 0xe .byte 0x1f .4byte 0x7c - .uleb128 0x11 + .uleb128 0x12 .4byte .LBB2 .4byte .LBE2-.LBB2 - .4byte 0x157 + .4byte 0x169 .uleb128 0x3 .ascii "dst\000" .byte 0x9 .byte 0x12 - .4byte 0x170 + .4byte 0x182 .uleb128 0x2 .byte 0x91 .sleb128 -12 @@ -317,19 +557,19 @@ interrupt_vector_table: .ascii "src\000" .byte 0x9 .byte 0x27 - .4byte 0x170 + .4byte 0x182 .uleb128 0x2 .byte 0x91 .sleb128 -16 .byte 0 - .uleb128 0x12 + .uleb128 0x13 .4byte .LBB3 .4byte .LBE3-.LBB3 .uleb128 0x3 .ascii "dst\000" .byte 0xf .byte 0x12 - .4byte 0x170 + .4byte 0x182 .uleb128 0x2 .byte 0x91 .sleb128 -20 @@ -558,12 +798,37 @@ interrupt_vector_table: .uleb128 0x6 .uleb128 0x40 .uleb128 0x18 - .uleb128 0x7c + .uleb128 0x7a .uleb128 0x19 .byte 0 .byte 0 .uleb128 0x10 .uleb128 0x2e + .byte 0 + .uleb128 0x3f + .uleb128 0x19 + .uleb128 0x3 + .uleb128 0xe + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x39 + .uleb128 0xb + .uleb128 0x27 + .uleb128 0x19 + .uleb128 0x11 + .uleb128 0x1 + .uleb128 0x12 + .uleb128 0x6 + .uleb128 0x40 + .uleb128 0x18 + .uleb128 0x7c + .uleb128 0x19 + .byte 0 + .byte 0 + .uleb128 0x11 + .uleb128 0x2e .byte 0x1 .uleb128 0x3f .uleb128 0x19 @@ -589,7 +854,7 @@ interrupt_vector_table: .uleb128 0x13 .byte 0 .byte 0 - .uleb128 0x11 + .uleb128 0x12 .uleb128 0xb .byte 0x1 .uleb128 0x11 @@ -600,7 +865,7 @@ interrupt_vector_table: .uleb128 0x13 .byte 0 .byte 0 - .uleb128 0x12 + .uleb128 0x13 .uleb128 0xb .byte 0x1 .uleb128 0x11 @@ -611,7 +876,7 @@ interrupt_vector_table: .byte 0 .byte 0 .section .debug_aranges,"",%progbits - .4byte 0x24 + .4byte 0x2c .2byte 0x2 .4byte .Ldebug_info0 .byte 0x4 @@ -622,6 +887,8 @@ interrupt_vector_table: .4byte .LFE0-.LFB0 .4byte .LFB1 .4byte .LFE1-.LFB1 + .4byte .LFB2 + .4byte .LFE2-.LFB2 .4byte 0 .4byte 0 .section .debug_rnglists,"",%progbits @@ -639,6 +906,9 @@ interrupt_vector_table: .byte 0x7 .4byte .LFB1 .uleb128 .LFE1-.LFB1 + .byte 0x7 + .4byte .LFB2 + .uleb128 .LFE2-.LFB2 .byte 0 .Ldebug_ranges3: .section .debug_macro,"",%progbits @@ -2621,7 +2891,7 @@ interrupt_vector_table: .ascii "INTMAX_MIN (-INTMAX_MAX - 1)\000" .LASF315: .ascii "__ULACCUM_EPSILON__ 0x1P-32ULK\000" -.LASF629: +.LASF631: .ascii "src/startup.c\000" .LASF476: .ascii "__MISC_VISIBLE 1\000" @@ -2843,8 +3113,6 @@ interrupt_vector_table: .ascii "__FDPIC__\000" .LASF111: .ascii "__INT_LEAST16_WIDTH__ 16\000" -.LASF168: - .ascii "__DBL_MAX_EXP__ 1024\000" .LASF529: .ascii "_UINT16_T_DECLARED \000" .LASF523: @@ -2863,7 +3131,7 @@ interrupt_vector_table: .ascii "__ARM_NEON\000" .LASF400: .ascii "__ARM_FEATURE_CMSE\000" -.LASF630: +.LASF632: .ascii "/home/alex/code/own/c-compile-experiments\000" .LASF229: .ascii "__FLT64_IS_IEC_60559__ 2\000" @@ -2935,7 +3203,7 @@ interrupt_vector_table: .ascii "__ULFRACT_EPSILON__ 0x1P-32ULR\000" .LASF53: .ascii "__INT_LEAST32_TYPE__ long int\000" -.LASF634: +.LASF635: .ascii "init_memory\000" .LASF272: .ascii "__ULFRACT_IBIT__ 0\000" @@ -2963,7 +3231,7 @@ interrupt_vector_table: .ascii "__FLT32X_DENORM_MIN__ 4.9406564584124654e-324F32x\000" .LASF427: .ascii "__ARM_FEATURE_FP16_SCALAR_ARITHMETIC\000" -.LASF631: +.LASF633: .ascii "stack_start\000" .LASF286: .ascii "__SACCUM_FBIT__ 7\000" @@ -2971,7 +3239,7 @@ interrupt_vector_table: .ascii "__WCHAR_TYPE__ unsigned int\000" .LASF173: .ascii "__DBL_MIN__ ((double)2.2250738585072014e-308L)\000" -.LASF624: +.LASF626: .ascii "_data_end\000" .LASF258: .ascii "__FRACT_MIN__ (-0.5R-0.5R)\000" @@ -3023,9 +3291,9 @@ interrupt_vector_table: .ascii "__UDA_FBIT__ 32\000" .LASF582: .ascii "INT_FAST32_MIN (-__INT_FAST32_MAX__ - 1)\000" -.LASF625: - .ascii "_data_addr\000" .LASF627: + .ascii "_data_addr\000" +.LASF629: .ascii "_bss_end\000" .LASF417: .ascii "__THUMBEL__ 1\000" @@ -3191,6 +3459,8 @@ interrupt_vector_table: .ascii "__INT_LEAST16_TYPE__ short int\000" .LASF201: .ascii "__FLT32_MAX_EXP__ 128\000" +.LASF622: + .ascii "default_handler\000" .LASF522: .ascii "__LEAST32 \"l\"\000" .LASF223: @@ -3265,7 +3535,7 @@ interrupt_vector_table: .ascii "__SVID_VISIBLE 1\000" .LASF414: .ascii "__GCC_ASM_FLAG_OUTPUTS__ 1\000" -.LASF623: +.LASF625: .ascii "_data_start\000" .LASF601: .ascii "UINT8_C(x) __UINT8_C(x)\000" @@ -3301,8 +3571,8 @@ interrupt_vector_table: .ascii "__SIZEOF_LONG__ 4\000" .LASF499: .ascii "__int20\000" -.LASF118: - .ascii "__UINT_LEAST8_MAX__ 0xff\000" +.LASF168: + .ascii "__DBL_MAX_EXP__ 1024\000" .LASF463: .ascii "_DEFAULT_SOURCE\000" .LASF14: @@ -3453,10 +3723,12 @@ interrupt_vector_table: .ascii "__WINT_WIDTH__ 32\000" .LASF498: .ascii "short\000" -.LASF626: +.LASF628: .ascii "_bss_start\000" .LASF471: .ascii "__ATFILE_VISIBLE 1\000" +.LASF16: + .ascii "__SIZEOF_INT__ 4\000" .LASF530: .ascii "__int16_t_defined 1\000" .LASF613: @@ -3543,7 +3815,7 @@ interrupt_vector_table: .ascii "__ARM_FEATURE_SIMD32 1\000" .LASF75: .ascii "__WCHAR_MAX__ 0xffffffffU\000" -.LASF633: +.LASF623: .ascii "reset\000" .LASF18: .ascii "__SIZEOF_LONG_LONG__ 8\000" @@ -3597,7 +3869,7 @@ interrupt_vector_table: .ascii "__UINT64_C(c) c ## ULL\000" .LASF310: .ascii "__LACCUM_EPSILON__ 0x1P-31LK\000" -.LASF632: +.LASF634: .ascii "main\000" .LASF250: .ascii "__SFRACT_EPSILON__ 0x1P-7HR\000" @@ -3665,7 +3937,7 @@ interrupt_vector_table: .ascii "__LDBL_EPSILON__ 2.2204460492503131e-16L\000" .LASF67: .ascii "__INTPTR_TYPE__ int\000" -.LASF622: +.LASF624: .ascii "interrupt_vector_table\000" .LASF145: .ascii "__DEC_EVAL_METHOD__ 2\000" @@ -3697,7 +3969,7 @@ interrupt_vector_table: .ascii "_NEWLIB_VERSION \"4.3.0\"\000" .LASF321: .ascii "__ULLACCUM_FBIT__ 32\000" -.LASF628: +.LASF630: .ascii "GNU C17 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 -ffunction-sections -fdata-sections -" @@ -3734,8 +4006,8 @@ interrupt_vector_table: .ascii "__INT_FAST32_TYPE__ int\000" .LASF161: .ascii "__FLT_HAS_QUIET_NAN__ 1\000" -.LASF16: - .ascii "__SIZEOF_INT__ 4\000" +.LASF118: + .ascii "__UINT_LEAST8_MAX__ 0xff\000" .LASF38: .ascii "__INTMAX_TYPE__ long long int\000" .LASF511: diff --git a/build/startup.i b/build/startup.i index f69501f..e495aa0 100644 --- a/build/startup.i +++ b/build/startup.i @@ -1521,6 +1521,7 @@ void init_memory(void) { } } + void reset(void) { (void)init_memory(); @@ -1531,8 +1532,149 @@ void reset(void) { } +void nmi(void) __attribute__ ((weak, alias("default_handler"))); +void hard_fault(void) __attribute__ ((weak, alias("default_handler"))); +void mem_manage(void) __attribute__ ((weak, alias("default_handler"))); +void bus_fault(void) __attribute__ ((weak, alias("default_handler"))); +void usage_fault(void) __attribute__ ((weak, alias("default_handler"))); +void sv_call(void) __attribute__ ((weak, alias("default_handler"))); +void x(void) __attribute__ ((weak, alias("default_handler"))); +void debug_monitor(void) __attribute__ ((weak, alias("default_handler"))); +void pend_sv(void) __attribute__ ((weak, alias("default_handler"))); +void systick(void) __attribute__ ((weak, alias("default_handler"))); +void wwdg(void) __attribute__ ((weak, alias("default_handler"))); +void pvd(void) __attribute__ ((weak, alias("default_handler"))); +void tamp_stamp(void) __attribute__ ((weak, alias("default_handler"))); +void rtc_wkup(void) __attribute__ ((weak, alias("default_handler"))); +void flash(void) __attribute__ ((weak, alias("default_handler"))); +void rcc(void) __attribute__ ((weak, alias("default_handler"))); +void exti0(void) __attribute__ ((weak, alias("default_handler"))); +void exti1(void) __attribute__ ((weak, alias("default_handler"))); +void exti2(void) __attribute__ ((weak, alias("default_handler"))); +void exti3(void) __attribute__ ((weak, alias("default_handler"))); +void exti4(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream0(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream1(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream2(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream3(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream4(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream5(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream6(void) __attribute__ ((weak, alias("default_handler"))); +void adc(void) __attribute__ ((weak, alias("default_handler"))); +void exti9_5(void) __attribute__ ((weak, alias("default_handler"))); +void tim1_brk_tim9(void) __attribute__ ((weak, alias("default_handler"))); +void tim1_up_tim10(void) __attribute__ ((weak, alias("default_handler"))); +void tim1_trg_com_tim11(void) __attribute__ ((weak, alias("default_handler"))); +void tim1_cc(void) __attribute__ ((weak, alias("default_handler"))); +void tim2(void) __attribute__ ((weak, alias("default_handler"))); +void tim3(void) __attribute__ ((weak, alias("default_handler"))); +void tim4(void) __attribute__ ((weak, alias("default_handler"))); +void i2c1_ev(void) __attribute__ ((weak, alias("default_handler"))); +void i2c1_er(void) __attribute__ ((weak, alias("default_handler"))); +void i2c2_ev(void) __attribute__ ((weak, alias("default_handler"))); +void i2c2_er(void) __attribute__ ((weak, alias("default_handler"))); +void spi1(void) __attribute__ ((weak, alias("default_handler"))); +void spi2(void) __attribute__ ((weak, alias("default_handler"))); +void usart1(void) __attribute__ ((weak, alias("default_handler"))); +void usart2(void) __attribute__ ((weak, alias("default_handler"))); +void exti15_10(void) __attribute__ ((weak, alias("default_handler"))); +void rtc_alarm(void) __attribute__ ((weak, alias("default_handler"))); +void otg_fs_wkup(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream7(void) __attribute__ ((weak, alias("default_handler"))); +void sdio(void) __attribute__ ((weak, alias("default_handler"))); +void tim5(void) __attribute__ ((weak, alias("default_handler"))); +void spi3(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream0(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream1(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream2(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream3(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream4(void) __attribute__ ((weak, alias("default_handler"))); +void otg_fs(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream5(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream6(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream7(void) __attribute__ ((weak, alias("default_handler"))); +void usart6(void) __attribute__ ((weak, alias("default_handler"))); +void i2c3_ev(void) __attribute__ ((weak, alias("default_handler"))); +void i2c3_er(void) __attribute__ ((weak, alias("default_handler"))); +void fpu(void) __attribute__ ((weak, alias("default_handler"))); +void spi4(void) __attribute__ ((weak, alias("default_handler"))); +void spi5(void) __attribute__ ((weak, alias("default_handler"))); + +void default_handler(void) { + for (;;) (void) 0; +} + + void (*const interrupt_vector_table[16 + 86])(void) __attribute__((section(".isr_vector"))) = { stack_start, - reset + reset, + nmi, + hard_fault, + mem_manage, + bus_fault, + usage_fault, + 0, 0, 0, 0, + sv_call, + debug_monitor, + 0, + pend_sv, + systick, + wwdg, + pvd, + tamp_stamp, + rtc_wkup, + flash, + rcc, + exti0, + exti1, + exti2, + exti3, + exti4, + dma1_stream0, + dma1_stream1, + dma1_stream2, + dma1_stream3, + dma1_stream4, + dma1_stream5, + dma1_stream6, + adc, + exti9_5, + tim1_brk_tim9, + tim1_up_tim10, + tim1_trg_com_tim11, + tim1_cc, + tim2, + tim3, + tim4, + i2c1_ev, + i2c1_er, + i2c2_ev, + i2c2_er, + spi1, + spi2, + usart1, + usart2, + exti15_10, + rtc_alarm, + otg_fs_wkup, + dma1_stream7, + sdio, + tim5, + spi3, + dma2_stream0, + dma2_stream1, + dma2_stream2, + dma2_stream3, + dma2_stream4, + otg_fs, + dma2_stream5, + dma2_stream6, + dma2_stream7, + usart6, + i2c3_ev, + i2c3_er, + fpu, + spi4, + spi5 }; diff --git a/build/startup.o b/build/startup.o index 2e0b47a..bf9c24a 100644 Binary files a/build/startup.o and b/build/startup.o differ diff --git a/src/startup.c b/src/startup.c index 39f0f82..f1c5acf 100644 --- a/src/startup.c +++ b/src/startup.c @@ -17,6 +17,7 @@ void init_memory(void) { } } +// Interrupt and exception vectors void reset(void) { (void)init_memory(); @@ -26,9 +27,150 @@ void reset(void) { for (;;) (void) 0; } + +void nmi(void) __attribute__ ((weak, alias("default_handler"))); +void hard_fault(void) __attribute__ ((weak, alias("default_handler"))); +void mem_manage(void) __attribute__ ((weak, alias("default_handler"))); +void bus_fault(void) __attribute__ ((weak, alias("default_handler"))); +void usage_fault(void) __attribute__ ((weak, alias("default_handler"))); +void sv_call(void) __attribute__ ((weak, alias("default_handler"))); +void x(void) __attribute__ ((weak, alias("default_handler"))); +void debug_monitor(void) __attribute__ ((weak, alias("default_handler"))); +void pend_sv(void) __attribute__ ((weak, alias("default_handler"))); +void systick(void) __attribute__ ((weak, alias("default_handler"))); +void wwdg(void) __attribute__ ((weak, alias("default_handler"))); +void pvd(void) __attribute__ ((weak, alias("default_handler"))); +void tamp_stamp(void) __attribute__ ((weak, alias("default_handler"))); +void rtc_wkup(void) __attribute__ ((weak, alias("default_handler"))); +void flash(void) __attribute__ ((weak, alias("default_handler"))); +void rcc(void) __attribute__ ((weak, alias("default_handler"))); +void exti0(void) __attribute__ ((weak, alias("default_handler"))); +void exti1(void) __attribute__ ((weak, alias("default_handler"))); +void exti2(void) __attribute__ ((weak, alias("default_handler"))); +void exti3(void) __attribute__ ((weak, alias("default_handler"))); +void exti4(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream0(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream1(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream2(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream3(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream4(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream5(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream6(void) __attribute__ ((weak, alias("default_handler"))); +void adc(void) __attribute__ ((weak, alias("default_handler"))); +void exti9_5(void) __attribute__ ((weak, alias("default_handler"))); +void tim1_brk_tim9(void) __attribute__ ((weak, alias("default_handler"))); +void tim1_up_tim10(void) __attribute__ ((weak, alias("default_handler"))); +void tim1_trg_com_tim11(void) __attribute__ ((weak, alias("default_handler"))); +void tim1_cc(void) __attribute__ ((weak, alias("default_handler"))); +void tim2(void) __attribute__ ((weak, alias("default_handler"))); +void tim3(void) __attribute__ ((weak, alias("default_handler"))); +void tim4(void) __attribute__ ((weak, alias("default_handler"))); +void i2c1_ev(void) __attribute__ ((weak, alias("default_handler"))); +void i2c1_er(void) __attribute__ ((weak, alias("default_handler"))); +void i2c2_ev(void) __attribute__ ((weak, alias("default_handler"))); +void i2c2_er(void) __attribute__ ((weak, alias("default_handler"))); +void spi1(void) __attribute__ ((weak, alias("default_handler"))); +void spi2(void) __attribute__ ((weak, alias("default_handler"))); +void usart1(void) __attribute__ ((weak, alias("default_handler"))); +void usart2(void) __attribute__ ((weak, alias("default_handler"))); +void exti15_10(void) __attribute__ ((weak, alias("default_handler"))); +void rtc_alarm(void) __attribute__ ((weak, alias("default_handler"))); +void otg_fs_wkup(void) __attribute__ ((weak, alias("default_handler"))); +void dma1_stream7(void) __attribute__ ((weak, alias("default_handler"))); +void sdio(void) __attribute__ ((weak, alias("default_handler"))); +void tim5(void) __attribute__ ((weak, alias("default_handler"))); +void spi3(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream0(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream1(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream2(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream3(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream4(void) __attribute__ ((weak, alias("default_handler"))); +void otg_fs(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream5(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream6(void) __attribute__ ((weak, alias("default_handler"))); +void dma2_stream7(void) __attribute__ ((weak, alias("default_handler"))); +void usart6(void) __attribute__ ((weak, alias("default_handler"))); +void i2c3_ev(void) __attribute__ ((weak, alias("default_handler"))); +void i2c3_er(void) __attribute__ ((weak, alias("default_handler"))); +void fpu(void) __attribute__ ((weak, alias("default_handler"))); +void spi4(void) __attribute__ ((weak, alias("default_handler"))); +void spi5(void) __attribute__ ((weak, alias("default_handler"))); + +void default_handler(void) { + for (;;) (void) 0; +} + // Create minimal interrupt vector table -// 16 standard and 86 STM32F411xC/E-specific handlers +// 16 standard and 86 STM32F411xC/E-specific handlers of 32bit size each void (*const interrupt_vector_table[16 + 86])(void) __attribute__((section(".isr_vector"))) = { - stack_start, // Defined in link.ld - reset + stack_start, // Defined in link.ld + reset, // Reset + nmi, // Non maskable interrupt, Clock Security System + hard_fault, // All class of fault + mem_manage, // Memory management + bus_fault, // Pre-fetch fault, memory access fault + usage_fault, // Undefined instruction or illegal state + 0, 0, 0, 0, // Reserved + sv_call, // System Service call via SWI instruction + debug_monitor, // Debug Monitor + 0, // Reserved + pend_sv, // Pendable request for system service + systick, // System tick timer + wwdg, // Window Watchdog interrupt + pvd, // EXTI Line 16 interrupt / PVD through EXTI line detection interrupt + tamp_stamp, // EXTI Line 21 interrupt / Tamper and TimeStamp interrupts through the EXTI line + rtc_wkup, // EXTI Line 22 interrupt / RTC Wakeup interrupt through the EXTI line + flash, // Flash global interrupt + rcc, // RCC global interrupt + exti0, // EXTI Line0 interrupt + exti1, // EXTI Line1 interrupt + exti2, // EXTI Line2 interrupt + exti3, // EXTI Line3 interrupt + exti4, // EXTI Line4 interrupt + dma1_stream0, // DMA1 Stream0 global interrupt + dma1_stream1, // DMA1 Stream1 global interrupt + dma1_stream2, // DMA1 Stream2 global interrupt + dma1_stream3, // DMA1 Stream3 global interrupt + dma1_stream4, // DMA1 Stream4 global interrupt + dma1_stream5, // DMA1 Stream5 global interrupt + dma1_stream6, // DMA1 Stream6 global interrupt + adc, // ADC1 global interrupts + exti9_5, // EXTI Line[9:5] interrupts + tim1_brk_tim9, // TIM1 Break interrupt and TIM9 global interrupt + tim1_up_tim10, // TIM1 Update interrupt and TIM10 global interrupt + tim1_trg_com_tim11, // TIM1 Trigger and Commutation interrupts and TIM11 global interrupt + tim1_cc, // TIM1 Capture Compare interrupt + tim2, // TIM2 global interrupt + tim3, // TIM3 global interrupt + tim4, // TIM4 global interrupt + i2c1_ev, // I2C1 event interrupt + i2c1_er, // I2C1 error interrupt + i2c2_ev, // I2C2 event interrupt + i2c2_er, // I2C2 error interrupt + spi1, // SPI1 global interrupt + spi2, // SPI2 global interrupt + usart1, // USART1 global interrupt + usart2, // USART2 global interrupt + exti15_10, // EXTI Line[15:10] interrupts + rtc_alarm, // EXTI Line 17 interrupt / RTC Alarms (A and B) through EXTI line interrupt + otg_fs_wkup, // EXTI Line 18 interrupt / USB On-The-Go FS Wakeup through EXTI line interrupt + dma1_stream7, // MA1 Stream7 global interrupt + sdio, // SDIO global interrupt + tim5, // TIM5 global interrupt + spi3, // SPI3 global interrupt + dma2_stream0, // DMA2 Stream0 global interrupt + dma2_stream1, // DMA2 Stream1 global interrupt + dma2_stream2, // DMA2 Stream2 global interrupt + dma2_stream3, // DMA2 Stream3 global interrupt + dma2_stream4, // DMA2 Stream4 global interrupt + otg_fs, // USB On The Go FS global interrupt + dma2_stream5, // DMA2 Stream5 global interrupt + dma2_stream6, // DMA2 Stream6 global interrupt + dma2_stream7, // DMA2 Stream7 global interrupt + usart6, // USART6 global interrupt + i2c3_ev, // I2C3 event interrupt + i2c3_er, // I2C3 error interrupt + fpu, // FPU global interrupt + spi4, // SPI4 global interrupt + spi5 // SPI5 global interrupt };