CH32V003勾选Link-time optimizer后可以初始化,但是跑不了程序了,该如何解决?
热门产品 :
CH182: 以太网PHY收发器芯片
CH32V003勾选Link-time optimizer后可以初始化,但是跑不了程序了,该如何解决?
您好,开启LTO选项之后,为了减少代码,编译器会在链接阶段对整个程序而不是单独文件来优化,包含提取内联消除冗余等等,可能会在执行时间和顺序上与原来有区别,导致在您的硬件上运行不正常。代码尺寸没有绝对要求的话可以不用开启此选项。
感觉差不多
Building target: ch32v003.elf Invoking: GNU RISC-V Cross C Linker riscv-none-embed-gcc -msmall-data-limit=0 -msave-restore -march=rv32ec -mabi=ilp32e -O1 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -flto -T "/home/alanfans/Desktop/elink/STM32/eclipse-workspaces/ch32v003/startup/Link.ld" -nostartfiles -Xlinker --gc-sections -Wl,-Map,"ch32v003.map" --specs=nano.specs --specs=nosys.specs -o "ch32v003.elf" ./system/src/Peripheral/ch32v00x_adc.o ./system/src/Peripheral/ch32v00x_dbgmcu.o ./system/src/Peripheral/ch32v00x_dma.o ./system/src/Peripheral/ch32v00x_exti.o ./system/src/Peripheral/ch32v00x_flash.o ./system/src/Peripheral/ch32v00x_gpio.o ./system/src/Peripheral/ch32v00x_i2c.o ./system/src/Peripheral/ch32v00x_iwdg.o ./system/src/Peripheral/ch32v00x_misc.o ./system/src/Peripheral/ch32v00x_opa.o ./system/src/Peripheral/ch32v00x_pwr.o ./system/src/Peripheral/ch32v00x_rcc.o ./system/src/Peripheral/ch32v00x_spi.o ./system/src/Peripheral/ch32v00x_tim.o ./system/src/Peripheral/ch32v00x_usart.o ./system/src/Peripheral/ch32v00x_wwdg.o ./system/src/Core/core_riscv.o ./startup/startup_ch32v00x.o ./src/ch32v00x_it.o ./src/debug.o ./src/ds18b20.o ./src/main.o ./src/system_ch32v00x.o Finished building target: ch32v003.elf Invoking: GNU RISC-V Cross Create Flash Image riscv-none-embed-objcopy -O ihex "ch32v003.elf" "ch32v003.hex" Invoking: GNU RISC-V Cross Print Size riscv-none-embed-size --format=berkeley "ch32v003.elf" text data bss dec hex filename 7444 168 536 8148 1fd4 ch32v003.elf Finished building: ch32v003.siz Finished building: ch32v003.hex
我用的gcc+eclipse