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.
Is this forum only for paid support? Or is there really nobody from keil reading this? GCC support is broken.
Any status update? Can someone from keil duplicate this and confirm it isn't working?
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!
I'm not interested in business side of things, as keil 32k limited compiler is free as in free as in free.
I want to continue using the IDE and project management and build using GCC, which it also OFFICIALLY SUPPORTS: https://www.keil.com/arm/gnu.asp
However, the support is BROKEN, which is the whole purpose of this post.
As it is, using keil uvision 5.38 external gcc build system does not work.
Also, VSCODE is not suitable for working with C, and neither are any of the eclipse-based stuff (therefore cubeide). My question wasn't about what else to use, my question was about how to use a feature that's claimed to be supported but does not work.
Just read my comment... You may have the answer there.If you don't make money from your project, why don't you switch to the Keil-MDK Community edition that doesn't have any code size limitation? My understanding was that you moved to GCC to eliminate the 32KB code size restriction. Is there a conflict with the use policy (non-commercial) of the Keil-MDK Community edition? Is it important for you to stick to GCC for other reasons?
I did read your comment. Latest GCC / clang produces potentially better code, and I may be using newest C++ features that are not in armcc etc, the reason for using gcc isn't relevant (let's ignore 32k limit for the moment) the point is the option is available, but does not work - that's what I want to fix.
The Keil MDK switched to clang since 5.37. I'm using it. I had an old project compiled with ARM_CC5 and I had to download it separately and install it as a secondary toolchain.Now I can switch from ARM_CC5 to ARCLANG. Give it a try and see if I'm wrong.
I"m aware of this as well. I still want to use gcc. If I wanted to ask about limitations of armclang from Keil, I would have titled the thread as such.
I apologize for the misunderstanding. I thought that you were looking to remove the 32 KB code size limitation. In this case, I hope you will find a solution. Good luck!
Thanks for raising your problem here. This forum relies on members of the community helping each other and is not the product support channel. The claim of MDK fully supporting GCC is no longer valid as there was no investment in that area of the product over the past years, where we also discontinued a special edition for using GCC + the uVision debugger. I will request to get this claim removed from the web page. Please excuse the inconvenience this has been causing you.
1) You said "In armcc version, there's a "no default includes" checkbox"
… You are correct, the µVision IDE does not have a "no default includes" option when using the GCC compiler.
2) If you want to minimize the number of included header files to 6, you could:
a) download and install the legacy pack "Arm Cortex-M" as described in the section " Legacy Pack Download" in:
https://developer.arm.com/documentation/101407/0539/Creating-Applications/Tips-and-Tricks/Use-MDK-Version-4-Projects
b) Then, when you create a new project, instead choose "Legacy Device Database [No RTE]" as in:
developer.arm.com/.../Setup-the-Project
3) It looked like you used "--specs" instead of "-specs". Using arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-eabi from
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
… in µVision under Project -> Options For Target -> CC, for Misc Controls, I entered: "-specs=foo.specs"
If I don't include the specs file, I would get 3 warnings. If I do include the .specs file, I get zero warnings.
Inside my foo.specs file:
*cc1:-Wno-unknown-pragmas -DSTM32F40_41xxx
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.