src/occBootLoader/bootMain.c
// Function Specification
//
//  Name: boot_load_image
//
//  Description: This function copies main application (405)
//               image from main memory to SRAM
//
// End Function Specification
Function Specification
Name: boot_load_image

This function copies main application (405)
image from main memory to SRAM

End Function Specification
Function Specification Name : boot_load_image This function copies main application ( 405 ) image from main memory to SRAM End Function Specification
uint32_t boot_load_405(const imageHdr_t* i_hdrAddr)
{
    uint32_t l_rc = 0x0;
    uint32_t l_mainAppDestRange = (i_hdrAddr->start_addr) +
                                 (i_hdrAddr->image_size-1);
    if((l_mainAppDestRange < SRAM_START_ADDRESS_405) ||
       (l_mainAppDestRange > SRAM_END_ADDRESS_405))
    {
        if(l_mainAppDestRange != 0)
        {
            l_rc = l_mainAppDestRange;
        }
        else
        {
            l_rc = EYE_CATCHER_ADDRESS;
        }
    }
    else if((i_hdrAddr->start_addr < SRAM_START_ADDRESS_405) ||
            (i_hdrAddr->start_addr > SRAM_END_ADDRESS_405))
    {
        if(i_hdrAddr->start_addr != 0)
        {
            l_rc = i_hdrAddr->start_addr;
        }
        else
        {
            l_rc = EYE_CATCHER_ADDRESS;
        }
    }
    else
    {
        uint8_t *l_srcPtr = (uint8_t *)(i_hdrAddr);
        uint8_t *l_destPtr = (uint8_t *)(i_hdrAddr->start_addr);
        uint32_t l_numWords = i_hdrAddr->image_size;
        while(l_numWords != 0)
        {
            *l_destPtr = *l_srcPtr;
            l_destPtr++;
            l_srcPtr++;
            l_numWords--;
        }
    }
    return l_rc;
}
uint32_t boot_load_405 ( const imageHdr_t * i_hdrAddr ) { uint32_t l_rc = 0x0 ; uint32_t l_mainAppDestRange = ( i_hdrAddr -> start_addr ) + ( i_hdrAddr -> image_size - 1 ) ; if ( ( l_mainAppDestRange < SRAM_START_ADDRESS_405 ) || ( l_mainAppDestRange > SRAM_END_ADDRESS_405 ) ) { if ( l_mainAppDestRange != 0 ) { l_rc = l_mainAppDestRange ; } else { l_rc = EYE_CATCHER_ADDRESS ; } } else if ( ( i_hdrAddr -> start_addr < SRAM_START_ADDRESS_405 ) || ( i_hdrAddr -> start_addr > SRAM_END_ADDRESS_405 ) ) { if ( i_hdrAddr -> start_addr != 0 ) { l_rc = i_hdrAddr -> start_addr ; } else { l_rc = EYE_CATCHER_ADDRESS ; } } else { uint8_t * l_srcPtr = ( uint8_t * ) ( i_hdrAddr ) ; uint8_t * l_destPtr = ( uint8_t * ) ( i_hdrAddr -> start_addr ) ; uint32_t l_numWords = i_hdrAddr -> image_size ; while ( l_numWords != 0 ) { * l_destPtr = * l_srcPtr ; l_destPtr ++ ; l_srcPtr ++ ; l_numWords -- ; } } return l_rc ; }
Function Specification
Name: boot_load_image
Function Specification Name : boot_load_image
// Make sure main application destination rang address falls within SRAM // range. // Return destination range address if address is out of range and // address is not zero. If address is zero, then return eye-catcher // address. // Make sure main application start address falls within SRAM range // Return start address if address is out of range and // address is not zero. If address is zero, then return eye-catcher // address. // At this point we know that main application destination address // is within SRAM range. // Now copy main application (405) from main memory to SRAM.