Page 1 of 1

Using DFU firmware at default 0x800000 address.

Posted: Thu Dec 05, 2013 6:47 pm
by z80
Hello!

I would like my custom DFU software run just before main ChibiOS firmware. So I tried flashing that DFU firmware at the very beginning of the flash memory. And I uploaded main firmware 10kB after that. When I use simple firmware without use of ChibiOS or with chibios routines commented everything is normal. It is executed and I can see it works normally.

But my problem is with regular firmware with ChibiOS when execution point reaches any of ChibiOS routine it jumps to default failure routine infinite loop. And it happens regardless of whether I use NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x2800 ) as a very first line of main() code or not.

I use Chibios version 2.4.2 if it matters.

Thank you for assistance in advance!

Re: Using DFU firmware at default 0x800000 address.

Posted: Thu Dec 05, 2013 7:11 pm
by Tectu
I never did it myself but from my understanding, it's just a matter of modifying the linker script correctly. Probably you should add that to your post so people can have a look.


~ Tectu

Re: Using DFU firmware at default 0x800000 address.

Posted: Thu Dec 05, 2013 8:36 pm
by Giovanni
Correct, you should verify the linker script, you should also verify if your bootloader leaves the system in an after-reset-like state.

Note that NVIC_SetVectorTable() does not work because the Cortex-M3 port reinitializes the vectors table base register by itself. You should use the CORTEX_VTOR_INIT option instead (you may add the setting to chconf.h).

Giovanni

Re: Using DFU firmware at default 0x800000 address.

Posted: Fri Dec 06, 2013 12:26 pm
by z80
Thank you very much for the explanation! It seems to me setting CORTEX_VTOR_INIT #define should solve the problem.