arch/arm/src/stm32l4: add initial support for STM32L412 and STM32L422 chips

This commit is contained in:
Juha Niskanen 2018-11-09 09:54:20 -06:00 committed by Gregory Nutt
parent 8193c28e91
commit e37f260d67
4 changed files with 80 additions and 8 deletions

View File

@ -93,12 +93,12 @@
defined(CONFIG_STM32L4_STM32L462XX)
# define STM32L4_SRAM1_SIZE (128*1024) /* 128Kb SRAM1 on AHB bus Matrix */
# define STM32L4_SRAM2_SIZE (32*1024) /* 32Kb SRAM2 on AHB bus Matrix */
#elif defined(CONFIG_STM32L4_STM32L432XX)
# define STM32L4_SRAM1_SIZE (48*1024) /* 48Kb SRAM1 on AHB bus Matrix */
# define STM32L4_SRAM2_SIZE (16*1024) /* 16Kb SRAM2 on AHB bus Matrix */
#elif defined(CONFIG_STM32L4_STM32L433XX)
#elif defined(CONFIG_STM32L4_STM32L432XX) || defined(CONFIG_STM32L4_STM32L433XX)
# define STM32L4_SRAM1_SIZE (48*1024) /* 48Kb SRAM1 on AHB bus Matrix */
# define STM32L4_SRAM2_SIZE (16*1024) /* 16Kb SRAM2 on AHB bus Matrix */
#elif defined(CONFIG_STM32L4_STM32L412XX) || defined(CONFIG_STM32L4_STM32L422XX)
# define STM32L4_SRAM1_SIZE (32*1024) /* 32Kb SRAM1 on AHB bus Matrix */
# define STM32L4_SRAM2_SIZE (8*1024) /* 8Kb SRAM2 on AHB bus Matrix */
#else
# error "Unsupported STM32L4 chip"
#endif
@ -303,7 +303,37 @@
# define STM32L4_NCRC 1 /* CRC */
# define STM32L4_NCOMP 2 /* Comparators */
# define STM32L4_NOPAMP 1 /* Operational Amplifiers */
#endif /* CONFIG_STM32L4_STM32L432XX */
#endif /* CONFIG_STM32L4_STM32L433XX */
#if defined(CONFIG_STM32L4_STM32L412XX) || defined(CONFIG_STM32L4_STM32L422XX)
# define STM32L4_NFSMC 0 /* No FSMC memory controller */
# define STM32L4_NATIM 1 /* One advanced timer TIM1 */
# define STM32L4_NGTIM32 1 /* 32-bit general timer TIM2 with DMA */
# define STM32L4_NGTIM16 2 /* 16-bit general timers TIM15-16 with DMA */
# define STM32L4_NGTIMNDMA 0 /* No 16-bit general timers without DMA */
# define STM32L4_NBTIM 1 /* One basic timer, TIM6 */
# define STM32L4_NLPTIM 2 /* Two low-power timers, LPTIM1-2 */
# define STM32L4_NRNG 1 /* Random number generator (RNG) */
# define STM32L4_NUART 0 /* No UART */
# define STM32L4_NUSART 3 /* USART 1-3 */
# define STM32L4_NLPUART 1 /* LPUART 1 */
# define STM32L4_QSPI 1 /* QuadSPI1 */
# define STM32L4_NSPI 3 /* SPI1-SPI3 */
# define STM32L4_NI2C 3 /* I2C1-I2C3 */
# define STM32L4_NSWPMI 0 /* No SWPMI */
# define STM32L4_NUSBOTGFS 0 /* No USB OTG FS */
# define STM32L4_NUSBFS 1 /* USB FS */
# define STM32L4_NCAN 0 /* No CAN */
# define STM32L4_NSAI 0 /* No SAI */
# define STM32L4_NSDMMC 0 /* No SDMMC interface */
# define STM32L4_NDMA 2 /* DMA1-2 */
# define STM32L4_NPORTS 8 /* 8 GPIO ports, GPIOA-H */
# define STM32L4_NADC 2 /* 12-bit ADC1-2, 10 channels */
# define STM32L4_NDAC 0 /* No DAC */
# define STM32L4_NCRC 1 /* CRC */
# define STM32L4_NCOMP 2 /* Comparators */
# define STM32L4_NOPAMP 1 /* Operational Amplifiers */
#endif /* CONFIG_STM32L4_STM32L412XX || CONFIG_STM32L4_STM32L422XX */
/* NVIC priority levels *************************************************************/
/* 16 Programmable interrupt levels */

View File

@ -12,6 +12,14 @@ choice
default ARCH_CHIP_STM32L476RG
depends on ARCH_CHIP_STM32L4
config ARCH_CHIP_STM32L412KB
bool "STM32L412KB"
select STM32L4_STM32L412XX
select STM32L4_FLASH_CONFIG_B
select STM32L4_IO_CONFIG_K
---help---
STM32 L4 Cortex M4, 128 Kb FLASH, 40 Kb SRAM
config ARCH_CHIP_STM32L432KB
bool "STM32L432KB"
select STM32L4_STM32L432XX
@ -558,6 +566,19 @@ config STM32L4_STM32L4XR
# Chip subfamilies:
config STM32L4_STM32L412XX
bool
default n
select STM32L4_STM32L4X2
select STM32L4_HAVE_ADC2
config STM32L4_STM32L422XX
bool
default n
select STM32L4_STM32L4X2
select STM32L4_HAVE_ADC2
select STM32L4_HAVE_AES
config STM32L4_STM32L431XX
bool
default n
@ -717,6 +738,7 @@ choice
that designates the FLASH size.
Designator Size in KiB
8 64
B 128
C 256
E 512
@ -738,6 +760,9 @@ choice
config STM32L4_FLASH_OVERRIDE_DEFAULT
bool "Default"
config STM32L4_FLASH_OVERRIDE_8
bool "8 64 KB"
config STM32L4_FLASH_OVERRIDE_B
bool "B 128 KB"
@ -757,6 +782,11 @@ endchoice # "Override Flash Size Designator"
# Flash configurations
config STM32L4_FLASH_CONFIG_8
bool
default n
depends on STM32L4_STM32L412XX
config STM32L4_FLASH_CONFIG_B
bool
default n
@ -787,6 +817,10 @@ config STM32L4_IO_CONFIG_K
bool
default n
config STM32L4_IO_CONFIG_T
bool
default n
config STM32L4_IO_CONFIG_C
bool
default n

View File

@ -63,11 +63,13 @@
#define _K(x) ((x)*1024)
#if !defined(CONFIG_STM32L4_FLASH_OVERRIDE_DEFAULT) && \
!defined(CONFIG_STM32L4_FLASH_OVERRIDE_8) && \
!defined(CONFIG_STM32L4_FLASH_OVERRIDE_B) && \
!defined(CONFIG_STM32L4_FLASH_OVERRIDE_C) && \
!defined(CONFIG_STM32L4_FLASH_OVERRIDE_E) && \
!defined(CONFIG_STM32L4_FLASH_OVERRIDE_G) && \
!defined(CONFIG_STM32L4_FLASH_OVERRIDE_I) && \
!defined(CONFIG_STM32L4_FLASH_CONFIG_8) && \
!defined(CONFIG_STM32L4_FLASH_CONFIG_B) && \
!defined(CONFIG_STM32L4_FLASH_CONFIG_C) && \
!defined(CONFIG_STM32L4_FLASH_CONFIG_E) && \
@ -80,12 +82,15 @@
/* Override of the Flash has been chosen */
#if !defined(CONFIG_STM32L4_FLASH_OVERRIDE_DEFAULT)
# undef CONFIG_STM32L4_FLASH_CONFIG_8
# undef CONFIG_STM32L4_FLASH_CONFIG_B
# undef CONFIG_STM32L4_FLASH_CONFIG_C
# undef CONFIG_STM32L4_FLASH_CONFIG_E
# undef CONFIG_STM32L4_FLASH_CONFIG_G
# undef CONFIG_STM32L4_FLASH_CONFIG_I
# if defined(CONFIG_STM32L4_FLASH_OVERRIDE_B)
# if defined(CONFIG_STM32L4_FLASH_OVERRIDE_8)
# define CONFIG_STM32L4_FLASH_CONFIG_8
# elif defined(CONFIG_STM32L4_FLASH_OVERRIDE_B)
# define CONFIG_STM32L4_FLASH_CONFIG_B
# elif defined(CONFIG_STM32L4_FLASH_OVERRIDE_C)
# define CONFIG_STM32L4_FLASH_CONFIG_C
@ -100,7 +105,10 @@
/* Define the valid configuration */
#if defined(CONFIG_STM32L4_FLASH_CONFIG_B) /* 128 kB */
#if defined(CONFIG_STM32L4_FLASH_CONFIG_8) /* 64 kB */
# define STM32L4_FLASH_NPAGES 32
# define STM32L4_FLASH_PAGESIZE 2048
#elif defined(CONFIG_STM32L4_FLASH_CONFIG_B) /* 128 kB */
# define STM32L4_FLASH_NPAGES 64
# define STM32L4_FLASH_PAGESIZE 2048
#elif defined(CONFIG_STM32L4_FLASH_CONFIG_C) /* 256 kB */

View File

@ -365,7 +365,7 @@ void up_addregion(void)
up_heap_color((FAR void *)SRAM3_START, SRAM3_END-SRAM3_START);
/* Add the SRAM2 user heap region. */
/* Add the SRAM3 user heap region. */
kumm_addregion((FAR void *)SRAM3_START, SRAM3_END-SRAM3_START);