This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] LAUNCHXL-CC26X2R1:关于函数 oadImgBlockWrite

Guru**** 2589280 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1380007/launchxl-cc26x2r1-regarding-function-oadimgblockwrite

器件型号:LAUNCHXL-CC26X2R1

工具与软件:

尊敬的所有人:

我们来考虑一下 SDK v7.40中的这段代码

        else if (blkNum == (numBlksInImgHdr - 1))
        {
            ...

            ...
            status = oadValidateCandidateHdr((imgHdr_t * )&candidateImageHeader);
            if(status == OAD_SUCCESS)
            {
            ...
                status = oadEraseExtFlashPages(imagePage, candidateImageHeader.fixedHdr.len, pageSize);
                // Cancel OAD due to flash erase error
                if(FLASH_SUCCESS != status)
                {
                    return (OAD_FLASH_ERR);
                }

            ...


                // Write a OAD_BLOCK to Flash.
                status = writeFlashPg(imagePage, 0,
                                        (uint8_t * ) &candidateImageHeader,
                                        sizeof(imgHdr_t));

                // Cancel OAD due to flash program error
                if(FLASH_SUCCESS != status)
                {
                    return (OAD_FLASH_ERR);
                }


                // If there are non header (image data) bytes in this packet
                // write them to flash as well
                if(nonHeaderBytes)
                {
                    // Write a OAD_BLOCK to Flash.
                    status = writeFlashPg(imagePage,
                                            sizeof(imgHdr_t),
                                            (pValue+OAD_BLK_NUM_HDR_SZ+remainder),
                                            nonHeaderBytes);

                    // Cancel OAD due to flash program error
                    if(FLASH_SUCCESS != status)
                    {
                        return (OAD_FLASH_ERR);
                    }
                }
            }

我担心的是连续2次调用 writeFlashPg()。  

在它们中、失调电压已正确完成。 第一次调用的长度为141。 第二次调用的长度为99。

但它们都指向同一 imagePage 计数器变量。

在我正在使用的存储器中(通常为256块大小和4096扇区大小)、您无法做到这一点。

您必须一次性写入256块大小的内容。 嗯、不完全是、但您不能进行扩展超过256的写入。

因此、我想我需要向存储器驱动程序代码中添加一些边界检查逻辑吗?  

提前感谢您的参与。