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

bugfix(broken atomic): atomic removal #61

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

Codetector1374
Copy link
Member

As discovered in #59, the QingKeV4 atomic implementation is likely broken. As a result we added a compiler check to make sure the atomic exetnsion is disabled in ch32-rs/qingke#8. This change updates the dependency to use the new qingke as well as remove any reference to core::atomic in ch32-hal.

@Codetector1374
Copy link
Member Author

Checks are broken until new qingke is published

"data-layout": "e-m:e-p:32:32-i64:64-n32-S128",
"eh-frame-header": false,
"emit-debug-gdb-scripts": false,
"features": "+m,+f,+c,+forced-atomics",
Copy link
Member Author

Choose a reason for hiding this comment

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

+forced-atomics is actually in every single none target. Which means core::atomic::* actually exists.

@@ -0,0 +1,19 @@
{
"arch": "riscv32",
"atomic-cas": false,
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 what disables compare_and_swap

This change remvoes all use of atomic (CAS) from ch32-hal

As discovered in ch32-rs#59, the QingKeV4 atomic implementation is likely
broken. As a result we added a compiler check to make sure the atomic
exetnsion is disabled in ch32-rs/qingke#8. This change updates the
dependency to use the new qingke as well as remove any reference to
`core::atomic` in ch32-hal.
This is a follow-up change to the `bugfix(broken atomics)` where we
removed all use of atomics. This update the qingke version and examples'
target setting to not include the atomic extension
@Codetector1374
Copy link
Member Author

If you want a quick / easy review experience, only look at the bugfix commit.

@Codetector1374 Codetector1374 changed the title bugfix(broken atomic): DMA Driver atomic removal bugfix(broken atomic): atomic removal Nov 3, 2024
@@ -130,20 +127,21 @@ impl Driver for SystickDriver {
let period = self.period.load(Ordering::Relaxed) as u64;
rb.cnt().read() / period
}

unsafe fn allocate_alarm(&self) -> Option<AlarmHandle> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Please take an extra look make sure this is equivalent

Copy link
Member

@Dummyc0m Dummyc0m left a comment

Choose a reason for hiding this comment

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

LGTM @andelf please take a look.

Copy link
Contributor

@andelf andelf left a comment

Choose a reason for hiding this comment

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

LGTM.

non-blocking(todo later): Better add documentation in README to clarify target change.

@andelf andelf merged commit 0468b48 into ch32-rs:main Nov 4, 2024
11 checks passed
@andelf
Copy link
Contributor

andelf commented Nov 4, 2024

This is another BREAKING CHANGE. CC @romainreignier

@Codetector1374 Codetector1374 deleted the atomic-removal branch November 26, 2024 23:30
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.

3 participants