Skip to main content
Visitor II
January 8, 2025
Question

STM32 CDC Bootloader

  • January 8, 2025
  • 1 reply
  • 827 views

I apologize for I am new at learning bootloader and I am trying to create a custom bootloader for stm32f103 custom dev board. First, I just want to know how can create a compatible binary file to be flashed at existing bootloader.

https://github.com/stevstrong/STM32-CDC-Bootloader

I installed the bootloader from the repo link above and I have managed to flash an app but it has overwritten the bootloader.

I have already edited the linker file of my application to start at the address wherein it wouldn't touch the memory allocated for the bootloader.

 

/* Memories definition */
MEMORY
{
 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
 FLASH (rx) : ORIGIN = 0x8001000, LENGTH = 20K
}

 

the binary file of the repo has a 4kb size and I follow the 4*1024 =4096
decimal to hex = 1000 for memory addressing. Has anyone have been able to create an app binary file which is fit at the bootloader program?
What is the best way to solve this?

    This topic has been closed for replies.

    1 reply

    Graduate II
    January 8, 2025

    If you want to debug, attach a debugger and read out memory and compare what is really written in flash. E.g. gdb compare-sections command will compare flash against the elf file.

    Otherwise I propose to switch to a DFU bootloader. E.g. the blackmagic probe  has a small DFU bootloader for F1. If your device already has a DFU bootloader in system memory, you do not need your own bootloader at all, you just start the system bootloader.