diff --git a/EQUiSatOS/EQUiSatOS/EQUiSatOs.cproj b/EQUiSatOS/EQUiSatOS/EQUiSatOs.cproj index f2a5e247..121a0ab2 100644 --- a/EQUiSatOS/EQUiSatOS/EQUiSatOs.cproj +++ b/EQUiSatOS/EQUiSatOS/EQUiSatOs.cproj @@ -415,7 +415,6 @@ NDEBUG TEST_SUITE_DEFINE_ASSERT_MACRO - _ASSERT_ENABLE_ SYSTICK_MODE I2C_MASTER_CALLBACK_MODE=false USART_CALLBACK_MODE=false @@ -475,10 +474,9 @@ Optimize for size (-Os) - -fdata-sections - True + True True - -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 + -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 True @@ -492,6 +490,7 @@ True + -Wl,--entry=Reset_Handler -Wl,--cref -mthumb -T../src/ASF/sam0/utils/linker_scripts/samd21/gcc/samd21j18a_flash.ld @@ -663,7 +662,6 @@ ../src/ASF/thirdparty/TraceRecorder/streamports/Jlink_RTT/include - True Maximum (-g3) -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 True diff --git a/EQUiSatOS/EQUiSatOS/src/config.h b/EQUiSatOS/EQUiSatOS/src/config.h index bd08c415..66a604be 100644 --- a/EQUiSatOS/EQUiSatOS/src/config.h +++ b/EQUiSatOS/EQUiSatOS/src/config.h @@ -21,7 +21,7 @@ * MAKE SURE to RE-BUILD solution to be double-sure they were disabled */ #define FLASH_ACTIVE // enable flashing -//#define ANTENNA_DEPLOY_ACTIVE // enable antenna deployment +#define ANTENNA_DEPLOY_ACTIVE // enable antenna deployment #define TRANSMIT_ACTIVE // enable radio transmission (note PRINT_DEBUG must be 0) #define BAT_CHARGING_ACTIVE // enable battery charging logic ACTUALLY changing battery actions #define WATCHDOG_RESET_ACTIVE // enable watchdog actually rebooting satellite @@ -31,48 +31,48 @@ // ***AT THE EXPENSE OF COMPLETELY NORMAL FUNCTIONALITY*** // ENUMERATION of changes when ON: // - don't read data distributed around an orbit -#define TESTING_SPEEDUP -#define TESTING_SPEEDUP_LONG_OPS +//#define TESTING_SPEEDUP +//#define TESTING_SPEEDUP_LONG_OPS // reduces the stack size of some tasks to a workable but risky level //#define RISKY_STACK_SIZES // use this flag to disable reed-solomon tables (frees up memory) -//#define USE_REED_SOLOMON +#define USE_REED_SOLOMON // if defined, explicitly sets the initial SAT state (must set both) -#define OVERRIDE_INIT_SAT_STATE INITIAL -#define OVERRIDE_INIT_TASK_STATES INITIAL_TASK_STATES +//#define OVERRIDE_INIT_SAT_STATE INITIAL +//#define OVERRIDE_INIT_TASK_STATES INITIAL_TASK_STATES // WDOG, STATE, (ant), BAT, TRANS, FLASH, IDLE, LOWP, ATTI, PERSIST //#define OVERRIDE_INIT_TASK_STATES ((task_states){{true, true, false, true, false, false, false, false, true, true}}) #define OVERRIDE_STATE_HOLD_INIT 0 // whether to hold initial state (stop auto state changes) // whether to start up misc. testing tasks (doing both at same time will likely run out of mem) //#define ONLY_RUN_TESTING_TASKS // doesn't run normal EQUISAT tasks -#define RUN_RTOS_SYSTEM_TEST // ~800 bytes of memory +//#define RUN_RTOS_SYSTEM_TEST // ~800 bytes of memory // less data //#define RTOS_SYSTEM_TEST_SUMMARY // whether to print all data every test or only one element per stack (with exception of error stack) //#define RTOS_SYSTEM_TEST_ONLY_RECENT -#define SYSTEM_TEST_TASK_FREQ (43*1000) // ms +//#define SYSTEM_TEST_TASK_FREQ (43*1000) // ms //#define RUN_TESTING_TASK // ~1024 bytes of memory //#define RUN_TASK_STACK_TESTS // whether to rewrite MRAM with "zero" values (done before launch) -#define WRITE_DEFAULT_MRAM_VALS +//#define WRITE_DEFAULT_MRAM_VALS /** System Tests/Simulations **/ //#define EQUISIM_SIMULATE_BATTERIES // see config in equisim_simulated_data.h -#define EQUISIM_SIMULATE_DIRECT_STATE_CHANGES // must disable OVERRIDE_STATE_HOLD_INIT! - #define EQUISIM_IN_STATE_TIME_MS (1*60*1000) +//#define EQUISIM_SIMULATE_DIRECT_STATE_CHANGES // must disable OVERRIDE_STATE_HOLD_INIT! +// #define EQUISIM_IN_STATE_TIME_MS (1*60*1000) //#define EQUISIM_WATCHDOG_RESET_TEST /** Debug **/ // whether to include Tracelyzer tracing library -#define USE_TRACELYZER 1 +#define USE_TRACELYZER 0 // whether to configASSERTs (and other asserts) should hang -#define USE_ASSERTIONS +//#define USE_ASSERTIONS // add strict asserts to notify of events that we want to be rare //#define USE_STRICT_ASSERTIONS @@ -82,16 +82,16 @@ // 1 to print over USART // 2 to print over Tracelyzer trace_print // 3 to print over both -#define PRINT_DEBUG 1 +#define PRINT_DEBUG 0 // whether to let normal transmissions print while print enabled -#define DONT_PRINT_RAW_TRANSMISSIONS +//#define DONT_PRINT_RAW_TRANSMISSIONS // whether to use a mutex to avoid collisions with radio // define for radio testing but turn off for timing/task testing // (it slows down and alters the OS timings) //#define SAFE_PRINT // define to print errors as the come in -#define PRINT_NEW_ERRORS // note: probably will result in many stack overflows +//#define PRINT_NEW_ERRORS // note: probably will result in many stack overflows /****************************************************************************************/ /* DO NOT EDIT BELOW THIS LINE UNLESS YOU ARE INTENTIONALLY MODIFYING CONFIGURATION */ diff --git a/EQUiSatOS/EQUiSatOS/src/runnable_configurations/satellite_state_control.c b/EQUiSatOS/EQUiSatOS/src/runnable_configurations/satellite_state_control.c index de3e3bc6..f28670a8 100644 --- a/EQUiSatOS/EQUiSatOS/src/runnable_configurations/satellite_state_control.c +++ b/EQUiSatOS/EQUiSatOS/src/runnable_configurations/satellite_state_control.c @@ -518,7 +518,7 @@ static void set_antenna_deploy_by_sat_state(sat_state_t prev_sat_state, sat_stat /************************************************************************/ // helper to wait until a semaphore is at zero -bool wait_on_semaphore(SemaphoreHandle_t sem, TickType_t wait_time) { +static bool wait_on_semaphore(SemaphoreHandle_t sem, TickType_t wait_time) { TickType_t start_ticks = xTaskGetTickCount(); while (uxSemaphoreGetCount(sem) < IR_POW_SEMAPHORE_MAX_COUNT) { vTaskDelay(SEMAPHORE_EMPTY_POLL_TIME_TICKS); diff --git a/bootloader/bootloader/bootloader.cproj b/bootloader/bootloader/bootloader.cproj index 413efb81..c4fd195f 100644 --- a/bootloader/bootloader/bootloader.cproj +++ b/bootloader/bootloader/bootloader.cproj @@ -311,8 +311,7 @@ Optimize for size (-Os) - -fdata-sections - True + True True -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 True @@ -320,18 +319,17 @@ libarm_cortexM0l_math libm - MRAM_Commands.h - MRAM_Commands.c ../cmsis/linkerScripts ../src/ASF/thirdparty/CMSIS/Lib/GCC - C:\Users\mcken\Documents\projects\BSE\GitHub\EQUiSat_clone_aux\EQUiSatOS\EQUiSatOS\EQUiSatOS\src\processor_drivers True + True + -Wl,--entry=Reset_Handler -Wl,--cref -mthumb -T../src/ASF/sam0/utils/linker_scripts/samd21/gcc/samd21j18a_flash.ld @@ -441,8 +439,6 @@ Optimize for size (-Os) - -fdata-sections - True True Maximum (-g3) True diff --git a/bootloader/bootloader/src/main_bootloader.c b/bootloader/bootloader/src/main_bootloader.c index 7d898990..f2706975 100644 --- a/bootloader/bootloader/src/main_bootloader.c +++ b/bootloader/bootloader/src/main_bootloader.c @@ -9,7 +9,7 @@ /* CONFIG */ //#define WRITE_PROG_MEM_TO_MRAM -#define DISABLE_REWRITE_FROM_MRAM +//#define DISABLE_REWRITE_FROM_MRAM //#define RUN_TESTS #ifdef WRITE_PROG_MEM_TO_MRAM @@ -95,7 +95,7 @@ static void start_application(void) } // Returns the number of matching bytes in the two buffers up to len. -size_t num_similar(uint8_t* data1, uint8_t* data2, size_t len) { +static size_t num_similar(uint8_t* data1, uint8_t* data2, size_t len) { size_t num_same = 0; for (size_t i = 0; i < len; i++) { if (data1[i] == data2[i]) { @@ -110,13 +110,13 @@ size_t num_similar(uint8_t* data1, uint8_t* data2, size_t len) { in the actual flash, and corrects any buffers that don't match. Returns whether any were corrected */ -int check_and_fix_prog_mem(struct spi_module* spi_master_instance, +static int check_and_fix_prog_mem(struct spi_module* spi_master_instance, struct spi_slave_inst* mram_slave1, struct spi_slave_inst* mram_slave2) { - int num_copied = 0; + uint num_copied = 0; uint32_t mram_addr = RAD_SAFE_FIELD_GET(mram_app_address); uint32_t flash_addr = (uint32_t) RAD_SAFE_FIELD_GET(app_start_address); - int corrections_made = 0; + uint corrections_made = 0; while (num_copied < RAD_SAFE_FIELD_GET(prog_mem_size)) { size_t buf_size = min(RAD_SAFE_FIELD_GET(prog_mem_size) - num_copied, RAD_SAFE_FIELD_GET(mram_copy_buffer_size)); @@ -170,7 +170,7 @@ int check_and_fix_prog_mem(struct spi_module* spi_master_instance, /* Function to write to "program memory rewritten" field in MRAM. */ -void set_prog_memory_rewritten(uint8_t was_rewritten, struct spi_module* spi_master_instance, +static void set_prog_memory_rewritten(uint8_t was_rewritten, struct spi_module* spi_master_instance, struct spi_slave_inst* mram_slave1, struct spi_slave_inst* mram_slave2) { // write duplicate fields to both mrams (no spacing) uint8_t field_size = RAD_SAFE_FIELD_GET(mram_prog_mem_rewritten_size); // == 1