-
-
Notifications
You must be signed in to change notification settings - Fork 125
Support for targets without native atomics #597
Copy link
Copy link
Open
Labels
priority: mediumMedium priority for the Knurling teamMedium priority for the Knurling teamstatus: blockedBlocked on another issue, or on upstream librariesBlocked on another issue, or on upstream librariesstatus: needs decisionThe Knurling team needs to make a decision on thisThe Knurling team needs to make a decision on thistopic: risc-v
Metadata
Metadata
Assignees
Labels
priority: mediumMedium priority for the Knurling teamMedium priority for the Knurling teamstatus: blockedBlocked on another issue, or on upstream librariesBlocked on another issue, or on upstream librariesstatus: needs decisionThe Knurling team needs to make a decision on thisThe Knurling team needs to make a decision on thistopic: risc-v
The
esp32c3is a riscv based cpu, without the atomic extension. Unlike the armthumbv6target, it does not have atomic load/stores for the following typesu8,u16,u32, which means we cannot usedefmt(and other rtt based crates) as it stands.I recently landed a PR in
atomic-polyfillthat adds load/store for those types mentioned above, implemented using critical sections. I have a PR inrtt-targetto use that, but it has not yet been accepted.In theory for better performance, we could ditch the critical section and implement our own atomic operation that use fences to ensure atomicity (this is what is done in llvm for
thumbv6) - however this can cause UB when mixed with lock based CAS atomics (see: here, here, and here ) therefore is not suitable to add toatomic-polyfillas it stands.I would like the esp32c3 to be able to support the c3, and I am sure there are other riscv, non-a targets too.
What do you think the best idea is going forward?