So it is this. Been using keil for small projects under 32k but finally decided to do something bigger and quickly ran out of space even with -Os.
So here my goal is to use keil IDE simply as IDE / project management / debugger, and build with arm gnu toolchain as available here:
https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain
I went to project/items and checked Use GCC compiler for arm projects, confirmed the warnings, and re-entered all the define and include paths.
under CC options, I have unchecked all the stuff under code generation, added relative paths to include folders inside my project, and added some things to misc controls like --specs=nano.specs -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
However looking at the "compiler control line", I see the following ugly mess:
-c -mcpu=cortex-m4 -mthumb -gdwarf-2 -MD -Wall -O0 -I ./lib/CMSIS -I ./lib/CMSIS/Include -I ./lib/STM32F4xx_StdPeriph_Driver/inc -I ./lib/fatfs -I ./lib/RTT -I ./lib/wiznet --specs=nosys.specs -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -IC:/KEIL/ARM/CMSIS/Include -IC:/KEIL/ARM/INC/ST/STM32F4xx -IF:/programs/arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi/arm-none-eabi/include -IF:/programs/arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.2.1/include -IF:/programs/arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi/arm-none-eabi/include/c++/13.2.1 -IF:/programs/arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi/arm-none-eabi/include/c++/13.2.1/arm-none-eabi -D__UVISION_VERSION="538" -D__GCC -D__GCC_VERSION="1321" -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx -DHSE_VALUE="8000000" -o *.o
In armcc version, there's a "no default includes" checkbox and I always check it because I don't want any files outside the project folder to affect anything I build to keep it portable.
However here, it seems to assume that I for some reason want stuff from C:\Keil and other places included with no way to force it out.
It also seems to ignore --specs because I keep getting libc link errors even tho nano/nosys shouldn't include full-sized libc...
Anyway, how do I fix this to just build? I have a normal Makefile to match this project
CFLAGS = -Wall $(OPTFLAGS) -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ggdb -ffunction-sections -fdata-sections $(INCLUDES) $(DEFINES)LDFLAGS = -Tflash.ld -Wl,--gc-sections
with these settings and everything builds fine outside of the IDE.
Thanks, nice to hear it directly from the Director of Engineering MCU Tools.
It's unfortunate that with proliferation of inferior "tools" like vscode and eclipse, working support inside one of the last decent remaining IDEs is getting removed.
I understand that supporting it costs ARM money and doens't bring any money in exchange, so it will be sad to see it go.