Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52 development using clang

Hello, 

We are running a pretty massive nRF52832, SDK14.2, softdevice5.0.0, freertos based project built using Keil's "default compiler version 5"

For various reasons we are considering moving to llvm clang compiler either in SES environment or using Keil V6 compiler (which I understand is clang)

My questions are:

  1. I've seen some pretty old posts (e.g. RK's comment here, and here) that the app breaks/softdevice calls not supported when using clang compiler. Is this still the case?
  2. Is there a (reasonably) easy way to make the project clang/Keil V6 compatible?
  3. Are there any Code/RAM/Performance deltas when comparing Keil V5 and clang? (I've found this old post , but it compares gcc only and its outdated)

Thanks for any insight

Parents
  • Hi,

     

    I just want to initially point out that armclang / llvm is not supported in nRF5 SDK, so please be aware that there might be unwanted side effects by using this toolchain.

    I've seen some pretty old posts (e.g. RK's comment here, and here) that the app breaks/softdevice calls not supported when using clang compiler. Is this still the case?

     Yes, that would still be the case. llvm/clang is close to gcc compatible, but not 100 % on the asm parts, and other ARM specific attributes (SVC for instance).

    Is there a (reasonably) easy way to make the project clang/Keil V6 compatible?

     I haven't tried since SDK 13/14, but other forum users have. From the first thread you linked to, you can find a link to this github repo:

    https://github.com/eblot/nrf5-llvm

    You can try it out and see if that works for you.

    Are there any Code/RAM/Performance deltas when comparing Keil V5 and clang? (I've found this old post , but it compares gcc only and its outdated)

    I am not sure if moving to llvm/armclang would be the best option if you're looking to tune your code, but for research purposes, it makes sense to look at it.

    From the link you posted, you can see that most compilers perform equally when optimizing for size. Without having done any testing with llvm/armclang in a while, I do suspect that the performance would be similar to other ARM compilers out there (IAR, gcc, armcc).

     

    Kind regards,

    Håkon

  • Thanks.

    We are aware of the git repo you've mentioned. We have tried to follow the instructions with SDK14.2 with limited success.

    Is there any clang support on Nordic's roadmap on the foreseeable future?

    Thanks

Reply Children
Related