diff --git a/PROVESFlightControllerReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/PROVESFlightControllerReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index baf03fb5..a8b7a9b7 100644 --- a/PROVESFlightControllerReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/PROVESFlightControllerReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -9,7 +9,7 @@ // #include // Necessary project-specified types -#include +#include #include #include @@ -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 @@ -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); @@ -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); + payloadSeq.deallocateBuffer(ComCcsds::Allocation::memAllocator); + safeModeSeq.deallocateBuffer(ComCcsds::Allocation::memAllocator); } }; // namespace ReferenceDeployment diff --git a/PROVESFlightControllerReference/project/config/CMakeLists.txt b/PROVESFlightControllerReference/project/config/CMakeLists.txt index 13b518c2..27950be1 100644 --- a/PROVESFlightControllerReference/project/config/CMakeLists.txt +++ b/PROVESFlightControllerReference/project/config/CMakeLists.txt @@ -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" diff --git a/PROVESFlightControllerReference/project/config/ComCcsdsConfig/ComCcsdsSubtopologyConfig.cpp b/PROVESFlightControllerReference/project/config/ComCcsdsConfig/ComCcsdsSubtopologyConfig.cpp index cbcb0548..76b453b7 100644 --- a/PROVESFlightControllerReference/project/config/ComCcsdsConfig/ComCcsdsSubtopologyConfig.cpp +++ b/PROVESFlightControllerReference/project/config/ComCcsdsConfig/ComCcsdsSubtopologyConfig.cpp @@ -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 -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 diff --git a/PROVESFlightControllerReference/project/config/ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp b/PROVESFlightControllerReference/project/config/ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp index db0be600..0fa3c8c9 100644 --- a/PROVESFlightControllerReference/project/config/ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp +++ b/PROVESFlightControllerReference/project/config/ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp @@ -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 diff --git a/lib/fprime-zephyr b/lib/fprime-zephyr index 31399714..e7fb94d0 160000 --- a/lib/fprime-zephyr +++ b/lib/fprime-zephyr @@ -1 +1 @@ -Subproject commit 313997144363ea930af66e86b52d43537cf7f489 +Subproject commit e7fb94d0d8c2b0934147eb42f30774174d594bcd diff --git a/prj.conf b/prj.conf index 3bf2423f..6bb56072 100644 --- a/prj.conf +++ b/prj.conf @@ -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 CONFIG_MAIN_STACK_SIZE=8192 CONFIG_POSIX_API=y CONFIG_REBOOT=y