SEGGER_RTT_Conf.h build failure on clang

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • SEGGER_RTT_Conf.h build failure on clang


      I am in the process of moving my project from gcc to clang. I am using RTT. Everything builds fine except the SEGGER_RTT_LOCK(); macro from SEGGER_RTT_Conf.h (the code will build cleanly when I change that macro to empty).

      The header is marked with Revision: $Rev: 13430 $.

      Build command: clang -o build_output/build/my_project_standalone.elf//my/project/path/libs/RTT/SEGGER_RTT.o -c -MD --target=arm-none-eabi -nostdlib --sysroot=/opt/toolchains/gcc-arm-none-eabi-9-2019-q4-major/bin/../arm-none-eabi -fshort-enums -mcpu=cortex-m0 -mthumb -mfloat-abi=soft -g3 -I ../libs/CMSIS -I ../libs/RTT -I ../libs/ -Oz -std=gnu11 -Wall -pipe -ffunction-sections -fdata-sections -I/my/project/path/libs/libs/RTT /my/project/path/libs/RTT/SEGGER_RTT.c

      Error message (repeated every time the macro is called):

      C Source Code

      1. /my/project/path/libs/RTT/SEGGER_RTT.c:722:3: error: invalid instruction, any one of the following would fix this:
      2. SEGGER_RTT_LOCK();
      3. ^
      4. ../libs/RTT/SEGGER_RTT_Conf.h:133:73: note: expanded from macro 'SEGGER_RTT_LOCK'
      5. __asm volatile ("mrs %0, primask \n\t" \
      6. ^
      7. <inline asm>:2:2: note: instantiated into assembly here
      8. movs r1, $1
      9. ^
      10. /my/project/path/libs/RTT/SEGGER_RTT.c:722:3: note: operand must be an immediate in the range [0,255]
      11. SEGGER_RTT_LOCK();
      12. ^
      13. ../libs/RTT/SEGGER_RTT_Conf.h:133:73: note: expanded from macro 'SEGGER_RTT_LOCK'
      14. __asm volatile ("mrs %0, primask \n\t" \
      15. ^
      16. <inline asm>:2:12: note: instantiated into assembly here
      17. movs r1, $1
      18. ^
      19. /my/project/path/libs/RTT/SEGGER_RTT.c:722:3: note: operand must be a register in range [r0, r7]
      20. SEGGER_RTT_LOCK();
      21. ^
      22. ../libs/RTT/SEGGER_RTT_Conf.h:133:73: note: expanded from macro 'SEGGER_RTT_LOCK'
      23. __asm volatile ("mrs %0, primask \n\t" \
      24. ^
      25. <inline asm>:2:12: note: instantiated into assembly here
      26. movs r1, $1
      27. ^
      Display All

      My compiler


      1. $ clang --version
      2. clang version 13.0.0
      3. Target: x86_64-pc-linux-gnu
      4. Thread model: posix
      5. InstalledDir: /usr/lib/llvm/13/bin
      6. $ llc --version
      7. LLVM (
      8. LLVM version 13.0.0
      9. Optimized build.
      10. Default target: x86_64-pc-linux-gnu
      11. Host CPU: haswell
      12. Registered Targets:
      13. amdgcn - AMD GCN GPUs
      14. arm - ARM
      15. armeb - ARM (big endian)
      16. bpf - BPF (host endian)
      17. bpfeb - BPF (big endian)
      18. bpfel - BPF (little endian)
      19. nvptx - NVIDIA PTX 32-bit
      20. nvptx64 - NVIDIA PTX 64-bit
      21. r600 - AMD GPUs HD2XXX-HD6XXX
      22. thumb - Thumb
      23. thumbeb - Thumb (big endian)
      24. x86 - 32-bit X86: Pentium-Pro and above
      25. x86-64 - 64-bit X86: EM64T and AMD64
      Display All

      Thanks for help.
    • New


      Thank you for your inquriy.
      This is simply an old version of the RTT files.
      We always recommend to the latest RTT files.
      Currently we are on Rev. 24316

      You can find them in your J-Link software installation folder under Samples/RTT
      The latest software version can be found here:

      Best regards,
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system:

      Or you can contact us via e-mail.