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: Confused by line of code in BIM

Guru 18595 points
Part Number: LAUNCHXL-CC26X2R1

Dear,

Let's see if you can help me understand what I am seeing here, maybe I am just too tired.

SimpleLink SDK == v.5.2.

Project "bim".

Function "static void Bim_checkImages(void)", more precisely line 762.

    /* First try finding a valid image on off-chip flash */
    if( !(retVal = checkImagesExtFlash() ) )
    {
        /* Could not find valid image on off-chip Flash.
         * Try finding application image on on-chip flash and jump to it */
       checkImagesIntFlash(0);
    }

It is my understanding the condition should skip the "!". I mean checkImagesINTFlash(0) should be called when checkImagesEXTFlash returns 1, which means could not find copy and boot any external image.

Please let me know your opinion.

  • checkImagesExtFlash checks for stored images on external flash. If valid image is found to be copied, it copies the image and if the image is executable it will jump to execute. checkImagesExtFlash would return  SUCCESS (0x0) if no valid external flash metadata not found indicating the image to be copied. For such case, the "if( !(retVal = checkImagesExtFlash() ) )" would be true and calls checkImagesIntFlash to try finding application image on on-chip flash and jump to it. It seems reasonable.

  • What about the first lines of:

    static int8_t checkImagesExtFlash(void)
    {
        ExtImageInfo_t metadataHdr;
        int8_t flashPageNum = 0;
    
        uint8_t status;
        uint32_t eFlStrAddr; /* will be populated on reading a VALID meta data */
        int8_t securityStatus = FAIL;
    
        /* Initialize external flash driver. */
        if(!extFlashOpen())
        {
            return(FAIL);
        }

    If it returns FAIL, which is 1, this condition --> if( !(retVal = checkImagesExtFlash() ) ) will be 0, so the line checkImagesIntFlash(0); will NOT run. However, failing to access EXTERNAL flash is precisely a good reason to try to check the INTERNAL one.

    For me, something is odd here. I managed to make what I wanted to do using the RELEASE build configuration but for DEBUG, I am not understanding it.

  • I agree your point on failing to access EXTERNAL flash is precisely a good reason to try to check the INTERNAL one. I suppose this is only TI reference design and you can revise it according to your application requirement.

  • It's a bit weird indeed.

    Sometimes there is just too much documentation between SimpleLink Academy, Application Notes, the code itself, the SDK. Obviously it's a tremendous amount of work but all this OTAA part I have seen lots of people having problems with it. Disappointed

  • There is always something needed to be improved and I believe that's why TI E2E forum exists.