SLVAFL1 October   2024 TPS25751 , TPS26750

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2EEPROM Boot Flow
    1. 2.1 Boot Process
    2. 2.2 Updating the EEPROM Image
    3. 2.3 Commands
    4. 2.4 EEPROM Update Example
  6. 3Source Code Example
    1. 3.1 UpdateRegionOfEeprom()
    2. 3.2 UpdateRegionOfEeprom_Step1
    3. 3.3 UpdateRegionOfEeprom_Step2()
    4. 3.4 UpdatingRegionOfEeprom_Step3()
    5. 3.5 UpdatingRegionOfEeprom_Step4()
    6. 3.6 WriteRegionPointer()
  7. 4Recovering From EEPROM Failure
  8. 5Summary
  9. 6References

UpdateRegionOfEeprom()

const uint32_t region_ptr_start[NUM_OF_REGIONS] = {0x0 , 0x400 };
const uint32_t region_ptr_appconfig_offset[NUM_OF_REGIONS] = {0x3FC, 0x7FC };
const uint32_t region_addr_patchbundle[NUM_OF_REGIONS] = {0x800, 0x4400};
static int32_t UpdateRegionOfEeprom()
{
s_AppContext *const pCtx = &gAppCtx;
int32_t retVal = -1;
UART_PRINT("\n\rActive Region is [%d] - Region being updated is [%d]\n\r",\
pCtx->active_region, pCtx->inactive_region);
/*
* Region-0/Region-1 is currently active, hence update Region-1/Region-0 respectively
*/
retVal = UpdateRegionOfEeprom_Step1(pCtx->inactive_region);
if(0 != retVal)
{
UART_PRINT("Region[%d] update Step 1 failed.! Next boot will happen from Region[%d]\n\r",\
pCtx->inactive_region, pCtx->active_region);
goto error;
}
/*
* Region-0/Region-1 is currently active, hence update Region-1/Region-0 respectively
*/
retVal = UpdateRegionOfEeprom_Step2(pCtx->inactive_region);
if(0 != retVal)
{
UART_PRINT("Region[%d] update Step 2 failed.! Next boot will happen from Region[%d]\n\r",\
pCtx->inactive_region, pCtx->active_region);
goto error;
}
/*
* Write is through. Now verify if the content/copy is valid.
* Update the corresponding region-pointer point to the new region.
*/
retVal = UpdateRegionOfEeprom_Step3(pCtx->inactive_region);
if(0 != retVal)
{
UART_PRINT("Region[%d] update Step 3 failed.! Next boot will happen from Region[%d]\n\r",\
pCtx->inactive_region, pCtx->active_region);
goto error;
}
/*
* Invalidate the region-pointer of the old region.
*/
retVal = UpdateRegionOfEeprom_Step4(pCtx->active_region);
if(0 != retVal) {goto error;}
error:
SignalEvent(APP_EVENT_END_UPDATE);
return retVal;
}