diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/common/ymodem.c b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/common/ymodem.c index 078ba3296..4032793ae 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/common/ymodem.c +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/common/ymodem.c @@ -23,11 +23,6 @@ #include "flash_for_ota.h" #include "boot_for_ota.h" -uint8_t tab_1024[1024] ={0}; -uint8_t FileName[FILE_NAME_LENGTH]; - - - /******************************************************************************* * 函 数 名: Ymodem_Receive * 功能描述: 使用ymodem协议接收文件 diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/flash_for_ota.h b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/flash_for_ota.h index 79aed412f..9e6a72a45 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/flash_for_ota.h +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/flash_for_ota.h @@ -25,7 +25,6 @@ #include "common.h" #define FLASH_PAGE_FAST_SIZE 256 -#define FLASH_BLOCK_SIZE 4096 typedef int32_t status_t; diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/ymodem.h b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/ymodem.h index d40b826fe..8de5dc59c 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/ymodem.h +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/ymodem.h @@ -24,32 +24,6 @@ #include -#define PACKET_SEQNO_INDEX (1) -#define PACKET_SEQNO_COMP_INDEX (2) - -#define PACKET_HEADER (3) -#define PACKET_TRAILER (2) -#define PACKET_OVERHEAD (PACKET_HEADER + PACKET_TRAILER) -#define PACKET_SIZE (128) -#define PACKET_1K_SIZE (1024) - -#define FILE_NAME_LENGTH (256) -#define FILE_SIZE_LENGTH (16) - -#define SOH (0x01) /* start of 128-byte data packet */ -#define STX (0x02) /* start of 1024-byte data packet */ -#define EOT (0x04) /* end of transmission */ -#define ACK (0x06) /* acknowledge */ -#define NAK (0x15) /* negative acknowledge */ -#define CA (0x18) /* two of these in succession aborts transfer */ -#define CRC16 (0x43) /* 'C' == 0x43, request 16-bit CRC */ - -#define ABORT1 (0x41) /* 'A' == 0x41, abort by user */ -#define ABORT2 (0x61) /* 'a' == 0x61, abort by user */ - -#define NAK_TIMEOUT (0x100000) -#define MAX_ERRORS (5) - int32_t SerialDownload(const uint32_t addr); int32_t Ymodem_Receive(uint8_t *buf, const uint32_t addr); diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/ota/flash_for_ota.c b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/ota/flash_for_ota.c index e2a3d4501..87e0b42ef 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/ota/flash_for_ota.c +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/ota/flash_for_ota.c @@ -23,12 +23,6 @@ #include "flash_for_ota.h" #include "ch32v20x_flash.h" -#if 0 -uint8_t NorFlash_BUFFER[4096]; //4K buffer cache -uint8_t buffer[FLASH_PAGE_SIZE]; //256 bytes buffer cache -#endif - - /******************************************************************************* * 函 数 名: FLASH_Init @@ -38,19 +32,8 @@ uint8_t buffer[FLASH_PAGE_SIZE]; //256 bytes buffer cache *******************************************************************************/ void FLASH_Init(void) { - #if 0 - /* Update LUT Table for Status, Write Enable, Erase and Program */ - ROM_FLEXSPI_NorFlash_UpdateLut(0, NOR_CMD_LUT_SEQ_IDX_READSTATUS, (const uint32_t *)FlashLookupTable.ReadStatus_Seq, 10U); - /* Use 30MHz Flexspi clock for safe operation */ - flexspi_clock_config(0, kFLEXSPISerialClk_30MHz, kFLEXSPIClk_DDR); - extern flexspi_nor_config_t Qspiflash_config; - flexspi_config_mcr1(0, &Qspiflash_config.memConfig); - flexspi_configure_dll(0, &Qspiflash_config.memConfig); - ROM_FLEXSPI_NorFlash_ClearCache(0); - #endif } - /******************************************************************************* * 函 数 名: FLASH_DeInit * 功能描述: Flash接口反初始化,需在完成Flash相关操作后进行调用 @@ -59,13 +42,6 @@ void FLASH_Init(void) *******************************************************************************/ void FLASH_DeInit(void) { - #if 0 - lookuptable_t clearlut; - memset(&clearlut, 0, sizeof(lookuptable_t)); - ROM_FLEXSPI_NorFlash_UpdateLut(0, NOR_CMD_LUT_SEQ_IDX_READSTATUS, (const uint32_t *)FlashLookupTable.ReadStatus_Seq, 10U); - /* Use 30MHz Flexspi clock for safe operation */ - flexspi_clock_config(0, kFLEXSPISerialClk_30MHz, kFLEXSPIClk_DDR); - #endif } /******************************************************************************* @@ -132,7 +108,6 @@ status_t Flash_Read(uint32_t addr, uint8_t *buf, uint32_t len) return 0; } - /******************************************************************************* * 函 数 名: Flash_Copy * 功能描述: 实现flash数据在分区之间的拷贝 @@ -143,61 +118,6 @@ status_t Flash_Read(uint32_t addr, uint8_t *buf, uint32_t len) *******************************************************************************/ status_t Flash_Copy(uint32_t srcAddr,uint32_t dstAddr, uint32_t imageSize) { - #if 0 - uint32_t PageNum, Remain, i; - status_t status; - - if((srcAddr == dstAddr) || imageSize > APP_FLASH_SIZE) - { - return (status_t)kStatus_Fail; - } - - status = Flash_Erase(dstAddr,imageSize); - if(status != kStatus_Success) - { - KPrintf("Erase flash 0x%08x failure !\r\n",dstAddr); - return status; - } - - PageNum = imageSize/FLASH_PAGE_SIZE; - Remain = imageSize%FLASH_PAGE_SIZE; - - for(i=0;i=SECTOR_SIZE) - { - status = Flash_Write(WriteAddr,dataBuff,dataLen); - if(status != kStatus_Success) - { - return status; - } - packetNum = 0; - dataLen = 0; - } - *FlashAddress += DataLength; - } - else - { - status = Flash_Write(WriteAddr,dataBuff,dataLen); - if(status != kStatus_Success) - { - return status; - } - packetNum = 0; - dataLen = 0; - } - return (status_t)kStatus_Success;; - #endif return 0; }