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

interrupt: Support Xtensa #86

Merged
merged 2 commits into from
Mar 28, 2023
Merged

interrupt: Support Xtensa #86

merged 2 commits into from
Mar 28, 2023

Conversation

taiki-e
Copy link
Owner

@taiki-e taiki-e commented Mar 22, 2023

This adds portable_atomic_unsafe_assume_single_core support for Xtensa targets without atomic CAS.

Copy link

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

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

Just swinging by to say thanks for this, will be very useful for the esp-rs community! The implementation looks good to me also, we have a similar implementation in esp-hal, just with a different level (to allow debug interrupts to occur).

I noticed some TODO's in the CI, if you are having issues setting up the toolchain let me know. We also have github action for installing the toolchain in CI if that's useful: https://github.com/esp-rs/xtensa-toolchain

@taiki-e taiki-e force-pushed the xtensa branch 4 times, most recently from a7fac8f to c584a97 Compare March 28, 2023 19:11
@taiki-e
Copy link
Owner Author

taiki-e commented Mar 28, 2023

I noticed some TODO's in the CI

TODO in CI is about tests on CI (using a simulator).

I mainly use QEMU and semihosting crate to test no-std targets, so I tried to do the same with Xtensa, but the compiler didn't seem to recognize the simcall instruction so I gave that up testing on CI and decided to test locally using your wokwi-server (it worked well).

Tests passed except for a few tests that ran into compiler bugs (?).

  • wrong value on fetch_nand
    let a = portable_atomic::AtomicUsize::new(0x13);
    assert_eq!(a.fetch_nand(0x31, portable_atomic::Ordering::Relaxed), 0x13);
    assert_eq!(a.load(portable_atomic::Ordering::Relaxed), !(0x13 & 0x31));
    panicked at 'assertion failed: `(left == right)`
      left: `4290789375`,
     right: `4294967278`', src/main.rs:21:5
    
  • compile failure on fetch_{min,max}
    let a = portable_atomic::AtomicUsize::new(23);
    assert_eq!(a.fetch_min(24, Ordering::Relaxed), 23);
    assert_eq!(a.load(Ordering::Relaxed), 23);
    error: Undefined temporary symbol .LBB1_2
    

(These may be known problems.)

@taiki-e
Copy link
Owner Author

taiki-e commented May 6, 2023

Published in 1.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-xtensa Target: Xtensa processors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants