From 5b41852b9e27d97f27f92c3a53e2688c22081dc3 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 4 Dec 2016 22:54:38 +0900 Subject: [PATCH] link time optimisations tried, but cant use debugger --- Makefile | 3 ++- Middlewares/Third_Party/FreeRTOS/Source/include/task.h | 2 +- MotorControl/low_level.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c056646e..0c463eb9 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ TARGET = ODriveFirmware # debug build? DEBUG = 1 # optimization +# OPT = -O3 -ffast-math -flto OPT = -O0 -ffast-math ####################################### @@ -116,7 +117,7 @@ LDSCRIPT = STM32F405RGTx_FLASH.ld # libraries LIBS = -lc -lm -lnosys LIBDIR = -LDFLAGS = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections +LDFLAGS = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs $(OPT) -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections # default action: build all all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin diff --git a/Middlewares/Third_Party/FreeRTOS/Source/include/task.h b/Middlewares/Third_Party/FreeRTOS/Source/include/task.h index b8d6dd89..448e3ebc 100644 --- a/Middlewares/Third_Party/FreeRTOS/Source/include/task.h +++ b/Middlewares/Third_Party/FreeRTOS/Source/include/task.h @@ -1931,7 +1931,7 @@ BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, cons * Sets the pointer to the current TCB to the TCB of the highest priority task * that is ready to run. */ -void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION; +void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION __attribute__((used)); /* * THESE FUNCTIONS MUST NOT BE USED FROM APPLICATION CODE. THEY ARE USED BY diff --git a/MotorControl/low_level.c b/MotorControl/low_level.c index b2c1be35..e6787aa6 100644 --- a/MotorControl/low_level.c +++ b/MotorControl/low_level.c @@ -293,7 +293,7 @@ void pwm_trig_adc_cb(ADC_HandleTypeDef* hadc) { static bool check_timing() { #define log_size 32 - static uint16_t timings[log_size]; + static volatile uint16_t timings[log_size]; static int idx = 0; uint16_t timing = htim1.Instance->CNT;