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.

CCS/CC2640R2F-Q1: OAD Off-Chip function to copy factory image into external flash memory

Part Number: CC2640R2F-Q1


Tool/software: Code Composer Studio

Hi,

Working with example simple_peripheral_oad_offchip from SDK v3.10.00.15 and CCS v9.0.1

I use a custom board with a 8Mbytes flash external memory and i need to copy a factory image into this external flash memory.

I have check function in bim_main.c from bim_oad_offchip_cc2640r2lp_app if this function already exist. I fund the function "isLastMetaData" with this brief:

/*******************************************************************************
 * @fn     isLastMetaData
 *
 * @brief  Copies the internal application + stack image to the external flash
 *         to serve as the permanent resident image in external flash.
 *
 * @param  flashPageNum - Flash page number to start search for external flash
 *         metadata
 *
 * @return flashPageNum - Valid flash page number if metadata is found.
 *         IMG_HDR_FOUND - if metadat starting form specified flash page not found
 *         EMPTY_METADATA - if it is empty flashif metadata not found.
 */

It seems to me that the brief of this function does not correspond to its true utility. This function is used to search image metadata in external flash.

My question is: Is there already a function that copies a factory image from the internal flash memory to the external flash memory ?

Best regards

  • Vincent,

    I've assigned your post to someone internally who will assist you here. 

  • I found this declaration in the oad.h file of the application's OAD.

    /*!
     * This function creates factory image backup of current running image
     *
     * @return  @ref OAD_SUCCESS on successful erasure else
     *          @ref OAD_FLASH_ERR
     */
    extern uint8_t oadCreateFactoryImageBackup(void);

    It's seem to be the function I search but I didn't find the function in oad.c.

    Regards

  • Hi Vincent,

    This declaration is actually a non used function in the CC2640R2 SDK. It is not supposed to be there and will be removed from the file, so firstly, thanks for the notice.

    Secondly, I'm obligated to go out and mention that factory image handling is not supported on CC2640R2 by TI, but with that being said, I can point you in the right direction.
    The function does exist in the CC26X2 SDK in oad.c, so I'd recommend you download the SDK and try to port as much as you can from there back to your project with the CC2640R2.

    Best Regards,
    Yuval

  • Hi,

    Thanks for the answer. I'm gonna check the function in this SDK 

    Best Regards

  • HI,

    I was able to retrieve the copy function "uint8_t oadCreateFactoryImageBackup(void)" and adapt it for the CC2640R2.

    To test this I need a BIM function to check factory image in external flash after the function "checkImagesIntFlash(0);" in "bim_main.c" file.

    /*******************************************************************************
     * @fn     Bim_checkImages
     *
     * @brief  Check for stored images on external flash needed to be copied and
     *         execute. If there is no image to be copied, execute on-chip image.
     *
     * @param  none
     *
     * @return none
     */
    void Bim_checkImages(void)
    {
    #ifndef DEBUG
       
        checkImagesExtFlash();
    
        /*  Find executable on onchip flash and execute */
        checkImagesIntFlash(0);

    Is there somewhere a function to go check the presence of an factory image in the external memory?

    I didn't find it in examples code from CC26X2 SDK.

    Best regards,

    Vincent

  • Hi Vincent,

    From the BLE5 Stack User's Guide:

    The convention is that image header sector 0 is reserved for the Factory Image. This region should be reserved for known good images as the BIM will revert to the factory image if there are no acceptable images in internal or external flash (user section).

    So the assumption is that the factory image is the first image in the external flash and the checks that are done in isLastMetaData just basically check the image header.

    There is no specific function to check the factory image.

    Best Regards,
    Yuval