diff options
| author | Damien George | 2018-02-23 16:54:07 +1100 |
|---|---|---|
| committer | Damien George | 2018-02-23 16:54:07 +1100 |
| commit | 989fc16162125c9c1c65e0f74d9d7bc73bc9a340 (patch) | |
| tree | f91b06e6061bc716e5128af02493080b8b188996 /ports/stm32/mpconfigboard_common.h | |
| parent | ea05b400df92a5d2282ca139f282b83db4740e22 (diff) | |
stm32: Move MCU-specific cfg from mphalport.h to mpconfigboard_common.h.
It's cleaner to have all the MCU-specific configuration in one location,
not least to help with adding support for a new MCU series.
Diffstat (limited to 'ports/stm32/mpconfigboard_common.h')
| -rw-r--r-- | ports/stm32/mpconfigboard_common.h | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/ports/stm32/mpconfigboard_common.h b/ports/stm32/mpconfigboard_common.h index 6465608f7..7befe998a 100644 --- a/ports/stm32/mpconfigboard_common.h +++ b/ports/stm32/mpconfigboard_common.h @@ -27,6 +27,8 @@ // Common settings and defaults for board configuration. // The defaults here should be overridden in mpconfigboard.h. +#include STM32_HAL_H + /*****************************************************************************/ // Feature settings with defaults @@ -93,19 +95,37 @@ /*****************************************************************************/ // General configuration -// Define the maximum number of peripherals that the MCU supports -#if defined(MCU_SERIES_F7) +// Configuration for STM32F4 series +#if defined(STM32F4) + +#define MP_HAL_UNIQUE_ID_ADDRESS (0x1fff7a10) +#define PYB_EXTI_NUM_VECTORS (23) +#define MICROPY_HW_MAX_TIMER (14) +#define MICROPY_HW_MAX_UART (6) + +// Configuration for STM32F7 series +#elif defined(STM32F7) + +#if defined(STM32F722xx) || defined(STM32F723xx) || defined(STM32F732xx) || defined(STM32F733xx) +#define MP_HAL_UNIQUE_ID_ADDRESS (0x1ff07a10) +#else +#define MP_HAL_UNIQUE_ID_ADDRESS (0x1ff0f420) +#endif + #define PYB_EXTI_NUM_VECTORS (24) #define MICROPY_HW_MAX_TIMER (17) #define MICROPY_HW_MAX_UART (8) -#elif defined(MCU_SERIES_L4) + +// Configuration for STM32L4 series +#elif defined(STM32L4) + +#define MP_HAL_UNIQUE_ID_ADDRESS (0x1fff7590) #define PYB_EXTI_NUM_VECTORS (23) #define MICROPY_HW_MAX_TIMER (17) #define MICROPY_HW_MAX_UART (6) + #else -#define PYB_EXTI_NUM_VECTORS (23) -#define MICROPY_HW_MAX_TIMER (14) -#define MICROPY_HW_MAX_UART (6) +#error Unsupported MCU series #endif // Enable hardware I2C if there are any peripherals defined @@ -118,3 +138,16 @@ // Pin definition header file #define MICROPY_PIN_DEFS_PORT_H "pin_defs_stm32.h" + +// D-cache clean/invalidate helpers +#if __DCACHE_PRESENT == 1 +#define MP_HAL_CLEANINVALIDATE_DCACHE(addr, size) \ + (SCB_CleanInvalidateDCache_by_Addr((uint32_t*)((uint32_t)addr & ~0x1f), \ + ((uint32_t)((uint8_t*)addr + size + 0x1f) & ~0x1f) - ((uint32_t)addr & ~0x1f))) +#define MP_HAL_CLEAN_DCACHE(addr, size) \ + (SCB_CleanDCache_by_Addr((uint32_t*)((uint32_t)addr & ~0x1f), \ + ((uint32_t)((uint8_t*)addr + size + 0x1f) & ~0x1f) - ((uint32_t)addr & ~0x1f))) +#else +#define MP_HAL_CLEANINVALIDATE_DCACHE(addr, size) +#define MP_HAL_CLEAN_DCACHE(addr, size) +#endif |
