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

Allow writing to bootloader segments by modifying MCU's fuses #2384

Open
rnd-ash opened this issue Apr 18, 2024 · 1 comment
Open

Allow writing to bootloader segments by modifying MCU's fuses #2384

rnd-ash opened this issue Apr 18, 2024 · 1 comment
Labels
chip:atsam Issues and PRs related to Microchip ATSAM devices enhancement New feature or request

Comments

@rnd-ash
Copy link

rnd-ash commented Apr 18, 2024

On Atmel Samd/Same MCU, the bootloader regions are locked. This means that you cannot flash your own bootloader with probe-rs.

Tools like OpenOCD can modify the MCU Fuses like so in order to write to the bootloader region of these controllers:

atsame5 bootloader 0 // Write 0 to bootloader fuse
program bootloader.bin verify
atsame5 bootloader 16384 // Set bootloader size to 16KB

Describe the solution you'd like
Probe-rs can be extended in order to perform this. For now, the only use case for fuse modifying would be to flash the bootloader. With regards to implementation, I could see a couple ways on doing this:

  1. Create a new flag for probe-rs that allows for fuse toggling bootloader protection (And thus setting the target size after flash - This would allow for writing a larger bootloader if needed)

  2. Modify the default flash process (Read the current fuse state, set it to 0. Write flash, Write back old fuse state) - Maybe let the user pass a flag to probe-rs to acknowledge writing to 'dangerous' flash regions

@rnd-ash rnd-ash added the enhancement New feature or request label Apr 18, 2024
@bugadani bugadani added the chip:atsam Issues and PRs related to Microchip ATSAM devices label Apr 18, 2024
@bugadani
Copy link
Contributor

In general, the team is hesitant to add target-specific flags. If you can write a flash algorithm that implements 2) we can add atsamdXXXX-with-bootloader targets that execute the modified flash algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chip:atsam Issues and PRs related to Microchip ATSAM devices enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants