arm7 lpc21XX系列的IAP应用实例

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

/****************************************************************************

基于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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值