fprime/RPI/Main.cpp
Rob Bocchino da11b3a7c5
Improve warning flags in builds (#3319)
* Update fpp version

Add more warnings to FppTest

* Update fpp version

Add warnings to build

* Enable warnings in unit tests

Fix warnings

* Clean up test code

* Update fpp version

Remove workarounds in unit test builds

* Update fpp version

Fix warnings

* Revise DpManager tests

Remove conversion warnings

* Revise DpWriter tests

Remove conversion warnings

* Refactor Hash

Provide a size type to remove dependencies on NATIVE_INT_TYPE,
which is going away.

* Revise top-level CMakeLists.txt

* Fix warnings in Ref

* Fix warnings in Ref, RPI

* Revise warning flags

* Revise code to eliminate warnings

* Revise code to fix warnings

* Revise code to fix warnings

* Revise code to fix warnings

* Revise Serializable.cpp

* Revise Serializable.cpp

* Revise warning flags

* Fix warnings in test code

* Fix warnings

* Fix warnings

* Fix warnings and static analysis errors

* Fix warnings

* Fix warnings

* Fix warnings

* Fix warnings

* Fix warnings

* Turn off -Wshadow for unit tests

* Revise comments

* Fix warnings

* Fix warnings

* Fix warnings

* Fix warnings

* Fix warnings

* Fix warnings

* Fix warnings

* Fix warnings

* Fix warnings

* Enable -Wshadow for main ut builds

* Revise compile options

* Remove commented-out code

* Update STest

Eliminate warnings

* Fix warning

* Fix warnings

* Fix warning

* Fix warning

* Fix warning

* Revise comments

* Revise static cast expression

* Cast return type to void

* Remove unneeded cast

* Fix warnings that appear on the F Prime dev machine

* Fix more warnings

* Enable more warnings

* Update fpp version

* Remove commented-out compiler flags

* Enable warning flag in CmdDispatcher

* Disable -Wconversion in gtest

* Revise compiler warning flags

* Revise compiler options

* Revise compiler flags

* Revise compiler flags

* Revise compiler flags

* Revise compiler flags

* Revise Buffer

* Fix comments

* Fix warning flags

* Fix compiler warning flags

* Fix compiler warnings

* Fix compiler warning flags

* Fix compiler warnings

* Fix compiler warning flags

* Fix compiler warning flags

* Fix compiler warning flags

* Fix compiler warning flags

* Fix compiler warning flags

* Fix compiler warning flags

* Fix compiler warning flags

* Fix compiler warning flags

* Revise compiler warning flags

* Restore deleted test

* Fixing UT_TARGET collision

---------

Co-authored-by: Robert L Bocchino <bocchino@fprime-fsw-0.jpl.nasa.gov>
Co-authored-by: Michael D Starch <Michael.D.Starch@jpl.nasa.gov>
Co-authored-by: M Starch <LeStarch@googlemail.com>
2025-03-12 12:04:43 -07:00

70 lines
1.7 KiB
C++

#include <cstdio>
#include <cstdlib>
#include <ctype.h>
#include <getopt.h>
#include <signal.h>
#include <Os/Os.hpp>
#include <Fw/Time/Time.hpp>
#include <RPI/Top/RPITopologyAc.hpp>
RPI::TopologyState state;
void print_usage(const char* app) {
(void) printf("Usage: ./%s [options]\n-p\tport_number\n-a\thostname/IP address\n",app);
}
// Handle a signal, e.g. control-C
static void sighandler(int signum) {
// Call the teardown function
// This causes the Linux timer to quit
RPI::teardown(state);
}
int main(int argc, char* argv[]) {
Os::init();
I32 option = 0;
while ((option = getopt(argc, argv, "hp:a:")) != -1){
switch(option) {
case 'h':
print_usage(argv[0]);
return 0;
break;
case 'p':
state.portNumber = static_cast<U16>(atoi(optarg));
break;
case 'a':
state.hostName = optarg;
break;
case '?':
return 1;
default:
print_usage(argv[0]);
return 1;
}
}
(void) printf("Hit Ctrl-C to quit\n");
RPI::setup(state);
// register signal handlers to exit program
signal(SIGINT,sighandler);
signal(SIGTERM,sighandler);
// Start the Linux timer.
// The timer runs on the main thread until it quits
// in the teardown function, called from the signal
// handler.
RPI::linuxTimer.startTimer(100); //!< 10Hz
// Signal handler was called, and linuxTimer quit.
// Time to exit the program.
// Give time for threads to exit.
(void) printf("Waiting for threads...\n");
Os::Task::delay(Fw::TimeInterval(1, 0));
(void) printf("Exiting...\n");
return 0;
}