Skip to content

Conversation

@jacmet
Copy link
Contributor

@jacmet jacmet commented Jun 12, 2023

ATxmega devices have lockbits efuses, which can be used to limit what flash areas can be read/written. The Atmel DFU bootloader checks the lock bits at SET_CONFIGURATION time, and will reject a program request unless an erase has been sent.

SET_CONFIGURATION is unfortunately triggered every time dfu-programmer is run (from dfu_device_init()), so it doesn't work to do:

dfu-programmer <device> erase
dfu-programmer <device> flash

As the lockbits are again read at the start of the flash command. As a workaround, add an --erase-first argument to the flash command to trigger a full erase before flashing.

@cinderblock
Copy link
Member

My general feeling is that this would be helpful, even for other targets. These changes look good to me.

However, I'd like to let this sit for a short amount of time (1~3 weeks) to collect any comments about issues that I may not have considered. I'm particularly interested in other mechanisms that could be used to do the same thing. I just want to be a little careful and intentional about adding arguments that would need to be supported for the future life of this project.

Thank you for the contribution :)

@cinderblock cinderblock added enhancement feature-request A request to add a feature to the software labels Jun 13, 2023
@cinderblock cinderblock self-assigned this Jun 13, 2023
…kbits set

ATxmega devices have lockbits efuses, which can be used to limit what flash
areas can be read/written.  The Atmel DFU bootloader checks the lock bits at
SET_CONFIGURATION time, and will reject a program request unless an erase
has been sent.

SET_CONFIGURATION is unfortunately triggered every time dfu-programmer is
run (from dfu_device_init()), so it doesn't work to do:

dfu-programmer <device> erase
dfu-programmer <device> flash

As the lockbits are again read at the start of the flash command.  As a
workaround, add an --erase-first argument to the flash command to trigger a
full erase before flashing.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
@jacmet jacmet force-pushed the feature/flash-erase-first branch from f93d6dd to 5d7d90c Compare June 13, 2023 20:13
@jacmet
Copy link
Contributor Author

jacmet commented Jun 13, 2023

My general feeling is that this would be helpful, even for other targets. These changes look good to me.

Great!

However, I'd like to let this sit for a short amount of time (1~3 weeks) to collect any comments about issues that I may not have considered. I'm particularly interested in other mechanisms that could be used to do the same thing. I just want to be a little careful and intentional about adding arguments that would need to be supported for the future life of this project.

Sure. I have pondered it a bit, and haven't been able to come up with anything better than this, as we somehow need to do the erase and program without calling dfu_device_init() in between.

Thank you for the contribution :)

You're welcome, thanks for a nice tool!

@cinderblock
Copy link
Member

Not my tool. I just raised my hand and joined the team. Have been cleaning up a couple things here and there.

@jacmet
Copy link
Contributor Author

jacmet commented Jul 6, 2023

My general feeling is that this would be helpful, even for other targets. These changes look good to me.

However, I'd like to let this sit for a short amount of time (1~3 weeks) to collect any comments about issues that I may not have considered. I'm particularly interested in other mechanisms that could be used to do the same thing. I just want to be a little careful and intentional about adding arguments that would need to be supported for the future life of this project.

Hi,

We're now 3 weeks later. Can this be applied?

@jacmet
Copy link
Contributor Author

jacmet commented Jul 6, 2023

@cinderblock thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement feature-request A request to add a feature to the software

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants