标题:
HC32F460的IAP例程与资料
[打印本页]
作者:
pp8899
时间:
2021-6-23 18:25
标题:
HC32F460的IAP例程与资料
这是华大的HC32F460的IAP例程,供大家参考。
51hei.png
(8.04 KB, 下载次数: 116)
下载附件
2021-6-23 19:11 上传
以上资料下载:
hc32f460_iap资料.7z
(3.11 MB, 下载次数: 215)
2021-6-23 19:14 上传
点击文件名下载附件
下载积分: 黑币 -5
/*******************************************************************************
* Include files
******************************************************************************/
#include "iap.h"
#include "basic.h"
#include "flash.h"
#include "uart.h"
#include "modem.h"
#include "User_Timer.h"
/*******************************************************************************
* Local type definitions ('typedef')
******************************************************************************/
/*******************************************************************************
* Local pre-processor symbols/macros ('#define')
******************************************************************************/
/*******************************************************************************
* Global variable definitions (declared in header file with 'extern')
******************************************************************************/
uint32_t JumpAddress;
func_ptr_t JumpToApplication;
/*******************************************************************************
* Local function prototypes ('static')
******************************************************************************/
static en_result_t IAP_JumpToApp(uint32_t u32Addr);
static void IAP_ResetConfig(void);
/*******************************************************************************
* Local variable definitions ('static')
******************************************************************************/
/*******************************************************************************
* Function implementation - global ('extern') and local ('static')
******************************************************************************/
/**
*******************************************************************************
** \brief Initialize IAP
**
** \param [in] None
**
** \retval None
**
******************************************************************************/
void IAP_Init(void)
{
SystemClock_Init();
LED_Init();
UART_Init();
}
/**
*******************************************************************************
** \brief UART receive byte.
**
** \param [out] u8RxData Pointer to Rx data.
**
** \retval Ok Receive data finished.
** \retval Error Don't receive data.
**
******************************************************************************/
void IAP_Main(void)
{
uint32_t u32AppFlag;
en_result_t enRet;
while (1)
{
enRet = Modem_Process(BOOT_WAIT_TIME);
if ((enRet == Ok) || (enRet == ErrorTimeout))
{
u32AppFlag = *(__IO uint32_t *)BOOT_PARA_ADDRESS;
if ((0xFFFF != u32AppFlag))
{
if (Error == IAP_JumpToApp(APP_ADDRESS))
{
LED0_OFF();
LED1_ON();
}
}
else
{
LED0_ON();
LED1_ON();
}
}
else
{
LED1_OFF();
LED0_ON();
}
}
}
/**
*******************************************************************************
** \brief IAP main function
**
** \param [in] u32Addr APP address
**
** \retval Error APP address error
**
******************************************************************************/
static en_result_t IAP_JumpToApp(uint32_t u32Addr)
{
uint32_t u32StackTop = *((__IO uint32_t *)u32Addr);
/* Check if user code is programmed starting from address "u32Addr" */
/* Check stack top pointer. */
if ((u32StackTop > SRAM_BASE) && (u32StackTop <= (SRAM_BASE + RAM_SIZE)))
{
IAP_ResetConfig();
/* Jump to user application */
JumpAddress = *(__IO uint32_t *)(u32Addr + 4);
JumpToApplication = (func_ptr_t)JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t *)u32Addr);
JumpToApplication();
}
return Error;
}
/**
*******************************************************************************
** \brief Boot reset configure
**
** \param [in] None
**
** \retval None
**
******************************************************************************/
static void IAP_ResetConfig(void)
{
LED_DeInit();
UART_DeInit();
Timer_DeInit();
SystemClock_DeInit();
}
/******************************************************************************
* EOF (not truncated)
*****************************************************************************/
复制代码
作者:
yutouyes
时间:
2021-9-2 16:49
好资料,51黑有你更精彩!!!
作者:
cliff_w
时间:
2022-3-31 16:28
感谢感谢,找了很久终于找到了
作者:
150315175
时间:
2022-4-26 09:53
这个资料在哪里找的啊?我去官网都没找到
作者:
mmloster001
时间:
2023-3-13 22:01
感谢,,,,马上下载来研究研究
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1