Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizing stack sizes 10 #15

Merged
merged 5 commits into from
Jan 13, 2025
Merged
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
11 changes: 11 additions & 0 deletions Core/Inc/msb_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,14 @@

// VERBOSE LOGGING
#define LOG_VERBOSE

//Note
//STACK SIZES
#define CAN_DISPATCH_STACK_SIZE 128 * 8 //can_dispatch_handle
#define LED_CONTROLLER_STACK_SIZE 32 * 8 //led_controller_handle
#define DEFAULT_TASK_STACK_SIZE 128 * 4 //defaultTaskHandle
#define TEMP_MONITOR_STACK_SIZE 64 * 16 //temp_monitor_handle
#define IMU_MONITOR_STACK_SIZE 128 * 8 //imu_monitor_handle
#define TOF_MONITOR_STACK_SIZE 128 * 8 //tof_monitor_handle
#define SHOCKPOT_MONITOR_STACK_SIZE 64 * 8 //shockpot_monitor_handle
#define STRAIN_MONITOR_STACK_SIZE 64 * 8 //strain_monitor_handle
2 changes: 1 addition & 1 deletion Core/Src/can_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void can1_init()
osThreadId_t can_dispatch_handle;
const osThreadAttr_t can_dispatch_attributes = {
.name = "CanDispatch",
.stack_size = 128 * 8,
.stack_size = CAN_DISPATCH_STACK_SIZE,
.priority = (osPriority_t)osPriorityRealtime5,
};

Expand Down
2 changes: 1 addition & 1 deletion Core/Src/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern device_loc_t device_loc;
osThreadId_t led_controller_handle;
const osThreadAttr_t led_controller_attributes = {
.name = "LedController",
.stack_size = 32 * 8,
.stack_size = LED_CONTROLLER_STACK_SIZE,
.priority = (osPriority_t)osPriorityBelowNormal1,
};

Expand Down
2 changes: 1 addition & 1 deletion Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ UART_HandleTypeDef huart2;
osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
.name = "defaultTask",
.stack_size = 128 * 4,
.stack_size = DEFAULT_TASK_STACK_SIZE,
.priority = (osPriority_t) osPriorityNormal,
};
/* USER CODE BEGIN PV */
Expand Down
10 changes: 5 additions & 5 deletions Core/Src/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ uint16_t convert_can(uint16_t original_value, device_loc_t mode)
osThreadId_t temp_monitor_handle;
const osThreadAttr_t temp_monitor_attributes = {
.name = "TempMonitor",
.stack_size = 64 * 16,
.stack_size = TEMP_MONITOR_STACK_SIZE,
.priority = (osPriority_t)osPriorityHigh1,
};

Expand Down Expand Up @@ -88,7 +88,7 @@ void vTempMonitor(void *pv_params)
osThreadId_t imu_monitor_handle;
const osThreadAttr_t imu_monitor_attributes = {
.name = "IMUMonitor",
.stack_size = 128 * 8,
.stack_size = IMU_MONITOR_STACK_SIZE,
.priority = (osPriority_t)osPriorityHigh,
};

Expand Down Expand Up @@ -186,7 +186,7 @@ void vIMUMonitor(void *pv_params)
osThreadId_t tof_monitor_handle;
const osThreadAttr_t tof_monitor_attributes = {
.name = "TOFMonitor",
.stack_size = 128 * 8,
.stack_size = TOF_MONITOR_STACK_SIZE,
.priority = (osPriority_t)osPriorityHigh,
};

Expand Down Expand Up @@ -225,7 +225,7 @@ void vTOFMonitor(void *pv_params)
osThreadId_t shockpot_monitor_handle;
const osThreadAttr_t shockpot_monitor_attributes = {
.name = "ShockpotMonitor",
.stack_size = 64 * 8,
.stack_size = SHOCKPOT_MONITOR_STACK_SIZE,
.priority = (osPriority_t)osPriorityHigh1,
};

Expand Down Expand Up @@ -263,7 +263,7 @@ void vShockpotMonitor(void *pv_params)
osThreadId_t strain_monitor_handle;
const osThreadAttr_t strain_monitor_attributes = {
.name = "StrainMonitor",
.stack_size = 64 * 8,
.stack_size = STRAIN_MONITOR_STACK_SIZE,
.priority = (osPriority_t)osPriorityHigh1,
};

Expand Down
Loading