cancel
Showing results for 
Search instead for 
Did you mean: 

Bootloader Firmware Update for STM32H757 using UART

Nitin007
Visitor

Hi All,

I have created two projects. One is for the bootloader and another one is for the Application and will place the bootloader in the starting position of the flash, which is 0x08000000. And application into 0x08040000.

Below is the code for bootloader and application i.e., green led will be turned on when the bootloader starts and when entering into application green led will be turned off and red led will be toggling for 1ms:

Bootloader Code:

in main()

/* USER CODE BEGIN 2 */
HAL_GPIO_WritePin(GPIOK, GPIO_PIN_3, GPIO_PIN_RESET); // Green Led On
HAL_Delay(2000);

goto_application();
/* USER CODE END 2 */

 

static void goto_application(void)
{
 
void (*app_reset_handler)(void) = (void*)(*((volatile uint32_t*) (0x08040000 + 4U)));
HAL_GPIO_WritePin(GPIOK, GPIO_PIN_3, GPIO_PIN_SET );    //Green LED OFF
 
app_reset_handler();    //call the app reset handler
}
 

MEMORY

{

  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 512K

  FLASH    (rx)    : ORIGIN = 0x8000000,   LENGTH = 64K    /* Allocating 64K for Bootloader */

}

Application Code:

 

/* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE BEGIN 3 */
  HAL_GPIO_TogglePin(GPIOK, GPIO_PIN_4);
  HAL_Delay(1000);    //1 Sec delay
    /* USER CODE END 3 */
  }
/* USER CODE END WHILE */

MEMORY

{

  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 512K

  FLASH    (rx)    : ORIGIN = 0x8040000,   LENGTH = 512K    /* Allocating 512K for Application */

}

 

How to write a code for the bootloader firmware upgrade of just a 10ms toggling LED using UART for data transfer. 

I hope I have been able to describe the problem clearly.

 

Regards,

Nithin

1 REPLY 1
TDK
Guru

> How to write a code for the bootloader firmware upgrade of just a 10ms toggling LED using UART for data transfer. 

I hope I have been able to describe the problem clearly.

Not sure I follow. Are you looking for someone to write the entire bootloader code for you? Or is there something bad happening with the code you've already written that you're looking to get help on?

Why does toggling an LED for 10ms matter here?

If you're using UART, consider using the system bootloader instead to avoid writing your own bootloader.

If you feel a post has answered your question, please click "Accept as Solution".