access-softek / msp430-clang

0 stars 2 forks source link

Enable chibiOS building #54

Closed asl closed 5 years ago

asl commented 5 years ago

http://www.chibios.org/dokuwiki/doku.php

dmikushin commented 5 years ago

ChibiOS MSP430X demos now compile, yet not running.

Two major changes needed, in order to give it a go:

chbessonova commented 5 years ago

Someone submitted a relevant partial patch not so long ago, which we can adopt: dmikushin@5b953f7

You can try my patches from #2 PR. It should help to resolve interrupt-related issues.

dmikushin commented 5 years ago

You can try my patches from #2 PR. It should help to resolve interrupt-related issues.

Thanks, this one is carried out with a lot more care! Alas, with so many dangling PRs I tend to miss things. Will switch to your patches once we get there. Currently, clang won't produce valid binaries for ChibiOS demos, which should be fixed first.

dmikushin commented 5 years ago

Fixing MSP430X demos up to the state they can be built and simulated with TI GCC toolchain (msp430-gcc-7.3.2.154_linux64): https://github.com/dmikushin/msp430-clang-chibios/commit/a9c5e9b2708362c35cecc3f669f3ccae442fa62e . On the other hand, Clang interestingly won't post any .text into the final binary:

msp430-elf-size build/nil.elf
   text    data     bss     dec     hex filename
      0       6    3072    3078     c06 build/nil.elf

So let's compare GCC's objects against Clang's to figure this out.

dmikushin commented 5 years ago

ChibiOS MSP430 demos now run well, when compiled by Clang and linked by GCC, given that the following changes are made:

1) Adding workarounds for current Clang issues #58 and #60. 2) Adding macro condition to make _port_switch() function naked for Clang as well. 3) PR #62 is applied

https://github.com/dmikushin/msp430-clang-chibios/commit/e441db8ebb2801ce3af07fe533b32a2be55412ab

Please feel free to reopen if anything else is to be done here.