This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Keil MDK 5 free license using with ARM GNU Compiler - build errors and inability to fully control compiler command line

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.

Parents
  • I'm not entirely sure what the exact cost structure of the Keil MDK is. The build toolchain (compiler, linker, librarian) is just a part. The editor, project manager, debugger, flash loader, and soft pack manager are part of the MDK too. Companies are charging $$$ only for the IDE (and related tools) despite using the GNU toolchain. I think this can be your real issue in the end.
    However, if you are using Keil MDK for learning, educating others, or as your hobby (or other non-commercial activities), you can always use Keil MDK Community edition. If you intend to develop products for profit, I suggest you move towards a paid solution or an MCU vendor-specific development environment. For example, if you use STM32F4xx MCU, you can switch to the STM32CubeIDE environment (provided by ST Microelectronics for free). Another alternative is to move to VSCode-based free solutions like PlatformIO, or EIDE. For a small amount of money, you can also try VisualGDB (integrates with Microsoft Visual Studio).

    I hope this helps. Good luck!

Reply
  • I'm not entirely sure what the exact cost structure of the Keil MDK is. The build toolchain (compiler, linker, librarian) is just a part. The editor, project manager, debugger, flash loader, and soft pack manager are part of the MDK too. Companies are charging $$$ only for the IDE (and related tools) despite using the GNU toolchain. I think this can be your real issue in the end.
    However, if you are using Keil MDK for learning, educating others, or as your hobby (or other non-commercial activities), you can always use Keil MDK Community edition. If you intend to develop products for profit, I suggest you move towards a paid solution or an MCU vendor-specific development environment. For example, if you use STM32F4xx MCU, you can switch to the STM32CubeIDE environment (provided by ST Microelectronics for free). Another alternative is to move to VSCode-based free solutions like PlatformIO, or EIDE. For a small amount of money, you can also try VisualGDB (integrates with Microsoft Visual Studio).

    I hope this helps. Good luck!

Children