2024-07-24 06:05 AM - edited 2024-07-24 06:18 AM
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 */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K /* Allocating 64K for Bootloader */
}
Application Code:
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
2024-07-24 06:35 AM
> 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.
2024-07-24 11:02 PM
Hi TDK,
Thank you for your reply.
> 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?
I have created a basic bootloader that jumps to an application where an LED toggles every 1ms that attached in the above code. Now, I want to update the bootloader application to toggle the LED every 10ms to learn how firmware updates work in a bootloader. Can anyone write the code or guide on how to perform this firmware update?
> If you're using UART, consider using the system bootloader instead to avoid writing your own bootloader.
As I mentioned, I want to update the firmware to achieve a 10ms delay for the LED toggling. To accomplish this, I will use UART for data transfer. Could you please write the code or guide on how to perform this firmware update using UART?
2024-07-25 05:52 AM
Ah, so a learning exercise. I don't think me writing code will help you in the long run.
I would suggest looking at examples of erasing and writing flash pages. If you are making your own UART bootloader, it is up to you to choose the protocol. Consider adopting a similar protocol as STM32.
cd00264342-usart-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf
2024-07-27 02:02 PM
> Can anyone write the code or guide on how to perform this firmware update?
Sure, here you can find help and guidance.
2024-07-27 03:09 PM
ST should have some IAP (In App Programming) examples for this or other platforms, using UART and Y-MODEM
There are other FW Upgrade examples using USB Flash sticks via a USB MSC Host driver
2024-07-30 04:17 AM
Can you share some sample code that demonstrate the logic I need to use? The initial PC board sends a message to the STM32 board (via UART or USB) to enter update mode, and then the initial board sends the new firmware for it to update.
In the end, there are two different pieces of code: one on the PC that acts as the master and sends a message to the STM32H757 (via UART or USB) when it needs to enter update mode. The STM32H757 enters update mode, and the PC sends it the new program for updating.
2024-08-06 05:02 AM
2024-08-06 10:56 AM
It's your board, who else is programming for it? As I said look at IAP examples furnished by ST as a starting point to port from.
STM32Cube_FW_H7_V1.11.2\Projects\STM32H743I-EVAL\Applications\USB_Host\FWupgrade_Standalone
STM32Cube_FW_H7_V1.11.2\Projects\STM32H743I-EVAL\Applications\ExtMem_CodeExecution\ExtMem_Boot
STM32Cube_FW_H7_V1.11.2\Projects\STM32H743I-EVAL\Applications\IAP\IAP_Main\Src\ymodem.c