diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/.gitignore | 3 | ||||
m--------- | src/lib/FreeRTOS-Kernel | 0 | ||||
m--------- | src/lib/STM32-base | 0 | ||||
m--------- | src/lib/STM32-base-STM32Cube | 0 | ||||
-rw-r--r-- | src/main.c | 40 | ||||
-rw-r--r-- | src/makefile | 109 | ||||
-rw-r--r-- | src/ppu/consts.h | 26 | ||||
-rw-r--r-- | src/ppu/internals.h | 22 | ||||
-rw-r--r-- | src/ppu/ppu.h | 11 | ||||
-rw-r--r-- | src/ppu/types.h | 40 | ||||
-rw-r--r-- | src/stm32/FreeRTOSConfig.h | 128 | ||||
-rw-r--r-- | src/stm32/idle_task_static_memory.c | 18 | ||||
-rw-r--r-- | src/stm32/idle_task_static_memory.h | 8 | ||||
-rw-r--r-- | src/stm32/stm32f0xx_hal_conf.h | 117 |
14 files changed, 522 insertions, 0 deletions
diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..312c0ff --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,3 @@ +*.o +main.elf +main.bin diff --git a/src/lib/FreeRTOS-Kernel b/src/lib/FreeRTOS-Kernel new file mode 160000 +Subproject a4b28e35103d699edf074dfff4835921b481b30 diff --git a/src/lib/STM32-base b/src/lib/STM32-base new file mode 160000 +Subproject 02610b5a8cc3042a2a076771c3a38c6f68d26fc diff --git a/src/lib/STM32-base-STM32Cube b/src/lib/STM32-base-STM32Cube new file mode 160000 +Subproject 71bcfb75e9b3aadbfcb05b57148d995a7f340b4 diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..910d2dd --- /dev/null +++ b/src/main.c @@ -0,0 +1,40 @@ +#include <malloc.h> +#include <math.h> +#include <stdio.h> + +#include "ppu/ppu.h" +#include "ppu/consts.h" + +hh_s_ppu_loc_sprite* hh_debug_circle_sprite() { + hh_s_ppu_loc_sprite* s = malloc(sizeof(hh_s_ppu_loc_sprite)); + + for (int x = 0; x < HH_PPU_SPRITE_WIDTH; x++) + for (int y = 0; y < HH_PPU_SPRITE_HEIGHT; y++) + *s[y * HH_PPU_SPRITE_WIDTH + x] = (pow(x - 8, 2) + pow(y - 8, 2) < 67) ? 1 : 0; + + return s; +} + +int main() { + hh_ppu_init(); + + hh_ppu_update_aux((hh_s_ppu_loc_aux) { + .bg_shift_x = 0, + .bg_shift_y = 0, + .fg_fetch = 0, + .sysreset = 0, + }); + + hh_s_ppu_loc_sprite* sprite = hh_debug_circle_sprite(); + hh_ppu_update_sprite(0, *sprite); + free(sprite); + + while (1); +} + +void hh_ppu_vblank_interrupt() { + static unsigned long frame = 0; + frame++; + + +} diff --git a/src/makefile b/src/makefile new file mode 100644 index 0000000..22e956e --- /dev/null +++ b/src/makefile @@ -0,0 +1,109 @@ +CC = arm-none-eabi-gcc +LD = arm-none-eabi-gcc +OC = arm-none-eabi-objcopy +OS = arm-none-eabi-size +RM = rm -f + +TARGET = main + +HOST=$(strip $(shell uname -o)) + +SHARED_FLAGS += -g +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./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 +SHARED_FLAGS += -I./lib/FreeRTOS-Kernel/include +SHARED_FLAGS += -I./lib/FreeRTOS-Kernel/portable/GCC/ARM_CM0/ +SHARED_FLAGS += -I. +ifeq ($(HOST),GNU/Linux) +SHARED_FLAGS += -I/usr/arm-none-eabi/include/ +endif +# SHARED_FLAGS += -O1 +SHARED_FLAGS += -ffunction-sections +SHARED_FLAGS += -fdata-sections +SHARED_FLAGS += -Wl,--gc-sections +SHARED_FLAGS += -mlittle-endian +SHARED_FLAGS += -mthumb +SHARED_FLAGS += -specs=nosys.specs +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 +SHARED_FLAGS += -mcpu=cortex-m0 +SHARED_FLAGS += -march=armv6-m + +CFLAGS += $(SHARED_FLAGS) +LFLAGS += $(SHARED_FLAGS) +AFLAGS += $(SHARED_FLAGS) + +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 \ + lib/FreeRTOS-Kernel/queue.o \ + lib/FreeRTOS-Kernel/stream_buffer.o \ + lib/FreeRTOS-Kernel/tasks.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_rcc.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_rcc_ex.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_i2c.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_i2c_ex.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_gpio.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_dma.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_cortex.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_pwr.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_pwr_ex.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_flash.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_flash_ex.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_tim.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_tim_ex.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_uart.o \ + lib/STM32-base-STM32Cube/HAL/STM32F0xx/src/stm32f0xx_hal_uart_ex.o +OBJS += idle_task_static_memory.o +OBJS += main.o + +.PHONY: flash clean format + +$(TARGET).bin: $(TARGET).elf + $(OC) -O binary $< $@ + $(OS) $< + +%.o: %.s + $(CC) -c $(AFLAGS) $< -o $@ + +lib/%.o: lib/%.c + $(CC) -c $(CFLAGS) -w $< -o $@ + +%.o: %.c + $(CC) -c $(CFLAGS) $< -o $@ + +%-stm.o: %.c + $(CC) -c $(CFLAGS) $< -o $@ + +$(TARGET).elf: $(OBJS) + $(LD) $(LFLAGS) $^ -o $@ + +flash: $(TARGET).bin + st-flash --reset write $(TARGET).bin 0x08000000 + +compile_commands.json: clean + compiledb make -Bn + ../scripts/compiledb-full-path-mingw.sh compile_commands.json + +format: + clang-format -i $(SRCS) + clang-tidy --fix-errors $(SRCS) + +clean: + $(RM) $(TARGET).bin $(TARGET).elf $(OBJS) + diff --git a/src/ppu/consts.h b/src/ppu/consts.h new file mode 100644 index 0000000..ee94a69 --- /dev/null +++ b/src/ppu/consts.h @@ -0,0 +1,26 @@ +#pragma once + +#define HH_PPU_PALETTE_COUNT 8 +#define HH_PPU_PALETTE_COLOR_COUNT 8 +#define HH_PPU_RAM_BUS_ADDR_WIDTH 16 +#define HH_PPU_RAM_BUS_DATA_WIDTH 16 +#define HH_PPU_FG_SPRITE_COUNT 128 +#define HH_PPU_SPRITE_WIDTH 16 +#define HH_PPU_SPRITE_HEIGHT 16 +#define HH_PPU_SCREEN_WIDTH 320 +#define HH_PPU_SCREEN_HEIGHT 240 +#define HH_PPU_BG_CANVAS_TILES_H 40 +#define HH_PPU_BG_CANVAS_TILES_V 30 + +#include "types.h" + +#define HH_PPU_VRAM_TMM_OFFSET ((hh_ppu_addr_t) 0x0000) +#define HH_PPU_VRAM_TMM_SIZE ((hh_ppu_addr_t) 0xd000) +#define HH_PPU_VRAM_BAM_OFFSET ((hh_ppu_addr_t) 0xd000) +#define HH_PPU_VRAM_BAM_SIZE ((hh_ppu_addr_t) 0x04b0) +#define HH_PPU_VRAM_FAM_OFFSET ((hh_ppu_addr_t) 0xd800) +#define HH_PPU_VRAM_FAM_SIZE ((hh_ppu_addr_t) 0x0100) +#define HH_PPU_VRAM_PAL_OFFSET ((hh_ppu_addr_t) 0xdc00) +#define HH_PPU_VRAM_PAL_SIZE ((hh_ppu_addr_t) 0x0040) +#define HH_PPU_VRAM_AUX_OFFSET ((hh_ppu_addr_t) 0xde00) +#define HH_PPU_VRAM_AUX_SIZE ((hh_ppu_addr_t) 0x0002) diff --git a/src/ppu/internals.h b/src/ppu/internals.h new file mode 100644 index 0000000..ddb2196 --- /dev/null +++ b/src/ppu/internals.h @@ -0,0 +1,22 @@ +#pragma once + +#include <stdbool.h> + +#include "types.h" + +typedef struct { + hh_ppu_addr_t offset; + hh_ppu_addr_t size; + hh_ppu_data_t* data; +} hh_s_ppu_vram_data; + +bool hh_ppu_vram_valid_address(hh_ppu_addr_t addr); +void hh_ppu_vram_write(hh_ppu_addr_t addr, hh_ppu_data_t data); +void hh_ppu_vram_memcpy(void* a, hh_s_ppu_vram_data b); + +hh_s_ppu_vram_data* hh_ppu_2nat_bam(hh_s_ppu_loc_bam_entry); +hh_s_ppu_vram_data* hh_ppu_2nat_fam(hh_s_ppu_loc_fam_entry); +hh_s_ppu_vram_data* hh_ppu_2nat_aux(hh_s_ppu_loc_aux); +hh_s_ppu_vram_data* hh_ppu_2nat_sprite(hh_ppu_loc_sprite_data_t); +hh_s_ppu_vram_data* hh_ppu_2nat_pal(hh_ppu_loc_palette_data_t); + diff --git a/src/ppu/ppu.h b/src/ppu/ppu.h new file mode 100644 index 0000000..ac01ef7 --- /dev/null +++ b/src/ppu/ppu.h @@ -0,0 +1,11 @@ +#pragma once + +#include "types.h" + +void hh_ppu_vblank_interrupt(); +void hh_ppu_init(); + +void hh_ppu_update_foreground(unsigned index, hh_s_ppu_loc_fam_entry e); +void hh_ppu_update_background(unsigned index, hh_s_ppu_loc_bam_entry e); +void hh_ppu_update_sprite(unsigned tilemap_index, hh_s_ppu_loc_sprite sprite); +void hh_ppu_update_aux(hh_s_ppu_loc_aux aux); diff --git a/src/ppu/types.h b/src/ppu/types.h new file mode 100644 index 0000000..d7605a5 --- /dev/null +++ b/src/ppu/types.h @@ -0,0 +1,40 @@ +#pragma once + +#include <stdint.h> +#include <stdbool.h> + +#include "consts.h" + +typedef uint16_t hh_ppu_addr_t; +typedef uint16_t hh_ppu_data_t; + +typedef uint8_t hh_ppu_loc_sprite_data_t[HH_PPU_SPRITE_WIDTH * HH_PPU_SPRITE_HEIGHT]; +typedef uint8_t hh_ppu_loc_palette_data_t[HH_PPU_PALETTE_COLOR_COUNT]; + +typedef hh_ppu_loc_sprite_data_t hh_s_ppu_loc_sprite; +typedef hh_ppu_loc_palette_data_t hh_s_ppu_loc_palette; + +typedef struct { + bool horizontal_flip; + bool vertical_flip; + uint8_t palette_index; + uint8_t tilemap_index; +} hh_s_ppu_loc_bam_entry; + +typedef struct { + bool horizontal_flip; + bool vertical_flip; + uint16_t position_x; + uint16_t position_y; + uint8_t palette_index; + uint8_t tilemap_index; +} hh_s_ppu_loc_fam_entry; + +typedef struct { + bool sysreset; + bool fg_fetch; + uint16_t bg_shift_x; + uint16_t bg_shift_y; +} hh_s_ppu_loc_aux; + +typedef uint16_t hh_ppu_native_color_t; diff --git a/src/stm32/FreeRTOSConfig.h b/src/stm32/FreeRTOSConfig.h new file mode 100644 index 0000000..223cf8b --- /dev/null +++ b/src/stm32/FreeRTOSConfig.h @@ -0,0 +1,128 @@ +/* USER CODE BEGIN Header */ +/* + * FreeRTOS Kernel V10.0.1 + * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ +/* USER CODE END Header */ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * These parameters and more are described within the 'configuration' section of the + * FreeRTOS API documentation available on the FreeRTOS.org web site. + * + * See http://www.freertos.org/a00110.html + *----------------------------------------------------------*/ + +/* USER CODE BEGIN Includes */ +/* Section where include file can be added */ +/* USER CODE END Includes */ + +/* Ensure definitions are only used by the compiler, and not by the assembler. */ +#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) + #include <stdint.h> + extern uint32_t SystemCoreClock; + void xPortSysTickHandler(void); +#endif +#define configUSE_PREEMPTION 1 +#define configSUPPORT_STATIC_ALLOCATION 1 +#define configSUPPORT_DYNAMIC_ALLOCATION 1 +#define configUSE_IDLE_HOOK 0 +#define configUSE_TICK_HOOK 0 +#define configCPU_CLOCK_HZ ( SystemCoreClock ) +#define configTICK_RATE_HZ ((TickType_t)1000) +#define configMAX_PRIORITIES ( 56 ) +#define configMINIMAL_STACK_SIZE ((uint16_t)128) +#define configTOTAL_HEAP_SIZE ((size_t)3072) +#define configMAX_TASK_NAME_LEN ( 16 ) +#define configUSE_TRACE_FACILITY 1 +#define configUSE_16_BIT_TICKS 0 +#define configUSE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 8 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + +/* Software timer definitions. */ +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY ( 2 ) +#define configTIMER_QUEUE_LENGTH 10 +#define configTIMER_TASK_STACK_DEPTH 256 + +/* The following flag must be enabled only when using newlib */ +#define configUSE_NEWLIB_REENTRANT 1 + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_xQueueGetMutexHolder 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 +#define INCLUDE_eTaskGetState 1 + +/* + * The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used + * by the application thus the correct define need to be enabled below + */ +#define USE_FreeRTOS_HEAP_4 + +/* Normal assert() semantics without relying on the provision of an assert.h +header file. */ +/* USER CODE BEGIN 1 */ +#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );} +/* USER CODE END 1 */ + +/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS +standard names. */ +#define vPortSVCHandler SVC_Handler +#define xPortPendSVHandler PendSV_Handler + +/* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick, + to prevent overwriting SysTick_Handler defined within STM32Cube HAL */ + +/* #define xPortSysTickHandler SysTick_Handler */ + +/* USER CODE BEGIN Defines */ +/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */ +/* USER CODE END Defines */ + +#endif /* FREERTOS_CONFIG_H */ diff --git a/src/stm32/idle_task_static_memory.c b/src/stm32/idle_task_static_memory.c new file mode 100644 index 0000000..0774224 --- /dev/null +++ b/src/stm32/idle_task_static_memory.c @@ -0,0 +1,18 @@ +#include "idle_task_static_memory.h" + +void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) { + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; +} + +void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) { + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; +} + diff --git a/src/stm32/idle_task_static_memory.h b/src/stm32/idle_task_static_memory.h new file mode 100644 index 0000000..24712fa --- /dev/null +++ b/src/stm32/idle_task_static_memory.h @@ -0,0 +1,8 @@ +#pragma once + +#include <FreeRTOS.h> +#include <FreeRTOSConfig.h> +#include <task.h> + +void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize); +void vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t * pulTimerTaskStackSize); diff --git a/src/stm32/stm32f0xx_hal_conf.h b/src/stm32/stm32f0xx_hal_conf.h new file mode 100644 index 0000000..fc27221 --- /dev/null +++ b/src/stm32/stm32f0xx_hal_conf.h @@ -0,0 +1,117 @@ +#pragma once + +#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 0U + +#define HAL_RCC_MODULE_ENABLED +#define HAL_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED + +#ifdef HAL_RCC_MODULE_ENABLED +#include <stm32f0xx_hal_rcc.h> +#endif +#ifdef HAL_GPIO_MODULE_ENABLED +#include <stm32f0xx_hal_gpio.h> +#endif +#ifdef HAL_DMA_MODULE_ENABLED +#include <stm32f0xx_hal_dma.h> +#endif +#ifdef HAL_CORTEX_MODULE_ENABLED +#include <stm32f0xx_hal_cortex.h> +#endif +#ifdef HAL_ADC_MODULE_ENABLED +#include <stm32f0xx_hal_adc.h> +#endif +#ifdef HAL_CAN_MODULE_ENABLED +#include <stm32f0xx_hal_can.h> +#endif +#ifdef HAL_CEC_MODULE_ENABLED +#include <stm32f0xx_hal_cec.h> +#endif +#ifdef HAL_COMP_MODULE_ENABLED +#include <stm32f0xx_hal_comp.h> +#endif +#ifdef HAL_CRC_MODULE_ENABLED +#include <stm32f0xx_hal_crc.h> +#endif +#ifdef HAL_DAC_MODULE_ENABLED +#include <stm32f0xx_hal_dac.h> +#endif +#ifdef HAL_FLASH_MODULE_ENABLED +#include <stm32f0xx_hal_flash.h> +#endif +#ifdef HAL_I2C_MODULE_ENABLED +#include <stm32f0xx_hal_i2c.h> +#endif +#ifdef HAL_I2S_MODULE_ENABLED +#include <stm32f0xx_hal_i2s.h> +#endif +#ifdef HAL_IRDA_MODULE_ENABLED +#include <stm32f0xx_hal_irda.h> +#endif +#ifdef HAL_IWDG_MODULE_ENABLED +#include <stm32f0xx_hal_iwdg.h> +#endif +#ifdef HAL_PCD_MODULE_ENABLED +#include <stm32f0xx_hal_pcd.h> +#endif +#ifdef HAL_PWR_MODULE_ENABLED +#include <stm32f0xx_hal_pwr.h> +#endif +#ifdef HAL_RTC_MODULE_ENABLED +#include <stm32f0xx_hal_rtc.h> +#endif +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include <stm32f0xx_hal_smartcard.h> +#endif +#ifdef HAL_SMBUS_MODULE_ENABLED +#include <stm32f0xx_hal_smbus.h> +#endif +#ifdef HAL_SPI_MODULE_ENABLED +#include <stm32f0xx_hal_spi.h> +#endif +#ifdef HAL_TIM_MODULE_ENABLED +#include <stm32f0xx_hal_tim.h> +#endif +#ifdef HAL_TSC_MODULE_ENABLED +#include <stm32f0xx_hal_tsc.h> +#endif +#ifdef HAL_UART_MODULE_ENABLED +#include <stm32f0xx_hal_uart.h> +#endif +#ifdef HAL_USART_MODULE_ENABLED +#include <stm32f0xx_hal_usart.h> +#endif +#ifdef HAL_WWDG_MODULE_ENABLED +#include <stm32f0xx_hal_wwdg.h> +#endif + +#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 |