ChibiOS crashes when my firmware is not at beginning of flash memory

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

Moderators: RoccoMarco, barthess

kalpesh
Posts: 19
Joined: Mon Dec 09, 2019 11:53 am

Re: ChibiOS crashes when my firmware is not at beginning of flash memory

Postby kalpesh » Wed Mar 04, 2020 10:27 am

Hi,

Any update on the above issue (for relocating chibios to different sector).

User avatar
Giovanni
Site Admin
Posts: 14462
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1078 times
Been thanked: 922 times
Contact:

Re: ChibiOS crashes when my firmware is not at beginning of flash memory

Postby Giovanni » Wed Mar 04, 2020 1:32 pm

I don't have information to give a meaningful suggestion.

Others have implemented a similar bootloader so there must something wrong is some minor detail.

Giovanni

kalpesh
Posts: 19
Joined: Mon Dec 09, 2019 11:53 am

Re: ChibiOS crashes when my firmware is not at beginning of flash memory

Postby kalpesh » Wed Mar 04, 2020 2:33 pm

Hi,

After changing the following info in STM32F407xG.ld file, my vector in ch.list file now points to sector 5 which I think is correct. But still the code is not getting started.

STM32F407xG.ld file :
flash0 : org = 0x08020000, len = 512k

ch.list file :

Disassembly of section .vectors:

08020000 <_vectors>:
8020000: 20000400 .word 0x20000400
8020004: 080202d9 .word 0x080202d9
8020008: 080202db .word 0x080202db

Someone shared that "set CORTEX_VTOR_INIT to the new offset". But I did not find this Macro in my chibios code.

User avatar
Giovanni
Site Admin
Posts: 14462
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1078 times
Been thanked: 922 times
Contact:

Re: ChibiOS crashes when my firmware is not at beginning of flash memory

Postby Giovanni » Wed Mar 04, 2020 2:36 pm

If you are using the latest version then VTOS is set in startup files, no need for that option.

Giovanni

kalpesh
Posts: 19
Joined: Mon Dec 09, 2019 11:53 am

Re: ChibiOS crashes when my firmware is not at beginning of flash memory

Postby kalpesh » Thu Mar 05, 2020 6:46 am

Hi,

I am using the following version of chibios. In this version is it necessary to set CORTEX_VTOR_INIT
/*
* @brief ChibiOS version string.
*/
#define CH_VERSION "19.1.2"

Thanks

User avatar
Giovanni
Site Admin
Posts: 14462
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1078 times
Been thanked: 922 times
Contact:

Re: ChibiOS crashes when my firmware is not at beginning of flash memory

Postby Giovanni » Thu Mar 05, 2020 8:55 am

It is not necessary.

Giovanni

kalpesh
Posts: 19
Joined: Mon Dec 09, 2019 11:53 am

Re: ChibiOS crashes when my firmware is not at beginning of flash memory

Postby kalpesh » Thu Mar 05, 2020 1:54 pm

Hi,

Any inputs from your side for relocating the chibios to different sector(Any extra changes to be made in code).

Thanks

User avatar
Giovanni
Site Admin
Posts: 14462
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1078 times
Been thanked: 922 times
Contact:

Re: ChibiOS crashes when my firmware is not at beginning of flash memory

Postby Giovanni » Thu Mar 05, 2020 2:54 pm

No changes, you just need to change the LD file and make sure that you enter ChibiOS under the same conditions you have after exiting a reset (interrupts disabled, peripherals in their reset state etc).

Giovanni

kalpesh
Posts: 19
Joined: Mon Dec 09, 2019 11:53 am

Re: ChibiOS crashes when my firmware is not at beginning of flash memory

Postby kalpesh » Mon Mar 09, 2020 7:18 am

Hi,

I carried out some test and got the results. This might help in getting a clear idea why chibios is not able to relocate to different sector.

For example : I made a bootloader code in HAL and a simple application code in HAL, then it is working.

Bootloader code Application code Result

1. HAL HAL Working
2. Chibios Chibios Working
3. HAL Chibios Not Working
4. Chibios HAL Not Working

Any idea from your side. The final application code is chibios.

Thanks

User avatar
wurstnase
Posts: 121
Joined: Tue Oct 17, 2017 2:24 pm
Has thanked: 43 times
Been thanked: 30 times
Contact:

Re: ChibiOS crashes when my firmware is not at beginning of flash memory

Postby wurstnase » Tue Mar 10, 2020 9:55 am

I successfully jump from HAL bootloader to ChibiOS main application.

Be sure that you will set VTOR, MSP etc. correctly AND jump before halInit and chInit etc.
\o/ Nico


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 7 guests