我正在尝试使用 CubeIDE 和 STM32 HAL 对 STM32F042K6 nucleo 进行编程,但编译器会抛出错误:
区域“FLASH”溢出 1212 个字节。
这是确切的控制台输出:
09:55:03 **** Incremental Build of configuration Debug for project Virtual Com Port ****
make -j16 all
arm-none-eabi-gcc -o "Virtual Com Port.elf" @"objects.list" -mcpu=cortex-m0 -T"C:\Users\EE Engineering\Documents\Projects\Firmware\Virtual Comm Port\STM32F042K6TX_FLASH.ld" --specs=nosys.specs -Wl,-Map="Virtual Com Port.map" -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
c:\st\stm32cubeide_1.7.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_2.0.0.202105311346\tools\arm-none-eabi\bin\ld.exe: Virtual Com Port.elf section `.text' will not fit in region `FLASH'
c:\st\stm32cubeide_1.7.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_2.0.0.202105311346\tools\arm-none-eabi\bin\ld.exe: region `FLASH' overflowed by 1212 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:69: Virtual Com Port.elf] Error 1
"make -j16 all" terminated with exit code 2. Build might be incomplete.
09:55:04 Build Failed. 3 errors, 0 warnings. (took 340ms).
但是,当我查看构建分析器中的内存区域时,它显示 32KB 大小中有 16.58 KB 可用,使用率为 48.19%。如果只使用了 48% 的闪存,那么闪存如何溢出 1212 字节,我该怎么做才能解决这个问题?