Using GnuK with DFU bootloader

NIIBE Yutaka gniibe at
Sat Dec 29 01:45:26 CET 2018

Hello, Peter,

Thanks a lot for your correcting my misunderstanding.

Well, I wonder how I will put the correction to the wrong description in
my commit log.  Perhaps, I will address it in another commit log.

Peter Lebbing <peter at> wrote:
> I think that it's not the case that the NVIC system reset actually uses
> a relocated vector table to find the reset vector! It is my
> interpretation that on NVIC system reset, the VCR register is cleared to
> default and the vector at 0x0000 0004 and MSP at 0x0000 0000 are taken.
> I've found statements on reset and reset vector in the following
> sections:
> Programming Manual (PM0056):
> - Page 15 -> Stack pointer and Program counter
> - Page 32 -> Reset
> - Page 15 -> Directly below figure
> - Page 133 -> Vector table offset register reset value
> Reference manual (RM0008):
> - Page 90 -> System reset ("resets all registers to their reset values
>   except...") and they explicitly group 'Software reset' under this type
>   of reset.
> And this is also what seems to happen when nvic_system_reset() is
> invoked from device_initialize_once(), as the following gdb trace seems
> to indicate.
> So... I think the VCR register contents don't matter on invoking
> nvic_system_reset().

I see.  Thank you for your time to investigate this.

Then, there are no problem what I was care of.  It goes through by new
SYS reset routine, and reGNUal will be able to use new SYS routines.

> However, current GnuK doesn't ever invoke nvic_system_reset() AFAIK.
> reGNUal does, and actually has VCR pointing into the SRAM when it calls
> nvic_system_reset(). Again, this is a moot point since VCR is not used.
> I investigated the reGNUal reset and it goes fine as well.

I had forgotten this case when I wrote previous mail.  Indeed, if
current VCR were used for nvic_system_reset, this wouldn't work.

BTW, today, I can't find the reason why I call it VCR (vector control
register, which we have the name in the comment of mcu/sys-stm32f103.c).
In ARMv7m manual and Cortex-M3 manual, it is called VTOR (vector table
offset register).

I'm going to fix the comment in Chopstx, to avoid confusion.

More information about the Gnuk-users mailing list