Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clang compatibility] Added Clang CMake definitions. #76

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Johnn333
Copy link

Able to change the compiler used in target.json to CLANG now, this will build using clang (atleast up to the libraries) given some other changes, such as setting the flag--target=arm-none-eabi.

@JohnVidler
Copy link
Collaborator

Can you please update this with a note in the toolchain files to say this is currently unsupported.

I'm generally happy to merge this in, but I don't want to end up maintaining two 'official' toolchains :)

@JohnVidler JohnVidler added this to the v0.2.57 milestone Jul 13, 2023
@JohnVidler JohnVidler added the enhancement New feature or request label Jul 13, 2023
Explained how to get a Clang build running (This depends on other pull requests) in compiler-flags.cmake which wasn't documented anywhere. Also made sure users are aware this isn't the preferred or official compiler. Mileage may vary.

# This file is a copy from ../ARM_GCC, building with Clang/LLVM however will not immediatly work,
# some flags are not accepted by both compilers (e.g -Wl,--no-wchar-size-warning, defined in target.json), handle conflicts,
# and Clang will require the --target=arm-none-eabi flag. We also need Clang to include extra header files:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the --target=arm-none-eabi flag be added to this file?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other flags added to lancaster-university/codal-microbit-v2@master...Johnn333:codal-microbit-v2-clang:master could also be include in this file instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the --target=arm-none-eabi flag be added to this file?

Possibly, although I'm not sure where it would be added. "cpu_opts" in target.json feels like a more correct spot for it? Although we can't easily have a separate target.json.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other flags added to lancaster-university/codal-microbit-v2@master...Johnn333:codal-microbit-v2-clang:master could also be include in this file instead?

The main flags added here is for include paths which annoyingly have a version number in their name. Probably not the best thing to push as depending on arm-none-eabi version they may not have the directory? As for the others flags it was mostly to suppress warnings.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is more -W flags added to the target-lock.json file. I assume those might not be required and could be removed to reduce the diff?
What was the reason they were added? To help catch issues with the toolchain porting?

Copy link
Author

@Johnn333 Johnn333 Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From memory it was all just to reduce warnings aswell. Clang would give a warning about unused linker inputs so I got rid of them. It still builds but now I think about it may have something to do with the hex size diff? Might be worth looking into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants