!yafYEipFNsXDdwiHMT:matrix.org

Real-Time Interrupt-driven Concurrency (RTIC)

554 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 | Meeting-notes: https://rtic.rs/meeting | Code of conduct: https://www.rust-lang.org/conduct.html62 Servers

Load older messages


SenderMessageTime
26 Jun 2022
@firefrommoonlight:matrix.orgfirefrommoonlight The naive approach of using #[cfg or the cfg_if macro is not working 22:44:18
@firefrommoonlight:matrix.orgfirefrommoonlight

The way I can do it now is:

    #[task(binds = DMA1_CH3, shared = [rotor_timer_a], priority = 6)]
    // #[task(binds = DMA1_STR3, shared = [rotor_timer_a], priority = 6)]
22:44:39
@firefrommoonlight:matrix.orgfirefrommoonlightAnd swap the commented lined when I change which MCU I'm flashing, but thisn't ideal22:44:56
@firefrommoonlight:matrix.orgfirefrommoonlightDirbao probably has this solved by making all the NVIC names the same lol22:45:12
@firefrommoonlight:matrix.orgfirefrommoonlight * Dirbaio probably has this solved by making all the NVIC names the same lol22:45:24
@firefrommoonlight:matrix.orgfirefrommoonlight(Its' not just DMA; the names vary significantly among STM32 variants in PAC)22:45:38
@firefrommoonlight:matrix.orgfirefrommoonlightUSB names vary widely etc22:45:44
@firefrommoonlight:matrix.orgfirefrommoonlight * USB and timer names vary widely etc22:45:49
@dirbaio:matrix.orgdirbaio
In reply to @firefrommoonlight:matrix.org
Dirbaio probably has this solved by making all the NVIC names the same lol
nope! some mcus have irqs shared between multiple dma channels, or even between DMA and non-DMA stuff!
22:46:09
@firefrommoonlight:matrix.orgfirefrommoonlight:(22:48:05
@dirbaio:matrix.orgdirbaio my favourite is stm32g0c1ve's DMA1_Ch4_7_DMA2_Ch1_5_DMAMUX1_OVR 22:48:24
@dirbaio:matrix.orgdirbaio👌22:48:27
@firefrommoonlight:matrix.orgfirefrommoonlightUH fuck that22:48:44
@firefrommoonlight:matrix.orgfirefrommoonlight

Also, this doesn't work:

    #[cfg(featuer = "g4")]
    #[task(binds = DMA1_CH3, shared = [rotor_timer_a], priority = 6)]
    #[cfg(featuer = "h7")]
    #[task(binds = DMA1_STR3, shared = [rotor_timer_a], priority = 6)]
22:48:52
@hmvp:matrix.orgHmvpdont you need to feature gate the actual function?22:49:20
@hmvp:matrix.orgHmvpso shim functions that call the actual relevant functions?22:49:36
@dirbaio:matrix.orgdirbaio #[cfg_attr(feature="g4", task(binds = DMA1_CH3, shared = [rotor_timer_a], priority = 6))] maybe? though that probably needs the macro to opt-in to parse that properly.. 22:49:37
@firefrommoonlight:matrix.orgfirefrommoonlight I think What I posted is feature gating the fn? 22:50:39
@dirbaio:matrix.orgdirbaio

feature-gating the fn would be

    #[cfg(featuer = "g4")]
    #[task(binds = DMA1_CH3, shared = [rotor_timer_a], priority = 6)]
    fn dma1_ch3_task(...) { ... }

    #[cfg(featuer = "h7")]
    #[task(binds = DMA1_STR3, shared = [rotor_timer_a], priority = 6)]
    fn dma1_ch3_task(...) { ... }
22:51:12
@dirbaio:matrix.orgdirbaioie copypasting the code22:51:15
@firefrommoonlight:matrix.orgfirefrommoonlight

Sort of? At least when you do

#[repr(u8)]
#[cfg_if(feature = "asdf")]
fn myfn() {
22:51:20
@firefrommoonlight:matrix.orgfirefrommoonlightAll the #[ applies to teh fn22:51:26
@firefrommoonlight:matrix.orgfirefrommoonlight yea - that's where I copy pasted from; jsut didn't include the fn lines below 22:51:51
@dirbaio:matrix.orgdirbaioand it doesn't work? :S file an issue I guess, then22:52:20
@firefrommoonlight:matrix.orgfirefrommoonlight*Just tried your example; no work, but worth a shot!22:52:36
@dirbaio:matrix.orgdirbaio at the very least, you can definitely do it by #[cfg]ing and duplicating the whole mod app, lol 22:52:48
@hmvp:matrix.orgHmvpMaybe write a macro that generates the shim functions...🤐22:52:53
@firefrommoonlight:matrix.orgfirefrommoonlighthaha true!22:52:58
@firefrommoonlight:matrix.orgfirefrommoonlightMacro could work22:53:05
@firefrommoonlight:matrix.orgfirefrommoonlightYea good call re issue22:53:20

There are no newer messages yet.


Back to Room List