Rahix / avr-hal

embedded-hal abstractions for AVR microcontrollers
Apache License 2.0
1.23k stars 216 forks source link

ravedude should check rust target against selected MCU #531

Open Rahix opened 3 months ago

Rahix commented 3 months ago

We should safeguard against people accidentally flashing a binary for a different MCU.

User report: https://github.com/Rahix/avr-hal/discussions/530

Rahix commented 3 months ago

We have to catch two problems:

  1. Wrong rust target
  2. Wrong MCU-feature selected in the HAL

For the rust target, I guess we can just check the architecture from the ELF.

For the MCU-feature, maybe the HAL should define a static symbol in the ELF which contains the selected MCU?

brainstorm commented 2 months ago

And/or potentially substitute ravedude for this one?:

https://github.com/luqasz/avrisp

As discussed in probe-rs in https://github.com/probe-rs/probe-rs/discussions/391

Rahix commented 2 months ago

@brainstorm, I think this is not really related to the topic of this issue. If you want to discuss this, please open a separate issue.