/****************************************************************************
基于arm7 lpc21XX系列的IAP应用实例
* 文件名:IAPTEST.C
* 功能:LPC2100的IAP功能测试。
* 说明:调用IAP服务程序,完成FLASH编程操作。
* 将paramout添加到Watch窗口,观察返回值。
****************************************************************************/
#include "config.h"
#include "stdio.h"
#define BEEP (1 << 22)
/* 定义IAP命令字 */
#define IAP_SELSECTOR 50
#define IAP_RAMTOFLASH 51
#define IAP_ERASESECTOR 52
#define IAP_BLANKCHK 53
#define IAP_READPARTID 54
#define IAP_BOOTCODEID 55
#define IAP_COMPARE 56
/* 定义IAP返回状态字 */
#define CMD_SUCCESS 0
#define INVALID_COMMAND 1
#define SRC_ADDR_ERROR 2
#define DST_ADDR_ERROR 3
#define SRC_ADDR_NOT_MAPPED 4
#define DST_ADDR_NOT_MAPPED 5
#define COUNT_ERROR 6
#define INVALID_SECTOR 7
#define SECTOR_NOT_BLANK 8
#define SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION 9
#define COMPARE_ERROR 10
#define BUSY 11
#define PARAM_ERROR 12 /* Insufficient number of parameters */
#define ADDR_ERROR 13 /* Address not on word boundary */
#define ADDR_NOT_MAPPED 14
#define CMD_LOCKED 15 /* Command is locked */
#define INVALID_CODE 16 /* Unlock code is invalid */
#define INVALID_BAUD_RATE 17
#define INVALID_STOP_BIT 18
uint32 paramin[8]; // IAP入口参数缓冲区
uint3

本文档详细介绍了基于ARM7的LPC21XX系列微控制器进行In-Application Programming(IAP)的应用实例,包括IAP命令、扇区选择、数据复制到Flash、扇区擦除、查空检查等功能的实现代码,以及存储和读取Flash数据的方法。
最低0.47元/天 解锁文章
2615

被折叠的 条评论
为什么被折叠?



