aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-03 19:53:26 +0200
committerlonkaars <loek@pipeframe.xyz>2022-10-03 19:53:26 +0200
commit45a0a4a215fb41564c1a9192d34eae0d0d3423c6 (patch)
tree0390edf71b154071e9f87cc34fd34a71552cd0fa
parent2094aa7dbc69771de1669aa533deb29d940c6e50 (diff)
gpio hal example compiles, doesn't work
-rw-r--r--stm32f091/makefile29
-rw-r--r--stm32f091/stm32f0xx_hal_conf.h59
2 files changed, 49 insertions, 39 deletions
diff --git a/stm32f091/makefile b/stm32f091/makefile
index fa289a9..bba85f4 100644
--- a/stm32f091/makefile
+++ b/stm32f091/makefile
@@ -6,13 +6,14 @@ RM = rm -f
TARGET = main
SHARED_FLAGS += -g
-SHARED_FLAGS += -D STM32F091xC
+SHARED_FLAGS += -DSTM32F091xC
SHARED_FLAGS += -Wall
SHARED_FLAGS += -Wextra
# SHARED_FLAGS += -Wno-register
SHARED_FLAGS += -Wa,--defsym,CALL_ARM_SYSTEM_INIT=1
# SHARED_FLAGS += -I/usr/arm-none-eabi/include/
SHARED_FLAGS += -I./lib/STM32-base-STM32Cube/HAL/STM32F0xx/inc
+SHARED_FLAGS += -I./lib/STM32-base-STM32Cube/HAL/STM32F0xx/inc/Legacy
SHARED_FLAGS += -I./lib/STM32-base-STM32Cube/CMSIS/ARM/inc
SHARED_FLAGS += -I./lib/STM32-base-STM32Cube/CMSIS/STM32F0xx/inc
SHARED_FLAGS += -I./lib/STM32-base/startup
@@ -35,6 +36,8 @@ LFLAGS += $(SHARED_FLAGS)
AFLAGS += $(SHARED_FLAGS)
OBJS += $(patsubst %.c,%.o, $(wildcard *.c))
+OBJS += ./lib/STM32-base/startup/STM32F0xx/STM32F091xC.o
+OBJS += ./lib/STM32-base-STM32Cube/CMSIS/STM32F0xx/src/system_stm32f0xx.o
OBJS += lib/FreeRTOS-Kernel/croutine.o \
lib/FreeRTOS-Kernel/event_groups.o \
lib/FreeRTOS-Kernel/list.o \
@@ -44,18 +47,16 @@ OBJS += lib/FreeRTOS-Kernel/croutine.o \
lib/FreeRTOS-Kernel/timers.o \
lib/FreeRTOS-Kernel/portable/GCC/ARM_CM0/port.o \
lib/FreeRTOS-Kernel/portable/MemMang/heap_4.o
-OBJS += lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_gpio.o \
- lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_cortex.o \
- lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_flash.o \
- lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_i2c.o \
- lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_i2s.o \
- lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_pwr.o \
- lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_rtc.o \
- lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_uart.o \
- lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_usart.o
-
-OBJS += ./lib/STM32-base/startup/STM32F0xx/STM32F091xC.o
-OBJS += ./lib/STM32-base-STM32Cube/CMSIS/STM32F0xx/src/system_stm32f0xx.o
+OBJS += lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_gpio.o
+# OBJS += lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_gpio.o \
+# lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_cortex.o \
+# lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_flash.o \
+# lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_i2c.o \
+# lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_i2s.o \
+# lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_pwr.o \
+# lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_rtc.o \
+# lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_uart.o \
+# lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_usart.o
.PHONY: flash clean
@@ -75,7 +76,7 @@ flash: $(TARGET).bin
st-flash write $(TARGET).bin 0x08000000
compile_commands: clean
- compiledb make
+ compiledb make -n
../scripts/compiledb-full-path-mingw.sh compile_commands.json
clean:
diff --git a/stm32f091/stm32f0xx_hal_conf.h b/stm32f091/stm32f0xx_hal_conf.h
index 3937e39..48ec387 100644
--- a/stm32f091/stm32f0xx_hal_conf.h
+++ b/stm32f091/stm32f0xx_hal_conf.h
@@ -1,42 +1,51 @@
#pragma once
-#define HSE_VALUE 8000000U
-#define HSE_STARTUP_TIMEOUT 100U
-#define HSI_VALUE 8000000U
-#define HSI_STARTUP_TIMEOUT 5000U
-#define HSI14_VALUE 14000000U
-#define HSI48_VALUE 48000000U
-#define LSI_VALUE 40000U
-#define LSE_VALUE 32768U
-#define LSE_STARTUP_TIMEOUT 5000U
+#define HSE_VALUE ((uint32_t)8000000)
+#define HSE_STARTUP_TIMEOUT ((uint32_t)100)
+#define HSI_VALUE ((uint32_t)8000000)
+#define HSI_STARTUP_TIMEOUT ((uint32_t)5000)
+#define HSI14_VALUE ((uint32_t)14000000)
+#define HSI48_VALUE ((uint32_t)48000000)
+#define LSI_VALUE ((uint32_t)40000)
+#define LSE_VALUE ((uint32_t)32768)
+#define LSE_STARTUP_TIMEOUT ((uint32_t)5000)
+
#define VDD_VALUE 3300U
#define TICK_INT_PRIORITY ((uint32_t)(1U<<__NVIC_PRIO_BITS) - 1U)
+
#define USE_RTOS 0U
#define PREFETCH_ENABLE 1U
#define INSTRUCTION_CACHE_ENABLE 0U
#define DATA_CACHE_ENABLE 0U
-#define USE_SPI_CRC 1U
+#define USE_SPI_CRC 0U
#define HAL_MODULE_ENABLED
-#define HAL_GPIO_MODULE_ENABLED
+#define HAL_UART_MODULE_ENABLED
#define HAL_CORTEX_MODULE_ENABLED
+#define HAL_DMA_MODULE_ENABLED
#define HAL_FLASH_MODULE_ENABLED
-#define HAL_I2C_MODULE_ENABLED
-#define HAL_I2S_MODULE_ENABLED
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_EXTI_MODULE_ENABLED
#define HAL_PWR_MODULE_ENABLED
-#define HAL_RTC_MODULE_ENABLED
-#define HAL_UART_MODULE_ENABLED
-#define HAL_USART_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_I2C_MODULE_ENABLED
#include <stm32f0xx_hal.h>
-#include <stm32f0xx_hal_dma.h>
+#include <stm32f0xx_hal_rcc.h>
+// #include <stm32f0xx_hal_dma.h>
#include <stm32f0xx_hal_gpio.h>
-#include <stm32f0xx_hal_cortex.h>
-#include <stm32f0xx_hal_flash.h>
-#include <stm32f0xx_hal_i2c.h>
-#include <stm32f0xx_hal_i2s.h>
-#include <stm32f0xx_hal_pwr.h>
-#include <stm32f0xx_hal_rtc.h>
-#include <stm32f0xx_hal_uart.h>
-#include <stm32f0xx_hal_usart.h>
+// #include <stm32f0xx_hal_cortex.h>
+// #include <stm32f0xx_hal_flash.h>
+// #include <stm32f0xx_hal_i2c.h>
+// #include <stm32f0xx_hal_i2s.h>
+// #include <stm32f0xx_hal_pwr.h>
+// #include <stm32f0xx_hal_rtc.h>
+// #include <stm32f0xx_hal_uart.h>
+// #include <stm32f0xx_hal_usart.h>
+#ifdef USE_FULL_ASSERT
+#define assert_param(expr) ((expr) ? (void)0U : assert_failed((char *)__FILE__, __LINE__))
+void assert_failed(char* file, uint32_t line);
+#else
+#define assert_param(expr) ((void)0U)
+#endif