资源简介
1.什么是IAP?
英文名:in-application programming。
中文名:应用程序内编程。
作用:对于大多数基于闪存的系统,一个重要的要求是能够在最终产品中安装固件时进行更新。
STM32微控制器可以运行用户特定的固件来对微控制器中嵌入的闪存执行IAP。
接口:此功能支持的任何通信接口。
由于不限制通信接口协议等,只要能通过任意通信接口拿到新版固件包数据(bin文件),就能自己升级固件。
这就能做到添加 外部无线模块(4G模块、wifi)做到OTA升级。
也可以使用U盘或TF卡等外部存储设备做到OTG升级。U盘升级的IAP官方有模板程
代码片段和文件信息
/*
* flash_if.c
*
* Created on: Aug 12 2020
* Author: Sudaroot
*/
/** @addtogroup STM32F4xx_IAP_Main
* @{
*/
/* Includes ------------------------------------------------------------------*/
#include “flash_if.h“
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
static uint32_t GetSector(uint32_t Address);
/* Private functions ---------------------------------------------------------*/
/**
* @brief Unlocks Flash for write access
* @param None
* @retval None
*/
void FLASH_If_Init(void)
{
HAL_FLASH_Unlock();
/* Clear pending flags (if any) */
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR);
}
/**
* @brief This function does an erase of all user flash area
* @param StartSector: start of user flash area
* @retval 0: user flash area successfully erased
* 1: error occurred
*/
uint32_t FLASH_If_Erase(uint32_t StartSector)
{
uint32_t UserStartSector;
uint32_t SectorError;
FLASH_EraseInitTypeDef pEraseInit;
/* Unlock the Flash to enable the flash control register access *************/
FLASH_If_Init();
/* Get the sector where start the user flash area */
UserStartSector = GetSector(APPLICATION_ADDRESS);
pEraseInit.TypeErase = TYPEERASE_SECTORS;
pEraseInit.Sector = UserStartSector;
pEraseInit.NbSectors = 10;
pEraseInit.VoltageRange = VOLTAGE_RANGE_3;
if (HAL_FLASHEx_Erase(&pEraseInit &SectorError) != HAL_OK)
{
/* Error occurred while page erase */
return (1);
}
return (0);
}
/**
* @brief This function writes a data buffer in flash (data are 32-bit aligned).
* @note After writing data buffer the flash content is checked.
* @param FlashAddress: start address for writing data buffer
* @param Data: pointer on data buffer
* @param DataLength: length of data buffer (unit is 32-bit word)
* @retval 0: Data successfully written to Flash memory
* 1: Error occurred while writing data in Flash memory
* 2: Written Data in flash memory is different from expected one
*/
uint32_t FLASH_If_Write(uint32_t FlashAddress uint32_t* Data uint32_t DataLength)
{
uint32_t i = 0;
for (i = 0; (i < DataLength) && (FlashAddress <= (USER_FLASH_END_ADDRESS-4)); i++)
{
/* Device voltage range supposed to be [2.7V to 3.6V] the operation will
be done by word */
if (HAL_FLASH_Program(TYPEPROGRAM_WORD FlashAddress *(uint32_t*)(Data+i)) == HAL_OK)
{
/* Check the wri
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 26008 2020-08-16 21:52 IAP Bootloader\.cproject
文件 6889 2020-08-16 21:52 IAP Bootloader\.mxproject
文件 1387 2020-08-16 21:46 IAP Bootloader\.project
文件 2372 2020-08-20 23:31 IAP Bootloader\.settings\language.settings.xm
文件 2495 2020-08-12 14:35 IAP Bootloader\Core\Inc\flash_if.h
文件 2181 2020-08-16 21:52 IAP Bootloader\Core\Inc\main.h
文件 20065 2020-08-16 21:52 IAP Bootloader\Core\Inc\stm32f4xx_hal_conf.h
文件 2106 2020-08-16 21:52 IAP Bootloader\Core\Inc\stm32f4xx_it.h
文件 6962 2020-08-13 11:11 IAP Bootloader\Core\Src\flash_if.c
文件 9497 2020-08-16 22:05 IAP Bootloader\Core\Src\main.c
文件 4096 2020-08-16 21:52 IAP Bootloader\Core\Src\stm32f4xx_hal_msp.c
文件 5566 2020-08-16 21:52 IAP Bootloader\Core\Src\stm32f4xx_it.c
文件 2675 2020-08-12 10:44 IAP Bootloader\Core\Src\syscalls.c
文件 1468 2020-08-12 10:44 IAP Bootloader\Core\Src\sysmem.c
文件 26457 2020-07-13 23:42 IAP Bootloader\Core\Src\system_stm32f4xx.c
文件 24986 2020-07-13 23:42 IAP Bootloader\Core\Startup\startup_stm32f429igtx.s
文件 1480591 2020-07-13 23:42 IAP Bootloader\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f429xx.h
文件 9485 2020-07-13 23:42 IAP Bootloader\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h
文件 3796 2020-07-13 23:42 IAP Bootloader\Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h
文件 28208 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\cmsis_armcc.h
文件 56497 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\cmsis_armclang.h
文件 9014 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\cmsis_compiler.h
文件 62344 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\cmsis_gcc.h
文件 28414 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\cmsis_iccarm.h
文件 1716 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\cmsis_version.h
文件 97995 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\core_armv8mbl.h
文件 168914 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\core_armv8mml.h
文件 42208 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\core_cm0.h
文件 50464 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\core_cm0plus.h
文件 43456 2020-07-13 23:43 IAP Bootloader\Drivers\CMSIS\Include\core_cm1.h
............此处省略171个文件信息
相关资源
- 将STM32内部Flash虚拟成U盘通过复制bi
- IOS开发webview强制视频内联播放在没有
-
QML的MediaPla
yer支持XP播放视频的dse - STM32F103ZET6+IAP+超级终端
- STM32F207的U盘_USB_IAP升级程序 Bootloade
- STM32F103C8T6 IAP-串口在线升级
- uni-app实战仿糗事百科完整的后台源码
- STM32 USB IAP
-
TextureView+MediaPla
yer播放本地视频MV - stm32软件加密方法
- stm32L051 IAP程序升级,希望大家有用
- STM32Fxx单片机 IAP 加密 升级
- IAP程序上位机软件,
- CANopen协议的CiA文档全集
- USB_HID_IAP上位机.rar
- IAP15W4K58S4 官网例程、器件资料、原理
- PIC18F25K80_IAP方案
- IAP远程.rar
- stm32 bootloader U盘更新APP程序
-
mediaPla
yer.zip - STM32F103 通过SD卡IAP升级.zip
- 通过U盘升级STM32F103程序
- 基于Ymodem的STM32F4串口IAP
-
MusicPla
yer - apple lighting iap2 sample source
-
SurfaceView+MediaPla
yer视频播放器支持选 - stm32-串口开发工具软件(含超级终端
- INRIAP数据库
- niushop单商户旗舰版+uniapp 3.3.1 b2c
-
基于qt的qmediapla
yer类实现的一个播放
评论
共有 条评论