Zstack里OTA的HAL_OTA_DL和HAL_OTA_RC是什么意思,指的是待更新设备和协调器吗?Image指的是镜像文件吗?
- /******************************************************************************
- * @fn dl2rc
- *
- * [url=home.php?mod=space&uid=159083]@brief[/url] Copy the DL image to the RC image location.
- *
- * NOTE: Assumes that DL image ends on a flash word boundary.
- *
- * @param None.
- *
- * @return None.
- */
- static void dl2rc(void)
- {
- uint32 oset;
- OTA_SubElementHdr_t subElement;
- OTA_ImageHeader_t header;
- uint16 addr = HAL_OTA_RC_START / HAL_FLASH_WORD_SIZE;
- uint8 buf[4];
- // Determine the length and starting point of the upgrade image
- HalOTARead(0, (uint8 *)&header, sizeof(OTA_ImageHeader_t), HAL_OTA_DL);
- HalOTARead(header.headerLength, (uint8*)&subElement, OTA_SUB_ELEMENT_HDR_LEN, HAL_OTA_DL);
- for (oset = 0; oset < subElement.length; oset += HAL_FLASH_WORD_SIZE)
- {
- HalOTARead(oset + header.headerLength + OTA_SUB_ELEMENT_HDR_LEN, buf, HAL_FLASH_WORD_SIZE, HAL_OTA_DL);
- if ((addr % (HAL_FLASH_PAGE_SIZE / HAL_FLASH_WORD_SIZE)) == 0)
- {
- HalFlashErase(addr / (HAL_FLASH_PAGE_SIZE / HAL_FLASH_WORD_SIZE));
- }
- HalFlashWrite(addr++, buf, 1);
- }
- }
复制代码
此帖出自
小平头技术问答
一周热门 更多>