STM32F411: add cpu-stm32.c

This commit is contained in:
Nico Tonnhofer 2016-03-25 02:21:01 +01:00
parent a4083dc360
commit ab03852750
4 changed files with 28 additions and 10 deletions

View File

@ -210,13 +210,6 @@ void SystemInit(void)
AHB/APBx prescalers and Flash settings */ AHB/APBx prescalers and Flash settings */
SetSysClock(); 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;
} }
/** /**

View File

@ -5,7 +5,7 @@
To be included from cpu.c, for details see there. 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" #include "config_wrapper.h"
@ -23,4 +23,4 @@ void cpu_init() {
#endif #endif
} }
#endif /* defined TEACUP_C_INCLUDE && defined __ARMEL__ */ #endif /* defined TEACUP_C_INCLUDE && defined __ARM_LPC1114__ */

24
cpu-stm32.c Normal file
View File

@ -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__ */

1
cpu.c
View File

@ -10,6 +10,7 @@
#define TEACUP_C_INCLUDE #define TEACUP_C_INCLUDE
#include "cpu-avr.c" #include "cpu-avr.c"
#include "cpu-lpc.c" #include "cpu-lpc.c"
#include "cpu-stm32.c"
#undef TEACUP_C_INCLUDE #undef TEACUP_C_INCLUDE
/* No common code so far. */ /* No common code so far. */