diff --git a/build/final.elf b/build/final.elf index c3a176f..b09d646 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 858d1de..6d411a5 100644 --- a/build/final.elf.map +++ b/build/final.elf.map @@ -245,7 +245,7 @@ LOAD linker stubs .debug_rnglists 0x00000032 0x1f build/startup.o -.debug_macro 0x00000000 0x2d8f +.debug_macro 0x00000000 0x2e91 .debug_macro 0x00000000 0xb56 build/gpio.o .debug_macro 0x00000b56 0x22 build/gpio.o .debug_macro 0x00000b78 0x75 build/gpio.o @@ -262,23 +262,23 @@ LOAD linker stubs .debug_macro 0x000015e1 0x22 build/gpio.o .debug_macro 0x00001603 0x34 build/gpio.o .debug_macro 0x00001637 0xb6b build/main.o - .debug_macro 0x000021a2 0x16 build/main.o - .debug_macro 0x000021b8 0x2e build/main.o - .debug_macro 0x000021e6 0xb02 build/startup.o - .debug_macro 0x00002ce8 0x56 build/startup.o - .debug_macro 0x00002d3e 0x51 build/startup.o + .debug_macro 0x000021a2 0x118 build/main.o + .debug_macro 0x000022ba 0x2e build/main.o + .debug_macro 0x000022e8 0xb02 build/startup.o + .debug_macro 0x00002dea 0x56 build/startup.o + .debug_macro 0x00002e40 0x51 build/startup.o .debug_line 0x00000000 0x2fe .debug_line 0x00000000 0x116 build/gpio.o .debug_line 0x00000116 0xfe build/main.o .debug_line 0x00000214 0xea build/startup.o -.debug_str 0x00000000 0x553c +.debug_str 0x00000000 0x5ada .debug_str 0x00000000 0x5372 build/gpio.o 0x551a (size before relaxing) - .debug_str 0x00005372 0x142 build/main.o - 0x5607 (size before relaxing) - .debug_str 0x000054b4 0x88 build/startup.o + .debug_str 0x00005372 0x6e0 build/main.o + 0x5ba5 (size before relaxing) + .debug_str 0x00005a52 0x88 build/startup.o 0x3cdf (size before relaxing) .comment 0x00000000 0x45 diff --git a/build/main.S b/build/main.S index 704ea8e..4a25ba7 100644 --- a/build/main.S +++ b/build/main.S @@ -151,10 +151,10 @@ main: .byte 0x4 .4byte .Ldebug_abbrev0 .uleb128 0x9 - .4byte .LASF913 + .4byte .LASF956 .byte 0x1d - .4byte .LASF914 - .4byte .LASF915 + .4byte .LASF957 + .4byte .LASF958 .4byte .LLRL0 .4byte 0 .4byte .Ldebug_line0 @@ -162,17 +162,17 @@ main: .uleb128 0x2 .byte 0x1 .byte 0x6 - .4byte .LASF867 + .4byte .LASF910 .uleb128 0x2 .byte 0x1 .byte 0x8 - .4byte .LASF868 + .4byte .LASF911 .uleb128 0x2 .byte 0x2 .byte 0x5 - .4byte .LASF869 + .4byte .LASF912 .uleb128 0x3 - .4byte .LASF872 + .4byte .LASF915 .byte 0x2 .byte 0x39 .byte 0x1c @@ -180,13 +180,13 @@ main: .uleb128 0x2 .byte 0x2 .byte 0x7 - .4byte .LASF870 + .4byte .LASF913 .uleb128 0x2 .byte 0x4 .byte 0x5 - .4byte .LASF871 + .4byte .LASF914 .uleb128 0x3 - .4byte .LASF873 + .4byte .LASF916 .byte 0x2 .byte 0x4f .byte 0x1b @@ -194,15 +194,15 @@ main: .uleb128 0x2 .byte 0x4 .byte 0x7 - .4byte .LASF874 + .4byte .LASF917 .uleb128 0x2 .byte 0x8 .byte 0x5 - .4byte .LASF875 + .4byte .LASF918 .uleb128 0x2 .byte 0x8 .byte 0x7 - .4byte .LASF876 + .4byte .LASF919 .uleb128 0xa .byte 0x4 .byte 0x5 @@ -210,15 +210,15 @@ main: .uleb128 0x2 .byte 0x4 .byte 0x7 - .4byte .LASF877 + .4byte .LASF920 .uleb128 0x3 - .4byte .LASF878 + .4byte .LASF921 .byte 0x3 .byte 0x24 .byte 0x14 .4byte 0x3f .uleb128 0x3 - .4byte .LASF879 + .4byte .LASF922 .byte 0x3 .byte 0x30 .byte 0x14 @@ -238,12 +238,12 @@ main: .4byte 0xa0 .byte 0 .uleb128 0x1 - .4byte .LASF880 + .4byte .LASF923 .byte 0x8 .4byte 0xa0 .byte 0x4 .uleb128 0x1 - .4byte .LASF881 + .4byte .LASF924 .byte 0x9 .4byte 0xa0 .byte 0x8 @@ -253,97 +253,97 @@ main: .4byte 0xa0 .byte 0xc .uleb128 0x1 - .4byte .LASF882 + .4byte .LASF925 .byte 0xb .4byte 0xa0 .byte 0x10 .uleb128 0x1 - .4byte .LASF883 + .4byte .LASF926 .byte 0xc .4byte 0xa0 .byte 0x14 .uleb128 0x1 - .4byte .LASF884 + .4byte .LASF927 .byte 0xd .4byte 0x1f6 .byte 0x18 .uleb128 0x1 - .4byte .LASF885 + .4byte .LASF928 .byte 0xe .4byte 0xa0 .byte 0x20 .uleb128 0x1 - .4byte .LASF886 + .4byte .LASF929 .byte 0xf .4byte 0xa0 .byte 0x24 .uleb128 0x1 - .4byte .LASF887 + .4byte .LASF930 .byte 0x10 .4byte 0x1f6 .byte 0x28 .uleb128 0x1 - .4byte .LASF888 + .4byte .LASF931 .byte 0x11 .4byte 0xa0 .byte 0x30 .uleb128 0x1 - .4byte .LASF889 + .4byte .LASF932 .byte 0x12 .4byte 0xa0 .byte 0x34 .uleb128 0x1 - .4byte .LASF890 + .4byte .LASF933 .byte 0x13 .4byte 0x1f6 .byte 0x38 .uleb128 0x1 - .4byte .LASF891 + .4byte .LASF934 .byte 0x14 .4byte 0xa0 .byte 0x40 .uleb128 0x1 - .4byte .LASF892 + .4byte .LASF935 .byte 0x15 .4byte 0xa0 .byte 0x44 .uleb128 0x1 - .4byte .LASF893 + .4byte .LASF936 .byte 0x16 .4byte 0x1f6 .byte 0x48 .uleb128 0x1 - .4byte .LASF894 + .4byte .LASF937 .byte 0x17 .4byte 0xa0 .byte 0x50 .uleb128 0x1 - .4byte .LASF895 + .4byte .LASF938 .byte 0x18 .4byte 0xa0 .byte 0x54 .uleb128 0x1 - .4byte .LASF896 + .4byte .LASF939 .byte 0x19 .4byte 0x1f6 .byte 0x58 .uleb128 0x1 - .4byte .LASF897 + .4byte .LASF940 .byte 0x1a .4byte 0xa0 .byte 0x60 .uleb128 0x1 - .4byte .LASF898 + .4byte .LASF941 .byte 0x1b .4byte 0xa0 .byte 0x64 .uleb128 0x1 - .4byte .LASF899 + .4byte .LASF942 .byte 0x1c .4byte 0x1f6 .byte 0x68 .uleb128 0x1 - .4byte .LASF900 + .4byte .LASF943 .byte 0x1d .4byte 0xa0 .byte 0x70 @@ -353,22 +353,22 @@ main: .4byte 0xa0 .byte 0x74 .uleb128 0x1 - .4byte .LASF901 + .4byte .LASF944 .byte 0x1f .4byte 0x1f6 .byte 0x78 .uleb128 0x1 - .4byte .LASF902 + .4byte .LASF945 .byte 0x20 .4byte 0xa0 .byte 0x80 .uleb128 0x1 - .4byte .LASF903 + .4byte .LASF946 .byte 0x21 .4byte 0xa0 .byte 0x84 .uleb128 0x1 - .4byte .LASF904 + .4byte .LASF947 .byte 0x22 .4byte 0xa0 .byte 0x88 @@ -391,26 +391,26 @@ main: .byte 0xe .4byte 0x222 .uleb128 0x4 - .4byte .LASF905 + .4byte .LASF948 .byte 0 .uleb128 0x4 - .4byte .LASF906 + .4byte .LASF949 .byte 0x1 .uleb128 0x4 - .4byte .LASF907 + .4byte .LASF950 .byte 0x2 .uleb128 0x4 - .4byte .LASF908 + .4byte .LASF951 .byte 0x3 .byte 0 .uleb128 0x3 - .4byte .LASF909 + .4byte .LASF952 .byte 0x5 .byte 0x25 .byte 0x3 .4byte 0x1fb .uleb128 0x8 - .4byte .LASF911 + .4byte .LASF954 .byte 0x28 .4byte 0x243 .uleb128 0x5 @@ -421,9 +421,9 @@ main: .uleb128 0x2 .byte 0x1 .byte 0x2 - .4byte .LASF910 + .4byte .LASF953 .uleb128 0x8 - .4byte .LASF912 + .4byte .LASF955 .byte 0x27 .4byte 0x25f .uleb128 0x5 @@ -432,7 +432,7 @@ main: .4byte 0x222 .byte 0 .uleb128 0xf - .4byte .LASF916 + .4byte .LASF959 .byte 0x1 .byte 0xb .byte 0x5 @@ -453,7 +453,7 @@ main: .sleb128 -10 .byte 0 .uleb128 0x11 - .4byte .LASF917 + .4byte .LASF960 .byte 0x1 .byte 0x7 .byte 0x14 @@ -462,7 +462,7 @@ main: .uleb128 0x1 .byte 0x9c .uleb128 0x12 - .4byte .LASF918 + .4byte .LASF961 .byte 0x1 .byte 0x7 .byte 0x2b @@ -2274,7 +2274,7 @@ main: .uleb128 0x5 .byte 0x5 .uleb128 0x2 - .4byte .LASF853 + .4byte .LASF896 .file 17 "/nix/store/yr89i11mszv2az19r26l372zgaiivj1c-gcc-arm-embedded-12.3.rel1/lib/gcc/arm-none-eabi/12.3.1/include/stdbool.h" .byte 0x3 .uleb128 0x4 @@ -2287,7 +2287,7 @@ main: .byte 0x4 .byte 0x5 .uleb128 0x5 - .4byte .LASF866 + .4byte .LASF909 .byte 0x4 .byte 0 .section .debug_macro,"G",%progbits,wm4._newlib_version.h.4.6d111ab2e95434b664b53815e5c8ccba,comdat @@ -3547,7 +3547,7 @@ main: .uleb128 0x135 .4byte .LASF849 .byte 0 - .section .debug_macro,"G",%progbits,wm4.rcc.h.2.4336b76b7c5fd7e57a3fdd7174345804,comdat + .section .debug_macro,"G",%progbits,wm4.rcc.h.2.a0fe590d50a4a87e3e0cde8c35fecccb,comdat .Ldebug_macro14: .2byte 0x5 .byte 0 @@ -3560,6 +3560,135 @@ main: .byte 0x5 .uleb128 0x26 .4byte .LASF852 + .byte 0x5 + .uleb128 0x2a + .4byte .LASF853 + .byte 0x5 + .uleb128 0x2b + .4byte .LASF854 + .byte 0x5 + .uleb128 0x2e + .4byte .LASF855 + .byte 0x5 + .uleb128 0x2f + .4byte .LASF856 + .byte 0x5 + .uleb128 0x30 + .4byte .LASF857 + .byte 0x5 + .uleb128 0x33 + .4byte .LASF858 + .byte 0x5 + .uleb128 0x34 + .4byte .LASF859 + .byte 0x5 + .uleb128 0x37 + .4byte .LASF860 + .byte 0x5 + .uleb128 0x38 + .4byte .LASF861 + .byte 0x5 + .uleb128 0x3b + .4byte .LASF862 + .byte 0x5 + .uleb128 0x3c + .4byte .LASF863 + .byte 0x5 + .uleb128 0x3e + .4byte .LASF864 + .byte 0x5 + .uleb128 0x3f + .4byte .LASF865 + .byte 0x5 + .uleb128 0x42 + .4byte .LASF866 + .byte 0x5 + .uleb128 0x43 + .4byte .LASF867 + .byte 0x5 + .uleb128 0x44 + .4byte .LASF868 + .byte 0x5 + .uleb128 0x46 + .4byte .LASF869 + .byte 0x5 + .uleb128 0x47 + .4byte .LASF870 + .byte 0x5 + .uleb128 0x49 + .4byte .LASF871 + .byte 0x5 + .uleb128 0x4a + .4byte .LASF872 + .byte 0x5 + .uleb128 0x4b + .4byte .LASF873 + .byte 0x5 + .uleb128 0x4d + .4byte .LASF874 + .byte 0x5 + .uleb128 0x4e + .4byte .LASF875 + .byte 0x5 + .uleb128 0x4f + .4byte .LASF876 + .byte 0x5 + .uleb128 0x51 + .4byte .LASF877 + .byte 0x5 + .uleb128 0x52 + .4byte .LASF878 + .byte 0x5 + .uleb128 0x53 + .4byte .LASF879 + .byte 0x5 + .uleb128 0x57 + .4byte .LASF880 + .byte 0x5 + .uleb128 0x58 + .4byte .LASF881 + .byte 0x5 + .uleb128 0x5b + .4byte .LASF882 + .byte 0x5 + .uleb128 0x5c + .4byte .LASF883 + .byte 0x5 + .uleb128 0x5f + .4byte .LASF884 + .byte 0x5 + .uleb128 0x60 + .4byte .LASF885 + .byte 0x5 + .uleb128 0x63 + .4byte .LASF886 + .byte 0x5 + .uleb128 0x65 + .4byte .LASF887 + .byte 0x5 + .uleb128 0x66 + .4byte .LASF888 + .byte 0x5 + .uleb128 0x69 + .4byte .LASF889 + .byte 0x5 + .uleb128 0x6b + .4byte .LASF890 + .byte 0x5 + .uleb128 0x6c + .4byte .LASF891 + .byte 0x5 + .uleb128 0x6f + .4byte .LASF892 + .byte 0x5 + .uleb128 0x71 + .4byte .LASF893 + .byte 0x5 + .uleb128 0x72 + .4byte .LASF894 + .byte 0x5 + .uleb128 0x73 + .4byte .LASF895 .byte 0 .section .debug_macro,"G",%progbits,wm4.stdbool.h.29.eb124ecb79face0a1d832a352bec45e0,comdat .Ldebug_macro15: @@ -3567,19 +3696,19 @@ main: .byte 0 .byte 0x5 .uleb128 0x1d - .4byte .LASF854 + .4byte .LASF897 .byte 0x5 .uleb128 0x21 - .4byte .LASF855 + .4byte .LASF898 .byte 0x5 .uleb128 0x23 - .4byte .LASF856 + .4byte .LASF899 .byte 0x5 .uleb128 0x24 - .4byte .LASF857 + .4byte .LASF900 .byte 0x5 .uleb128 0x32 - .4byte .LASF858 + .4byte .LASF901 .byte 0 .section .debug_macro,"G",%progbits,wm4.gpio.h.20.f43cb24618dcbca74136a185a6bbf080,comdat .Ldebug_macro16: @@ -3587,25 +3716,25 @@ main: .byte 0 .byte 0x5 .uleb128 0x14 - .4byte .LASF859 + .4byte .LASF902 .byte 0x5 .uleb128 0x15 - .4byte .LASF860 + .4byte .LASF903 .byte 0x5 .uleb128 0x16 - .4byte .LASF861 + .4byte .LASF904 .byte 0x5 .uleb128 0x18 - .4byte .LASF862 + .4byte .LASF905 .byte 0x5 .uleb128 0x1a - .4byte .LASF863 + .4byte .LASF906 .byte 0x5 .uleb128 0x1c - .4byte .LASF864 + .4byte .LASF907 .byte 0x5 .uleb128 0x1e - .4byte .LASF865 + .4byte .LASF908 .byte 0 .section .debug_line,"",%progbits .Ldebug_line0: @@ -3622,7 +3751,7 @@ main: .ascii "__UHA_FBIT__ 8\000" .LASF814: .ascii "PRIiFAST64 __PRI64FAST(i)\000" -.LASF868: +.LASF911: .ascii "unsigned char\000" .LASF225: .ascii "__FLT64_DENORM_MIN__ 4.9406564584124654e-324F64\000" @@ -3656,7 +3785,7 @@ main: .ascii "__WINT_MIN__ 0U\000" .LASF90: .ascii "__INTMAX_MAX__ 0x7fffffffffffffffLL\000" -.LASF907: +.LASF950: .ascii "GPIO_MODE_AF\000" .LASF335: .ascii "__TQ_IBIT__ 0\000" @@ -3762,6 +3891,8 @@ main: .ascii "__SCNPTR(x) __STRINGIFY(x)\000" .LASF202: .ascii "__FLT32_MAX_10_EXP__ 38\000" +.LASF887: + .ascii "RCC_CFGR_HPRE_BIT 4\000" .LASF682: .ascii "SCNo8 __SCN8(o)\000" .LASF764: @@ -3776,11 +3907,13 @@ main: .ascii "__need_wchar_t\000" .LASF199: .ascii "__FLT32_MIN_EXP__ (-125)\000" -.LASF913: +.LASF956: .ascii "GNU C2X 12.3.1 20230626 -mcpu=cortex-m4 -mthumb -mf" .ascii "loat-abi=hard -mfpu=fpv4-sp-d16 -march=armv7e-m+fp " .ascii "-g3 -ggdb -O0 -std=c2x -ffunction-sections -fdata-s" .ascii "ections -fno-builtin -fno-common\000" +.LASF862: + .ascii "RCC_CR_HSEON_BIT 16\000" .LASF595: .ascii "INT16_MAX (__INT16_MAX__)\000" .LASF271: @@ -3793,6 +3926,8 @@ main: .ascii "__int_fast32_t_defined 1\000" .LASF133: .ascii "__INT_FAST64_WIDTH__ 64\000" +.LASF880: + .ascii "RCC_CFGR_PPRE_DIV_NONE 0\000" .LASF659: .ascii "___int_wchar_t_h \000" .LASF849: @@ -3833,6 +3968,9 @@ main: .ascii "__PRI32LEAST(x) __LEAST32 __STRINGIFY(x)\000" .LASF88: .ascii "__PTRDIFF_WIDTH__ 32\000" +.LASF895: + .ascii "RCC_CFGR_SW(clock) ((clock & RCC_CFGR_SW_MASK) << R" + .ascii "CC_CFGR_SW_BIT)\000" .LASF134: .ascii "__UINT_FAST8_MAX__ 0xffffffffU\000" .LASF540: @@ -3843,6 +3981,8 @@ main: .ascii "__LACCUM_IBIT__ 32\000" .LASF592: .ascii "INT_LEAST8_MAX (__INT_LEAST8_MAX__)\000" +.LASF889: + .ascii "RCC_CFGR_SWS_PLL (0b10)\000" .LASF559: .ascii "__EXP\000" .LASF81: @@ -3859,7 +3999,7 @@ main: .ascii "__INT64 \"ll\"\000" .LASF138: .ascii "__INTPTR_MAX__ 0x7fffffff\000" -.LASF895: +.LASF938: .ascii "AHB2LPENR\000" .LASF499: .ascii "__RAND_MAX\000" @@ -3882,6 +4022,8 @@ main: .ascii "INT_FAST32_MIN (-__INT_FAST32_MAX__ - 1)\000" .LASF672: .ascii "__SCN8LEAST(x) __LEAST8 __STRINGIFY(x)\000" +.LASF857: + .ascii "RCC_CR_PLLON_ON (1 << RCC_CR_PLLON_BIT)\000" .LASF55: .ascii "__UINT_LEAST8_TYPE__ unsigned char\000" .LASF727: @@ -3890,9 +4032,12 @@ main: .ascii "__ACCUM_FBIT__ 15\000" .LASF791: .ascii "PRId64 __PRI64(d)\000" +.LASF873: + .ascii "RCC_PLLCFGR_PLLP(p) ((p & RCC_PLLCFGR_PLLP_MASK) <<" + .ascii " RCC_PLLCFGR_PLLP_BIT)\000" .LASF302: .ascii "__UACCUM_IBIT__ 16\000" -.LASF871: +.LASF914: .ascii "long int\000" .LASF719: .ascii "SCNd16 __SCN16(d)\000" @@ -3910,6 +4055,9 @@ main: .ascii "__FLT32X_EPSILON__ 2.2204460492503131e-16F32x\000" .LASF556: .ascii "___int_least16_t_defined 1\000" +.LASF879: + .ascii "RCC_PLLCFGR_PLLM(m) ((m & RCC_PLLCFGR_PLLM_MASK) <<" + .ascii " RCC_PLLCFGR_PLLM_BIT)\000" .LASF59: .ascii "__INT_FAST8_TYPE__ int\000" .LASF544: @@ -3920,12 +4068,16 @@ main: .ascii "PRIdFAST32 __PRI32FAST(d)\000" .LASF93: .ascii "__UINTMAX_C(c) c ## ULL\000" +.LASF866: + .ascii "RCC_PLLCFGR_PLLQ_BIT 24\000" .LASF31: .ascii "__SIZEOF_POINTER__ 4\000" .LASF621: .ascii "INT_FAST64_MIN (-__INT_FAST64_MAX__ - 1)\000" .LASF371: .ascii "__GCC_ATOMIC_BOOL_LOCK_FREE 2\000" +.LASF894: + .ascii "RCC_CFGR_SW_MASK (0b11)\000" .LASF432: .ascii "__ARM_NEON__\000" .LASF587: @@ -3934,7 +4086,7 @@ main: .ascii "__FLT32_MAX_EXP__ 128\000" .LASF824: .ascii "__PRIMAX(x) __STRINGIFY(ll ##x)\000" -.LASF916: +.LASF959: .ascii "main\000" .LASF435: .ascii "__THUMB_INTERWORK__ 1\000" @@ -3952,7 +4104,7 @@ main: .ascii "__CHAR32_TYPE__ long unsigned int\000" .LASF429: .ascii "__ARM_FEATURE_FP16_VECTOR_ARITHMETIC\000" -.LASF853: +.LASF896: .ascii "GPIO_H_ \000" .LASF179: .ascii "__DBL_IS_IEC_60559__ 2\000" @@ -3964,7 +4116,7 @@ main: .ascii "__SIZEOF_LONG__ 4\000" .LASF753: .ascii "PRIi32 __PRI32(i)\000" -.LASF892: +.LASF935: .ascii "APB2ENR\000" .LASF850: .ascii "RCC_H_ \000" @@ -3980,7 +4132,7 @@ main: .ascii "__FLT32X_MIN_EXP__ (-1021)\000" .LASF815: .ascii "PRIoFAST64 __PRI64FAST(o)\000" -.LASF894: +.LASF937: .ascii "AHB1LPENR\000" .LASF406: .ascii "__ARM_FEATURE_SIMD32 1\000" @@ -3992,7 +4144,7 @@ main: .ascii "PRIoLEAST16 __PRI16LEAST(o)\000" .LASF458: .ascii "__NEWLIB__ 4\000" -.LASF904: +.LASF947: .ascii "DCKCFGR\000" .LASF720: .ascii "SCNi16 __SCN16(i)\000" @@ -4002,7 +4154,7 @@ main: .ascii "__FLT_DECIMAL_DIG__ 9\000" .LASF562: .ascii "_UINT8_T_DECLARED \000" -.LASF867: +.LASF910: .ascii "signed char\000" .LASF805: .ascii "PRIuLEAST64 __PRI64LEAST(u)\000" @@ -4012,7 +4164,7 @@ main: .ascii "INTMAX_MIN (-INTMAX_MAX - 1)\000" .LASF364: .ascii "__GNUC_STDC_INLINE__ 1\000" -.LASF909: +.LASF952: .ascii "GPIO_MODE\000" .LASF256: .ascii "__FRACT_FBIT__ 15\000" @@ -4024,34 +4176,40 @@ main: .ascii "__GNUC_PATCHLEVEL__ 1\000" .LASF374: .ascii "__GCC_ATOMIC_CHAR32_T_LOCK_FREE 2\000" +.LASF867: + .ascii "RCC_PLLCFGR_PLLQ_MASK (0b1111)\000" .LASF648: .ascii "__wchar_t__ \000" .LASF410: .ascii "__ARM_ARCH_PROFILE 77\000" .LASF546: .ascii "_STDINT_H \000" -.LASF854: +.LASF897: .ascii "_STDBOOL_H \000" .LASF219: .ascii "__FLT64_MAX_10_EXP__ 308\000" -.LASF884: +.LASF875: + .ascii "RCC_PLLCFGR_PLLN_MASK (0b111111111)\000" +.LASF927: .ascii "RESERVED0\000" -.LASF887: +.LASF930: .ascii "RESERVED1\000" -.LASF890: +.LASF933: .ascii "RESERVED2\000" .LASF3: .ascii "__STDC_UTF_32__ 1\000" -.LASF896: +.LASF939: .ascii "RESERVED4\000" .LASF241: .ascii "__FLT32X_DENORM_MIN__ 4.9406564584124654e-324F32x\000" -.LASF901: +.LASF944: .ascii "RESERVED6\000" .LASF152: .ascii "__FLT_MAX_10_EXP__ 38\000" .LASF42: .ascii "__SIG_ATOMIC_TYPE__ int\000" +.LASF884: + .ascii "RCC_CFGR_PPRE1_BIT 10\000" .LASF259: .ascii "__FRACT_MAX__ 0X7FFFP-15R\000" .LASF728: @@ -4064,6 +4222,8 @@ main: .ascii "_READ_WRITE_RETURN_TYPE int\000" .LASF771: .ascii "SCNoLEAST32 __SCN32LEAST(o)\000" +.LASF892: + .ascii "RCC_CFGR_SW_PLL (0b10)\000" .LASF844: .ascii "PRIXPTR __PRIPTR(X)\000" .LASF797: @@ -4086,13 +4246,13 @@ main: .ascii "__int_fast64_t_defined 1\000" .LASF837: .ascii "__PRIPTR(x) __STRINGIFY(x)\000" -.LASF878: +.LASF921: .ascii "uint16_t\000" .LASF417: .ascii "__thumb2__ 1\000" .LASF321: .ascii "__ULLACCUM_FBIT__ 32\000" -.LASF910: +.LASF953: .ascii "_Bool\000" .LASF366: .ascii "__STRICT_ANSI__ 1\000" @@ -4100,11 +4260,11 @@ main: .ascii "_SYS_FEATURES_H \000" .LASF812: .ascii "SCNxLEAST64 __SCN64LEAST(x)\000" -.LASF893: +.LASF936: .ascii "RESERVED3\000" .LASF22: .ascii "__SIZEOF_LONG_DOUBLE__ 8\000" -.LASF899: +.LASF942: .ascii "RESERVED5\000" .LASF386: .ascii "__PRAGMA_REDEFINE_EXTNAME 1\000" @@ -4112,7 +4272,7 @@ main: .ascii "__WCHAR_TYPE__ unsigned int\000" .LASF469: .ascii "_MB_LEN_MAX 8\000" -.LASF906: +.LASF949: .ascii "GPIO_MODE_OUTPUT\000" .LASF357: .ascii "__USA_IBIT__ 16\000" @@ -4126,6 +4286,8 @@ main: .ascii "__need_wchar_t \000" .LASF66: .ascii "__UINT_FAST64_TYPE__ long long unsigned int\000" +.LASF890: + .ascii "RCC_CFGR_SWS_BIT 2\000" .LASF156: .ascii "__FLT_MIN__ 1.1754943508222875e-38F\000" .LASF346: @@ -4150,9 +4312,9 @@ main: .ascii "__SCN64(x) __INT64 __STRINGIFY(x)\000" .LASF646: .ascii "_GCC_WRAP_STDINT_H \000" -.LASF872: +.LASF915: .ascii "__uint16_t\000" -.LASF889: +.LASF932: .ascii "AHB2ENR\000" .LASF804: .ascii "PRIoLEAST64 __PRI64LEAST(o)\000" @@ -4180,7 +4342,7 @@ main: .ascii "INTMAX_MAX (__INTMAX_MAX__)\000" .LASF601: .ascii "INT32_MAX (__INT32_MAX__)\000" -.LASF862: +.LASF905: .ascii "BIT(x) (1 << x)\000" .LASF350: .ascii "__DA_FBIT__ 31\000" @@ -4192,9 +4354,13 @@ main: .ascii "__FLT_DENORM_MIN__ 1.4012984643248171e-45F\000" .LASF533: .ascii "__LEAST8 \"hh\"\000" +.LASF886: + .ascii "RCC_CFGR_HPRE_DIV_NONE 0\000" +.LASF859: + .ascii "RCC_CR_HSEBYP (1 << RCC_CR_HSEBYP_BIT)\000" .LASF539: .ascii "_END_STD_C \000" -.LASF856: +.LASF899: .ascii "true ((_Bool)+1u)\000" .LASF766: .ascii "PRIuLEAST32 __PRI32LEAST(u)\000" @@ -4206,11 +4372,15 @@ main: .ascii "PRIiLEAST16 __PRI16LEAST(i)\000" .LASF303: .ascii "__UACCUM_MIN__ 0.0UK\000" +.LASF871: + .ascii "RCC_PLLCFGR_PLLP_BIT 16\000" .LASF157: .ascii "__FLT_EPSILON__ 1.1920928955078125e-7F\000" +.LASF856: + .ascii "RCC_CR_PLLON_OFF (0 << RCC_CR_PLLON_BIT)\000" .LASF769: .ascii "SCNdLEAST32 __SCN32LEAST(d)\000" -.LASF863: +.LASF906: .ascii "PIN(port,num) ((((port) - 'A') << 8) | num)\000" .LASF806: .ascii "PRIxLEAST64 __PRI64LEAST(x)\000" @@ -4230,6 +4400,8 @@ main: .ascii "INT_LEAST32_MIN (-__INT_LEAST32_MAX__ - 1)\000" .LASF376: .ascii "__GCC_ATOMIC_SHORT_LOCK_FREE 2\000" +.LASF864: + .ascii "RCC_CR_HSION_BIT 0\000" .LASF778: .ascii "PRIxFAST32 __PRI32FAST(x)\000" .LASF777: @@ -4244,8 +4416,10 @@ main: .ascii "__MISC_VISIBLE 0\000" .LASF306: .ascii "__LACCUM_FBIT__ 31\000" -.LASF900: +.LASF943: .ascii "BDCR\000" +.LASF865: + .ascii "RCC_CR_HSION_OFF (0 << RCC_CR_HSION_BIT)\000" .LASF211: .ascii "__FLT32_HAS_QUIET_NAN__ 1\000" .LASF484: @@ -4278,6 +4452,8 @@ main: .ascii "__FP_FAST_FMAF 1\000" .LASF628: .ascii "SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)\000" +.LASF863: + .ascii "RCC_CR_HSEON_ON (1 << RCC_CR_HSEON_BIT)\000" .LASF564: .ascii "_INT16_T_DECLARED \000" .LASF245: @@ -4298,11 +4474,15 @@ main: .ascii "__ARM_FEATURE_FP16_FML\000" .LASF802: .ascii "PRIdLEAST64 __PRI64LEAST(d)\000" +.LASF858: + .ascii "RCC_CR_HSEBYP_BIT 18\000" .LASF255: .ascii "__USFRACT_EPSILON__ 0x1P-8UHR\000" +.LASF861: + .ascii "RCC_CR_HSERDY_READY (1 << RCC_CR_HSERDY_BIT)\000" .LASF762: .ascii "SCNx32 __SCN32(x)\000" -.LASF881: +.LASF924: .ascii "CFGR\000" .LASF557: .ascii "___int_least32_t_defined 1\000" @@ -4370,7 +4550,7 @@ main: .ascii "___int8_t_defined 1\000" .LASF248: .ascii "__SFRACT_MIN__ (-0.5HR-0.5HR)\000" -.LASF874: +.LASF917: .ascii "long unsigned int\000" .LASF349: .ascii "__SA_IBIT__ 16\000" @@ -4386,9 +4566,11 @@ main: .ascii "__ARM_FP16_FORMAT_IEEE\000" .LASF48: .ascii "__UINT16_TYPE__ short unsigned int\000" -.LASF911: +.LASF869: + .ascii "RCC_PLLCFGR_PLLSRC_BIT 22\000" +.LASF954: .ascii "gpio_write\000" -.LASF857: +.LASF900: .ascii "false ((_Bool)+0u)\000" .LASF656: .ascii "_WCHAR_T_DEFINED_ \000" @@ -4396,11 +4578,11 @@ main: .ascii "__FLT_EVAL_METHOD_TS_18661_3__ 0\000" .LASF521: .ascii "int +2\000" -.LASF915: +.LASF958: .ascii "/home/alex/code/own/c-compile-experiments\000" .LASF636: .ascii "INT8_C(x) __INT8_C(x)\000" -.LASF866: +.LASF909: .ascii "exit 42\000" .LASF63: .ascii "__UINT_FAST8_TYPE__ unsigned int\000" @@ -4432,7 +4614,7 @@ main: .ascii "SCNx8 __SCN8(x)\000" .LASF208: .ascii "__FLT32_DENORM_MIN__ 1.4012984643248171e-45F32\000" -.LASF912: +.LASF955: .ascii "gpio_set_mode\000" .LASF125: .ascii "__UINT64_C(c) c ## ULL\000" @@ -4452,6 +4634,8 @@ main: .ascii "__GCC_ATOMIC_CHAR16_T_LOCK_FREE 2\000" .LASF789: .ascii "__PRI64FAST(x) __FAST64 __STRINGIFY(x)\000" +.LASF893: + .ascii "RCC_CFGR_SW_BIT 0\000" .LASF168: .ascii "__DBL_MAX_EXP__ 1024\000" .LASF532: @@ -4500,7 +4684,7 @@ main: .ascii "SCNxLEAST32 __SCN32LEAST(x)\000" .LASF711: .ascii "__SCN16LEAST(x) __LEAST16 __STRINGIFY(x)\000" -.LASF880: +.LASF923: .ascii "PLLCFGR\000" .LASF5: .ascii "__GNUC__ 12\000" @@ -4528,7 +4712,7 @@ main: .ascii "__ULACCUM_MIN__ 0.0ULK\000" .LASF461: .ascii "_ATEXIT_DYNAMIC_ALLOC 1\000" -.LASF873: +.LASF916: .ascii "__uint32_t\000" .LASF188: .ascii "__LDBL_MAX__ 1.7976931348623157e+308L\000" @@ -4538,7 +4722,7 @@ main: .ascii "__FLT_RADIX__ 2\000" .LASF454: .ascii "_INTTYPES_H \000" -.LASF875: +.LASF918: .ascii "long long int\000" .LASF784: .ascii "SCNxFAST32 __SCN32FAST(x)\000" @@ -4582,7 +4766,7 @@ main: .ascii "___int32_t_defined 1\000" .LASF83: .ascii "__INT_WIDTH__ 32\000" -.LASF886: +.LASF929: .ascii "APB2RSTR\000" .LASF409: .ascii "__ARM_ARCH_PROFILE\000" @@ -4632,15 +4816,15 @@ main: .ascii "__ARM_NEON_FP\000" .LASF280: .ascii "__LLFRACT_EPSILON__ 0x1P-63LLR\000" -.LASF898: +.LASF941: .ascii "APB2LPENR\000" .LASF820: .ascii "SCNiFAST64 __SCN64FAST(i)\000" -.LASF917: +.LASF960: .ascii "spin\000" .LASF683: .ascii "SCNu8 __SCN8(u)\000" -.LASF918: +.LASF961: .ascii "count\000" .LASF261: .ascii "__UFRACT_FBIT__ 16\000" @@ -4660,8 +4844,12 @@ main: .ascii "L)\000" .LASF607: .ascii "INT64_MAX (__INT64_MAX__)\000" -.LASF877: +.LASF920: .ascii "unsigned int\000" +.LASF860: + .ascii "RCC_CR_HSERDY_BIT 17\000" +.LASF903: + .ascii "GPIO_PORT_OFFSET (0x400U)\000" .LASF459: .ascii "__NEWLIB_MINOR__ 3\000" .LASF149: @@ -4736,13 +4924,15 @@ main: .ascii "__PRI8FAST(x) __FAST8 __STRINGIFY(x)\000" .LASF82: .ascii "__SHRT_WIDTH__ 16\000" +.LASF881: + .ascii "RCC_CFGR_PPRE_DIV_2 (0b100)\000" .LASF472: .ascii "_UNBUF_STREAM_OPT 1\000" .LASF667: .ascii "__STRINGIFY(a) #a\000" .LASF356: .ascii "__USA_FBIT__ 16\000" -.LASF897: +.LASF940: .ascii "APB1LPENR\000" .LASF479: .ascii "__IEEE_LITTLE_ENDIAN \000" @@ -4768,7 +4958,7 @@ main: .ascii "SCNxFAST64 __SCN64FAST(x)\000" .LASF681: .ascii "SCNi8 __SCN8(i)\000" -.LASF902: +.LASF945: .ascii "SSCGR\000" .LASF407: .ascii "__ARM_SIZEOF_MINIMAL_ENUM 1\000" @@ -4846,10 +5036,12 @@ main: .ascii "SCNuFAST16 __SCN16FAST(u)\000" .LASF801: .ascii "SCNx64 __SCN64(x)\000" -.LASF865: +.LASF908: .ascii "PINPORT(pin) (pin >> 8)\000" .LASF198: .ascii "__FLT32_DIG__ 6\000" +.LASF885: + .ascii "RCC_CFGR_PPRE1_MASK (0b111)\000" .LASF645: .ascii "UINTMAX_C(x) __UINTMAX_C(x)\000" .LASF623: @@ -4866,16 +5058,19 @@ main: .ascii "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1\000" .LASF733: .ascii "SCNuLEAST16 __SCN16LEAST(u)\000" -.LASF885: +.LASF928: .ascii "APB1RSTR\000" .LASF298: .ascii "__ACCUM_MIN__ (-0X1P15K-0X1P15K)\000" .LASF393: .ascii "__ARM_FEATURE_CRYPTO\000" -.LASF891: +.LASF934: .ascii "APB1ENR\000" .LASF741: .ascii "SCNdFAST16 __SCN16FAST(d)\000" +.LASF868: + .ascii "RCC_PLLCFGR_PLLQ(q) ((q & RCC_PLLCFGR_PLLQ_MASK) <<" + .ascii " RCC_PLLCFGR_PLLQ_BIT)\000" .LASF787: .ascii "__PRI64LEAST(x) __LEAST64 __STRINGIFY(x)\000" .LASF677: @@ -4894,14 +5089,19 @@ main: .ascii "__NEWLIB_PATCHLEVEL__ 0\000" .LASF26: .ascii "__ORDER_LITTLE_ENDIAN__ 1234\000" +.LASF870: + .ascii "RCC_PLLCFGR_PLLSRC_HSE (1 << RCC_PLLCFGR_PLLSRC_BIT" + .ascii ")\000" .LASF155: .ascii "__FLT_NORM_MAX__ 3.4028234663852886e+38F\000" -.LASF876: +.LASF919: .ascii "long long unsigned int\000" .LASF611: .ascii "UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)\000" .LASF150: .ascii "__FLT_MIN_10_EXP__ (-37)\000" +.LASF891: + .ascii "RCC_CFGR_SWS_MASK (0b11)\000" .LASF312: .ascii "__ULACCUM_IBIT__ 32\000" .LASF776: @@ -4934,6 +5134,9 @@ main: .ascii "__SACCUM_MIN__ (-0X1P7HK-0X1P7HK)\000" .LASF274: .ascii "__ULFRACT_MAX__ 0XFFFFFFFFP-32ULR\000" +.LASF876: + .ascii "RCC_PLLCFGR_PLLN(n) ((n & RCC_PLLCFGR_PLLN_MASK) <<" + .ascii " RCC_PLLCFGR_PLLN_BIT)\000" .LASF56: .ascii "__UINT_LEAST16_TYPE__ short unsigned int\000" .LASF573: @@ -4948,6 +5151,8 @@ main: .ascii "PRIXFAST16 __PRI16FAST(X)\000" .LASF833: .ascii "SCNiMAX __SCNMAX(i)\000" +.LASF853: + .ascii "RCC_CR_PLLRDY_BIT 25\000" .LASF767: .ascii "PRIxLEAST32 __PRI32LEAST(x)\000" .LASF344: @@ -4998,7 +5203,7 @@ main: .ascii "PRIoMAX __PRIMAX(o)\000" .LASF747: .ascii "__SCN32(x) __INT32 __STRINGIFY(x)\000" -.LASF905: +.LASF948: .ascii "GPIO_MODE_INPUT\000" .LASF743: .ascii "SCNoFAST16 __SCN16FAST(o)\000" @@ -5056,7 +5261,7 @@ main: .ascii "__UINT_LEAST32_TYPE__ long unsigned int\000" .LASF405: .ascii "__ARM_FEATURE_NUMERIC_MAXMIN\000" -.LASF859: +.LASF902: .ascii "GPIO_BASE_ADDR (0x40020000U)\000" .LASF38: .ascii "__INTMAX_TYPE__ long long int\000" @@ -5066,7 +5271,7 @@ main: .ascii "__ARM_ARCH_7EM__ 1\000" .LASF428: .ascii "__ARM_FEATURE_FP16_SCALAR_ARITHMETIC\000" -.LASF888: +.LASF931: .ascii "AHB1ENR\000" .LASF295: .ascii "__USACCUM_EPSILON__ 0x1P-8UHK\000" @@ -5106,14 +5311,16 @@ main: .ascii "__DBL_DIG__ 15\000" .LASF275: .ascii "__ULFRACT_EPSILON__ 0x1P-32ULR\000" -.LASF883: +.LASF926: .ascii "AHB2RSTR\000" .LASF671: .ascii "__SCN8(x) __INT8 __STRINGIFY(x)\000" +.LASF883: + .ascii "RCC_CFGR_PPRE2_MASK (0b111)\000" .LASF23: .ascii "__SIZEOF_SIZE_T__ 4\000" -.LASF860: - .ascii "GPIO_PORT_OFFSET (0x400U)\000" +.LASF854: + .ascii "RCC_CR_PLLRDY_LOCKED (1 << RCC_CR_PLLRDY_BIT)\000" .LASF50: .ascii "__UINT64_TYPE__ long long unsigned int\000" .LASF579: @@ -5134,7 +5341,7 @@ main: .ascii "unsigned\000" .LASF381: .ascii "__GCC_DESTRUCTIVE_SIZE 64\000" -.LASF869: +.LASF912: .ascii "short int\000" .LASF835: .ascii "SCNuMAX __SCNMAX(u)\000" @@ -5144,6 +5351,8 @@ main: .ascii "__UDA_IBIT__ 32\000" .LASF534: .ascii "__LEAST16 \"h\"\000" +.LASF878: + .ascii "RCC_PLLCFGR_PLLM_MASK (0b111111)\000" .LASF586: .ascii "INTPTR_MAX (__INTPTR_MAX__)\000" .LASF710: @@ -5156,7 +5365,7 @@ main: .ascii "_ATTRIBUTE(attrs) __attribute__ (attrs)\000" .LASF443: .ascii "__ARM_FEATURE_COPROC\000" -.LASF908: +.LASF951: .ascii "GPIO_MODE_ANALOG\000" .LASF177: .ascii "__DBL_HAS_INFINITY__ 1\000" @@ -5174,6 +5383,8 @@ main: .ascii "__DBL_DECIMAL_DIG__ 17\000" .LASF550: .ascii "__have_long32 1\000" +.LASF855: + .ascii "RCC_CR_PLLON_BIT 24\000" .LASF657: .ascii "_WCHAR_T_DEFINED \000" .LASF792: @@ -5186,6 +5397,8 @@ main: .ascii "__INT16_MAX__ 0x7fff\000" .LASF478: .ascii "__SYS_CONFIG_H__ \000" +.LASF877: + .ascii "RCC_PLLCFGR_PLLM_BIT 0\000" .LASF8: .ascii "__VERSION__ \"12.3.1 20230626\"\000" .LASF497: @@ -5220,6 +5433,8 @@ main: .ascii "PRIdMAX __PRIMAX(d)\000" .LASF388: .ascii "__SIZEOF_WINT_T__ 4\000" +.LASF882: + .ascii "RCC_CFGR_PPRE2_BIT 13\000" .LASF782: .ascii "SCNoFAST32 __SCN32FAST(o)\000" .LASF394: @@ -5232,7 +5447,7 @@ main: .ascii "PRIXFAST8 __PRI8FAST(X)\000" .LASF308: .ascii "__LACCUM_MIN__ (-0X1P31LK-0X1P31LK)\000" -.LASF914: +.LASF957: .ascii "src/main.c\000" .LASF126: .ascii "__INT_FAST8_MAX__ 0x7fffffff\000" @@ -5274,7 +5489,7 @@ main: .ascii "__GCC_CONSTRUCTIVE_SIZE 64\000" .LASF664: .ascii "_BSD_WCHAR_T_\000" -.LASF903: +.LASF946: .ascii "PLLI2SCFGR\000" .LASF277: .ascii "__LLFRACT_IBIT__ 0\000" @@ -5284,8 +5499,10 @@ main: .ascii "PRIx32 __PRI32(x)\000" .LASF278: .ascii "__LLFRACT_MIN__ (-0.5LLR-0.5LLR)\000" -.LASF879: +.LASF922: .ascii "uint32_t\000" +.LASF874: + .ascii "RCC_PLLCFGR_PLLN_BIT 6\000" .LASF689: .ascii "PRIxLEAST8 __PRI8LEAST(x)\000" .LASF506: @@ -5318,6 +5535,8 @@ main: .ascii "__LDBL_DIG__ 15\000" .LASF89: .ascii "__SIZE_WIDTH__ 32\000" +.LASF872: + .ascii "RCC_PLLCFGR_PLLP_MASK (0b11)\000" .LASF480: .ascii "_SUPPORTS_ERREXCEPT \000" .LASF215: @@ -5332,13 +5551,13 @@ main: .ascii "__INT_LEAST16_TYPE__ short int\000" .LASF159: .ascii "__FLT_HAS_DENORM__ 1\000" -.LASF864: +.LASF907: .ascii "PINNUM(pin) (pin & 0b1111)\000" .LASF768: .ascii "PRIXLEAST32 __PRI32LEAST(X)\000" .LASF171: .ascii "__DBL_MAX__ ((double)1.7976931348623157e+308L)\000" -.LASF870: +.LASF913: .ascii "short unsigned int\000" .LASF276: .ascii "__LLFRACT_FBIT__ 63\000" @@ -5352,9 +5571,9 @@ main: .ascii "PRIXLEAST8 __PRI8LEAST(X)\000" .LASF328: .ascii "__HQ_FBIT__ 15\000" -.LASF858: +.LASF901: .ascii "__bool_true_false_are_defined 1\000" -.LASF861: +.LASF904: .ascii "GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADD" .ascii "R + (GPIO_PORT_OFFSET * port)))\000" .LASF798: @@ -5379,7 +5598,7 @@ main: .ascii "SCNuFAST32 __SCN32FAST(u)\000" .LASF522: .ascii "long +4\000" -.LASF882: +.LASF925: .ascii "AHB1RSTR\000" .LASF723: .ascii "SCNx16 __SCN16(x)\000" @@ -5431,7 +5650,7 @@ main: .ascii "INT_FAST32_MAX (__INT_FAST32_MAX__)\000" .LASF205: .ascii "__FLT32_NORM_MAX__ 3.4028234663852886e+38F32\000" -.LASF855: +.LASF898: .ascii "bool _Bool\000" .LASF698: .ascii "PRIoFAST8 __PRI8FAST(o)\000" @@ -5443,6 +5662,8 @@ main: .ascii "__ULFRACT_IBIT__ 0\000" .LASF852: .ascii "RCC ((struct rcc *) RCC_BASE_ADDR)\000" +.LASF888: + .ascii "RCC_CFGR_HPRE_MASK (0b1111)\000" .LASF72: .ascii "__INT_MAX__ 0x7fffffff\000" .LASF54: diff --git a/build/main.i b/build/main.i index 2980f25..8675bbd 100644 --- a/build/main.i +++ b/build/main.i @@ -2004,6 +2004,83 @@ struct rcc { #define RCC_BASE_ADDR (0x40023800U) #define RCC ((struct rcc *) RCC_BASE_ADDR) + + + +#define RCC_CR_PLLRDY_BIT 25 +#define RCC_CR_PLLRDY_LOCKED (1 << RCC_CR_PLLRDY_BIT) + + +#define RCC_CR_PLLON_BIT 24 +#define RCC_CR_PLLON_OFF (0 << RCC_CR_PLLON_BIT) +#define RCC_CR_PLLON_ON (1 << RCC_CR_PLLON_BIT) + + +#define RCC_CR_HSEBYP_BIT 18 +#define RCC_CR_HSEBYP (1 << RCC_CR_HSEBYP_BIT) + + +#define RCC_CR_HSERDY_BIT 17 +#define RCC_CR_HSERDY_READY (1 << RCC_CR_HSERDY_BIT) + + +#define RCC_CR_HSEON_BIT 16 +#define RCC_CR_HSEON_ON (1 << RCC_CR_HSEON_BIT) + +#define RCC_CR_HSION_BIT 0 +#define RCC_CR_HSION_OFF (0 << RCC_CR_HSION_BIT) + + +#define RCC_PLLCFGR_PLLQ_BIT 24 +#define RCC_PLLCFGR_PLLQ_MASK (0b1111) +#define RCC_PLLCFGR_PLLQ(q) ((q & RCC_PLLCFGR_PLLQ_MASK) << RCC_PLLCFGR_PLLQ_BIT) + +#define RCC_PLLCFGR_PLLSRC_BIT 22 +#define RCC_PLLCFGR_PLLSRC_HSE (1 << RCC_PLLCFGR_PLLSRC_BIT) + +#define RCC_PLLCFGR_PLLP_BIT 16 +#define RCC_PLLCFGR_PLLP_MASK (0b11) +#define RCC_PLLCFGR_PLLP(p) ((p & RCC_PLLCFGR_PLLP_MASK) << RCC_PLLCFGR_PLLP_BIT) + +#define RCC_PLLCFGR_PLLN_BIT 6 +#define RCC_PLLCFGR_PLLN_MASK (0b111111111) +#define RCC_PLLCFGR_PLLN(n) ((n & RCC_PLLCFGR_PLLN_MASK) << RCC_PLLCFGR_PLLN_BIT) + +#define RCC_PLLCFGR_PLLM_BIT 0 +#define RCC_PLLCFGR_PLLM_MASK (0b111111) +#define RCC_PLLCFGR_PLLM(m) ((m & RCC_PLLCFGR_PLLM_MASK) << RCC_PLLCFGR_PLLM_BIT) + + + +#define RCC_CFGR_PPRE_DIV_NONE 0 +#define RCC_CFGR_PPRE_DIV_2 (0b100) + + +#define RCC_CFGR_PPRE2_BIT 13 +#define RCC_CFGR_PPRE2_MASK (0b111) + + +#define RCC_CFGR_PPRE1_BIT 10 +#define RCC_CFGR_PPRE1_MASK (0b111) + + +#define RCC_CFGR_HPRE_DIV_NONE 0 + +#define RCC_CFGR_HPRE_BIT 4 +#define RCC_CFGR_HPRE_MASK (0b1111) + + +#define RCC_CFGR_SWS_PLL (0b10) + +#define RCC_CFGR_SWS_BIT 2 +#define RCC_CFGR_SWS_MASK (0b11) + + +#define RCC_CFGR_SW_PLL (0b10) + +#define RCC_CFGR_SW_BIT 0 +#define RCC_CFGR_SW_MASK (0b11) +#define RCC_CFGR_SW(clock) ((clock & RCC_CFGR_SW_MASK) << RCC_CFGR_SW_BIT) # 3 "src/main.c" 2 # 1 "src/gpio.h" 1 diff --git a/build/main.o b/build/main.o index 6ad24d2..8c3c42b 100644 Binary files a/build/main.o and b/build/main.o differ diff --git a/src/rcc.h b/src/rcc.h index 8f8f09a..bfd657e 100644 --- a/src/rcc.h +++ b/src/rcc.h @@ -37,4 +37,81 @@ struct rcc { #define RCC_BASE_ADDR (0x40023800U) #define RCC ((struct rcc *) RCC_BASE_ADDR) +// CR Register +// PLL ready flag +#define RCC_CR_PLLRDY_BIT 25 +#define RCC_CR_PLLRDY_LOCKED (1 << RCC_CR_PLLRDY_BIT) + +// PLL toggle +#define RCC_CR_PLLON_BIT 24 +#define RCC_CR_PLLON_OFF (0 << RCC_CR_PLLON_BIT) +#define RCC_CR_PLLON_ON (1 << RCC_CR_PLLON_BIT) + +// HSE clock bypass +#define RCC_CR_HSEBYP_BIT 18 +#define RCC_CR_HSEBYP (1 << RCC_CR_HSEBYP_BIT) + +// HSE clock ready flag +#define RCC_CR_HSERDY_BIT 17 +#define RCC_CR_HSERDY_READY (1 << RCC_CR_HSERDY_BIT) + +// HSE clock enable +#define RCC_CR_HSEON_BIT 16 +#define RCC_CR_HSEON_ON (1 << RCC_CR_HSEON_BIT) + +#define RCC_CR_HSION_BIT 0 +#define RCC_CR_HSION_OFF (0 << RCC_CR_HSION_BIT) + +// PLLCFGR Register +#define RCC_PLLCFGR_PLLQ_BIT 24 // Bits [27:24] +#define RCC_PLLCFGR_PLLQ_MASK (0b1111) +#define RCC_PLLCFGR_PLLQ(q) ((q & RCC_PLLCFGR_PLLQ_MASK) << RCC_PLLCFGR_PLLQ_BIT) + +#define RCC_PLLCFGR_PLLSRC_BIT 22 +#define RCC_PLLCFGR_PLLSRC_HSE (1 << RCC_PLLCFGR_PLLSRC_BIT) + +#define RCC_PLLCFGR_PLLP_BIT 16 // Bits [17:16] +#define RCC_PLLCFGR_PLLP_MASK (0b11) +#define RCC_PLLCFGR_PLLP(p) ((p & RCC_PLLCFGR_PLLP_MASK) << RCC_PLLCFGR_PLLP_BIT) + +#define RCC_PLLCFGR_PLLN_BIT 6 // Bits [14:6] +#define RCC_PLLCFGR_PLLN_MASK (0b111111111) +#define RCC_PLLCFGR_PLLN(n) ((n & RCC_PLLCFGR_PLLN_MASK) << RCC_PLLCFGR_PLLN_BIT) + +#define RCC_PLLCFGR_PLLM_BIT 0 // Bits [5:0] +#define RCC_PLLCFGR_PLLM_MASK (0b111111) +#define RCC_PLLCFGR_PLLM(m) ((m & RCC_PLLCFGR_PLLM_MASK) << RCC_PLLCFGR_PLLM_BIT) + +// CFGR Register +// APB{1,2} prescalar +#define RCC_CFGR_PPRE_DIV_NONE 0 +#define RCC_CFGR_PPRE_DIV_2 (0b100) + +// APB2 +#define RCC_CFGR_PPRE2_BIT 13 // Bits [15:13] +#define RCC_CFGR_PPRE2_MASK (0b111) + +// APB1 +#define RCC_CFGR_PPRE1_BIT 10 // Bits [12:10] +#define RCC_CFGR_PPRE1_MASK (0b111) + +// AHB prescalar +#define RCC_CFGR_HPRE_DIV_NONE 0 + +#define RCC_CFGR_HPRE_BIT 4 // Bits [7:4] +#define RCC_CFGR_HPRE_MASK (0b1111) + +//System clock switch status +#define RCC_CFGR_SWS_PLL (0b10) + +#define RCC_CFGR_SWS_BIT 2 // Bits [3:2] +#define RCC_CFGR_SWS_MASK (0b11) + +// System clock switch +#define RCC_CFGR_SW_PLL (0b10) + +#define RCC_CFGR_SW_BIT 0 // Bits [1:0] +#define RCC_CFGR_SW_MASK (0b11) +#define RCC_CFGR_SW(clock) ((clock & RCC_CFGR_SW_MASK) << RCC_CFGR_SW_BIT) + #endif