Using GnuK with DFU bootloader

NIIBE Yutaka gniibe at
Wed Dec 26 06:53:58 CET 2018

Hello Peter,

Thanks for your fixes.  I merged and released Gnuk 1.2.13.

	tag release/1.2.13
	Tagger: NIIBE Yutaka <gniibe at>
	Date:   Wed Dec 26 14:14:23 2018 +0900
	commit b7368e41e9d15f3f1d25572a8dc3bf53bfa95723

> It might be there's some confusion with all the vector tables while
> trying to understand the code flow.

Yes.  It's complicated.

> I also added a reset after flash_protect(). The flash programming manual
> says:
>>The read protection is activated by setting the RDP option byte and
>>then, by applying a system reset to reload the new RDP option byte.
> so it's probably better to add that reset.

IIUC, it is recommended to have power off -> power on cycle, when we
change the RDB option byte.  Perhaps, I am confused about the case of
mass erase.

Anyway, for this particular case, I thik that it is recommended to have
power off -> power on cycle, after the first run (which kills DFU).

As I added a comment in the commit log, we should know that this reset
event in the first run uses old RESET vector.  This does not go through
newly written SYS.  Thus, the VCR register keeps its old value.  When
there is no power cycle, after reGNUal's reset, it might go wrong place.

> Incidentally, I also fixed two clean targets in the next commit,
> b57c33c204f7fc5c04aab7b2ffd0f7e0bfdc78ea. It's a tiny change. Both can
> be found in [2].

Thank you.  All merged.

> Also, I was happy to discover that actually, the boards I bought to
> perhaps be handed out to some people at the 35C3 /do/ have the small
> STM32duino bootloader that is required for GnuK in DFU-mode! Up until
> now, I had been testing with an old board revision I bought in May 2017.
> It turns out that in the boards I ordered a few weeks ago they updated
> the bootloader (the schematic is unchanged, but they did change the
> board, it now uses a micro-USB connector rather than mini-USB).

It seems that it's common in China.  I hope they change MPN
(manufacturer part number), when having such changes (hardware-wise or
firmware-wise), so that a user can distinguish changes.

More information about the Gnuk-users mailing list