30 May 2023 |
schmeckinger | btw is there a good way to start the sm at a specific adress, or should I just do exec instruction with a jmp? | 16:02:04 |
schmeckinger |  Download image.png | 16:05:15 |
schmeckinger | the c sdk has a initial pc | 16:07:30 |
ithinuel | I'll take note of that for my pio update. | 16:15:28 |
31 May 2023 |
schmeckinger | Im pretty torn rn, I have 2 different pio programs both doing the same thing for a library. One of them has 10 instructions instead of 9, but the one with 9 needs some accommodations. | 09:18:47 |
schmeckinger | The one with 9 needs to start at an offset and I need to run a check on every second push so if the first pushes 0 I need to add 8 to the second | 09:19:54 |
schmeckinger | Idk if it is worth it ovdr saving thst one instruction | 09:20:11 |
schmeckinger | over* | 09:20:34 |
schmeckinger | https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b0eb1ff050592c60a9a9ae52daaf22d2 | 09:24:20 |
schmeckinger | Also idk if here is the right place to ask such question or if I should go the pico discord and ask in the pio channel | 09:26:05 |
9names | you're welcome to ask such things here, but I think you're more likely to get a good answer on the discord | 10:27:01 |
ithinuel | I'd say it mostly depends on how much you value the PIO instruction slots.
There's only 32 of them, so 1 instruction is already more than 3% of the available space.
But overall for your firmware, if it makes it use an extra 10k (I'm exagerating on purpose) of Flash or if your firmware runs twice as slow, it may be worth using an extra slot of PIO 🤷 | 11:53:50 |
schmeckinger | In reply to @ithinuel:matrix.org I'd say it mostly depends on how much you value the PIO instruction slots. There's only 32 of them, so 1 instruction is already more than 3% of the available space. But overall for your firmware, if it makes it use an extra 10k (I'm exagerating on purpose) of Flash or if your firmware runs twice as slow, it may be worth using an extra slot of PIO 🤷 fn move_map(mov: Movement) -> IntoIter<u32, 2> {
[mov.0, mov.1].into_iter()
}
fn move_map(mov: Movement) -> IntoIter<u32, 2> {
match mov {
Movement(0, delay) => [0, delay.saturating_add(8)],
Movement(steps, delay) => [steps, delay],
}
.into_iter()
}
| 12:00:42 |
schmeckinger | basically the difference is that I would need to put the bottom one in the flat map | 12:01:21 |
ithinuel | It doesn't look like a huge impact on the firmware, so it might be worth saving a pio instr 🙂
But someone else may thing differently 🙂 | 12:02:44 |
jannic | It also depends on what else you expect to do with the pio. If you don't plan to install any other pio program in parallel, saving an instruction doesn't help at all. | 12:23:26 |
schmeckinger | In reply to @jannic:matrix.org It also depends on what else you expect to do with the pio. If you don't plan to install any other pio program in parallel, saving an instruction doesn't help at all. its a library, so someone could install something in parallel | 12:27:12 |
schmeckinger | ithinuel: I found a problem: pio::Instruction does not implement Copy and StateMachine::exec_instruction takes Instruction and not &Instruction | 12:28:43 |
schmeckinger | also has no Clone | 12:29:21 |
schmeckinger | let op = InstructionOperands::JMP { condition: JmpCondition::Always, address: prog.addr };
sm.exec_instruction(Instruction::decode(op.encode(), prog.side_set).unwrap());
| 12:37:40 |
schmeckinger | Redacted or Malformed Event | 12:38:00 |
schmeckinger | * pub struct TmcProgram<P: PIOExt> {
prog: InstalledProgram<P>,
addr: u8,
side_set: SideSet,
} | 12:38:28 |
schmeckinger | where prog is
pub struct TmcProgram<P: PIOExt> {
prog: InstalledProgram<P>,
addr: u8,
side_set: SideSet,
}
| 12:39:02 |
schmeckinger | Having to carry the address and SideSet around with me to create the Instruction feels hacky | 12:42:32 |
schmeckinger | I just created a issue in the pio git, since implementing Clone would pretty much remove my problem. | 13:10:29 |
jannic | It should be fine to derive both Copy and Clone. https://github.com/rp-rs/pio-rs/pull/45 | 13:39:21 |
1 Jun 2023 |
animus27 | is there a way to write to the flash to store program values across reboots? | 05:57:51 |
9names | https://github.com/jannic/rp2040-flash/blob/master/examples/flash_example.rs | 06:06:38 |
9names | if you're using embassy, https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/flash.rs | 06:09:17 |
animus27 | In reply to @9names:matrix.org https://github.com/jannic/rp2040-flash/blob/master/examples/flash_example.rs Thanks | 06:41:14 |