From 02810bf527bfe919a3fb68e10b701024954c7abd Mon Sep 17 00:00:00 2001 From: Totoo Date: Fri, 15 Dec 2023 20:18:21 +0100 Subject: [PATCH] Move Jammer ext app (with baseband image too) (#1647) --- firmware/application/CMakeLists.txt | 2 +- firmware/application/external/external.cmake | 5 ++ firmware/application/external/external.ld | 9 ++ firmware/application/external/jammer/main.cpp | 82 +++++++++++++++++++ .../{apps => external/jammer}/ui_jammer.cpp | 7 +- .../{apps => external/jammer}/ui_jammer.hpp | 4 +- firmware/application/ui_navigation.cpp | 8 +- firmware/baseband/CMakeLists.txt | 13 +-- 8 files changed, 114 insertions(+), 16 deletions(-) create mode 100644 firmware/application/external/jammer/main.cpp rename firmware/application/{apps => external/jammer}/ui_jammer.cpp (98%) rename firmware/application/{apps => external/jammer}/ui_jammer.hpp (98%) diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index 4a8a5dece..a7dcaecd6 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -273,7 +273,7 @@ set(CPPSRC apps/ui_freqman.cpp apps/ui_fsk_rx.cpp apps/ui_iq_trim.cpp - apps/ui_jammer.cpp + # apps/ui_jammer.cpp # apps/ui_keyfob.cpp # apps/ui_lcr.cpp apps/ui_level.cpp diff --git a/firmware/application/external/external.cmake b/firmware/application/external/external.cmake index bc7be0d2c..b2c397708 100644 --- a/firmware/application/external/external.cmake +++ b/firmware/application/external/external.cmake @@ -40,6 +40,10 @@ set(EXTCPPSRC external/lcr/main.cpp external/lcr/ui_lcr.cpp + + #lcr + external/jammer/main.cpp + external/jammer/ui_jammer.cpp ) set(EXTAPPLIST @@ -53,4 +57,5 @@ set(EXTAPPLIST coasterp lge lcr + jammer ) diff --git a/firmware/application/external/external.ld b/firmware/application/external/external.ld index b7881291b..27727f7e3 100644 --- a/firmware/application/external/external.ld +++ b/firmware/application/external/external.ld @@ -27,6 +27,7 @@ MEMORY ram_external_app_coasterp(rwx) : org = 0xEEF00000, len = 32k ram_external_app_lge(rwx) : org = 0xEEF10000, len = 32k ram_external_app_lcr(rwx) : org = 0xEEF20000, len = 32k + ram_external_app_jammer(rwx) : org = 0xEEF30000, len = 32k } SECTIONS @@ -93,4 +94,12 @@ SECTIONS *(*ui*external_app*lcr*); } > ram_external_app_lcr + + .external_app_jammer : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.external_app.app_jammer.application_information)); + *(*ui*external_app*jammer*); + } > ram_external_app_jammer + + } diff --git a/firmware/application/external/jammer/main.cpp b/firmware/application/external/jammer/main.cpp new file mode 100644 index 000000000..8fe3403bd --- /dev/null +++ b/firmware/application/external/jammer/main.cpp @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2023 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_jammer.hpp" +#include "ui_navigation.hpp" +#include "external_app.hpp" + +namespace ui::external_app::jammer { +void initialize_app(ui::NavigationView& nav) { + nav.push(); +} +} // namespace ui::external_app::jammer + +extern "C" { + +__attribute__((section(".external_app.app_jammer.application_information"), used)) application_information_t _application_information_jammer = { + /*.memory_location = */ (uint8_t*)0x00000000, + /*.externalAppEntry = */ ui::external_app::jammer::initialize_app, + /*.header_version = */ CURRENT_HEADER_VERSION, + /*.app_version = */ VERSION_MD5, + + /*.app_name = */ "Jammer", + /*.bitmap_data = */ { + 0xE0, + 0x07, + 0xF8, + 0x1F, + 0x1C, + 0x38, + 0x0E, + 0x78, + 0x06, + 0x7C, + 0x03, + 0xCE, + 0x03, + 0xC7, + 0x83, + 0xC3, + 0xC3, + 0xC1, + 0xE3, + 0xC0, + 0x73, + 0xC0, + 0x3E, + 0x60, + 0x1E, + 0x70, + 0x1C, + 0x38, + 0xF8, + 0x1F, + 0xE0, + 0x07, + }, + /*.icon_color = */ ui::Color::green().v, + /*.menu_location = */ app_location_t::TX, + + /*.m4_app_tag = portapack::spi_flash::image_tag_jammer */ {'P', 'J', 'A', 'M'}, + /*.m4_app_offset = */ 0x00000000, // will be filled at compile time +}; +} diff --git a/firmware/application/apps/ui_jammer.cpp b/firmware/application/external/jammer/ui_jammer.cpp similarity index 98% rename from firmware/application/apps/ui_jammer.cpp rename to firmware/application/external/jammer/ui_jammer.cpp index 50945cb4e..19fd689ee 100644 --- a/firmware/application/apps/ui_jammer.cpp +++ b/firmware/application/external/jammer/ui_jammer.cpp @@ -29,7 +29,7 @@ using namespace portapack; -namespace ui { +namespace ui::external_app::jammer { void RangeView::focus() { check_enabled.focus(); @@ -331,7 +331,8 @@ JammerView::JammerView( NavigationView& nav) : nav_{nav} { Rect view_rect = {0, 3 * 8, 240, 80}; - baseband::run_image(portapack::spi_flash::image_tag_jammer); + // baseband::run_image(portapack::spi_flash::image_tag_jammer); + baseband::run_prepared_image(portapack::memory::map::m4_code.base()); add_children({&tab_view, &view_range_a, @@ -372,4 +373,4 @@ JammerView::JammerView( }; } -} /* namespace ui */ +} // namespace ui::external_app::jammer diff --git a/firmware/application/apps/ui_jammer.hpp b/firmware/application/external/jammer/ui_jammer.hpp similarity index 98% rename from firmware/application/apps/ui_jammer.hpp rename to firmware/application/external/jammer/ui_jammer.hpp index 41a8c85ca..b3e2550e1 100644 --- a/firmware/application/apps/ui_jammer.hpp +++ b/firmware/application/external/jammer/ui_jammer.hpp @@ -33,7 +33,7 @@ using namespace jammer; -namespace ui { +namespace ui::external_app::jammer { class RangeView : public View { public: @@ -242,4 +242,4 @@ class JammerView : public View { }}; }; -} /* namespace ui */ +} // namespace ui::external_app::jammer diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 4efa7f5db..921204b15 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -47,9 +47,9 @@ #include "ui_freqman.hpp" #include "ui_fsk_rx.hpp" #include "ui_iq_trim.hpp" -#include "ui_jammer.hpp" -// #include "ui_keyfob.hpp" -// #include "ui_lcr.hpp" +// #include "ui_jammer.hpp" //moved to ext +// #include "ui_keyfob.hpp" +// #include "ui_lcr.hpp" #include "ui_level.hpp" #include "ui_looking_glass_app.hpp" #include "ui_mictx.hpp" @@ -593,7 +593,7 @@ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) { {"BLE Tx", ui::Color::green(), &bitmap_icon_btle, [&nav]() { nav.push(); }}, // {"BurgerPgr", ui::Color::yellow(), &bitmap_icon_burger, [&nav]() { nav.push(); }}, //moved to ext {"GPS Sim", ui::Color::green(), &bitmap_icon_gps_sim, [&nav]() { nav.push(); }}, - {"Jammer", ui::Color::green(), &bitmap_icon_jammer, [&nav]() { nav.push(); }}, + //{"Jammer", ui::Color::green(), &bitmap_icon_jammer, [&nav]() { nav.push(); }}, //moved to ext // { "Key fob", ui::Color::orange(), &bitmap_icon_keyfob, [&nav](){ nav.push(); }}, // {"LGE", ui::Color::yellow(), &bitmap_icon_lge, [&nav]() { nav.push(); }}, //moved to ext {"Morse", ui::Color::green(), &bitmap_icon_morse, [&nav]() { nav.push(); }}, diff --git a/firmware/baseband/CMakeLists.txt b/firmware/baseband/CMakeLists.txt index 7e13e5415..dff2da685 100644 --- a/firmware/baseband/CMakeLists.txt +++ b/firmware/baseband/CMakeLists.txt @@ -419,12 +419,6 @@ set(MODE_CPPSRC ) DeclareTargets(PFSR fskrx) -### Jammer - -set(MODE_CPPSRC - proc_jammer.cpp -) -DeclareTargets(PJAM jammer) ### Microphone transmit @@ -622,6 +616,13 @@ set(MODE_CPPSRC DeclareTargets(PNRR nrfrx) +### Jammer + +set(MODE_CPPSRC + proc_jammer.cpp +) +DeclareTargets(PJAM jammer) + ### AM TV set(MODE_CPPSRC