CycloneBOOT 2.6.6
Secure Bootloader for ARM Cortex-M MCU
Loading...
Searching...
No Matches
boot_fallback.c File Reference

CycloneBOOT Bootloader fallback managment. More...

#include "boot_fallback.h"
#include "debug.h"
#include "image/image.h"
#include "second_stage/boot.h"
#include "second_stage/boot_common.h"

Macros

#define TRACE_LEVEL   CBOOT_TRACE_LEVEL
 

Functions

cboot_error_t fallbackFindSlotWithEquivImg (BootContext *context, Slot **slotEquivImg, Memory *memories)
 Search for the fallback slot that contains the image equivalent of the current image in internal flash slot. "Equivalent" means that the image to be found will have the same index than the current image in internal flash.
 
cboot_error_t fallbackCompareSlots (Slot *slot1, Slot *slot2, int8_t *res)
 Compare two given slots together with respect to the index of the images inside the slots.
 
cboot_error_t fallbackDeleteSlot (Slot *slot)
 Delete the given slot. In other words it erase the content of the given slot.
 
cboot_error_t fallbackRestoreBackupSlot (BootContext *context, Slot *slot)
 Restore the image contained in the backup slot. It will extract the firmware application from the image inside the backup slot. Then a new image that old the back application firmware will be generated in internal memory slot. It will allow the system to boot to the backup application firmware.
 
bool_t bootIsFallbackAvailable (BootContext *context)
 Report whether a fall back to a previous firmware is possible.
 
cboot_error_t fallbackTask (BootContext *context, Memory *memories)
 Fallback Task routine.
 

Detailed Description

CycloneBOOT Bootloader fallback managment.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2021-2026 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneBOOT Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.6.6

Function Documentation

◆ bootIsFallbackAvailable()

bool_t bootIsFallbackAvailable ( BootContext *  context)

Report whether a fall back to a previous firmware is possible.

Parameters
[in]contextPointer to the Bootloader context
Returns
TRUE if a fall back could be performed, FALSE otherwise

◆ fallbackCompareSlots()

cboot_error_t fallbackCompareSlots ( Slot *  slot1,
Slot *  slot2,
int8_t *  res 
)

Compare two given slots together with respect to the index of the images inside the slots.

  • If the image index of the first slot (slot1) is strictly inferior to the image index of the first slot (slot1) then result will be -1.
  • If the image index of the first slot (slot1) is equal to the image index of the first slot (slot1) then result will be 0.
  • Otherwise the result will be 1.
    Parameters
    [in]slot1Pointer to the first slot to be compared with.
    [in]slot2Pointer to the second slot to be compared with.
    [ou]res Result of the slot comparison.
    Returns
    Error code.

◆ fallbackDeleteSlot()

cboot_error_t fallbackDeleteSlot ( Slot *  slot)

Delete the given slot. In other words it erase the content of the given slot.

Parameters
[in]slotPointer to the slot to be deleted.
Returns
Error code.

◆ fallbackFindSlotWithEquivImg()

cboot_error_t fallbackFindSlotWithEquivImg ( BootContext *  context,
Slot **  slotEquivImg,
Memory *  memories 
)

Search for the fallback slot that contains the image equivalent of the current image in internal flash slot. "Equivalent" means that the image to be found will have the same index than the current image in internal flash.

Parameters
[in]contextPointer to bootloader context.
[out]slotEquivImgPointer to the slot that holding the equivalent image.
Returns
Error code.

◆ fallbackRestoreBackupSlot()

cboot_error_t fallbackRestoreBackupSlot ( BootContext *  context,
Slot *  slot 
)

Restore the image contained in the backup slot. It will extract the firmware application from the image inside the backup slot. Then a new image that old the back application firmware will be generated in internal memory slot. It will allow the system to boot to the backup application firmware.

Parameters
[in]slotPointer to the slot to be deleted.
Returns
Error code.

◆ fallbackTask()

cboot_error_t fallbackTask ( BootContext *  context,
Memory *  memories 
)

Fallback Task routine.

Parameters
[in]contextPointer to the Bootloader context
Returns
Status Code