Better Firmware with LLVM/Clang | Interrupt

I setup a clean Linux install to debug this. Here’s what I found:

  1. You need to install the arm-none-eabi-gcc build from ARM rather than from the Debian package archives. The latter is missing the sysroot, which we use to find the right header files. Head to ARM’s website to download the latest. Make sure it’s on your PATH, or set the ARM_GNU_CC make variable accordingly.
  2. You haven’t run into it yet, but there’s an issue with compiler detection in our Makefile. I just fixed it here. Make sure to pull the latest.

With those two things sorted, I can build fine on Linux:

root@fbo-dev:~/interrupt/example/freertos-example-llvm# COMPILER=clang ARM_GNU_CC=~/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc make clean all
clang
===Clang Compiler Detected===
rm -rf /root/interrupt/example/freertos-example-llvm/build
Compiling src/builtin_scanbuild_examples.c
Compiling src/main.c
Compiling src/memory_leak_examples.c
Compiling src/memory_pool.c
Compiling src/mutex_examples.c
Compiling src/stub_functions.c
Compiling src/freertos_lock_port.c
Compiling src/startup.c
Compiling freertos_kernel/tasks.c
Compiling freertos_kernel/queue.c
Compiling freertos_kernel/list.c
Compiling freertos_kernel/timers.c
Compiling freertos_kernel/portable/GCC/ARM_CM4F/port.c
Compiling freertos_kernel/portable/MemMang/heap_1.c
Linking library
Generated build/nrf52.elf
1 Like