access-softek / llvm-project

Other
0 stars 0 forks source link

[WIP] Make Contiki-NG buildable with Clang #32

Closed atrosinenko closed 11 months ago

atrosinenko commented 4 years ago

This is an issue for tracking progress on building Contiki-NG with a recent build of Clang and recent MSP430 sysroot from TI.

Examples from both Contiki-NG and FreeRTOS seem to refer to some obsolete version of msp430-gcc, so they are not straightforwardly buildable by recent msp430-elf-gcc.

After updating them, the hello-world example from Contiki-NG does not fit into flash used by sky and z1 boards. I suppose maybe they were not tested with such a general purpose example (that starts IPv6 stack aside from printing "Hello world!"...).

in430.h header from TI sysroot contains code such as

#define _set_interrupt_state(x) \
({ \
    __asm__ __volatile__ ("mov %0, SR { nop" \
        : : "ri"((unsigned int) x) \
    );\
})

First, it requires passing -fheinous-gnu-extensions to compile. Second, the { character is an instruction separator in MSP430 asm, so NoAsmVariants = true; should be set in clang/lib/Basic/Targets/MSP430.h, so this code is correctly parsed by Clang.