Skip to content

Commit

Permalink
Merge pull request #25 from fprime-community/update/v3.5.0
Browse files Browse the repository at this point in the history
Updates Baremetal to v3.5.0
  • Loading branch information
LeStarch authored Oct 29, 2024
2 parents 45c7a56 + a19fae7 commit e1abea5
Show file tree
Hide file tree
Showing 42 changed files with 457 additions and 267 deletions.
22 changes: 16 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
.vscode
.idea
venv
**/logs
**/build-artifacts
**/build-fprime-*
# fprime items
logs/
cmake-build-*
build-artifacts/
build-fprime-*
*-template
*.template.cpp
*.template.hpp

# Misc
/venv/
/fprime-venv/
/.idea/
/.vscode/
.DS_Store
*.gcov
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[submodule "fprime"]
path = fprime
path = lib/fprime
url = https://github.com/nasa/fprime.git
branch = devel
[submodule "lib/arduino/RadioHead"]
path = lib/arduino/RadioHead
url = https://github.com/PaulStoffregen/RadioHead.git
[submodule "lib/arduino/fprime-arduino"]
path = lib/arduino/fprime-arduino
path = lib/fprime-arduino
url = https://github.com/fprime-community/fprime-arduino.git
branch = devel
[submodule "lib/fprime-baremetal"]
Expand Down
33 changes: 10 additions & 23 deletions BaremetalReference/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,23 @@
#include <BaremetalReference/Top/BaremetalReferenceTopologyAc.hpp>
#include <BaremetalReference/Top/BaremetalReferenceTopology.hpp>
// Used for Task Runner
#include <Os/Baremetal/TaskRunner/TaskRunner.hpp>
#include <fprime-baremetal/Os/TaskRunner/TaskRunner.hpp>

// Used for logging
#include <Os/Log.hpp>
#include <Arduino/Os/StreamLog.hpp>

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

// Task Runner
Os::TaskRunner taskrunner;
#include <Fw/Logger/Logger.hpp>
#include <Arduino/Os/Console.hpp>

/**
* \brief execute the program
*
* This F´ program is designed to run in standard environments (e.g. Linux/macOs running on a laptop). Thus it uses
* command line inputs to specify how to connect.
*
* @return: 0 on success, something else on failure
* \brief setup the program
*/
void setup()
{
// Setup Serial
Serial.begin(115200); //Uart Comm
Serial1.begin(115200); //logging
Os::setArduinoStreamLogHandler(&Serial1);
Serial.begin(115200); //Uart Comm and logging
static_cast<Os::Arduino::StreamConsoleHandle*>(Os::Console::getSingleton().getHandle())->setStreamHandler(Serial);

delay(1000);
Fw::Logger::logMsg("Program Started\n");
Fw::Logger::log("Program Started\n");

// Object for communicating state to the reference topology
BaremetalReference::TopologyState inputs;
Expand All @@ -43,13 +32,11 @@ void setup()

// Setup, cycle, and teardown topology
BaremetalReference::setupTopology(inputs);
// BaremetalReference::teardownTopology(inputs);
}

void loop()
{
void loop() {
#ifdef USE_BASIC_TIMER
rateDriver.cycle();
#endif
taskrunner.run();
Os::Baremetal::TaskRunner::getSingleton().run();
}
10 changes: 2 additions & 8 deletions BaremetalReference/Top/BaremetalReferenceTopology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
// ======================================================================
// Provides access to autocoded functions
#include <BaremetalReference/Top/BaremetalReferenceTopologyAc.hpp>
#include <BaremetalReference/Top/BaremetalReferencePacketsAc.hpp>
#include <config/FppConstantsAc.hpp>

#include "Fw/Logger/Logger.hpp"
#include "FprimeArduino.hpp"
// Necessary project-specified types
#include <Fw/Types/MallocAllocator.hpp>
#include <Svc/FramingProtocol/FprimeProtocol.hpp>
Expand Down Expand Up @@ -96,23 +96,17 @@ void setupTopology(const TopologyState& state) {
// loadParameters();
// Autocoded task kick-off (active components). Function provided by autocoder.
startTasks(state);

// Configure hardware rate driver
rateDriver.configure(1);

// Configure GPIO pins
gpioDriver.open(Arduino::DEF_LED_BUILTIN, Arduino::GpioDriver::GpioDirection::OUT);
//gpioRadioReset.open(Radio::RFM69_RST, Arduino::GpioDriver::GpioDirection::OUT); //***Turn off for Uart Comm

// Configure I2C driver
i2cDriver.open(&Wire);

// Configure IMU
imu.setup(Sensors::IMU_MPU9250::I2cDevAddr::AD0_0);

// Configure StreamDriver / UART
comDriver.configure(&Serial); //***turn off if using radio

// Start hardware rate driver
rateDriver.start();
}
Expand Down
5 changes: 0 additions & 5 deletions BaremetalReference/Top/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@

set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/instances.fpp"
"${CMAKE_CURRENT_LIST_DIR}/BaremetalReferencePackets.xml"
"${CMAKE_CURRENT_LIST_DIR}/topology.fpp"
"${CMAKE_CURRENT_LIST_DIR}/BaremetalReferenceTopology.cpp"
)
set(MOD_DEPS
Fw/Logger
Arduino/ArduinoTime
Arduino/Drv/StreamDriver
Arduino/Drv/I2cDriver
Os/Baremetal/TaskRunner
)

register_fprime_module()
2 changes: 1 addition & 1 deletion BaremetalReference/Top/instances.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module BaremetalReference {

instance fatalAdapter: Svc.AssertFatalAdapter base id 0x4100

instance fatalHandler: Svc.FatalHandler base id 0x4200
instance fatalHandler: Baremetal.FatalHandler base id 0x4200

instance systemTime: Arduino.ArduinoTime base id 0x4300 \

Expand Down
2 changes: 1 addition & 1 deletion BaremetalReference/Top/topology.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module BaremetalReference {
instance commQueue
instance deframer
instance eventLogger
instance fatalAdapter
# instance fatalAdapter
instance fatalHandler
instance framer
instance gpioDriver
Expand Down
35 changes: 12 additions & 23 deletions BaseDeployment/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,23 @@
#include <BaseDeployment/Top/BaseDeploymentTopologyAc.hpp>
#include <BaseDeployment/Top/BaseDeploymentTopology.hpp>
// Used for Task Runner
#include <Os/Baremetal/TaskRunner/TaskRunner.hpp>
#include <fprime-baremetal/Os/TaskRunner/TaskRunner.hpp>

// Used for logging
#include <Os/Log.hpp>
#include <Arduino/Os/StreamLog.hpp>

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

// Task Runner
Os::TaskRunner taskrunner;
#include <Fw/Logger/Logger.hpp>
#include <Arduino/Os/Console.hpp>

/**
* \brief execute the program
*
* This F´ program is designed to run in standard environments (e.g. Linux/macOs running on a laptop). Thus it uses
* command line inputs to specify how to connect.
*
* @return: 0 on success, something else on failure
* \brief setup the program
*/
void setup()
{
Serial.begin(115200);
Os::setArduinoStreamLogHandler(&Serial);
// Setup Serial
Serial.begin(115200); //Uart Comm and logging
static_cast<Os::Arduino::StreamConsoleHandle*>(Os::Console::getSingleton().getHandle())->setStreamHandler(Serial);

delay(1000);
Fw::Logger::logMsg("Program Started\n");
Fw::Logger::log("Program Started\n");

// Object for communicating state to the reference topology
BaseDeployment::TopologyState inputs;
Expand All @@ -41,13 +32,11 @@ void setup()

// Setup, cycle, and teardown topology
BaseDeployment::setupTopology(inputs);
// BaseDeployment::teardownTopology(inputs);
}

void loop()
{
void loop() {
#ifdef USE_BASIC_TIMER
rateDriver.cycle();
#endif
taskrunner.run();
}
Os::Baremetal::TaskRunner::getSingleton().run();
}
5 changes: 0 additions & 5 deletions BaseDeployment/Top/BaseDeploymentPackets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
<channel name="systemResources.NON_VOLATILE_FREE"/>
</packet>

<packet name="SystemRes2" id="6" level="2">
<channel name="systemResources.FRAMEWORK_VERSION"/>
<channel name="systemResources.PROJECT_VERSION"/>
</packet>

<packet name="SystemRes3" id="7" level="2">
<channel name="systemResources.CPU"/>
<channel name="systemResources.CPU_00"/>
Expand Down
3 changes: 0 additions & 3 deletions BaseDeployment/Top/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ set(SOURCE_FILES
)
set(MOD_DEPS
Fw/Logger
Arduino/ArduinoTime
Arduino/Drv/StreamDriver
Os/Baremetal/TaskRunner
)

register_fprime_module()
2 changes: 1 addition & 1 deletion BaseDeployment/Top/instances.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module BaseDeployment {

instance fatalAdapter: Svc.AssertFatalAdapter base id 0x4200

instance fatalHandler: Svc.FatalHandler base id 0x4300
instance fatalHandler: Baremetal.FatalHandler base id 0x4300

instance systemTime: Arduino.ArduinoTime base id 0x4400 \

Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
####
cmake_minimum_required(VERSION 3.13)
project(BareMetal C CXX)

###
# F' Core Setup
# This includes all of the F prime core components, and imports the make-system.
###
include("${CMAKE_CURRENT_LIST_DIR}/fprime/cmake/FPrime.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/lib/fprime/cmake/FPrime.cmake")
# NOTE: register custom targets between these two lines
include("${FPRIME_FRAMEWORK_PATH}/cmake/FPrime-Code.cmake")

# This includes project-wide objects
include("${CMAKE_CURRENT_LIST_DIR}/project.cmake")
set_target_properties(Svc_FatalHandler PROPERTIES EXCLUDE_FROM_ALL TRUE)
35 changes: 35 additions & 0 deletions CMakeUserPresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": 4,
"configurePresets": [
{
"name": "rp2040",
"inherits": "fprime",
"displayName": "RP2040 Release Preset",
"description": "F´ release build using local fprime-venv",
"binaryDir": "${sourceDir}/build-fprime-automatic-featherrp2040",
"cacheVariables": {
"CMAKE_DEBUG_OUTPUT": "ON"
},
"toolchainFile": "${sourceDir}/lib/fprime-arduino/cmake/toolchain/featherrp2040.cmake"
},
{
"name": "rp2040-debug",
"inherits": [
"fprime-debug",
"rp2040"
],
"displayName": "RP2040 Debug Preset",
"description": "RP2040 debug build using local fprime-venv"
},
{
"name": "teensy41",
"inherits": "fprime",
"displayName": "F´ Cross-Compile Preset",
"description": "F´ Cross-Compile build using local fprime-venv",
"binaryDir": "${sourceDir}/build-fprime-automatic-teensy41",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/lib/fprime-arduino/cmake/toolchain/teensy41.cmake"
}
}
]
}
2 changes: 1 addition & 1 deletion Components/LedBlinker/LedBlinker.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module Components {
format "Invalid Blinking Argument: {}"

@ Reports the state we set to blinking.
event SetBlinkingState(state: Fw.On) \
event SetBlinkingState($state: Fw.On) \
severity activity high \
format "Set blinking state to {}."

Expand Down
4 changes: 2 additions & 2 deletions Components/Radio/RFM69/RFM69.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <Components/Radio/RFM69/RFM69.hpp>
#include <FpConfig.hpp>
#include <Os/Log.hpp>
#include <Fw/Logger/Logger.hpp>

namespace Radio {

Expand Down Expand Up @@ -111,7 +111,7 @@ void RFM69 ::run_handler(const NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context
}

if (!rfm69.init()) {
Fw::Logger::logMsg("Failed to initialize radio... Trying again...\n");
Fw::Logger::log("Failed to initialize radio... Trying again...\n");
return;
}

Expand Down
33 changes: 11 additions & 22 deletions RadioPassthrough/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,23 @@
#include <RadioPassthrough/Top/RadioPassthroughTopologyAc.hpp>
#include <RadioPassthrough/Top/RadioPassthroughTopology.hpp>
// Used for Task Runner
#include <Os/Baremetal/TaskRunner/TaskRunner.hpp>
#include <fprime-baremetal/Os/TaskRunner/TaskRunner.hpp>

// Used for logging
#include <Os/Log.hpp>
#include <Arduino/Os/StreamLog.hpp>

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

// Task Runner
Os::TaskRunner taskrunner;
#include <Fw/Logger/Logger.hpp>
#include <Arduino/Os/Console.hpp>

/**
* \brief execute the program
*
* This F´ program is designed to run in standard environments (e.g. Linux/macOs running on a laptop). Thus it uses
* command line inputs to specify how to connect.
*
* @return: 0 on success, something else on failure
* \brief setup the program
*/
void setup()
{
Serial.begin(115200);
Os::setArduinoStreamLogHandler(&Serial);
// Setup Serial
Serial.begin(115200); //Uart Comm and logging
static_cast<Os::Arduino::StreamConsoleHandle*>(Os::Console::getSingleton().getHandle())->setStreamHandler(Serial);

delay(1000);
Fw::Logger::logMsg("Program Started\n");
Fw::Logger::log("Program Started\n");

// Object for communicating state to the reference topology
RadioPassthrough::TopologyState inputs;
Expand All @@ -41,13 +32,11 @@ void setup()

// Setup, cycle, and teardown topology
RadioPassthrough::setupTopology(inputs);
// RadioPassthrough::teardownTopology(inputs);
}

void loop()
{
void loop() {
#ifdef USE_BASIC_TIMER
rateDriver.cycle();
#endif
taskrunner.run();
Os::Baremetal::TaskRunner::getSingleton().run();
}
Loading

0 comments on commit e1abea5

Please sign in to comment.