Feather M4 with FreeRTOS and F': not starting after adding a single custom Component #4348
-
|
Hello I'm trying to run F' on an Adafruit Feather M4 CAN Express following the reference project (https://github.com/fprime-community/fprime-featherm4-freertos-reference). Setting up and running the ReferenceDeployment in the Repository works without any errors, but when I try to add a Component the Software won't start. The Code still compiles without any errors. To test this I added a basic Component which just adds two numbers and returns them. Test.cpp: void Test ::Basic_Test_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 Num_1, U32 Num_2) {
U32 Result = Num_1 + Num_2;
this->log_ACTIVITY_HI_Return_Number(Result);
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}
void Test ::schedIn_handler(FwIndexType portNum, U32 context) {
FwSizeType numMsgs = this->m_queue.getMessagesAvailable();
for (FwSizeType i = 0; i < numMsgs; ++i) {
(void) this->doDispatch();
}
}Test.fpp: Test.hpp: private:
void Basic_Test_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
U32 Num_1,
U32 Num_2) override;
void schedIn_handler(
FwIndexType portNum, //!< The port number
U32 context //!< The call order
) override; I tried adding it as an active and also as an queued component and it didn't work for either one. topology.fpp: I scanned the UART-port using minicom on the connected computer and got those messages after which nothing more was transmitted. This is with the queued Component, with the active one the "Program Started" line will not be printed. for reference the void setup() {
// Initialize OSAL
Os::init();
// Setup Serial and Logging
Serial.begin(115200);
while (!Serial) ;
static_cast<Os::Arduino::StreamConsoleHandle*>(Os::Console::getSingleton().getHandle())->setStreamHandler(Serial);
// Object for communicating state to the reference topology
ReferenceDeployment::TopologyState inputs;
inputs.uartNumber = 0;
inputs.uartBaud = 115200;
// Setup topology
ReferenceDeployment::setupTopology(inputs);
xTaskCreate(RateLoop, "RateLoop", 1600, NULL, 1, NULL);
Fw::Logger::log("Program Started\n");
vTaskStartScheduler();
}I added a few Serial.println("..."); Commands in the main.cpp file of the ReferenceDeployment when the component is an active one it stops during this line:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
|
I don't have direct experience with Feather M4 + FreeRTOS, however; on these very tiny systems there are things that you can check. When
Here is the configuration from fprime-zephyr-reference: https://github.com/fprime-community/fprime-zephyr-reference/blob/9fa3b0aca65a68f94569119306be4c8509713874/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp#L14. Any additional command in fprime-zephyr-reference requires an increase in this number
The other major issue could be out-of-memory problems. Make sure to configure queue sizes to what you need, rather than just some large value....as queues put pressure on memory. Same with stack sizes. @laboratory10 might have more insight. |
Beta Was this translation helpful? Give feedback.
-
|
This sounds a lot like memory issues. Take a careful look at the sizing of the FreeRTOS heap and how precisely it is filling up. The best way to do this is by printing how much memory remains available while the topology is being setup. I remember when I initially had issues like this I was printing it after each task was initialized in the autocoded startTasks function. Something else that might help is if you look at some of my more recent but not yet merged branches. OsResources for example contains a component I made specifically to better understand how memory was being used. Once I made that component, I made several changes to heap size, queue sizes, and various other configuration changes to free up memory for more components. |
Beta Was this translation helpful? Give feedback.
This sounds a lot like memory issues. Take a careful look at the sizing of the FreeRTOS heap and how precisely it is filling up. The best way to do this is by printing how much memory remains available while the topology is being setup. I remember when I initially had issues like this I was printing it after each task was initialized in the autocoded startTasks function.
Something else that might help is if you look at some of my more recent but not yet merged branches. OsResources for example contains a component I made specifically to better understand how memory was being used. Once I made that component, I made several changes to heap size, queue sizes, and various other configuration…