diff --git a/cmsis-system_stm32f4xx.c b/cmsis-system_stm32f4xx.c index a5d3bad..b3e04b5 100644 --- a/cmsis-system_stm32f4xx.c +++ b/cmsis-system_stm32f4xx.c @@ -209,13 +209,6 @@ void SystemInit(void) /* Configure the System clock source, PLL Multiplier and Divider factors, AHB/APBx prescalers and Flash settings */ SetSysClock(); - - // Enable power and clocking for all GPIO - RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN | \ - RCC_AHB1ENR_GPIOBEN | \ - RCC_AHB1ENR_GPIOCEN | \ - RCC_AHB1ENR_GPIODEN | \ - RCC_AHB1ENR_GPIOHEN; } diff --git a/cpu-lpc.c b/cpu-lpc.c index 8b5d325..fc66d7d 100644 --- a/cpu-lpc.c +++ b/cpu-lpc.c @@ -5,8 +5,8 @@ To be included from cpu.c, for details see there. */ -#if defined TEACUP_C_INCLUDE && defined __ARMEL__ - +#if defined TEACUP_C_INCLUDE && defined __ARM_LPC1114__ + #include "config_wrapper.h" void cpu_init() { @@ -23,4 +23,4 @@ void cpu_init() { #endif } -#endif /* defined TEACUP_C_INCLUDE && defined __ARMEL__ */ +#endif /* defined TEACUP_C_INCLUDE && defined __ARM_LPC1114__ */ diff --git a/cpu-stm32.c b/cpu-stm32.c new file mode 100644 index 0000000..1bc8a28 --- /dev/null +++ b/cpu-stm32.c @@ -0,0 +1,24 @@ + +/** \file + \brief CPU initialisation, ARM specific part. + + To be included from cpu.c, for details see there. +*/ + +#if defined TEACUP_C_INCLUDE && defined __ARM_STM32F411__ + +#include "config_wrapper.h" + +void cpu_init() { + /** + Enable all periphals. + */ + // Enable power and clocking for all GPIO + RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN | + RCC_AHB1ENR_GPIOBEN | + RCC_AHB1ENR_GPIOCEN | + RCC_AHB1ENR_GPIODEN | + RCC_AHB1ENR_GPIOHEN; +} + +#endif /* defined TEACUP_C_INCLUDE && defined __ARM_STM32F411__ */ diff --git a/cpu.c b/cpu.c index 3ae8133..d154a27 100644 --- a/cpu.c +++ b/cpu.c @@ -10,6 +10,7 @@ #define TEACUP_C_INCLUDE #include "cpu-avr.c" #include "cpu-lpc.c" +#include "cpu-stm32.c" #undef TEACUP_C_INCLUDE /* No common code so far. */