Wno-address -Wno-unused-but-set-variable -s -fdata-sections -ffunction-sections -g -gdwarf-2 --specs=nano.specs
在汇编器参数中增加 ${MCPU_FLAGS} ${VFP_FLAGS} # 定义通用编译器参数; set(CFCOMMON "${MCPU_FLAGS} ${VFP_FLAGS} --specs=nano.specs
不过用起来不太爽,我写了个hello world链接选项就要手写–specs=nano.specs -lc -lc -lrdimon 总而言之,就是很难用啊很难用 方案五:(还是人家的工具脚本) 还是无意中找到滴
f103ze_gcc.ld -o $(TARGET).elf -mthumb -mcpu=cortex-m3 -Wl,--start-group -lc -lm -Wl,--end-group -specs=nano.specs 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 至于链接时其他的链接参数大部分和编译参数相同,不同的也就是: --start-group -lc -lm -Wl,--end-group -specs=nano.specs
第3步、在VSCode里使用搜索功能,并将redlib.specs替换成nano.specs 现在,在VSCode里重新搜索redlib,可以发现在subdir.mk文件里,gcc编译指令行有这么一个宏定义参数
libraries LIBS = -lc -lm -lnosys LIBDIR = LDFLAGS = $(MCU) -u_printf_float -u_sprintf_float -specs=nano.specs
system_stm32f4xx.o build/startup_stm32f407xx.o -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs