2015-10-08 10:31 PM
Hi all, I have a project that is in late stage, and client is suddenly asking (forcing) toenable firmware upgrade. We have a bluetooth module on board and is connecting to the MCU by UART, is it possible that I could send commands to the bluetooth from my phone and rewrite the program flash area, so it is upgraded? I am currently using STM32F051 MCU.
Thank you in advance!2015-10-09 12:09 AM
It's called in-application programming. You must split your program into two parts: a bootloader and the main program. The bootloader is always there, it updates the main program if requested, then jumps into it (to execute).
http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/LN1734/PF258152
If you are using the Cube, look also athttp://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/LN1920/PF262163
.2015-10-09 03:27 AM
Thank you! After knowing this and reading more, I am able to put my program that I want to run after some check at 0x8002000, put that into flash first, and then make a simple program at 0x8000000 with a few lines of code like the following:
uint32_t startAddress = *(__IO uint32_t*)(FIRMWARE_START_ADDRESS + 4);pFunction RestartFirmware = (pFunction)startAddress;__set_MSP(*(__IO uint32_t*)FIRMWARE_START_ADDRESS);RestartFirmware();And jump to that address of 0x8002000 (FIRMWARE_START_ADDRESS). However, seems the interrupts are not working.Seems I need to set the vector table to my firmware too, but I cannot find the function to actually set the vector table. I am using STM32F0, is there a way to set it?2015-10-09 03:35 AM
I assume you downloaded the zip file from my first link.
Look at STM32F0xx_AN4065_FW_V1.0.0\Project\STM32F0xx_IAP\binary_template\src\main.c to see how to relocate the vector table of the main application.2015-10-10 11:46 PM
Thank you! I used the first link and can see how the vector table is copied to the RAM and remapping to it. However, due to the lack of knowledge in this, I am unable to understand what this error means?
Error: L6971E: stm32f0xx_hal.o(.data) type RW incompatible with main.o(.ARM.__AT_0x20000000) type ZI in er RW_IRAM1.Please help.2015-10-11 11:24 PM
Found out it is the address problem. However, still one problem not solved, can anyone tell me how to write the following lines using HAL driver?
/* Enable the SYSCFG peripheral clock*/ RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE); /* Remap SRAM at 0x00000000 */ SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM);