cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103C8T6 Firmware for Bootloader

Chlaban
Visitor

Greetings to the community,

I have a problem with creating a firmware for the bootloader. I'll start a little differently:

Some time ago I made a bootloader for STM32F407VET6. The only thing I did was change the memory length in the STM32F407VETX_FLASH.ld file to:
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 16K
and after jumping to the FW I jump to the correct address
In the FW I changed the STM32F407VETX_FLASH.ld file:
FLASH (rx) : ORIGIN = 0x8004000, LENGTH = 496K
and in the main.c file I added the line:
int main(void)
{

/* USER CODE BEGIN 1 */
SCB->VTOR = 0x08004000;
/* USER CODE END 1 */
......
Everything works without any problems, even when I run the debugger from FW, the bootloader is not deleted and the program jumps directly to the FW address. I am satisfied.

Now I am making a bootloader for STM32F103C8T6, I proceed exactly the same way and nothing works. The program is correctly written to the required address. I have tried all sorts of options from discussions on the Internet.
Change the SystemInit (void) function, which is run before the main program loop,
change the USER_VECT_TAB_ADDRESS constants
None of this helps, the program either ends with the HardFault_Handler function (after calling the bl __libc_init_array function) or by accessing an invalid address.
The disassembled code is also strange:
00004000: str r0, [r0, r0]
00004002: movs r0, #0
00004004: ldr r4, [pc, #404] @ (0x419c)
00004006: lsrs r0, r0, #32
00004008: bx lr
0000400a: lsrs r0, r0, #32
0000400c: bx pc
0000400e: lsrs r0, r0, #32
00004010: bx pc
00004012: lsrs r0, r0, #32
00004014: @ <UNDEFINED> instruction: 0x4781
00004016: lsrs r0, r0, #32
00004018: @ <UNDEFINED> instruction: 0x4785
.....
Does anyone have experience with this, can anyone advise? Thanks

0 REPLIES 0