eide icon indicating copy to clipboard operation
eide copied to clipboard

[bug]调用STM32标准库中stm32f10x_flash.h的函数时,编译出错

Open senhtry opened this issue 1 year ago • 1 comments

What are you doing? 利用STM32标准库中的stm32f10x_flash.h提供的函数操作flash

Describe the bug 编译错误,stm32f10x_flash.h内的函数全部提示undefined reference to XXXX,但使用其他库就不会有问题,例如使用stm32f10x_usart.h做串口通讯就不会出问题。 d:/apps/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/Debug/src/FlashStore.o: in function FlashStore_Save': d:\Source\Test/./src/FlashStore.c:25: undefined reference to FLASH_Unlock' d:/apps/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: d:\Source\Test/./src/FlashStore.c:26: undefined reference to FLASH_ErasePage' d:/apps/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: d:\Source\Test/./src/FlashStore.c:28: undefined reference to FLASH_ProgramHalfWord' d:/apps/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: d:\Source\Test/./src/FlashStore.c:30: undefined reference to FLASH_Lock' d:/apps/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/Debug/src/FlashStore.o: in function FlashStore_Init': d:\Source\Test/./src/FlashStore.c:9: undefined reference to FLASH_Unlock' d:/apps/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: d:\Source\Test/./src/FlashStore.c:10: undefined reference to FLASH_ErasePage' d:/apps/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: d:\Source\Test/./src/FlashStore.c:11: undefined reference to FLASH_ProgramHalfWord' d:/apps/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: d:\Source\Test/./src/FlashStore.c:13: undefined reference to FLASH_ProgramHalfWord' d:/apps/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: d:\Source\Test/./src/FlashStore.c:15: undefined reference to `FLASH_Lock'

To Reproduce Steps to reproduce the behavior:

  1. 创建一个STM32 gcc模板
  2. 写一段简单的调用stm32f10x_flash.h内函数的程序
  3. 编译报错

Expected behavior 同样的代码在Keil中使用ARMCC编译通过

Screenshots

Desktop (please complete the following information):

  • OS: Win10 22H2
  • EIDE Version:v3.13.2023060401
  • VSCode Version:1.85.1

senhtry avatar Dec 19 '23 06:12 senhtry

检查是否添加了 stm32f10x_flash.c

github0null avatar Jan 12 '24 01:01 github0null