HID bootloader for STM32F0 series

Bootloader for STM32F103 and STM32F4xx micro-controllers
No special driver is required. Support for Windows, Linux and Mac Operating System
Post Reply
geraldjustice
Posts: 4
Joined: Mon Jul 12, 2021 6:25 am

HID bootloader for STM32F0 series

Post by geraldjustice »

Hi there guys! im new but i wanted to ask this question as you guys are more familiar with the arduinos side of the STM32 stuff. I recently wrote a Bootloader for the stm32F0 in HID following losely the example HAL for the F4 platform. managed to use to to flash chips. But hit the brick wall until i found out about the SRAM vector table for the F0 since it doest not have a VTOR like the F4 does. fixed it and "main" apps now run when i copy over the vector table in code when im using CubeIDE. But i wanted to try to see if i can get the STM32duino to work with it. It basically uses the same upload protocol as the F1 and F4 bootloaders. Later i discovered someone already made one lol. https://github.com/aroerina/STM32_HID_Bootloader_F0

So im trying to support it in stm32duino. I got it working just fine on cubeIDE but i miss the quickness you can throw together code from there. I tried to add this by doing the following: 1 under boards.txt i added the F0 to the HID upload method to have this automated. Made the vector offset to 0x0000. Then modified the ld script to offset like the github link:

Code: Select all

MEMORY
{
  RAM    (xrw)    : ORIGIN = 0x200000c0,   LENGTH = 16192
  FLASH    (rx)    : ORIGIN = 0x8000800,   LENGTH = 126K
}
Therefore even when selecting the HID as upload method the vector offset and im also offsetting the RAM too at once.

Last bit of code i need to add would be this:

Code: Select all

	memcpy((void*)SRAM_VTABLE_ADDR,(void*)FLASH_VTABLE_ADDR,VTABLE_SIZE);
	SYSCFG->CFGR1 |= 3;
But not exactly sure were to add this. This has to be before HAL_Init();

Also i did test the bootloader in the link with HID-flash and works like a charm with the example using cube IDE.

Edit: also the bootloader i linked is set for a 128kB flash. so page size are 2kB. if your using something with less then change it to 1k
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: HID bootloader for STM32F0 series

Post by fpiSTM »

geraldjustice
Posts: 4
Joined: Mon Jul 12, 2021 6:25 am

Re: HID bootloader for STM32F0 series

Post by geraldjustice »

Thanks! i will come back to see how it when!
geraldjustice
Posts: 4
Joined: Mon Jul 12, 2021 6:25 am

Re: HID bootloader for STM32F0 series

Post by geraldjustice »

Dam it did not work. i need to see why. But i discovered that under STM32duino variant for "MALYANMx00_F070CB" also uses a sram offset. but im a little stumped. I will see what else i can do. Does anyone have any suggestions on how this can be done?
florencio48
Posts: 1
Joined: Wed Jul 05, 2023 8:54 am

Re: HID bootloader for STM32F0 series

Post by florencio48 »

Use the PB2 port tied to +3.3V after a RESET. This will kick in the HID Bootloader (even with anything written previously). One also can unplug the USB, tie PB2 to +3.3V, and plug it to the USB port, this also can kick in the HID Bootloader.
Post Reply

Return to “STM32 HID bootloader”