Skip to content

Commit

Permalink
Build firmware erasers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerivec committed Nov 1, 2024
1 parent 4ae4ddc commit 0c04173
Show file tree
Hide file tree
Showing 15 changed files with 279 additions and 0 deletions.
9 changes: 9 additions & 0 deletions manifests/aeotec/aeotec_zga008_firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: ZGA008 Firmware Eraser
device: EFR32MG21A020F1024IM32
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
9 changes: 9 additions & 0 deletions manifests/easyiot/easyiot_zb-gw04-1v1_firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: ZB-GW04-1v1 Firmware Eraser
device: EFR32MG21A020F768IM32
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
9 changes: 9 additions & 0 deletions manifests/easyiot/easyiot_zb-gw04-1v2_firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: ZB-GW04-1v2 Firmware Eraser
device: EFR32MG21A020F768IM32
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
9 changes: 9 additions & 0 deletions manifests/nabucasa/nabucasa_skyconnect_firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: SkyConnect Firmware Eraser
device: EFR32MG21A020F512IM32
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
9 changes: 9 additions & 0 deletions manifests/nabucasa/nabucasa_yellow_firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Yellow Firmware Eraser
device: MGM210PA32JIA
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
9 changes: 9 additions & 0 deletions manifests/smlight/smlight_slzb06m_firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: SLZB-06M Firmware Eraser
device: EFR32MG21A020F768IM32
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
9 changes: 9 additions & 0 deletions manifests/smlight/smlight_slzb07Mg24_firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: SLZB-07Mg24 Firmware Eraser
device: EFR32MG24A020F1024IM40
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
9 changes: 9 additions & 0 deletions manifests/smlight/smlight_slzb07_firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: SLZB-07 Firmware Eraser
device: EFR32MG21A020F768IM32
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
9 changes: 9 additions & 0 deletions manifests/sonoff/sonoff_zbdonglee_firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: ZBDongle-E Firmware Eraser
device: EFR32MG21A020F768IM32
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
9 changes: 9 additions & 0 deletions manifests/tubeszb/tubeszb-mgm24-firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: TubesZB MGM24 Firmware Eraser
device: MGM240PA32VNN
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
9 changes: 9 additions & 0 deletions manifests/tubeszb/tubeszb-mgm24PB-firmware_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: TubesZB MGM24PB Firmware Eraser
device: MGM240PB32VNN
base_project: src/firmware_eraser
filename: "{manifest_name}_{sdk_version}"
sdk: "simplicity_sdk:2024.6.2"
toolchain: "12.2.1.20221205"

gbl:
fw_type: firmware_eraser
58 changes: 58 additions & 0 deletions src/firmware_eraser/app.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/***************************************************************************//**
* @file
* @brief Top level application functions
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
#include <stdlib.h>

#include <em_msc.h>
#include <em_chip.h>

#include <btl_interface.h>

void bootloader_rebootAndInstall(void)
{
// Set reset reason to bootloader entry
BootloaderResetCause_t* resetCause = (BootloaderResetCause_t*) (SRAM_BASE);
resetCause->reason = BOOTLOADER_RESET_REASON_BADAPP;
resetCause->signature = BOOTLOADER_RESET_SIGNATURE_INVALID;
#if defined(RMU_PRESENT)
// Clear resetcause
RMU->CMD = RMU_CMD_RCCLR;
// Trigger a software system reset
RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_SYSRMODE_MASK) | RMU_CTRL_SYSRMODE_FULL;
#endif
NVIC_SystemReset();
}

/***************************************************************************//**
* Initialize application.
******************************************************************************/
void app_init(void)
{
// This will set the program counter (startOfAppSpace + 4) to 0xFFFFFFFF, which
// breaks the bootloader early with `BOOTLOADER_RESET_REASON_BADAPP`.
MSC_Init();
MSC_ErasePage((uint32_t*)BTL_APPLICATION_BASE);
MSC_Deinit();

bootloader_rebootAndInstall();
}

/***************************************************************************//**
* App ticking function.
******************************************************************************/
void app_process_action(void)
{
}
31 changes: 31 additions & 0 deletions src/firmware_eraser/app.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/***************************************************************************//**
* @file
* @brief Top level application functions
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/

#ifndef APP_H
#define APP_H

/***************************************************************************//**
* Initialize application.
******************************************************************************/
void app_init(void);

/***************************************************************************//**
* App ticking function.
******************************************************************************/
void app_process_action(void);

#endif // APP_H
33 changes: 33 additions & 0 deletions src/firmware_eraser/firmware_eraser.slcp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
project_name: firmware_eraser
package: platform
quality: production
label: Firmware Eraser
description: Erase the firmware
category: Example|Platform
filter:
- name: "Device Type"
value: ["SoC"]
- name: "MCU"
value: ["32-bit MCU"]
- name: "Project Difficulty"
value: ["Beginner"]

source:
- path: app.cpp
- path: main.cpp

include:
- path: .
file_list:
- path: app.h

component:
- id: sl_system
- id: device_init
- id: clock_manager
- id: cpp_support
- id: bootloader_app_properties
- id: bootloader_interface

define:
- name: DEBUG_EFM
58 changes: 58 additions & 0 deletions src/firmware_eraser/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/***************************************************************************//**
* @file main.cpp
* @brief main() function.
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
#include "sl_component_catalog.h"
#include "sl_system_init.h"
#include "app.h"
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#include "sl_power_manager.h"
#endif
#if defined(SL_CATALOG_KERNEL_PRESENT)
#include "sl_system_kernel.h"
#else // SL_CATALOG_KERNEL_PRESENT
#include "sl_system_process_action.h"
#endif // SL_CATALOG_KERNEL_PRESENT

int main(void)
{
// Initialize Silicon Labs device, system, service(s) and protocol stack(s).
// Note that if the kernel is present, processing task(s) will be created by
// this call.
sl_system_init();

// Initialize the application. For example, create periodic timer(s) or
// task(s) if the kernel is present.
app_init();

#if defined(SL_CATALOG_KERNEL_PRESENT)
// Start the kernel. Task(s) created in app_init() will start running.
sl_system_kernel_start();
#else // SL_CATALOG_KERNEL_PRESENT
while (1) {
// Do not remove this call: Silicon Labs components process action routine
// must be called from the super loop.
sl_system_process_action();

// Application process.
app_process_action();

#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
// Let the CPU go to sleep if the system allows it.
sl_power_manager_sleep();
#endif
}
#endif // SL_CATALOG_KERNEL_PRESENT
}

0 comments on commit 0c04173

Please sign in to comment.