Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
174 changes: 167 additions & 7 deletions .cproject

Large diffs are not rendered by default.

51 changes: 36 additions & 15 deletions .mxproject

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1707894391894188628" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1821062983124376147" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1707895099523668121" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1821063690753855640" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
26 changes: 14 additions & 12 deletions Components/DebugTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#include "Command.hpp"
#include "CubeUtils.hpp"
#include <cstring>

#include "SystemDefines.hpp"
#include "usb_device.h"
#include "stm32h7xx_hal.h"

// External Tasks (to send debug commands to)
Expand All @@ -32,7 +33,7 @@ extern I2C_HandleTypeDef hi2c2;
* @brief Constructor, sets all member variables
*/
DebugTask::DebugTask()
: Task(TASK_DEBUG_QUEUE_DEPTH_OBJS), kUart_(UART::Debug2) {
: Task(TASK_DEBUG_QUEUE_DEPTH_OBJS), kUart_(UART::Debug) {
memset(debugBuffer, 0, sizeof(debugBuffer));
debugMsgIdx = 0;
isDebugMsgReady = false;
Expand All @@ -43,7 +44,7 @@ DebugTask::DebugTask()
*/
void DebugTask::InitTask() {
// Make sure the task is not already initialized
CUBE_ASSERT(rtTaskHandle == nullptr, "Cannot initialize Debug task twice");
SOAR_ASSERT(rtTaskHandle == nullptr, "Cannot initialize Debug task twice");

// Start the task
BaseType_t rtValue = xTaskCreate(
Expand All @@ -52,7 +53,7 @@ void DebugTask::InitTask() {
(UBaseType_t)TASK_DEBUG_PRIORITY, (TaskHandle_t*)&rtTaskHandle);

// Ensure creation succeded
CUBE_ASSERT(rtValue == pdPASS, "DebugTask::InitTask - xTaskCreate() failed");
SOAR_ASSERT(rtValue == pdPASS, "DebugTask::InitTask - xTaskCreate() failed");
}

// TODO: Only run thread when appropriate GPIO pin pulled HIGH (or by define)
Expand All @@ -62,6 +63,7 @@ void DebugTask::InitTask() {
void DebugTask::Run(void* pvParams) {
// Arm the interrupt
ReceiveData();
MX_USB_DEVICE_Init();
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MX_USB_DEVICE_Init() is also called from StartDefaultTask in Core/Src/main.c. Initializing the USB device stack twice can lead to allocation/endpoint/state issues depending on the ST middleware behavior. Ensure USB init happens in exactly one place (either the default task or a dedicated init path) and remove the duplicate call.

Suggested change
MX_USB_DEVICE_Init();

Copilot uses AI. Check for mistakes.

while (1) {
Command cm;
Expand All @@ -87,20 +89,20 @@ void DebugTask::HandleDebugMessage(const char* msg) {
//-- SYSTEM / CHAR COMMANDS -- (Must be last)
if (strcmp(msg, "sysreset") == 0) {
// Reset the system
CUBE_ASSERT(false, "System reset requested");
SOAR_ASSERT(false, "System reset requested");
} else if (strcmp(msg, "sysinfo") == 0) {
// Print message
CUBE_PRINT("\n\n-- CUBE SYSTEM --\n");
CUBE_PRINT("Current System Free Heap: %d Bytes\n", xPortGetFreeHeapSize());
CUBE_PRINT("Lowest Ever Free Heap: %d Bytes\n",
SOAR_PRINT("\n\n-- SOAR SYSTEM --\n");
SOAR_PRINT("Current System Free Heap: %d Bytes\n", xPortGetFreeHeapSize());
SOAR_PRINT("Lowest Ever Free Heap: %d Bytes\n",
xPortGetMinimumEverFreeHeapSize());
CUBE_PRINT("Debug Task Runtime \t: %d ms\n\n",
SOAR_PRINT("Debug Task Runtime \t: %d ms\n\n",
TICKS_TO_MS(xTaskGetTickCount()));
} else {
// Single character command, or unknown command
switch (msg[0]) {
default:
CUBE_PRINT("Debug, unknown command: %s\n", msg);
SOAR_PRINT("Debug, unknown command: %s\n", msg);
break;
}
}
Expand Down Expand Up @@ -162,14 +164,14 @@ int32_t DebugTask::ExtractIntParameter(const char* msg,
uint16_t identifierLen) {
// Handle a command with an int parameter at the end
if (static_cast<uint16_t>(strlen(msg)) < identifierLen + 1) {
CUBE_PRINT("Int parameter command insufficient length\r\n");
SOAR_PRINT("Int parameter command insufficient length\r\n");
return ERRVAL;
}

// Extract the value and attempt conversion to integer
const int32_t val = Utils::StringToLong(&msg[identifierLen]);
if (val == ERRVAL) {
CUBE_PRINT("Int parameter command invalid value\r\n");
SOAR_PRINT("Int parameter command invalid value\r\n");
}

return val;
Expand Down
Loading
Loading