Skip to content

Commit 8dc3851

Browse files
authored
externalize wipe sdcard (#2502)
1 parent aef7c2b commit 8dc3851

File tree

10 files changed

+69
-8
lines changed

10 files changed

+69
-8
lines changed

firmware/application/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ set(CPPSRC
305305
apps/ui_recon.cpp
306306
apps/ui_scanner.cpp
307307
apps/ui_sd_over_usb.cpp
308-
apps/ui_sd_wipe.cpp
309308
apps/ui_search.cpp
310309
apps/ui_settings.cpp
311310
apps/ui_siggen.cpp

firmware/application/external/external.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ set(EXTCPPSRC
158158
# wav viewer
159159
external/wav_view/main.cpp
160160
external/wav_view/ui_view_wav.cpp
161+
162+
# wipe sdcard
163+
external/sd_wipe/main.cpp
164+
external/sd_wipe/ui_sd_wipe.cpp
161165
)
162166

163167
set(EXTAPPLIST
@@ -199,4 +203,5 @@ set(EXTAPPLIST
199203
app_manager
200204
antenna_length
201205
view_wav
206+
sd_wipe
202207
)

firmware/application/external/external.ld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ MEMORY
6161
ram_external_app_app_manager(rwx) : org = 0xADD40000, len = 32k
6262
ram_external_app_antenna_length(rwx) : org = 0xADD50000, len = 32k
6363
ram_external_app_view_wav(rwx) : org = 0xADD60000, len = 32k
64+
ram_external_app_sd_wipe(rwx) : org = 0xADD70000, len = 32k
6465
}
6566

6667
SECTIONS
@@ -294,4 +295,9 @@ SECTIONS
294295
*(*ui*external_app*view_wav*);
295296
} > ram_external_app_view_wav
296297

298+
.external_app_sd_wipe : ALIGN(4) SUBALIGN(4)
299+
{
300+
KEEP(*(.external_app.app_sd_wipe.application_information));
301+
*(*ui*external_app*sd_wipe*);
302+
} > ram_external_app_sd_wipe
297303
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (C) 2024 Bernd Herzog
3+
*
4+
* This file is part of PortaPack.
5+
*
6+
* This program is free software; you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation; either version 2, or (at your option)
9+
* any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program; see the file COPYING. If not, write to
18+
* the Free Software Foundation, Inc., 51 Franklin Street,
19+
* Boston, MA 02110-1301, USA.
20+
*/
21+
22+
#include "ui.hpp"
23+
#include "ui_sd_wipe.hpp"
24+
#include "ui_navigation.hpp"
25+
#include "external_app.hpp"
26+
27+
namespace ui::external_app::sd_wipe {
28+
void initialize_app(ui::NavigationView& nav) {
29+
nav.push<WipeSDView>();
30+
}
31+
} // namespace ui::external_app::sd_wipe
32+
33+
extern "C" {
34+
35+
__attribute__((section(".external_app.app_sd_wipe.application_information"), used)) application_information_t _application_information_sd_wipe = {
36+
/*.memory_location = */ (uint8_t*)0x00000000,
37+
/*.externalAppEntry = */ ui::external_app::sd_wipe::initialize_app,
38+
/*.header_version = */ CURRENT_HEADER_VERSION,
39+
/*.app_version = */ VERSION_MD5,
40+
41+
/*.app_name = */ "Wipe SD card",
42+
/*.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},
43+
/*.icon_color = */ ui::Color::red().v,
44+
/*.menu_location = */ app_location_t::UTILITIES,
45+
/*.desired_menu_position = */ -1,
46+
47+
/*.m4_app_tag = portapack::spi_flash::image_tag_none */ {0, 0, 0, 0},
48+
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
49+
};
50+
}

firmware/application/apps/ui_sd_wipe.cpp renamed to firmware/application/external/sd_wipe/ui_sd_wipe.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
#include "ui_sd_wipe.hpp"
2424

25-
namespace ui {
25+
using namespace ui;
26+
27+
namespace ui::external_app::sd_wipe {
2628

2729
Thread* WipeSDView::thread{nullptr};
2830

@@ -63,4 +65,4 @@ void WipeSDView::focus() {
6365
}
6466
}
6567

66-
} /* namespace ui */
68+
} // namespace ui::external_app::sd_wipe

firmware/application/apps/ui_sd_wipe.hpp renamed to firmware/application/external/sd_wipe/ui_sd_wipe.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030

3131
#include <cstdint>
3232

33-
namespace ui {
33+
using namespace ui;
34+
35+
namespace ui::external_app::sd_wipe {
3436

3537
class WipeSDView : public View {
3638
public:
@@ -87,6 +89,6 @@ class WipeSDView : public View {
8789
""};
8890
};
8991

90-
} /* namespace ui */
92+
} // namespace ui::external_app::sd_wipe
9193

9294
#endif /*__UI_SD_WIPE_H__*/

firmware/application/ui_navigation.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
#include "ui_recon.hpp"
5555
#include "ui_scanner.hpp"
5656
#include "ui_sd_over_usb.hpp"
57-
#include "ui_sd_wipe.hpp"
5857
#include "ui_search.hpp"
5958
#include "ui_settings.hpp"
6059
#include "ui_siggen.hpp"
@@ -151,7 +150,6 @@ const NavigationView::AppList NavigationView::appList = {
151150
//{"sstv", "SSTV", RX, Color::dark_grey(), &bitmap_icon_sstv, new ViewFactory<NotImplementedView>()},
152151
//{"tetra", "TETRA", RX, Color::dark_grey(), &bitmap_icon_tetra, new ViewFactory<NotImplementedView>()},
153152
/* TX ********************************************************************/
154-
//{"adsbtx", "ADS-B TX", TX, ui::Color::green(), &bitmap_icon_adsb, new ViewFactory<ADSBTxView>()},
155153
{"aprstx", "APRS TX", TX, ui::Color::green(), &bitmap_icon_aprs, new ViewFactory<APRSTXView>()},
156154
{"bht", "BHT Xy/EP", TX, ui::Color::green(), &bitmap_icon_bht, new ViewFactory<BHTView>()},
157155
{"bletx", "BLE Tx", TX, ui::Color::green(), &bitmap_icon_btle, new ViewFactory<BLETxView>()},
@@ -170,7 +168,6 @@ const NavigationView::AppList NavigationView::appList = {
170168
//{"testapp", "Test App", UTILITIES, Color::dark_grey(), nullptr, new ViewFactory<TestView>()},
171169
// Dangerous apps.
172170
{nullptr, "Flash Utility", UTILITIES, Color::red(), &bitmap_icon_peripherals_details, new ViewFactory<FlashUtilityView>()},
173-
{nullptr, "Wipe SD card", UTILITIES, Color::red(), &bitmap_icon_tools_wipesd, new ViewFactory<WipeSDView>()},
174171
};
175172

176173
const NavigationView::AppMap NavigationView::appMap = generate_app_map(NavigationView::appList);

0 commit comments

Comments
 (0)