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

CycloneBOOT Bootloader common functions. More...

#include "core/cboot_error.h"
#include "image/image.h"
#include "second_stage/boot.h"

Go to the source code of this file.

Macros

#define INIT_VECT_SIZE   16
 

Functions

void bootChangeState (BootContext *context, BootState newState)
 Update Bootloader state.
 
cboot_error_t bootInitPrimaryMem (BootContext *context, BootSettings *settings)
 Intialize bootloader primary flash memory.
 
cboot_error_t bootInitSecondaryMem (BootContext *context, BootSettings *settings)
 Initialize bootloader secondary (external) flash memory.
 
cboot_error_t bootSelectUpdateImageSlot (BootContext *context, Slot *selectedSlot)
 
cboot_error_t bootSelectRepairImageSlot (BootContext *context, Slot *selectedSlot)
 Select a slot holding an image that can repair the running application. Accepts an equal image index, never a lower one.
 
cboot_error_t bootUpdateApp (BootContext *context, Slot *slot)
 Update current application. Basically it decrypt/copy an image from the external flash memory into the internal flash memory.
 
cboot_error_t bootBackupCurrentApp (BootContext *context, Slot *updateSlot)
 Back up the running application before an update is installed. The copy is written as is. When the update slots are encrypted the application makes the backup instead, through updateCreateBackup().
 
cboot_error_t bootReadbackVerifyImage (Slot *slot)
 Read back and verify the image just installed in the given slot. Re-reads the slot from flash and re-checks its CRC32 whole-image integrity.
 
cboot_error_t bootCheckImage (BootContext *context, Slot *slot)
 Check image validity within the given slot.
 
cboot_error_t bootCheckRuntimeImage (BootContext *context, Slot *slot)
 Check signature or integrity of current running image.
 
cboot_error_t bootGetSlotImgHeader (Slot *slot, ImageHeader *header)
 Get header from the image inside the given slot.
 
cboot_error_t bootCheckSlotAppResetVector (Slot *slot)
 Check reset vector of the current application firmware binary.
 
const FlashDriver * bootGetSlotDriver (const Slot *slot)
 Resolve the flash driver backing a slot.
 

Detailed Description

CycloneBOOT Bootloader common functions.

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

◆ bootBackupCurrentApp()

cboot_error_t bootBackupCurrentApp ( BootContext *  context,
Slot *  updateSlot 
)

Back up the running application before an update is installed. The copy is written as is. When the update slots are encrypted the application makes the backup instead, through updateCreateBackup().

Parameters
[in]contextPointer to the bootloader context
[in]updateSlotSlot holding the incoming update image
Returns
Status code

◆ bootChangeState()

void bootChangeState ( BootContext *  context,
BootState  newState 
)

Update Bootloader state.

Parameters
[in]contextPointer to the Bootloader context
[in]newStateNew state to switch to

◆ bootCheckImage()

cboot_error_t bootCheckImage ( BootContext *  context,
Slot *  slot 
)

Check image validity within the given slot.

Parameters
[in]slotPointer to the slot containing the image to be checked.
Returns
Error code.

◆ bootCheckRuntimeImage()

cboot_error_t bootCheckRuntimeImage ( BootContext *  context,
Slot *  slot 
)

Check signature or integrity of current running image.

Parameters
[in]slotPointer to the slot containing the image to be checked.
Returns
Error code.

◆ bootCheckSlotAppResetVector()

cboot_error_t bootCheckSlotAppResetVector ( Slot *  slot)

Check reset vector of the current application firmware binary.

Parameters
[in]slotPointer to the slot that contains the application firmware binary.
Returns
Error code.

◆ bootGetSlotDriver()

const FlashDriver * bootGetSlotDriver ( const Slot *  slot)

Resolve the flash driver backing a slot.

Parameters
[in]slotPointer to the slot
Returns
Pointer to the slot's flash driver

◆ bootGetSlotImgHeader()

cboot_error_t bootGetSlotImgHeader ( Slot *  slot,
ImageHeader *  header 
)

Get header from the image inside the given slot.

Parameters
[in]slotPointer to the slot that contains the image header
[out]headerPointer that will hold the retrieved image header.
Returns
Error code.

◆ bootInitPrimaryMem()

cboot_error_t bootInitPrimaryMem ( BootContext *  context,
BootSettings *  settings 
)

Intialize bootloader primary flash memory.

Parameters
[in,out]contextPointer the bootloader context.
[in]settingsBootloader user settings used to initialize primary flash.
Returns
Error code

◆ bootInitSecondaryMem()

cboot_error_t bootInitSecondaryMem ( BootContext *  context,
BootSettings *  settings 
)

Initialize bootloader secondary (external) flash memory.

Parameters
[in,out]contextPointer the bootloader context.
[in]settingsBootloader user settings used to initialize secondary flash.
Returns
Error code

◆ bootReadbackVerifyImage()

cboot_error_t bootReadbackVerifyImage ( Slot *  slot)

Read back and verify the image just installed in the given slot. Re-reads the slot from flash and re-checks its CRC32 whole-image integrity.

Parameters
[in]slotPointer to the freshly written destination slot.
Returns
Error code.

◆ bootSelectRepairImageSlot()

cboot_error_t bootSelectRepairImageSlot ( BootContext *  context,
Slot *  selectedSlot 
)

Select a slot holding an image that can repair the running application. Accepts an equal image index, never a lower one.

Parameters
[in]contextPointer to the bootloader context
[out]selectedSlotSlot holding the repair image
Returns
Error code

◆ bootUpdateApp()

cboot_error_t bootUpdateApp ( BootContext *  context,
Slot *  slot 
)

Update current application. Basically it decrypt/copy an image from the external flash memory into the internal flash memory.

Parameters
[in]contextPointer to Bootloader context
[in]slotPointer to the slot in the external flash memory that contains the new application
Returns
Status code