diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index d6762f218..05d2b5851 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -305,7 +305,6 @@ set(CPPSRC apps/ui_recon.cpp apps/ui_scanner.cpp apps/ui_sd_over_usb.cpp - apps/ui_sd_wipe.cpp apps/ui_search.cpp apps/ui_settings.cpp apps/ui_siggen.cpp diff --git a/firmware/application/external/external.cmake b/firmware/application/external/external.cmake index 0aca5875d..75ffd606d 100644 --- a/firmware/application/external/external.cmake +++ b/firmware/application/external/external.cmake @@ -158,6 +158,10 @@ set(EXTCPPSRC # wav viewer external/wav_view/main.cpp external/wav_view/ui_view_wav.cpp + + # wipe sdcard + external/sd_wipe/main.cpp + external/sd_wipe/ui_sd_wipe.cpp ) set(EXTAPPLIST @@ -199,4 +203,5 @@ set(EXTAPPLIST app_manager antenna_length view_wav + sd_wipe ) diff --git a/firmware/application/external/external.ld b/firmware/application/external/external.ld index 5c571c434..edb82367c 100644 --- a/firmware/application/external/external.ld +++ b/firmware/application/external/external.ld @@ -61,6 +61,7 @@ MEMORY ram_external_app_app_manager(rwx) : org = 0xADD40000, len = 32k ram_external_app_antenna_length(rwx) : org = 0xADD50000, len = 32k ram_external_app_view_wav(rwx) : org = 0xADD60000, len = 32k + ram_external_app_sd_wipe(rwx) : org = 0xADD70000, len = 32k } SECTIONS @@ -294,4 +295,9 @@ SECTIONS *(*ui*external_app*view_wav*); } > ram_external_app_view_wav + .external_app_sd_wipe : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.external_app.app_sd_wipe.application_information)); + *(*ui*external_app*sd_wipe*); + } > ram_external_app_sd_wipe } diff --git a/firmware/application/external/sd_wipe/.main.cpp.swp b/firmware/application/external/sd_wipe/.main.cpp.swp new file mode 100644 index 000000000..61fed4d3c Binary files /dev/null and b/firmware/application/external/sd_wipe/.main.cpp.swp differ diff --git a/firmware/application/external/sd_wipe/.ui_sd_wipe.cpp.swp b/firmware/application/external/sd_wipe/.ui_sd_wipe.cpp.swp new file mode 100644 index 000000000..130817719 Binary files /dev/null and b/firmware/application/external/sd_wipe/.ui_sd_wipe.cpp.swp differ diff --git a/firmware/application/external/sd_wipe/.ui_sd_wipe.hpp.swp b/firmware/application/external/sd_wipe/.ui_sd_wipe.hpp.swp new file mode 100644 index 000000000..a6f404141 Binary files /dev/null and b/firmware/application/external/sd_wipe/.ui_sd_wipe.hpp.swp differ diff --git a/firmware/application/external/sd_wipe/main.cpp b/firmware/application/external/sd_wipe/main.cpp new file mode 100644 index 000000000..09a304212 --- /dev/null +++ b/firmware/application/external/sd_wipe/main.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2024 Bernd Herzog + * + * This file is part of PortaPack. + * + * 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, 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include "ui.hpp" +#include "ui_sd_wipe.hpp" +#include "ui_navigation.hpp" +#include "external_app.hpp" + +namespace ui::external_app::sd_wipe { +void initialize_app(ui::NavigationView& nav) { + nav.push(); +} +} // namespace ui::external_app::sd_wipe + +extern "C" { + +__attribute__((section(".external_app.app_sd_wipe.application_information"), used)) application_information_t _application_information_sd_wipe = { + /*.memory_location = */ (uint8_t*)0x00000000, + /*.externalAppEntry = */ ui::external_app::sd_wipe::initialize_app, + /*.header_version = */ CURRENT_HEADER_VERSION, + /*.app_version = */ VERSION_MD5, + + /*.app_name = */ "Wipe SD card", + /*.bitmap_data = */ {0xF0, 0x3F, 0x58, 0x35, 0x5C, 0x35, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0x3C, 0x1C, 0xBC, 0xC9, 0xBC, 0xE3, 0x2C, 0x77, 0x5C, 0x3E, 0xAC, 0x1C, 0x5C, 0x3E, 0x2C, 0x77, 0x9C, 0xE3, 0xAC, 0xC1}, + /*.icon_color = */ ui::Color::red().v, + /*.menu_location = */ app_location_t::UTILITIES, + /*.desired_menu_position = */ -1, + + /*.m4_app_tag = portapack::spi_flash::image_tag_none */ {0, 0, 0, 0}, + /*.m4_app_offset = */ 0x00000000, // will be filled at compile time +}; +} diff --git a/firmware/application/apps/ui_sd_wipe.cpp b/firmware/application/external/sd_wipe/ui_sd_wipe.cpp similarity index 94% rename from firmware/application/apps/ui_sd_wipe.cpp rename to firmware/application/external/sd_wipe/ui_sd_wipe.cpp index c035691bc..a482e784a 100644 --- a/firmware/application/apps/ui_sd_wipe.cpp +++ b/firmware/application/external/sd_wipe/ui_sd_wipe.cpp @@ -22,7 +22,9 @@ #include "ui_sd_wipe.hpp" -namespace ui { +using namespace ui; + +namespace ui::external_app::sd_wipe { Thread* WipeSDView::thread{nullptr}; @@ -63,4 +65,4 @@ void WipeSDView::focus() { } } -} /* namespace ui */ +} // namespace ui::external_app::sd_wipe diff --git a/firmware/application/apps/ui_sd_wipe.hpp b/firmware/application/external/sd_wipe/ui_sd_wipe.hpp similarity index 95% rename from firmware/application/apps/ui_sd_wipe.hpp rename to firmware/application/external/sd_wipe/ui_sd_wipe.hpp index d3b873470..886d97d60 100644 --- a/firmware/application/apps/ui_sd_wipe.hpp +++ b/firmware/application/external/sd_wipe/ui_sd_wipe.hpp @@ -30,7 +30,9 @@ #include -namespace ui { +using namespace ui; + +namespace ui::external_app::sd_wipe { class WipeSDView : public View { public: @@ -87,6 +89,6 @@ class WipeSDView : public View { ""}; }; -} /* namespace ui */ +} // namespace ui::external_app::sd_wipe #endif /*__UI_SD_WIPE_H__*/ diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 5b2a04e8d..b8650dfcc 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -54,7 +54,6 @@ #include "ui_recon.hpp" #include "ui_scanner.hpp" #include "ui_sd_over_usb.hpp" -#include "ui_sd_wipe.hpp" #include "ui_search.hpp" #include "ui_settings.hpp" #include "ui_siggen.hpp" @@ -151,7 +150,6 @@ const NavigationView::AppList NavigationView::appList = { //{"sstv", "SSTV", RX, Color::dark_grey(), &bitmap_icon_sstv, new ViewFactory()}, //{"tetra", "TETRA", RX, Color::dark_grey(), &bitmap_icon_tetra, new ViewFactory()}, /* TX ********************************************************************/ - //{"adsbtx", "ADS-B TX", TX, ui::Color::green(), &bitmap_icon_adsb, new ViewFactory()}, {"aprstx", "APRS TX", TX, ui::Color::green(), &bitmap_icon_aprs, new ViewFactory()}, {"bht", "BHT Xy/EP", TX, ui::Color::green(), &bitmap_icon_bht, new ViewFactory()}, {"bletx", "BLE Tx", TX, ui::Color::green(), &bitmap_icon_btle, new ViewFactory()}, @@ -170,7 +168,6 @@ const NavigationView::AppList NavigationView::appList = { //{"testapp", "Test App", UTILITIES, Color::dark_grey(), nullptr, new ViewFactory()}, // Dangerous apps. {nullptr, "Flash Utility", UTILITIES, Color::red(), &bitmap_icon_peripherals_details, new ViewFactory()}, - {nullptr, "Wipe SD card", UTILITIES, Color::red(), &bitmap_icon_tools_wipesd, new ViewFactory()}, }; const NavigationView::AppMap NavigationView::appMap = generate_app_map(NavigationView::appList);