Linking with `link.exe` failed: exit code: 1120

Hello,
I am trying to do a simple led blink project from git .When i try to "cargo build" I get an error linking with "link.exe" failed: exit code 1120.
Has any of you had that problem before ? I tried to look it up on the forums but there doesn't seem te be a solution for this.

This is my command promp output:

C:\Users\Peter\Desktop\delete\rust_projects\hello>cargo build
   Compiling stm32l1xx-hal v0.1.0 (C:\Users\Peter\Desktop\delete\rust_projects\hello)
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\Peter\\AppData\\Local\\Temp\\rustc1zjTfP\\symbols.o" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\stm32l1xx_hal.stm32l1xx_hal.8bc0c4ee67a739e1-cgu.0.rcgu.o" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\stm32l1xx_hal.4iby74tzxawqvvg3.rcgu.o" "/LIBPATH:C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps" "/LIBPATH:C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\build\\cortex-m-rt-e8cdb4208dcabf1d\\out" "/LIBPATH:C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\build\\stm32l1-a89ebee89cd5f03b\\out" "/LIBPATH:C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libstm32l1xx_hal-0b580af582e5cdd6.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libstm32l1-84b5dfb71238466c.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libcast-504bd12a738ac3e6.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libpanic_semihosting-a3debc3555024505.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-e493bcbfdc66a475.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-467acea86c440d1f.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-8bcec20f8d868561.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-e75d865d889e433e.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-cd24a5810f58b720.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-44b4ecbbc95939b2.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-ff93d2b34eb6aecc.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-17346c417f0e9166.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-ff5a06ebf4571d10.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-cb2478631e21007b.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libcortex_m_rt-e021a831acb7c5ea.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libr0-679a9767a51960ac.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libcortex_m-6522b15ad5c765dc.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libcortex_m-421fc77aa5c8a43c.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libcortex_m-fea720b63f93d505.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libembedded_hal-0ccddaef9f77d8b6.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libvoid-137e18da1b7d98e5.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libnb-1b3b54ed7d84b8ca.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libnb-94201885005904b5.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libaligned-132e52b7dab641f2.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libas_slice-099fd5d98dd7c8ca.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libstable_deref_trait-3fab53636835efbb.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libgeneric_array-a18b4de8e0a6768d.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libgeneric_array-0f4f6f0929a5f1f7.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libgeneric_array-05559022b3529a2c.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libtypenum-b99480fcf5dbafa6.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libvolatile_register-8b3ba3a722052623.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libvcell-85b203dd412f02d3.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libbare_metal-53cc886adaaf381e.rlib" "C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\libaligned-96bcc4ef2bd1095c.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-58d59322b34f2b51.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-c192803e6895f627.rlib" "C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-20106e86b5dab94f.rlib" "kernel32.lib" "advapi32.lib" "bcrypt.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "ws2_32.lib" "kernel32.lib" "ntdll.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:C:\\Users\\Peter\\Desktop\\delete\\rust_projects\\hello\\target\\debug\\deps\\stm32l1xx_hal.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\Peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note: stm32l1xx_hal.stm32l1xx_hal.8bc0c4ee67a739e1-cgu.0.rcgu.o : error LNK2019: unresolved external symbol __primask_r referenced in function _ZN8cortex_m8register7primask4read17hb0102358bebe16f1E
          stm32l1xx_hal.stm32l1xx_hal.8bc0c4ee67a739e1-cgu.0.rcgu.o : error LNK2019: unresolved external symbol __cpsie referenced in function _ZN8cortex_m9interrupt6enable17h0f509535a9f0df9bE
          stm32l1xx_hal.stm32l1xx_hal.8bc0c4ee67a739e1-cgu.0.rcgu.o : error LNK2019: unresolved external symbol __cpsid referenced in function _ZN8cortex_m9interrupt7disable17h0adbd7283862e4c2E
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol WWDG
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol PVD
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol TAMPER_STAMP
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol RTC_WKUP
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol FLASH
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol RCC
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol EXTI0
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol EXTI1
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol EXTI2
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol EXTI3
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol EXTI4
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA1_CHANNEL1
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA1_CHANNEL2
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA1_CHANNEL3
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA1_CHANNEL4
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA1_CHANNEL5
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA1_CHANNEL6
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA1_CHANNEL7
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol ADC1
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol USB_HP
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol USB_LP
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DAC
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol COMP_CA
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol EXTI9_5
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol LCD
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol TIM9
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol TIM10
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol TIM11
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol TIM2
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol TIM3
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol TIM4
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol I2C1_EV
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol I2C1_ER
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol I2C2_EV
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol I2C2_ER
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol SPI1
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol SPI2
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol USART1
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol USART2
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol USART3
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol EXTI15_10
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol RTC_ALARM
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol USB_FS_WKUP
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol TIM6
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol TIM7
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol SDIO
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol TIM5
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol SPI3
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol UART4
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol UART5
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA2_CH1
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA2_CH2
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA2_CH3
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA2_CH4
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DMA2_CH5
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol AES
          libstm32l1-84b5dfb71238466c.rlib(stm32l1-84b5dfb71238466c.stm32l1.68be5b488713341-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol COMP_ACQ
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __pre_init referenced in function Reset
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __sbss referenced in function Reset
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __ebss referenced in function Reset
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __sdata referenced in function Reset
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __edata referenced in function Reset
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __sidata referenced in function Reset
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol NonMaskableInt
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol HardFaultTrampoline
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol MemoryManagement
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol BusFault
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol UsageFault
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol SVCall
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol DebugMonitor
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol PendSV
          libcortex_m_rt-e021a831acb7c5ea.rlib(cortex_m_rt-e021a831acb7c5ea.cortex_m_rt.8c13c13c47d6361d-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol SysTick
          libcortex_m-6522b15ad5c765dc.rlib(cortex_m-6522b15ad5c765dc.cortex_m.996bd295cd3edfe-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __dsb referenced in function _ZN8cortex_m3asm3dsb17h1a316b4e5a2752bfE
          libcortex_m-6522b15ad5c765dc.rlib(cortex_m-6522b15ad5c765dc.cortex_m.996bd295cd3edfe-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __nop referenced in function _ZN8cortex_m3asm3nop17hceb2f69f482f5da5E
          C:\Users\Peter\Desktop\delete\rust_projects\hello\target\debug\deps\stm32l1xx_hal.exe : fatal error LNK1120: 77 unresolved externals


error: could not compile `stm32l1xx-hal` (bin "stm32l1xx-hal") due to 1 previous error

cargo.toml file:

[package]
license = "MIT/Apache-2.0"
name = "stm32l1xx-hal"
readme = "README.md"
repository = "https://github.com/stm32-rs/stm32l1xx-hal"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m = "0.5.8"
nb = "0.1.1"
stm32l1 = "0.5.0"
cortex-m-rt = "0.6.7"
cortex-m-semihosting = "0.3.2"
panic-semihosting = "0.5.1"
cortex-m-rtic = "0.5.5"
stm32l1xx-hal = "0.1.0"

[dependencies.bare-metal]
features = ["const-fn"]
version = "0.2.4"

[dependencies.cast]
default-features = false
version = "0.2.2"

[dependencies.embedded-hal]
features = ["unproven"]
version = "0.2.3"

[dependencies.void]
default-features = false
version = "1.0.2"

[features]
rt = ["stm32l1/rt"]
stm32l152 = ["stm32l1/stm32l151"]


[profile.dev]
codegen-units = 1
incremental = false

[profile.release]
codegen-units = 1
debug = true
lto = true

main.rs file:

#![deny(warnings)]
#![deny(unsafe_code)]
#![no_main]
#![no_std]

extern crate cortex_m;
extern crate cortex_m_rt as rt;
extern crate panic_semihosting;
extern crate stm32l1xx_hal as hal;

use embedded_hal::digital::v2::ToggleableOutputPin;
use hal::prelude::*;
use hal::rcc::Config;
use hal::stm32;
use rt::entry;

#[entry]
fn main() -> ! {
    let dp = stm32::Peripherals::take().unwrap();
    let cp = cortex_m::Peripherals::take().unwrap();

    let rcc = dp.RCC.freeze(Config::default());
    let mut delay = cp.SYST.delay(rcc.clocks);

    let gpiob = dp.GPIOB.split();
    let mut led = gpiob.pb6.into_push_pull_output();

    loop {
        led.toggle().unwrap();
        delay.delay(300.ms());
    }
}

you need to tell cargo to cross-compile for the stm32 target, you cannot build embedded code for the host platform.

I think the stm32 family should use the thumbv7m-none-eabi target triplet. you can pass a command line flag to cargo or use a cargo configuration file. for example:

cargo build --target=thumbv7m-none-eabi

but first, make sure you have installed the necessary cross compiling components (and maybe C/C++ toolchains as well).

for rust, you need to install the rust-std component for the given target:

rustup target add thumbv7m-none-eabi

and for the system toolchain, it depends on your host platform. it's typically called something like arm-none-eabi-gcc. you might not need this for simple projects.

if you are new to embedded rust, I strongly recommend you read the embedded rust book:

https://docs.rust-embedded.org/book/

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.