cancel
Showing results for 
Search instead for 
Did you mean: 

UART Bootloader with STM32Flashloader.exe and STM32G0

AlexRabro
Associate

Hello,

 

after a long search for an answer to my problem, I still couldn't find a solution. Perhaps one of you can help me.

I use the MCU STM32G071RBT6 (with 128KB FLASH) and to upload .bin file via UART I use the old program STM32Flashloader.exe.  As .STmap file I use STM32F0_7x_128K.STmap.

My bootloader function looks like this:

void ServiceBootJump(void)

{

     void (*SysMemBootJump)(void);                                                                                         

     volatile uint32_t addr = 0x1FFF0000;                                     

     (void) HAL_RCC_DeInit();                                                                                                                    

   SysTick->CTRL = 0;                                     

  SysTick->LOAD = 0;                                                                                                                      

  SysTick->VAL = 0;                                                            

 (void)HAL_UART_DeInit(handleuart);                                                                                                                                    __disable_irq();                                                                                                                                                                __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();                                                                                              

 SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));               

  __set_MSP(*(uint32_t *)addr);                                                                                                                    SysMemBootJump();                                                                                                                                                      

                while (1)

                {

                }

}

The whole thing works perfectly.

Now to the problem: Since the memory of 128KB FLASH is not enough for me, I have chosen a different MCU:  STM32G0B1RCT6 with 256KB FLASH.

As .STmap file for STMFlashloader.exe I chose this one: STM32F0_9x_256K.STmap.

Now I have the problem that STMFlashloader.exe brings an error message:

Opening Port [OK]

Activating device [KO]

No response from target, the Boot loader can not be started.

What am I doing wrong or what do I have to change to make it work with the new MCU with 256KB FLASH? The address for the boot loader is the same for the booth MCUs: 0x1FFF0000.

 

I can successfully upload the created .bin file for the 256KB MCU with STM32CubeProgrammer via SWD port to the MCU. But I want it to work via UART and with STM32Flashloader.exe like the old MCU.

Please help.

Many thanks in advance.

 

2 REPLIES 2

The processor doesn't start with interrupts disabled.

SYSCFG's clock needs to be enabled to reconfigure the mapping.

The K0 likely meaning that the 0x7F data pattern sent at 9600 8E1 didn't illicit the correct 0x79 response. Perhaps easier to test manually with RealTerm in hex mode.

You can dump the memory at zero, or print out the SP/PC values. Check the remapping is actually working.

You should be able to step into the loader with the debugger.

Some of the newer STM32 will check the FLASH for a valid image, and the loader will send it back. Suggest blinking a LED in Reset Handler on your side to see if that's executing.

Does it work if BOOT0 is HIGH when you reset?

STM32 Cube Programmer should see newer parts in UART mode.

The AN3155 protocol isn't that complex, implementing on Windows or Linux should be within the grasp of most here.

 

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Pavel A.
Evangelist III

[deleted]