Skip to content

Commit

Permalink
Update cookiecutter templates and remove deprecated functionality ahe…
Browse files Browse the repository at this point in the history
…ad of v3.5.0 release (#221)

* Remove deprecated `new --project` command (now fprime-bootstrap)

* Update OSAL init and deployment-named namespaces

* Fix spelling
  • Loading branch information
thomas-bc authored Oct 14, 2024
1 parent d1704ae commit 450729e
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 271 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// ======================================================================
// Used to access topology functions
#include <{{cookiecutter.deployment_name}}/Top/{{cookiecutter.deployment_name}}Topology.hpp>
// OSAL initialization
#include <Os/Os.hpp>
// Used for signal handling shutdown
#include <signal.h>
// Used for command line argument processing
Expand Down Expand Up @@ -58,6 +60,7 @@ int main(int argc, char* argv[]) {
CHAR* hostname = nullptr;
U16 port_number = 0;
{%- endif %}
Os::init();

// Loop while reading the getopt supplied options
{%- if cookiecutter.com_driver_type == "UART" %}
Expand Down Expand Up @@ -112,7 +115,7 @@ int main(int argc, char* argv[]) {

// Setup, cycle, and teardown topology
{{cookiecutter.deployment_name}}::setupTopology(inputs);
{{cookiecutter.deployment_name}}::startSimulatedCycle(Fw::Time(1,0)); // Program loop cycling rate groups at 1Hz
{{cookiecutter.deployment_name}}::startSimulatedCycle(Fw::TimeInterval(1,0)); // Program loop cycling rate groups at 1Hz
{{cookiecutter.deployment_name}}::teardownTopology(inputs);
(void)printf("Exiting...\n");
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// Necessary project-specified types
#include <Fw/Types/MallocAllocator.hpp>
#include <Os/Log.hpp>
#include <Svc/FramingProtocol/FprimeProtocol.hpp>

// Used for 1Hz synthetic cycling
Expand All @@ -19,9 +18,6 @@
// Allows easy reference to objects in FPP/autocoder required namespaces
using namespace {{cookiecutter.deployment_name}};

// Instantiate a system logger that will handle Fw::Logger::logMsg calls
Os::Log logger;

// The reference topology uses a malloc-based allocator for components that need to allocate memory during the
// initialization phase.
Fw::MallocAllocator mallocator;
Expand Down Expand Up @@ -63,18 +59,18 @@ enum TopologyConstants {

// Ping entries are autocoded, however; this code is not properly exported. Thus, it is copied here.
Svc::Health::PingEntry pingEntries[] = {
{PingEntries::blockDrv::WARN, PingEntries::blockDrv::FATAL, "blockDrv"},
{PingEntries::tlmSend::WARN, PingEntries::tlmSend::FATAL, "chanTlm"},
{PingEntries::cmdDisp::WARN, PingEntries::cmdDisp::FATAL, "cmdDisp"},
{PingEntries::cmdSeq::WARN, PingEntries::cmdSeq::FATAL, "cmdSeq"},
{PingEntries::eventLogger::WARN, PingEntries::eventLogger::FATAL, "eventLogger"},
{PingEntries::fileDownlink::WARN, PingEntries::fileDownlink::FATAL, "fileDownlink"},
{PingEntries::fileManager::WARN, PingEntries::fileManager::FATAL, "fileManager"},
{PingEntries::fileUplink::WARN, PingEntries::fileUplink::FATAL, "fileUplink"},
{PingEntries::prmDb::WARN, PingEntries::prmDb::FATAL, "prmDb"},
{PingEntries::rateGroup1::WARN, PingEntries::rateGroup1::FATAL, "rateGroup1"},
{PingEntries::rateGroup2::WARN, PingEntries::rateGroup2::FATAL, "rateGroup2"},
{PingEntries::rateGroup3::WARN, PingEntries::rateGroup3::FATAL, "rateGroup3"},
{PingEntries::{{cookiecutter.deployment_name}}_blockDrv::WARN, PingEntries::{{cookiecutter.deployment_name}}_blockDrv::FATAL, "blockDrv"},
{PingEntries::{{cookiecutter.deployment_name}}_tlmSend::WARN, PingEntries::{{cookiecutter.deployment_name}}_tlmSend::FATAL, "chanTlm"},
{PingEntries::{{cookiecutter.deployment_name}}_cmdDisp::WARN, PingEntries::{{cookiecutter.deployment_name}}_cmdDisp::FATAL, "cmdDisp"},
{PingEntries::{{cookiecutter.deployment_name}}_cmdSeq::WARN, PingEntries::{{cookiecutter.deployment_name}}_cmdSeq::FATAL, "cmdSeq"},
{PingEntries::{{cookiecutter.deployment_name}}_eventLogger::WARN, PingEntries::{{cookiecutter.deployment_name}}_eventLogger::FATAL, "eventLogger"},
{PingEntries::{{cookiecutter.deployment_name}}_fileDownlink::WARN, PingEntries::{{cookiecutter.deployment_name}}_fileDownlink::FATAL, "fileDownlink"},
{PingEntries::{{cookiecutter.deployment_name}}_fileManager::WARN, PingEntries::{{cookiecutter.deployment_name}}_fileManager::FATAL, "fileManager"},
{PingEntries::{{cookiecutter.deployment_name}}_fileUplink::WARN, PingEntries::{{cookiecutter.deployment_name}}_fileUplink::FATAL, "fileUplink"},
{PingEntries::{{cookiecutter.deployment_name}}_prmDb::WARN, PingEntries::{{cookiecutter.deployment_name}}_prmDb::FATAL, "prmDb"},
{PingEntries::{{cookiecutter.deployment_name}}_rateGroup1::WARN, PingEntries::{{cookiecutter.deployment_name}}_rateGroup1::FATAL, "rateGroup1"},
{PingEntries::{{cookiecutter.deployment_name}}_rateGroup2::WARN, PingEntries::{{cookiecutter.deployment_name}}_rateGroup2::FATAL, "rateGroup2"},
{PingEntries::{{cookiecutter.deployment_name}}_rateGroup3::WARN, PingEntries::{{cookiecutter.deployment_name}}_rateGroup3::FATAL, "rateGroup3"},
};

/**
Expand Down Expand Up @@ -180,7 +176,7 @@ void setupTopology(const TopologyState& state) {
Os::Mutex cycleLock;
volatile bool cycleFlag = true;

void startSimulatedCycle(Fw::Time interval) {
void startSimulatedCycle(Fw::TimeInterval interval) {
cycleLock.lock();
bool cycling = cycleFlag;
cycleLock.unLock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void teardownTopology(const TopologyState& state);
*
* \param milliseconds: milliseconds to delay for each cycle. Default: 1000 or 1Hz.
*/
void startSimulatedCycle(Fw::Time interval = Fw::Time(1,0));
void startSimulatedCycle(Fw::TimeInterval interval = Fw::TimeInterval(1,0));

/**
* \brief stop the simulated cycle started by startSimulatedCycle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,40 +52,40 @@ struct TopologyState {
* ```
*/
namespace PingEntries {
namespace blockDrv {
namespace {{cookiecutter.deployment_name}}_blockDrv {
enum { WARN = 3, FATAL = 5 };
}
namespace tlmSend {
namespace {{cookiecutter.deployment_name}}_tlmSend {
enum { WARN = 3, FATAL = 5 };
}
namespace cmdDisp {
namespace {{cookiecutter.deployment_name}}_cmdDisp {
enum { WARN = 3, FATAL = 5 };
}
namespace cmdSeq {
namespace {{cookiecutter.deployment_name}}_cmdSeq {
enum { WARN = 3, FATAL = 5 };
}
namespace eventLogger {
namespace {{cookiecutter.deployment_name}}_eventLogger {
enum { WARN = 3, FATAL = 5 };
}
namespace fileDownlink {
namespace {{cookiecutter.deployment_name}}_fileDownlink {
enum { WARN = 3, FATAL = 5 };
}
namespace fileManager {
namespace {{cookiecutter.deployment_name}}_fileManager {
enum { WARN = 3, FATAL = 5 };
}
namespace fileUplink {
namespace {{cookiecutter.deployment_name}}_fileUplink {
enum { WARN = 3, FATAL = 5 };
}
namespace prmDb {
namespace {{cookiecutter.deployment_name}}_prmDb {
enum { WARN = 3, FATAL = 5 };
}
namespace rateGroup1 {
namespace {{cookiecutter.deployment_name}}_rateGroup1 {
enum { WARN = 3, FATAL = 5 };
}
namespace rateGroup2 {
namespace {{cookiecutter.deployment_name}}_rateGroup2 {
enum { WARN = 3, FATAL = 5 };
}
namespace rateGroup3 {
namespace {{cookiecutter.deployment_name}}_rateGroup3 {
enum { WARN = 3, FATAL = 5 };
}
} // namespace PingEntries
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions src/fprime/util/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ def skip_build_loading(parsed):
"""Determines if the build load step should be skipped. Commands that do not require a build object
should manually be added here by the developer.
"""
if parsed.command == "new" and parsed.new_project:
return True
if parsed.command == "version-check":
return True
return False
Expand Down Expand Up @@ -174,13 +172,6 @@ def add_special_parsers(
dest="new_module",
help="Generate a new module",
)
new_exclusive.add_argument(
"--project",
default=False,
action="store_true",
dest="new_project",
help="Generate a new project",
)
new_exclusive.add_argument(
"--subtopology",
default=False,
Expand Down
3 changes: 0 additions & 3 deletions src/fprime/util/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
new_component,
new_deployment,
new_module,
new_project,
new_subtopology,
)

Expand Down Expand Up @@ -137,8 +136,6 @@ def run_new(
return new_deployment(build, parsed)
if parsed.new_module:
return new_module(build, parsed)
if parsed.new_project:
return new_project(parsed)
if parsed.new_subtopology:
return new_subtopology(build, parsed)
raise NotImplementedError(
Expand Down
Loading

0 comments on commit 450729e

Please sign in to comment.