Hello,
I am looking for a how-to / walk-through for writing a custom bootloader for STM32. I need my device to bootload from attached SPI flash, so I can't use the built-in bootloader. So far I have been unable to find information about how to do this -- can anyone send a pointer to a how-to? (I am using uVision 4).
Thanks, -David Merrill
Have you looked at the ST App Note on the subject...?
I have seen appnotes from ST for using the built-in bootloader, but not anything for writing my and uploading using uvision 4.. thoughts? thanks, -David
AN2557: STM32F10x in-application programming using the USART
"The purpose of this application note is to provide general guidelines for creating an IAP application... The STM32F10x microcontroller can run user-specific firmware to perform IAP of the microcontroller-embedded Flash memory. This feature allows the use of any type of communication protocol for the reprogramming process (such as CAN, USART, USB). USART is the example used in this application note."
www.st.com/.../familiesdocs-110.html
Is the forum working again yet?
?
Test message - please ignore.
This is an administrative test message posted for site validation purposes. It will be deleted shortly. Pay me no mind'...
along with some others?
Thanks Andy.
So, just to make sure I understand: I think the way that the example in AN2557 works is the following:
- IAP driver program gets loaded into the Flash memory at the base address of the Flash (0x0800 0000)
- User program gets loaded into the flash memory immediately after the IAP driver (0x0800 2000)
- when the STM32 starts, the IAP driver code checks the state of a button that may or may not be pressed
- if the button was pressed at startup, it runs the IAP driver, otherwise it jumps to 0x0800 2000 to execute the user program.
Is that correct? And if so, what do I need to do at compile/link/upload time to put the code in the right places?
After looking through the project, I have a couple questions: is there a difference between unlocking the flash and disabling write protection?
(from stm32f10x_flash.c)
void FLASH_Unlock(void) { /* Authorize the FPEC Access */ FLASH->KEYR = FLASH_KEY1; FLASH->KEYR = FLASH_KEY2; }
Then in common.c, there is a call to:
FLASH_UserOptionByteConfig
It seems like FLASH_Unlock is always done when the IAP driver starts, and the function that calls FLASH_UserOptionByteConfig can be invoked interactively from the command line.
Also, it seems that this strategy for bootloading does not make use of the BOOT0 / BOOT1 pins at all -- the system is ALWAYS booting into the Flash (never to the System memory / built-in bootloader) -- is that correct?
thanks, -David