芯片解密,芯片破解,IC解密,单片机解密,MCU解密,STM解密

飞芯科技提供芯片解密,芯片破解,IC解密,单片机解密,MCU解密,STM解密逆向服务

芯片复制HK32F030Mxx API函数

  1. 芯片复制* Include files
  2. ******************************************************************************/
  3. 芯片复制#include "iap.h"
  4. 芯片复制#include "basic.h"
  5. 芯片复制#include "flash.h"
  6. #include "uart.h"
  7. #include "modem.h"
  8. #include "User_Timer.h"

  9. /*******************************************************************************
  10. * Local type definitions ('typedef')
  11. ******************************************************************************/

  12. /*******************************************************************************
  13. * Local pre-processor symbols/macros ('#define')
  14. ******************************************************************************/

  15. /*******************************************************************************
  16. * Global variable definitions (declared in header file with 'extern')
  17. ******************************************************************************/
  18. uint32_t JumpAddress;
  19. func_ptr_t JumpToApplication;

  20. /*******************************************************************************
  21. * Local function prototypes ('static')
  22. ******************************************************************************/
  23. static en_result_t IAP_JumpToApp(uint32_t u32Addr);
  24. static void IAP_ResetConfig(void);

  25. /*******************************************************************************
  26. * Local variable definitions ('static')
  27. ******************************************************************************/

  28. /*******************************************************************************
  29. * Function implementation - global ('extern') and local ('static')
  30. ******************************************************************************/
  31. /**
  32. *******************************************************************************
  33. ** \brief Initialize IAP
  34. **
  35. ** \param [in] None
  36. **
  37. ** \retval None
  38. **
  39. ******************************************************************************/
  40. void IAP_Init(void)
  41. {
  42.     SystemClock_Init();
  43.     LED_Init();
  44.     UART_Init();
  45. }

  46. /**
  47. *******************************************************************************
  48. ** \brief UART receive byte.
  49. **
  50. ** \param [out] u8RxData                   Pointer to Rx data.
  51. **
  52. ** \retval Ok                              Receive data finished.
  53. ** \retval Error                           Don't receive data.
  54. **
  55. ******************************************************************************/
  56. void IAP_Main(void)
  57. {
  58.     uint32_t u32AppFlag;
  59.     en_result_t enRet;

  60.     while (1)
  61.     {
  62.         enRet = Modem_Process(BOOT_WAIT_TIME);
  63.         if ((enRet == Ok) || (enRet == ErrorTimeout))
  64.         {
  65.             u32AppFlag = *(__IO uint32_t *)BOOT_PARA_ADDRESS;
  66.             if ((0xFFFF != u32AppFlag))
  67.             {
  68.                 if (Error == IAP_JumpToApp(APP_ADDRESS))
  69.                 {
  70.                     LED0_OFF();
  71.                     LED1_ON();   
  72.                 }
  73.             }
  74.             else
  75.             {
  76.                 LED0_ON();
  77.                 LED1_ON();
  78.             }
  79.         }
  80.         else
  81.         {
  82.             LED1_OFF();
  83.             LED0_ON();
  84.         }
  85.     }
  86. }

  87. /**
  88. *******************************************************************************
  89. ** \brief IAP main function
  90. **
  91. ** \param [in] u32Addr                     APP address
  92. **
  93. ** \retval Error                           APP address error
  94. **
  95. ******************************************************************************/
  96. static en_result_t IAP_JumpToApp(uint32_t u32Addr)
  97. {
  98.     uint32_t u32StackTop = *((__IO uint32_t *)u32Addr);

  99.     /* Check if user code is programmed starting from address "u32Addr" */
  100.     /* Check stack top pointer. */
  101.     if ((u32StackTop > SRAM_BASE) && (u32StackTop <= (SRAM_BASE + RAM_SIZE)))
  102.     {
  103.         IAP_ResetConfig();
  104.         /* Jump to user application */
  105.         JumpAddress = *(__IO uint32_t *)(u32Addr + 4);
  106.         JumpToApplication = (func_ptr_t)JumpAddress;
  107.         /* Initialize user application's Stack Pointer */
  108.         __set_MSP(*(__IO uint32_t *)u32Addr);
  109.         JumpToApplication();
  110.     }

  111.     return Error;
  112. }



联系方式

地址:石家庄市新华区民族路77号华强广场D座2009
电话:0311-88816616/87087811
手机:13315190088
传真:0311-67901001
联系人:张工
网址:www.taihedz.cn
邮箱:feixindz@163.com
微信:xinpianjiemi
QQ:527263666/568069805

在线客服
热线电话

企业微信