Skip to content

Commit

Permalink
externalize wipe sdcard
Browse files Browse the repository at this point in the history
  • Loading branch information
gullradriel committed Jan 27, 2025
1 parent aef7c2b commit 3e1541b
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 8 deletions.
1 change: 0 additions & 1 deletion firmware/application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions firmware/application/external/external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -199,4 +203,5 @@ set(EXTAPPLIST
app_manager
antenna_length
view_wav
sd_wipe
)
6 changes: 6 additions & 0 deletions firmware/application/external/external.ld
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
50 changes: 50 additions & 0 deletions firmware/application/external/sd_wipe/main.cpp
Original file line number Diff line number Diff line change
@@ -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<WipeSDView>();
}
} // 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
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

#include "ui_sd_wipe.hpp"

namespace ui {
using namespace ui;

namespace ui::external_app::sd_wipe {

Thread* WipeSDView::thread{nullptr};

Expand Down Expand Up @@ -63,4 +65,4 @@ void WipeSDView::focus() {
}
}

} /* namespace ui */
} // namespace ui::external_app::sd_wipe
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

#include <cstdint>

namespace ui {
using namespace ui;

namespace ui::external_app::sd_wipe {

class WipeSDView : public View {
public:
Expand Down Expand Up @@ -87,6 +89,6 @@ class WipeSDView : public View {
""};
};

} /* namespace ui */
} // namespace ui::external_app::sd_wipe

#endif /*__UI_SD_WIPE_H__*/
3 changes: 0 additions & 3 deletions firmware/application/ui_navigation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -151,7 +150,6 @@ const NavigationView::AppList NavigationView::appList = {
//{"sstv", "SSTV", RX, Color::dark_grey(), &bitmap_icon_sstv, new ViewFactory<NotImplementedView>()},
//{"tetra", "TETRA", RX, Color::dark_grey(), &bitmap_icon_tetra, new ViewFactory<NotImplementedView>()},
/* TX ********************************************************************/
//{"adsbtx", "ADS-B TX", TX, ui::Color::green(), &bitmap_icon_adsb, new ViewFactory<ADSBTxView>()},
{"aprstx", "APRS TX", TX, ui::Color::green(), &bitmap_icon_aprs, new ViewFactory<APRSTXView>()},
{"bht", "BHT Xy/EP", TX, ui::Color::green(), &bitmap_icon_bht, new ViewFactory<BHTView>()},
{"bletx", "BLE Tx", TX, ui::Color::green(), &bitmap_icon_btle, new ViewFactory<BLETxView>()},
Expand All @@ -170,7 +168,6 @@ const NavigationView::AppList NavigationView::appList = {
//{"testapp", "Test App", UTILITIES, Color::dark_grey(), nullptr, new ViewFactory<TestView>()},
// Dangerous apps.
{nullptr, "Flash Utility", UTILITIES, Color::red(), &bitmap_icon_peripherals_details, new ViewFactory<FlashUtilityView>()},
{nullptr, "Wipe SD card", UTILITIES, Color::red(), &bitmap_icon_tools_wipesd, new ViewFactory<WipeSDView>()},
};

const NavigationView::AppMap NavigationView::appMap = generate_app_map(NavigationView::appList);
Expand Down

0 comments on commit 3e1541b

Please sign in to comment.