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

Core(M): Add support for LLVM/Clang #19

Merged
merged 7 commits into from
Jul 20, 2023
Merged

Core(M): Add support for LLVM/Clang #19

merged 7 commits into from
Jul 20, 2023

Conversation

JonatanAntoni
Copy link
Member

  • Add compiler header for clang.
  • Enhance CoreValidation for clang.

@JonatanAntoni JonatanAntoni requested a review from a user June 27, 2023 16:26
CMSIS/Core/Include/cmsis_clang.h Fixed Show fixed Hide fixed
CMSIS/Core/Include/cmsis_clang.h Fixed Show fixed Hide fixed
ghost
ghost previously approved these changes Jul 4, 2023
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Looks fine to me

{
uint32_t result;

#if __ARM_ISA_THUMB >= 2
Copy link

Choose a reason for hiding this comment

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

replace __ARM_ISA_THUMB with __ARM_ARCH_ISA_THUMB

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

#endif

#ifndef __INITIAL_SP
#define __INITIAL_SP __stack
Copy link

Choose a reason for hiding this comment

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

where is __stack defined?
why not use __StackTop as in GCC?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a linker defined symbol, defined in the linker script. We can use same names as in GCC if we adopt the linker script. I kept the symbols as defined in the toolchain provided linker script template.

Copy link

Choose a reason for hiding this comment

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

if we provide the linker script than I would suggest to align the symbol names.

#endif

#ifndef __STACK_LIMIT
#define __STACK_LIMIT __stack_limit
Copy link

Choose a reason for hiding this comment

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

where is __stack_limit defined?
why not use __StackLimit as in GCC?


#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
#ifndef __STACK_SEAL
#define __STACK_SEAL __stack_seal
Copy link

Choose a reason for hiding this comment

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

where is _stack_seal defined?
why not use __StackSeal as in GCC

}
#endif /* __ARM_ARCH_ISA_THUMB >= 2 */

#ifdef __ARM_FEATURE_LDREX
Copy link

Choose a reason for hiding this comment

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

Change
#ifdef __ARM_FEATURE_LDREX
to
#if __ARM_FEATURE_LDREX >= 7

see https://developer.arm.com/documentation/101028/0012/5--Feature-test-macros

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

}

/**
\brief LDRT Unprivileged (8 bit)
Copy link

Choose a reason for hiding this comment

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

are the LDR*/STR* Unprivileged instructions also covered by __ARM_FEATURE_LDREX?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point.

Copy link
Member Author

@JonatanAntoni JonatanAntoni Jul 19, 2023

Choose a reason for hiding this comment

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

LDRT is Thumb-2 instruction, so nothing to do with exclusive access ones.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

CMSIS/Core/Include/cmsis_clang.h Dismissed Show dismissed Hide dismissed
{
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
return __builtin_arm_get_fpscr();

Check warning

Code scanning / CodeQL

Implicit function declaration Warning

Function call implicitly declares '__builtin_arm_get_fpscr'.
@JonatanAntoni JonatanAntoni merged commit 193243d into main Jul 20, 2023
3 checks passed
@JonatanAntoni JonatanAntoni deleted the llvm branch July 20, 2023 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant