标题:
STM32F1 SD卡升级用户代码 bootloader_IAP
[打印本页]
作者:
yx216
时间:
2018-5-2 16:12
标题:
STM32F1 SD卡升级用户代码 bootloader_IAP
SD卡升级具体看代码 , 以后还有U盘升级, 远程升级等
bootloader_iap_sd
单片机源程序如下:
/*************************************************************
*************************************************************/
#include "includes.h"
extern pFunction Jump_To_Application;
extern uint32_t JumpAddress;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/*******************************************************************************
* @brief Main program.
* @param None
* @retval None
*******************************************************************************/
unsigned int key_flag = 0;
int main(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
//Flash解锁
FLASH_Unlock();
//Test if Key push-button on STM3210X-EVAL Board is pressed
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);//
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;//PA5
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //
GPIO_Init(GPIOA, &GPIO_InitStructure);//
key_flag = GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_5);
/* 如果按键按下, 执行IAP驱动程序更新Flash程序 */
if (!key_flag)
{
//串口初始化
BSP_Init();
SerialPutString("\r\n======================================================================");
SerialPutString("\r\n .\"\". .\"\",");
SerialPutString("\r\n | | / /");
SerialPutString("\r\n | | / /");
SerialPutString("\r\n | | / /");
SerialPutString("\r\n | |/ ;-._ ");
SerialPutString("\r\n } ` _/ / ;");
SerialPutString("\r\n | /` ) / /");
SerialPutString("\r\n | / /_/\\_/\\");
SerialPutString("\r\n |/ / |");
SerialPutString("\r\n ( ' \\ '- |");
SerialPutString("\r\n \\ `. /");
SerialPutString("\r\n | |");
SerialPutString("\r\n | |");
SerialPutString("\r\n= Bootloader for STM32F10X v1.0.1 =");
SerialPutString("\r\n= COPYRIGHT@2012 Wanwei Tech =");
SerialPutString("\r\n======================================================================");
SerialPutString("\r\n\r\n");
Main_Menu ();
}
else
{
IAP_JumpToApplication(); /* 执行用户程序 */
}
while (1)
{
}
}
#ifdef USE_FULL_ASSERT
/*******************************************************************************
* @brief Reports the name of the source file and the source line number
* where the CHECK_PARAM error has occurred.
* @param[in] file Pointer to the source file name
* @param[in] line assert_param error line source number
* @return None
*******************************************************************************/
void assert_failed(uint8_t* file, uint32_t line)
{
printf("Wrong parameters value: file %s on line %d\r\n", file, line);
//while(1);
}
#endif /* USE_FULL_ASSERT */
/**
* @}
*/
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
复制代码
所有资料51hei提供下载:
bootloader_iap_sd.rar
(1.16 MB, 下载次数: 183)
2018-5-2 16:10 上传
点击文件名下载附件
下载积分: 黑币 -5
作者:
0605
时间:
2019-2-27 15:42
F1系列小容量和中容量貌似没有SDIO接口啊
作者:
Whw2
时间:
2019-4-9 16:33
程序占用了19K的ROM啊,从3000开始跑APP程序会不会不够啊
作者:
一期一会619
时间:
2020-5-2 14:43
谢谢分享
作者:
miskel
时间:
2021-7-28 15:26
试试好不好用
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1