Skip to content

Commit

Permalink
Decreased stack sizes to save ram
Browse files Browse the repository at this point in the history
  • Loading branch information
vedderb committed Jan 16, 2022
1 parent 92efab4 commit 9c484d0
Show file tree
Hide file tree
Showing 28 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion applications/app_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

// Threads
static THD_FUNCTION(adc_thread, arg);
static THD_WORKING_AREA(adc_thread_wa, 1024);
static THD_WORKING_AREA(adc_thread_wa, 512);

// Private variables
static volatile adc_config config;
Expand Down
2 changes: 1 addition & 1 deletion applications/app_balance.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ typedef enum {

// Balance thread
static THD_FUNCTION(balance_thread, arg);
static THD_WORKING_AREA(balance_thread_wa, 2048); // 2kb stack for this thread
static THD_WORKING_AREA(balance_thread_wa, 1024); // 2kb stack for this thread

static thread_t *app_thread;

Expand Down
2 changes: 1 addition & 1 deletion applications/app_custom_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

// Threads
static THD_FUNCTION(my_thread, arg);
static THD_WORKING_AREA(my_thread_wa, 2048);
static THD_WORKING_AREA(my_thread_wa, 1024);

// Private functions
static void pwm_callback(void);
Expand Down
4 changes: 2 additions & 2 deletions applications/app_nunchuk.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@

// Threads
static THD_FUNCTION(chuk_thread, arg);
static THD_WORKING_AREA(chuk_thread_wa, 1024);
static THD_WORKING_AREA(chuk_thread_wa, 512);
static THD_FUNCTION(output_thread, arg);
static THD_WORKING_AREA(output_thread_wa, 1024);
static THD_WORKING_AREA(output_thread_wa, 512);

// Private variables
static volatile bool stop_now = true;
Expand Down
2 changes: 1 addition & 1 deletion applications/app_pas.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

// Threads
static THD_FUNCTION(pas_thread, arg);
static THD_WORKING_AREA(pas_thread_wa, 1024);
static THD_WORKING_AREA(pas_thread_wa, 512);

// Private variables
static volatile pas_config config;
Expand Down
2 changes: 1 addition & 1 deletion applications/app_ppm.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

// Threads
static THD_FUNCTION(ppm_thread, arg);
static THD_WORKING_AREA(ppm_thread_wa, 1536);
static THD_WORKING_AREA(ppm_thread_wa, 512);
static thread_t *ppm_tp;
static volatile bool ppm_rx = false;

Expand Down
2 changes: 1 addition & 1 deletion applications/app_uartcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

// Threads
static THD_FUNCTION(packet_process_thread, arg);
static THD_WORKING_AREA(packet_process_thread_wa, 4096);
static THD_WORKING_AREA(packet_process_thread_wa, 2048);

// Variables
static volatile bool thread_is_running = false;
Expand Down
4 changes: 2 additions & 2 deletions comm_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@

#if CAN_ENABLE
// Threads
static THD_WORKING_AREA(cancom_read_thread_wa, 512);
static THD_WORKING_AREA(cancom_process_thread_wa, 4096);
static THD_WORKING_AREA(cancom_read_thread_wa, 256);
static THD_WORKING_AREA(cancom_process_thread_wa, 2048);
static THD_WORKING_AREA(cancom_status_thread_wa, 512);
static THD_FUNCTION(cancom_read_thread, arg);
static THD_FUNCTION(cancom_status_thread, arg);
Expand Down
2 changes: 1 addition & 1 deletion comm_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static uint8_t serial_rx_buffer[SERIAL_RX_BUFFER_SIZE];
static int serial_rx_read_pos = 0;
static int serial_rx_write_pos = 0;
static THD_WORKING_AREA(serial_read_thread_wa, 256);
static THD_WORKING_AREA(serial_process_thread_wa, 4096);
static THD_WORKING_AREA(serial_process_thread_wa, 2048);
static mutex_t send_mutex;
static thread_t *process_tp;
static volatile unsigned int write_timeout_cnt = 0;
Expand Down
6 changes: 3 additions & 3 deletions conf_general.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#define CONF_GENERAL_H_

// Firmware version
#define FW_VERSION_MAJOR 5
#define FW_VERSION_MINOR 03
#define FW_VERSION_MAJOR 6
#define FW_VERSION_MINOR 00
// Set to 0 for building a release and iterate during beta test builds
#define FW_TEST_VERSION_NUMBER 0
#define FW_TEST_VERSION_NUMBER 1

#include "datatypes.h"

Expand Down
2 changes: 1 addition & 1 deletion gpdrive.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static void set_modulation(float mod);
static void do_dc_cal(void);

// Threads
static THD_WORKING_AREA(timer_thread_wa, 2048);
static THD_WORKING_AREA(timer_thread_wa, 512);
static THD_FUNCTION(timer_thread, arg);
static volatile bool timer_thd_stop;

Expand Down
2 changes: 1 addition & 1 deletion hwconf/hw_45.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

// Threads
THD_FUNCTION(temp_thread, arg);
static THD_WORKING_AREA(temp_thread_wa, 512);
static THD_WORKING_AREA(temp_thread_wa, 256);
static bool temp_thread_running = false;

// Variables
Expand Down
2 changes: 1 addition & 1 deletion hwconf/hw_gesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

// Threads
THD_FUNCTION(mag_thread, arg);
static THD_WORKING_AREA(mag_thread_wa, 512);
static THD_WORKING_AREA(mag_thread_wa, 256);
static bool mag_thread_running = false;

// Variables
Expand Down
2 changes: 1 addition & 1 deletion hwconf/hw_stormcore_100d.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ typedef enum {
// Variables
static volatile bool i2c_running = false;
static THD_WORKING_AREA(smart_switch_thread_wa, 128);
static THD_WORKING_AREA(mux_thread_wa, 256);
static THD_WORKING_AREA(mux_thread_wa, 128);
static THD_WORKING_AREA(switch_color_thread_wa, 128);
static THD_FUNCTION(mux_thread, arg);
static THD_FUNCTION(switch_color_thread, arg);
Expand Down
2 changes: 1 addition & 1 deletion hwconf/hw_stormcore_60d.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef enum {
// Variables
static volatile bool i2c_running = false;
static THD_WORKING_AREA(smart_switch_thread_wa, 128);
static THD_WORKING_AREA(mux_thread_wa, 256);
static THD_WORKING_AREA(mux_thread_wa, 128);
static THD_WORKING_AREA(switch_color_thread_wa, 128);
static THD_FUNCTION(mux_thread, arg);
static THD_FUNCTION(switch_color_thread, arg);
Expand Down
2 changes: 1 addition & 1 deletion hwconf/hw_uavc_qcube.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

// Threads
THD_FUNCTION(dac_thread, arg);
static THD_WORKING_AREA(dac_thread_wa, 512);
static THD_WORKING_AREA(dac_thread_wa, 128);
static bool dac_thread_running = false;

// Variables
Expand Down
2 changes: 1 addition & 1 deletion hwconf/hw_unity.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef enum {
// Variables
static volatile bool i2c_running = false;
static THD_WORKING_AREA(smart_switch_thread_wa, 128);
static THD_WORKING_AREA(mux_thread_wa, 256);
static THD_WORKING_AREA(mux_thread_wa, 128);
static THD_FUNCTION(mux_thread, arg);
static volatile switch_states switch_state = SWITCH_BOOTED;

Expand Down
4 changes: 2 additions & 2 deletions hwconf/hw_uxv_sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

// Threads
THD_FUNCTION(dac_thread, arg);
static THD_WORKING_AREA(dac_thread_wa, 1024);
static THD_WORKING_AREA(dac_thread_wa, 256);
static bool dac_thread_running = false;

// Variables
Expand Down Expand Up @@ -285,4 +285,4 @@ THD_FUNCTION(dac_thread, arg) {
DAC->DHR12R2 = scaled_current;
chThdSleepMilliseconds(100);
}
}
}
2 changes: 1 addition & 1 deletion hwconf/si8900.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

// Private variables
static THD_FUNCTION(si_read_thread, arg);
static THD_WORKING_AREA(si_read_thread_wa, 512);
static THD_WORKING_AREA(si_read_thread_wa, 256);
static volatile float m_voltages[3];

// Private functions
Expand Down
2 changes: 1 addition & 1 deletion imu/imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
static ATTITUDE_INFO m_att;
static FusionAhrs m_fusionAhrs;
static float m_accel[3], m_gyro[3], m_mag[3];
static stkalign_t m_thd_work_area[THD_WORKING_AREA_SIZE(2048) / sizeof(stkalign_t)];
static stkalign_t m_thd_work_area[THD_WORKING_AREA_SIZE(1024) / sizeof(stkalign_t)];
static i2c_bb_state m_i2c_bb;
static spi_bb_state m_spi_bb;
static ICM20948_STATE m_icm20948_state;
Expand Down
2 changes: 1 addition & 1 deletion libcanard/canard_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static uint8_t my_node_id = 0;
static bool refresh_parameters_enabled = true;

// Threads
static THD_WORKING_AREA(canard_thread_wa, 2048);
static THD_WORKING_AREA(canard_thread_wa, 1024);
static THD_FUNCTION(canard_thread, arg);

// Private functions
Expand Down
2 changes: 1 addition & 1 deletion lora/lora.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

// Threads
static THD_FUNCTION(packet_process_thread, arg);
static THD_WORKING_AREA(packet_process_thread_wa, 4096);
static THD_WORKING_AREA(packet_process_thread_wa, 2048);

// Variables
static volatile bool thread_is_running = false;
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
*/

// Private variables
static THD_WORKING_AREA(periodic_thread_wa, 512);
static THD_WORKING_AREA(periodic_thread_wa, 256);
static THD_WORKING_AREA(led_thread_wa, 256);
static THD_WORKING_AREA(flash_integrity_check_thread_wa, 256);
static bool m_init_done = false;
Expand Down
2 changes: 1 addition & 1 deletion mc_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static volatile motor_if_state_t *motor_now(void);
static void(*pwn_done_func)(void) = 0;

// Threads
static THD_WORKING_AREA(timer_thread_wa, 1024);
static THD_WORKING_AREA(timer_thread_wa, 512);
static THD_FUNCTION(timer_thread, arg);
static THD_WORKING_AREA(sample_send_thread_wa, 512);
static THD_FUNCTION(sample_send_thread, arg);
Expand Down
4 changes: 2 additions & 2 deletions mcpwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ static void pll_run(float phase, float dt, volatile float *phase_var,
#define IS_DETECTING() (state == MC_STATE_DETECTING)

// Threads
static THD_WORKING_AREA(timer_thread_wa, 2048);
static THD_WORKING_AREA(timer_thread_wa, 512);
static THD_FUNCTION(timer_thread, arg);
static THD_WORKING_AREA(rpm_thread_wa, 1024);
static THD_WORKING_AREA(rpm_thread_wa, 512);
static THD_FUNCTION(rpm_thread, arg);
static volatile bool timer_thd_stop;
static volatile bool rpm_thd_stop;
Expand Down
6 changes: 3 additions & 3 deletions mcpwm_foc.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ static void input_current_offset_measurement( void );
static void hfi_update(volatile motor_all_state_t *motor);

// Threads
static THD_WORKING_AREA(timer_thread_wa, 1024);
static THD_WORKING_AREA(timer_thread_wa, 512);
static THD_FUNCTION(timer_thread, arg);
static volatile bool timer_thd_stop;

static THD_WORKING_AREA(hfi_thread_wa, 1024);
static THD_WORKING_AREA(hfi_thread_wa, 512);
static THD_FUNCTION(hfi_thread, arg);
static volatile bool hfi_thd_stop;

static THD_WORKING_AREA(pid_thread_wa, 512);
static THD_WORKING_AREA(pid_thread_wa, 256);
static THD_FUNCTION(pid_thread, arg);
static volatile bool pid_thd_stop;

Expand Down
2 changes: 1 addition & 1 deletion nrf/nrf_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

// Variables
static THD_WORKING_AREA(rx_thread_wa, 2048);
static THD_WORKING_AREA(tx_thread_wa, 512);
static THD_WORKING_AREA(tx_thread_wa, 256);
static mote_state mstate;
static uint8_t rx_buffer[RX_BUFFER_SIZE];
static int nosend_cnt;
Expand Down
2 changes: 1 addition & 1 deletion timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static volatile bool kill_sw_active;
static volatile uint32_t feed_counter[MAX_THREADS_MONITOR];

// Threads
static THD_WORKING_AREA(timeout_thread_wa, 512);
static THD_WORKING_AREA(timeout_thread_wa, 256);
static THD_FUNCTION(timeout_thread, arg);

void timeout_init(void) {
Expand Down

0 comments on commit 9c484d0

Please sign in to comment.