!yafYEipFNsXDdwiHMT:matrix.org

Real-Time Interrupt-driven Concurrency (RTIC)

407 Members
Welcome to the Rust Embedded Real-Time Interrupt-driven Concurrency (RTIC) chat room! | Documentation: https://rtic.rs/ | Discuss, coordinate, help: https://github.com/rtic-rs | Code of conduct: https://www.rust-lang.org/conduct.html56 Servers

Load older messages


SenderMessageTime
26 Jul 2021
@cnnblike:matrix.orgcnnblikethe issue is like this: https://pastebin.com/NjEHTH2409:17:11
@bradleyharden:matrix.orgbradleyhardenI'm not sure this will work. The clocks struct won't have a static lifetime until it is moved into a static. I think the only way to access something with a static lifetime in init is for it to be a local resource of init itself.09:17:23
@cnnblike:matrix.orgcnnblike * the issue is like this: https://pastebin.com/NjEHTH2409:17:35
@bradleyharden:matrix.orgbradleyhardenWhen you paste, please use Markdown to format the code. It's really hard to read that09:18:02
@cnnblike:matrix.orgcnnblikeok09:18:21
@cnnblike:matrix.orgcnnblikeyep, I thought maybe some one in rtic community may have already been trapped into same scenario like me 09:18:35
@cnnblike:matrix.orgcnnblike *
impl<'a> UsbPeripheral<'a> {
    pub fn new<L, LSTAT>(usbd: USBD, _clocks: &'a Clocks<ExternalOscillator, L, LSTAT>) -> Self {
        Self {
            _usbd: usbd,
            _clocks: PhantomData,
        }
    }
}
09:19:29
@mriise:matrix.orgmriise
(gdb) break SDIO
Breakpoint 1 at 0x1986: file src/main.rs, line 17.
(gdb) continue
Continuing.
init start
init end
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
lib::__wfi () at asm/lib.rs:50
50	asm/lib.rs: No such file or directory.
(gdb) list breakpoints
Function "breakpoints" not defined.
(gdb) info breakpoints
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   0x00001986 in core::sync::atomic::atomic_load<u8> at src/main.rs:17
(gdb) step
blinky::app::rtic_ext::main () at src/main.rs:17
17	#[rtic::app(device = lpc55_hal::raw, dispatchers = [SDIO], peripherals = true)]
(gdb) 

i feel like this is right, but still no dice...

09:21:25
@bradleyharden:matrix.orgbradleyharden cnnblike, I don't understand the clock type enough, but it seems like it isn't Send or Sync. Do you need to actually store it as a resource? 09:23:42
@cnnblike:matrix.orgcnnblike
In reply to @bradleyharden:matrix.org
cnnblike, I don't understand the clock type enough, but it seems like it isn't Send or Sync. Do you need to actually store it as a resource?
actually no, storing it just to make sure it have a static lifetime
09:26:55
@cnnblike:matrix.orgcnnblikewill store it as "static mut" solve the problem?09:29:14
@bradleyharden:matrix.orgbradleyhardenIn your code right now, the clock struct is not static. It's dropped at the end of init. So your code wouldn't work there09:30:06
@bradleyharden:matrix.orgbradleyhardenBut I don't know that you need it to be static09:30:45
@bradleyharden:matrix.orgbradleyhardenWhat happens if you remove it from the Shared struct?09:31:02
@cnnblike:matrix.orgcnnblikeit went back the previous scenario, dropped at the end09:31:39
@cnnblike:matrix.orgcnnblikehttps://github.com/jamesmunns/m60-keyboard/blob/ee6dd111a253994a6c24b12379e0cfd7b947c487/src/bin/keyberon_app.rs <- similar attempt made on rtic & nrf52840_hal09:32:25
@cnnblike:matrix.orgcnnblikebut prior to 0.6.0-alpha5 api09:32:34
@cnnblike:matrix.orgcnnblikein which the usbd_dev is stored in LateResources, is there an difference between Shared+Local vs LateResources09:33:23
@cnnblike:matrix.orgcnnblikefrom what I can see in the implementation, they should act similar09:33:48
@afoht:matrix.orgAfoHT
In reply to @mriise:matrix.org
(gdb) break SDIO
Breakpoint 1 at 0x1986: file src/main.rs, line 17.
(gdb) continue
Continuing.
init start
init end
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
lib::__wfi () at asm/lib.rs:50
50	asm/lib.rs: No such file or directory.
(gdb) list breakpoints
Function "breakpoints" not defined.
(gdb) info breakpoints
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   0x00001986 in core::sync::atomic::atomic_load<u8> at src/main.rs:17
(gdb) step
blinky::app::rtic_ext::main () at src/main.rs:17
17	#[rtic::app(device = lpc55_hal::raw, dispatchers = [SDIO], peripherals = true)]
(gdb) 

i feel like this is right, but still no dice...

Seems you're dealing with gdb just fine. Something isn't setup properly is my guess, this is why I'd like you to check your hardware registers for the relevant parts, like systick, interrupts enabled etc

I'm quite fond of https://github.com/bnahill/PyCortexMDebug but you can also print raw addresses with gdb, and check the registers related to peripherals

09:36:01
@bradleyharden:matrix.orgbradleyharden Yes, they are similar. I'm not sure. I don't understand the types enough. It doesn't seem like you should need a &'static for the clock struct. But if you do, I'm not sure how best to do that right now. Seems like you might still need your own static mut. 09:37:01
@bradleyharden:matrix.orgbradleyharden AfoHT, there's no way to create a late static resource in init, right? 09:38:32
@bradleyharden:matrix.orgbradleyhardenYou can have early static resources as local resources of init09:39:10
@bradleyharden:matrix.orgbradleyhardenBut you probably need the singleton macro or something for late static resources09:39:38
@cnnblike:matrix.orgcnnblike
In reply to @bradleyharden:matrix.org
Yes, they are similar. I'm not sure. I don't understand the types enough. It doesn't seem like you should need a &'static for the clock struct. But if you do, I'm not sure how best to do that right now. Seems like you might still need your own static mut.
let me try that implementation and come back, just want to sure if rtic has done anything during the api change...
09:39:46
@afoht:matrix.orgAfoHT
In reply to @bradleyharden:matrix.org
AfoHT, there's no way to create a late static resource in init, right?
If memory serves then yes, I think atm that isn't doable. Looking at the examples/static.rs, we have what you describe as the early static resource as a local resource
09:48:56
@cnnblike:matrix.orgcnnblikeemmm, that example actually works, let me further check whether it's possible to make the API migrated to rtic-v0.6.0-alpha509:55:56
@cnnblike:matrix.orgcnnblikeok, I get it, this is why: https://github.com/nrf-rs/nrf-usbd/commit/4208283bb23d2def354cd03e4fb865c88759acd910:16:47
@cnnblike:matrix.orgcnnblikethe reference to clock has now been removed from this crate, my bad, the rtic is not the root cause10:17:15
@cnnblike:matrix.orgcnnblike🤣I was wondering how could the problem be easily resolved by adding a vendor folder instead of consuming directly from the master commit of nrf52840_hal10:18:44

There are no newer messages yet.


Back to Room List