Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// #include <PROVESFlightControllerReference/ReferenceDeployment/Top/ReferenceDeploymentPacketsAc.hpp>

// Necessary project-specified types
#include <Fw/Types/MallocAllocator.hpp>
#include <ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp>

#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/spi.h>
Expand All @@ -34,9 +34,6 @@ static const struct gpio_dt_spec payloadBatteryLoadSwitchGpio =
// Allows easy reference to objects in FPP/autocoder required namespaces
using namespace ReferenceDeployment;

// Instantiate a malloc allocator for cmdSeq buffer allocation
Fw::MallocAllocator mallocator;

constexpr FwSizeType BASE_RATEGROUP_PERIOD_MS = 1; // 1Khz

// Helper function to calculate the period for a given rate group frequency
Expand Down Expand Up @@ -78,9 +75,9 @@ void configureTopology() {
gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);

cmdSeq.allocateBuffer(0, mallocator, 1024);
payloadSeq.allocateBuffer(0, mallocator, 1024);
safeModeSeq.allocateBuffer(0, mallocator, 1024);
cmdSeq.allocateBuffer(0, ComCcsds::Allocation::memAllocator, 1024);
payloadSeq.allocateBuffer(0, ComCcsds::Allocation::memAllocator, 1024);
safeModeSeq.allocateBuffer(0, ComCcsds::Allocation::memAllocator, 1024);
gpioface4LS.open(face4LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
gpioface0LS.open(face0LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
gpioface1LS.open(face1LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
Expand Down Expand Up @@ -201,8 +198,8 @@ void teardownTopology(const TopologyState& state) {
stopTasks(state);
freeThreads(state);
tearDownComponents(state);
cmdSeq.deallocateBuffer(mallocator);
payloadSeq.deallocateBuffer(mallocator);
safeModeSeq.deallocateBuffer(mallocator);
cmdSeq.deallocateBuffer(ComCcsds::Allocation::memAllocator);
Comment thread
yudataguy marked this conversation as resolved.
payloadSeq.deallocateBuffer(ComCcsds::Allocation::memAllocator);
safeModeSeq.deallocateBuffer(ComCcsds::Allocation::memAllocator);
}
}; // namespace ReferenceDeployment
2 changes: 2 additions & 0 deletions PROVESFlightControllerReference/project/config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ register_fprime_config(
"${CMAKE_CURRENT_LIST_DIR}/CdhCoreTlmConfig.fpp"
"${CMAKE_CURRENT_LIST_DIR}/CdhCoreFatalHandlerConfig.fpp"
"${CMAKE_CURRENT_LIST_DIR}/ComCcsdsConfig.fpp"
"${CMAKE_CURRENT_LIST_DIR}/ComCcsdsConfig/ComCcsdsSubtopologyConfig.cpp"
"${CMAKE_CURRENT_LIST_DIR}/ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp"
"${CMAKE_CURRENT_LIST_DIR}/ComCfg.fpp"
"${CMAKE_CURRENT_LIST_DIR}/CommandDispatcherImplCfg.hpp"
"${CMAKE_CURRENT_LIST_DIR}/FileHandlingConfig.fpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#include "ComCcsdsSubtopologyConfig.hpp"

namespace ComCcsdsSband {
namespace Allocation {
// This instance can be changed to use a different allocator in the ComCcsdsSband Subtopology
Fw::MallocAllocator mallocatorInstance;
Fw::MemAllocator& memAllocator = mallocatorInstance;
} // namespace Allocation
} // namespace ComCcsdsSband
#include <default/zephyr-config/ZephyrAllocator.hpp>

namespace ComCcsdsLora {
namespace ComCcsds {
namespace Allocation {
// This instance can be changed to use a different allocator in the ComCcsdsLora Subtopology
Fw::MallocAllocator mallocatorInstance;
Fw::MemAllocator& memAllocator = mallocatorInstance;
Fw::ZephyrKmallocAllocator allocatorInstance;
Fw::MemAllocator& memAllocator = allocatorInstance;
} // namespace Allocation
} // namespace ComCcsdsLora
} // namespace ComCcsds
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
#ifndef COMCCSDSSUBTOPOLOGY_CONFIG_HPP
#define COMCCSDSSUBTOPOLOGY_CONFIG_HPP

#include "Fw/Types/MallocAllocator.hpp"
#include "Fw/Types/MemAllocator.hpp"

namespace ComCcsdsSband {
namespace ComCcsds {
namespace Allocation {
extern Fw::MemAllocator& memAllocator;
}
} // namespace ComCcsdsSband

namespace ComCcsdsLora {
namespace Allocation {
extern Fw::MemAllocator& memAllocator;
}
} // namespace ComCcsdsLora
} // namespace ComCcsds

#endif
1 change: 1 addition & 0 deletions prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CONFIG_REQUIRES_FULL_LIBCPP=y
CONFIG_CPP_EXCEPTIONS=n
CONFIG_CPP_RTTI=n
CONFIG_COMMON_LIBC_MALLOC=y
CONFIG_HEAP_MEM_POOL_SIZE=65536
Comment thread
yudataguy marked this conversation as resolved.
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_POSIX_API=y
CONFIG_REBOOT=y
Expand Down
Loading