Using DFU firmware at default 0x800000 address.

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
User avatar
z80
Posts: 20
Joined: Mon Oct 08, 2012 5:36 pm

Using DFU firmware at default 0x800000 address.

Post 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!
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: Using DFU firmware at default 0x800000 address.

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Using DFU firmware at default 0x800000 address.

Post 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
User avatar
z80
Posts: 20
Joined: Mon Oct 08, 2012 5:36 pm

Re: Using DFU firmware at default 0x800000 address.

Post by z80 »

Thank you very much for the explanation! It seems to me setting CORTEX_VTOR_INIT #define should solve the problem.
Post Reply