how to use llvm+clang to compile for stm32

wermut picture wermut · Nov 2, 2011 · Viewed 19.4k times · Source

Has someone infos how to build a llvm+clang toolchain using binutils and newlib and how to use it?

  • host: Linux, AMD64
  • target: cortex-m3, stm32
  • c-lib: newlib
  • assembler: gnu as

Answer

OlivierM picture OlivierM · Nov 20, 2015

I created a firmware framework - PolyMCU https://github.com/labapart/polymcu - that is based on CMake that support GCC and LLVM. Because it is based on CMake you can build your firmware on Linux/Windows/MacOS. It also uses Newlib - it looks all your requirements are there!

I also wrote a blog where I compared GCC and LLVM build size on ARM Cortex-M: http://labapart.com/blogs/3-the-importance-of-the-toolchain-version-in-embedded-space Interesting results, Clang generated code is not much bigger than GCC on Cortex-M...