Skip to content

Atomics: GCC fix for M23 (ARMv8-M baseline) #10705

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

Merged
merged 1 commit into from
Jun 9, 2019

Conversation

kjbracey
Copy link
Contributor

Description

Add unified syntax directives to make the atomic assembler work when GCC is building for M23.

GCC actually uses unified syntax when compiling C code, but puts .syntax divided before each piece of inline assembly when targetting Thumb-1 type devices like M0 and M23 for backwards compatibility. We can overcome this with our own .syntax unified. The command-line option -masm-syntax-unified intended to override this globally has been broken from GCC 6 to 8.0.

Fixes #10650

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Add unified syntax directives to make the atomic assembler work when GCC
is building for M23.

GCC actually uses unified syntax when compiling C code, but puts
`.syntax divided` before each piece of inline assembly when targetting
Thumb-1 type devices like M0 and M23 for backwards compatibility. We can
overcome this with our own `.syntax unified`.  The command-line option
`-masm-syntax-unified` intended to override this globally has been
broken from GCC 6 to 8.0.
@ciarmcom ciarmcom requested review from a team May 29, 2019 15:01
@ciarmcom
Copy link
Member

@kjbracey-arm, thank you for your changes.
@ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers please review.

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 7, 2019

Ci started

@mbed-ci
Copy link

mbed-ci commented Jun 8, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@0xc0170 0xc0170 merged commit 1e61f53 into ARMmbed:master Jun 9, 2019
@OlleOstberg
Copy link

OlleOstberg commented Aug 7, 2023

I am still having these types of issue when building for a cortex m0+ device. My compile messages say something like:
"C:\Users\ollost\AppData\Local\Temp\ccX5HLyz.s:62: Error: selected processor does not support `ldrexb r1,[r0]' in Thumb mode"
when compiling mbed_atomic_impl.c . Any idea what I am doing wrong? Any specific flag/define I need to use when compiling with gcc? kjbracey

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 11, 2023

You can ask on the forums, the best would be to define what youa re building and what platform you got. also the flags that are defined like macros, etc.

It might be that a newer Gcc version broke this again?

@OlleOstberg
Copy link

I solved my situation, I had defined "MBED_EXCLUSIVE_ACCESS" since I copied a setup for a cortex m4. It appears that MBED_EXCLUSIVE_ACCESS cannot be defined for cortex m0(+). I got a bit confused since I though that the assembler code discussed above would actually build for cortex m0(+) but my conclusion now is the it wont and should be removed from build by not defining MBED_EXCLUSIVE_ACCESS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

M2351: Compile failed on GCC with atomic
5 participants