Skip to content

Commit 86238b2

Browse files
LeStarchineskhouMikefly123nateinaction
authored
Behold! The FileSystem Has Arrived! (#69)
* updated fprime zephyr version * Initial radio addition * Add LoRa transmit * Add com delay component * Create custom_space_data_link.py this is for a patch for the gds accepting da packages * Allows Makefile with F Prime version and run GDS with camera * Add circuit pass-through * Update to use aggregation * Update to use aggregation * Appease Linter * Ran Linter * Fix Submodules * try * Apply suggestion from @nateinaction * changed the aggregator * Revert bootloadertrigger change * spacing * updated instrcutions and flow to run the circuitpython radio example * Add in com splitter and UART com * Fix format errors * letting ComIn be valid * Update to correct miss-aggregations * Fix LoRa beaconing * Update code.py * Lint * change back to do bc broncospace is out of cs and need to run integration test on lav sorry nate!!! * Hacked for Zephyr * Add in prmDb * Add FS telemetry component * added the fatfs support in the west.yml * make the update good * Remove SYNTHETIC_FALLOCATE definition Remove the SYNTHETIC_FALLOCATE compile definition from Os_File_Posix_Implementation. --------- Co-authored-by: ineskhou <[email protected]> Co-authored-by: ineskhou <[email protected]> Co-authored-by: Michael Pham <[email protected]> Co-authored-by: Nate Gay <[email protected]> Co-authored-by: Nate Gay <[email protected]>
1 parent 1d53de9 commit 86238b2

File tree

22 files changed

+244
-11
lines changed

22 files changed

+244
-11
lines changed

.codespell-ignore-words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
comIn
2+
Ines

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
####
55

66
cmake_minimum_required(VERSION 3.24.2)
7+
add_compile_definitions(_POSIX_C_SOURCE=200809L)
78

89
# Set BOARD_ROOT to find custom boards
910
# The structure is BOARD_ROOT/boards/vendor/board
@@ -33,6 +34,11 @@ fprime_setup_included_code()
3334

3435
# This includes project-wide objects
3536
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FprimeZephyrReference")
36-
37+
if (FPRIME_USE_POSIX)
38+
set_target_properties(Drv_Ip PROPERTIES EXCLUDE_FROM_ALL TRUE)
39+
set_target_properties(Drv_TcpServer PROPERTIES EXCLUDE_FROM_ALL TRUE)
40+
set_target_properties(Drv_TcpClient PROPERTIES EXCLUDE_FROM_ALL TRUE)
41+
set_target_properties(Drv_Udp PROPERTIES EXCLUDE_FROM_ALL TRUE)
42+
endif()
3743
set_target_properties(Svc_FatalHandler PROPERTIES EXCLUDE_FROM_ALL TRUE)
3844
set_target_properties(fprime-zephyr_Drv_ZephyrSpiDriver PROPERTIES EXCLUDE_FROM_ALL TRUE)

FprimeZephyrReference/Components/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog")
99
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Burnwire/")
1010
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/BootloaderTrigger/")
1111
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/AntennaDeployer/")
12+
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FsSpace/")
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
####
2+
# F Prime CMakeLists.txt:
3+
#
4+
# SOURCES: list of source files (to be compiled)
5+
# AUTOCODER_INPUTS: list of files to be passed to the autocoders
6+
# DEPENDS: list of libraries that this module depends on
7+
#
8+
# More information in the F´ CMake API documentation:
9+
# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/
10+
#
11+
####
12+
13+
# Module names are derived from the path from the nearest project/library/framework
14+
# root when not specifically overridden by the developer. i.e. The module defined by
15+
# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`.
16+
17+
register_fprime_library(
18+
AUTOCODER_INPUTS
19+
"${CMAKE_CURRENT_LIST_DIR}/FsSpace.fpp"
20+
SOURCES
21+
"${CMAKE_CURRENT_LIST_DIR}/FsSpace.cpp"
22+
# DEPENDS
23+
# MyPackage_MyOtherModule
24+
)
25+
26+
### Unit Tests ###
27+
# register_fprime_ut(
28+
# AUTOCODER_INPUTS
29+
# "${CMAKE_CURRENT_LIST_DIR}/FsSpace.fpp"
30+
# SOURCES
31+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/FsSpaceTestMain.cpp"
32+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/FsSpaceTester.cpp"
33+
# DEPENDS
34+
# STest # For rules-based testing
35+
# UT_AUTO_HELPERS
36+
# )
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// ======================================================================
2+
// \title FsSpace.cpp
3+
// \author starchmd
4+
// \brief cpp file for FsSpace component implementation class
5+
// ======================================================================
6+
7+
#include "FprimeZephyrReference/Components/FsSpace/FsSpace.hpp"
8+
#include <zephyr/kernel.h>
9+
#include <zephyr/sys/printk.h>
10+
#include "Os/FileSystem.hpp"
11+
12+
namespace Components {
13+
14+
// ----------------------------------------------------------------------
15+
// Component construction and destruction
16+
// ----------------------------------------------------------------------
17+
18+
FsSpace ::FsSpace(const char* const compName) : FsSpaceComponentBase(compName) {}
19+
20+
FsSpace ::~FsSpace() {}
21+
22+
// ----------------------------------------------------------------------
23+
// Handler implementations for typed input ports
24+
// ----------------------------------------------------------------------
25+
26+
void FsSpace ::run_handler(FwIndexType portNum, U32 context) {
27+
FwSizeType freeBytes = 0;
28+
FwSizeType totalBytes = 0;
29+
Os::FileSystem::Status status = Os::FileSystem::getFreeSpace("/prmDb.dat", totalBytes, freeBytes);
30+
if (status == Os::FileSystem::OP_OK) {
31+
this->tlmWrite_FreeSpace(freeBytes);
32+
this->tlmWrite_TotalSpace(totalBytes);
33+
}
34+
}
35+
36+
} // namespace Components
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module Components {
2+
@ Read free space
3+
passive component FsSpace {
4+
5+
##############################################################################
6+
#### Uncomment the following examples to start customizing your component ####
7+
##############################################################################
8+
9+
@ Free disk space telemetry channel
10+
telemetry FreeSpace: FwSizeType
11+
12+
@ Total disk space telemetry channel
13+
telemetry TotalSpace: FwSizeType
14+
15+
sync input port run: Svc.Sched
16+
17+
###############################################################################
18+
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters #
19+
###############################################################################
20+
@ Port for requesting the current time
21+
time get port timeCaller
22+
23+
@ Port for sending telemetry channels to downlink
24+
telemetry port tlmOut
25+
26+
}
27+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// ======================================================================
2+
// \title FsSpace.hpp
3+
// \author starchmd
4+
// \brief hpp file for FsSpace component implementation class
5+
// ======================================================================
6+
7+
#ifndef Components_FsSpace_HPP
8+
#define Components_FsSpace_HPP
9+
10+
#include "FprimeZephyrReference/Components/FsSpace/FsSpaceComponentAc.hpp"
11+
12+
namespace Components {
13+
14+
class FsSpace final : public FsSpaceComponentBase {
15+
public:
16+
// ----------------------------------------------------------------------
17+
// Component construction and destruction
18+
// ----------------------------------------------------------------------
19+
20+
//! Construct FsSpace object
21+
FsSpace(const char* const compName //!< The component name
22+
);
23+
24+
//! Destroy FsSpace object
25+
~FsSpace();
26+
27+
private:
28+
// ----------------------------------------------------------------------
29+
// Handler implementations for typed input ports
30+
// ----------------------------------------------------------------------
31+
32+
//! Handler implementation for run
33+
void run_handler(FwIndexType portNum, //!< The port number
34+
U32 context //!< The call order
35+
) override;
36+
};
37+
38+
} // namespace Components
39+
40+
#endif
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Components::FsSpace
2+
3+
Read free space from the filesystem (specifically the filesystem containing /prmDb.dat)/
4+
5+
## Telemetry
6+
| Name | Description |
7+
|---|---|
8+
| FreeSpace | Free space in bytes |
9+
| TotalSpace | Total space in bytes |
10+
11+
12+
## Change Log
13+
| Date | Description |
14+
|---|---|
15+
|---| Initial Draft |

FprimeZephyrReference/ReferenceDeployment/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@ if (FPRIME_PLATFORM STREQUAL "Zephyr")
2020
"${CMAKE_CURRENT_LIST_DIR}/Main.cpp"
2121
DEPENDS
2222
${FPRIME_CURRENT_MODULE}_Top
23+
CHOOSES_IMPLEMENTATIONS
24+
# Can remain stubs for now
25+
Os_File_Posix
2326
)
2427
endif()

FprimeZephyrReference/ReferenceDeployment/Main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ int main(int argc, char* argv[]) {
1919
// This sleep is necessary to allow the USB CDC ACM interface to initialize before
2020
// the application starts writing to it.
2121
k_sleep(K_MSEC(3000));
22-
2322
Os::init();
2423
// Object for communicating state to the topology
2524
ReferenceDeployment::TopologyState inputs;

0 commit comments

Comments
 (0)