diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-10-02 21:42:06 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-10-02 21:42:06 +0200 |
commit | 2094aa7dbc69771de1669aa533deb29d940c6e50 (patch) | |
tree | 347abd135125981435905a161d61ca0d1f3438bd /stm32f091 | |
parent | ad7ef8a421086b9c7085f6d149b2c555c4e7d635 (diff) |
broken makefile with hal_conf.h
Diffstat (limited to 'stm32f091')
-rw-r--r-- | stm32f091/main.c | 16 | ||||
-rw-r--r-- | stm32f091/makefile | 17 | ||||
-rw-r--r-- | stm32f091/stm32f0xx_hal_conf.h | 42 |
3 files changed, 60 insertions, 15 deletions
diff --git a/stm32f091/main.c b/stm32f091/main.c index 848bfac..5e5071e 100644 --- a/stm32f091/main.c +++ b/stm32f091/main.c @@ -2,16 +2,13 @@ #include <task.h> #include <stm32f0xx.h> #include <stdint.h> - -#define PORT GPIOA -#define PIN 5 +#include <stm32f0xx_hal_gpio.h> void task_1() { uint8_t led = 1; while (1) { - PORT->ODR &= ~(1 << PIN); - PORT->ODR |= (led << PIN); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, led); led ^= 1; vTaskDelay(1000 / portTICK_RATE_MS); @@ -19,11 +16,12 @@ void task_1() { } int main() { - RCC->AHBENR |= RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN; + HAL_GPIO_Init(GPIOA, &(GPIO_InitTypeDef) { + .Mode = GPIO_MODE_OUTPUT_PP, + .Pull = GPIO_NOPULL, + .Pin = GPIO_PIN_5 + }); - PORT->MODER &= ~(0b11 << (PIN * 2)); - PORT->MODER |= (0b01 << (PIN * 2)); - xTaskCreate(task_1, "task1", 128, NULL, 1, NULL); vTaskStartScheduler(); } diff --git a/stm32f091/makefile b/stm32f091/makefile index b5cf22f..fa289a9 100644 --- a/stm32f091/makefile +++ b/stm32f091/makefile @@ -12,6 +12,7 @@ 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/CMSIS/ARM/inc SHARED_FLAGS += -I./lib/STM32-base-STM32Cube/CMSIS/STM32F0xx/inc SHARED_FLAGS += -I./lib/STM32-base/startup @@ -22,10 +23,7 @@ SHARED_FLAGS += -ffunction-sections SHARED_FLAGS += -fdata-sections SHARED_FLAGS += -mlittle-endian SHARED_FLAGS += -mthumb -# SHARED_FLAGS += -masm-syntax-unified SHARED_FLAGS += -specs=nosys.specs -# SHARED_FLAGS += -fno-threadsafe-statics -# SHARED_FLAGS += -fno-rtti SHARED_FLAGS += -fno-exceptions SHARED_FLAGS += -fno-unwind-tables SHARED_FLAGS += -Wl,-L./lib/STM32-base/linker,-T./lib/STM32-base/linker/STM32F0xx/STM32F091xC.ld @@ -46,6 +44,15 @@ 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 @@ -61,9 +68,6 @@ $(TARGET).bin: $(TARGET).elf %.o: %.c $(CC) -c $(CFLAGS) $< -o $@ -%.o: %.c - $(CC) -c $(CFLAGS) $< -o $@ - $(TARGET).elf: $(OBJS) $(LD) $(LFLAGS) $^ -o $@ @@ -76,3 +80,4 @@ compile_commands: clean clean: $(RM) $(TARGET).bin $(TARGET).elf $(OBJS) + diff --git a/stm32f091/stm32f0xx_hal_conf.h b/stm32f091/stm32f0xx_hal_conf.h new file mode 100644 index 0000000..3937e39 --- /dev/null +++ b/stm32f091/stm32f0xx_hal_conf.h @@ -0,0 +1,42 @@ +#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 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 HAL_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_I2S_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED + +#include <stm32f0xx_hal.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> + |