When developing for ARM Cortex-M microcontrollers, the choice of compiler toolchain is an important decision that can significantly impact development time, code performance, and cost. The main compiler options for Cortex-M development include Keil MDK, IAR Embedded Workbench, GNU toolchains like GNU Arm Embedded Toolchain or Arm Embedded GCC, Yagarto, and Linaro. Here is an overview of the key differences between these major Cortex-M compiler toolchains.
Keil MDK
MDK from Keil is a complete IDE and toolchain for ARM Cortex-M development. Key features of MDK include:
- Integrated IDE with project manager, editor, and debugger.
- C Compiler with optimizations for code density and performance.
- Assembler, linker, and startup code.
- Debugger supports JTAG/SWD hardware debugging.
- Profiling tools for optimization.
- Supports all Cortex-M cores including M0/M0+/M1, M3, M4, M7, etc.
- Option for just the compiler or complete IDE.
- Paid commercial license required.
IAR Embedded Workbench
IAR EWARM is a complete Eclipse-based IDE and toolchain for ARM Cortex-M development. Key points about IAR EWARM include:
- Eclipse-based IDE with editor, project manager, and visual debugger.
- C/C++ compiler focused on optimizing for speed and code density.
- Assembler, linker, and startup code.
- Advanced debugger with hardware debugging support.
- Code coverage and profiling tools.
- Supports all Cortex-M variants.
- Can purchase just the compiler licenses.
- Paid commercial license required.
GNU Toolchains
There are a couple major open source GNU toolchain options for Cortex-M development including:
- GNU Arm Embedded Toolchain – Pre-built GNU toolchain from Arm.
- Arm Embedded GCC – GNU toolchain that supports Cortex-M and other Arm processors.
Key points about GNU Arm toolchains:
- GCC-based compiler with performance optimizations.
- GDB for debugging, can use IDEs like Eclipse.
- Newlib C library and GDB stub for Cortex-M.
- Free open source license.
- May not be as optimized for Cortex-M as commercial compilers.
- Requires more configuration work than commercial IDEs.
Yagarto
Yagarto is an open source toolchain for ARM Cortex-M and other ARM processors. Key points:
- GCC compiler with support for Cortex-M cores.
- Newlib nano C library designed for embedded use.
- GDB for debugging.
- Built with Eclipse and can be used with Eclipse IDE.
- Free open source license.
- Targets Linux and Windows hosts.
Linaro
Linaro offers an open source toolchain package for ARM Linux and bare metal development. For Cortex-M it includes:
- GCC cross compiler.
- GDB for debugging.
- Newlib C standard library.
- Supports Eclipse IDE integration.
- Commercial support and services available.
- Free open source license.
Summary of Key Differences
In summary, some key differences between the ARM Cortex-M compiler toolchains include:
- Keil and IAR provide commercial IDEs with advanced debugging while GNU toolchains can work with Eclipse.
- Keil and IAR focus optimizations specifically for Cortex-M cores.
- GNU and other open source toolchains have a free license.
- Keil and IAR may provide better technical support and ecosystem integration.
- GNU tools require more manual configuration but allow customization.
When choosing a compiler, developers should consider the license cost, toolchain integration, optimization capabilities, debug features, and technical support.