Skip to content

Commit aae40ee

Browse files
committed
Merge pull request adafruit#344 from dhylands/stmhal-systick-cleanup
Cleanup systick for stmhal
2 parents 659c19c + ef39f2d commit aae40ee

4 files changed

Lines changed: 8 additions & 18 deletions

File tree

stmhal/Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ CROSS_COMPILE = arm-none-eabi-
1919

2020
INC = -I.
2121
INC += -I$(PY_SRC)
22-
INC += -I$(CMSIS_DIR)
2322
INC += -I$(CMSIS_DIR)/inc
2423
INC += -I$(CMSIS_DIR)/devinc
2524
INC += -I$(HAL_DIR)/inc
@@ -32,7 +31,6 @@ INC += -I$(HAL_DIR)/inc
3231
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
3332
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 $(CFLAGS_CORTEX_M4) $(COPT)
3433

35-
BOARD = STM32F4DISC
3634
BOARD ?= PYBOARD4
3735
ifeq ($(wildcard boards/$(BOARD)/.),)
3836
$(error Invalid BOARD specified)
@@ -226,11 +224,6 @@ GEN_PINS_HDR = $(BUILD)/pins.h
226224
# which source files might need it.
227225
$(OBJ): | $(BUILD)/pins.h
228226

229-
# temp hack
230-
$(PY_BUILD):
231-
mkdir -p $@
232-
$(OBJ): | $(PY_BUILD) $(PY_BUILD)/qstrdefs.generated.h
233-
234227
# Use a pattern rule here so that make will only call make-pins.py once to make
235228
# both pins_$(BOARD).c and pins.h
236229
$(BUILD)/%_$(BOARD).c $(BUILD)/%.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE)

stmhal/stm32f4xx_it.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ void PendSV_Handler(void)
151151
{
152152
}
153153

154-
#if 0 // defined in systick.c
155154
/**
156155
* @brief This function handles SysTick Handler.
157156
* @param None
@@ -161,7 +160,6 @@ void SysTick_Handler(void)
161160
{
162161
HAL_IncTick();
163162
}
164-
#endif
165163

166164
/******************************************************************************/
167165
/* STM32F4xx Peripherals Interrupt Handlers */

stmhal/system_stm32f4xx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ void SystemClock_Config(void)
316316
{
317317
__fatal_error("HAL_RCC_ClockConfig");
318318
}
319+
320+
// SysTick_Config (called from HL_RCC_ClockConfig) sets the SysTick_IRQn to
321+
// be the lowest priority, but we want it to be the highest priority, so fix
322+
// things here.
323+
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
319324
}
320325

321326
/**

stmhal/systick.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,10 @@
55
void sys_tick_init(void) {
66
// SysTick_Config is now called from HAL_RCC_ClockConfig, which is called
77
// from SystemClock_Config
8-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); // make it highest priority
9-
}
108

11-
// called on SysTick interrupt
12-
void SysTick_Handler(void) {
13-
HAL_IncTick();
14-
HAL_SYSTICK_IRQHandler();
15-
// hack!
16-
//void audio_drain(void);
17-
//audio_drain();
9+
// SysTick_Config sets the SysTick_IRQn to be the lowest priority, but
10+
// we want it to be the highest priority, so fix things here.
11+
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
1812
}
1913

2014
void sys_tick_delay_ms(uint32_t delay_ms) {

0 commit comments

Comments
 (0)