mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Merged nuttx/arch into master
This commit is contained in:
@@ -83,8 +83,12 @@
|
||||
# define ATSAMA5D2 1 /* SAMA5D2 family */
|
||||
# undef ATSAMA5D3 /* Not SAMA5D3 family */
|
||||
# undef ATSAMA5D4 /* Not SAMA5D4 family */
|
||||
# define SAM_ISRAM0_SIZE (64*1024) /* 128KB of SRAM in two banks */
|
||||
# define SAM_ISRAM1_SIZE (64*1024)
|
||||
# define SAM_ISRAM0_SIZE (128*1024) /* SRAM0: 128KB */
|
||||
#ifdef CONFIG_ARMV7A_L2CC_PL310
|
||||
# define SAM_ISRAM1_SIZE (0) /* (SRAM1 used for L2 cache )*/
|
||||
#else
|
||||
# define SAM_ISRAM0_SIZE (64*1024) /* SRAM1: 128KB */
|
||||
#endif
|
||||
# define SAM_NDMAC 2 /* (2) XDMA controllers */
|
||||
# define SAM_NDMACHAN 16 /* (16) DMA channels per XDMA controller */
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -73,11 +73,11 @@
|
||||
/* SAMA5 Physical (unmapped) Memory Map */
|
||||
|
||||
#define SAM_INTMEM_PSECTION 0x00000000 /* 0x00000000-0x0fffffff: Internal Memories */
|
||||
#define SAM_EBICS0_PSECTION 0x10000000 /* 0x10000000-0x1fffffff: EBI Chip select 0 */
|
||||
#define SAM_DDRCS_PSECTION 0x20000000 /* 0x20000000-0x3fffffff: EBI DDRCS */
|
||||
#define SAM_EBICS1_PSECTION 0x60000000 /* 0x60000000-0x6fffffff: EBI Chip select 1 */
|
||||
#define SAM_EBICS2_PSECTION 0x70000000 /* 0x70000000-0x7fffffff: EBI Chip select 2 */
|
||||
#define SAM_EBICS3_PSECTION 0x80000000 /* 0x80000000-0x8fffffff: EBI Chip select 2 */
|
||||
#define SAM_EBICS0_PSECTION 0x10000000 /* 0x10000000-0x1fffffff: EBI Chip Select 0 */
|
||||
#define SAM_DDRCS_PSECTION 0x20000000 /* 0x20000000-0x3fffffff: EBI DDR Chip Select */
|
||||
#define SAM_EBICS1_PSECTION 0x60000000 /* 0x60000000-0x6fffffff: EBI Chip Select 1 */
|
||||
#define SAM_EBICS2_PSECTION 0x70000000 /* 0x70000000-0x7fffffff: EBI Chip Select 2 */
|
||||
#define SAM_EBICS3_PSECTION 0x80000000 /* 0x80000000-0x8fffffff: EBI Chip Select 3 */
|
||||
#define SAM_NFCCR_PSECTION 0x90000000 /* 0x90000000-0x9fffffff: NFC Command Registers */
|
||||
/* 0x80000000-0xefffffff: Undefined */
|
||||
#define SAM_PERIPH_PSECTION 0xf0000000 /* 0xf0000000-0xffffffff: Internal Peripherals */
|
||||
@@ -361,11 +361,11 @@
|
||||
# define SAM_DAP_VSECTION 0x00800000 /* 0x00800000-0x008fffff: DAP */
|
||||
# define SAM_SMD_VSECTION 0x00900000 /* 0x00900000-0x009fffff: SMD */
|
||||
# define SAM_L2CC_VSECTION 0x00a00000 /* 0x00a00000-0x00afffff: L2CC */
|
||||
# define SAM_EBICS0_VSECTION 0x10000000 /* 0x10000000-0x1fffffff: EBI Chip select 0 */
|
||||
# define SAM_DDRCS_VSECTION 0x20000000 /* 0x20000000-0x3fffffff: EBI DDRCS */
|
||||
# define SAM_EBICS1_VSECTION 0x60000000 /* 0x60000000-0x6fffffff: EBI Chip select 1 */
|
||||
# define SAM_EBICS2_VSECTION 0x70000000 /* 0x70000000-0x7fffffff: EBI Chip select 2 */
|
||||
# define SAM_EBICS3_VSECTION 0x80000000 /* 0x80000000-0x8fffffff: EBI Chip select 2 */
|
||||
# define SAM_EBICS0_VSECTION 0x10000000 /* 0x10000000-0x1fffffff: EBI Chip Select 0 */
|
||||
# define SAM_DDRCS_VSECTION 0x20000000 /* 0x20000000-0x3fffffff: EBI DDR Chip Select */
|
||||
# define SAM_EBICS1_VSECTION 0x60000000 /* 0x60000000-0x6fffffff: EBI Chip Select 1 */
|
||||
# define SAM_EBICS2_VSECTION 0x70000000 /* 0x70000000-0x7fffffff: EBI Chip Select 2 */
|
||||
# define SAM_EBICS3_VSECTION 0x80000000 /* 0x80000000-0x8fffffff: EBI Chip Select 3 */
|
||||
# define SAM_NFCCR_VSECTION 0x90000000 /* 0x90000000-0x9fffffff: NFC Command Registers */
|
||||
# define SAM_PERIPHA_VSECTION 0xf0000000 /* 0xf0000000-0xf0023fff: Internal Peripherals A */
|
||||
# define SAM_PERIPHB_VSECTION 0xf8000000 /* 0xf8000000-0xf803c3ff: Internal Peripherals B */
|
||||
|
||||
@@ -811,6 +811,73 @@ config ARCH_CHIP_STM32F446Z
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "Override Flash Size Designator"
|
||||
default STM32_FLASH_CONFIG_DEFAULT
|
||||
depends on ARCH_CHIP_STM32
|
||||
---help---
|
||||
STM32F series parts numbering (sans the package type) ends with a number or letter
|
||||
that designates the FLASH size.
|
||||
|
||||
Designator Size in KiB
|
||||
4 16
|
||||
6 32
|
||||
8 64
|
||||
B 128
|
||||
C 256
|
||||
D 384
|
||||
E 512
|
||||
F 768
|
||||
G 1024
|
||||
I 2048
|
||||
|
||||
This configuration option defaults to using the configuration based on that designator
|
||||
or the default smaller size if there is no last character designator is present in the
|
||||
STM32 Chip Selection.
|
||||
|
||||
Examples:
|
||||
If the STM32F407VE is chosen, the Flash configuration would be 'E', if a variant of
|
||||
the part with a 2048 KiB Flash is released in the future one could simply select
|
||||
the 'I' designator here.
|
||||
|
||||
If an STM32F42xxx or Series parts is chosen the default Flash configuration will be 'G'
|
||||
and can be set herein to 'I' to choose the larger FLASH part.
|
||||
|
||||
config STM32_FLASH_CONFIG_DEFAULT
|
||||
bool "Default"
|
||||
|
||||
config STM32_FLASH_CONFIG_4
|
||||
bool "4 16KiB"
|
||||
|
||||
config STM32_FLASH_CONFIG_6
|
||||
bool "6 32KiB"
|
||||
|
||||
config STM32_FLASH_CONFIG_8
|
||||
bool "8 64KiB"
|
||||
|
||||
config STM32_FLASH_CONFIG_B
|
||||
bool "B 128KiB"
|
||||
|
||||
config STM32_FLASH_CONFIG_C
|
||||
bool "C 256KiB"
|
||||
|
||||
config STM32_FLASH_CONFIG_D
|
||||
bool "D 384KiB"
|
||||
|
||||
config STM32_FLASH_CONFIG_E
|
||||
bool "E 512KiB"
|
||||
|
||||
config STM32_FLASH_CONFIG_F
|
||||
bool "F 768KiB"
|
||||
|
||||
config STM32_FLASH_CONFIG_G
|
||||
bool "G 1024KiB"
|
||||
|
||||
config STM32_FLASH_CONFIG_I
|
||||
bool "I 2048KiB"
|
||||
|
||||
endchoice
|
||||
|
||||
# This is really 15XX/16XX, but we treat the two the same.
|
||||
config STM32_STM32L15XX
|
||||
bool
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/stm32/chip/stm32_flash.h
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009, 2011, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@uas.net>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -40,46 +41,162 @@
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_STM32_STM32L15XX)
|
||||
#define _K(x) ((x)*1024)
|
||||
|
||||
#if !defined(CONFIG_STM32_FLASH_CONFIG_DEFAULT) && \
|
||||
!defined(CONFIG_STM32_FLASH_CONFIG_4) && \
|
||||
!defined(CONFIG_STM32_FLASH_CONFIG_6) && \
|
||||
!defined(CONFIG_STM32_FLASH_CONFIG_8) && \
|
||||
!defined(CONFIG_STM32_FLASH_CONFIG_B) && \
|
||||
!defined(CONFIG_STM32_FLASH_CONFIG_C) && \
|
||||
!defined(CONFIG_STM32_FLASH_CONFIG_D) && \
|
||||
!defined(CONFIG_STM32_FLASH_CONFIG_E) && \
|
||||
!defined(CONFIG_STM32_FLASH_CONFIG_F) && \
|
||||
!defined(CONFIG_STM32_FLASH_CONFIG_G) && \
|
||||
!defined(CONFIG_STM32_FLASH_CONFIG_I)
|
||||
# define CONFIG_STM32_FLASH_CONFIG_DEFAULT
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STM32_FLASH_CONFIG_DEFAULT)
|
||||
# if defined(CONFIG_STM32_STM32L15XX)
|
||||
|
||||
/* The STM32 L15xx/L16xx can support up to 384KB of FLASH. (In reality, supported
|
||||
* L15xx parts have no more than 128KB). The program memory block is divided into
|
||||
* 96 sectors of 4 Kbytes each, and each sector is further split up into 16 pages of
|
||||
* 256 bytes each. The sector is the write protection granularity. In total, the
|
||||
* program memory block contains 1536 pages.
|
||||
*/
|
||||
# define STM32_FLASH_NPAGES 1536
|
||||
# define STM32_FLASH_PAGESIZE 256
|
||||
|
||||
#elif defined(CONFIG_STM32_LOWDENSITY)
|
||||
# define STM32_FLASH_NPAGES 32
|
||||
# define STM32_FLASH_PAGESIZE 1024
|
||||
# define STM32_FLASH_NPAGES 1536
|
||||
# define STM32_FLASH_PAGESIZE 256
|
||||
|
||||
#elif defined(CONFIG_STM32_MEDIUMDENSITY)
|
||||
# define STM32_FLASH_NPAGES 128
|
||||
# define STM32_FLASH_PAGESIZE 1024
|
||||
# elif defined(CONFIG_STM32_LOWDENSITY)
|
||||
# define STM32_FLASH_NPAGES 32
|
||||
# define STM32_FLASH_PAGESIZE 1024
|
||||
|
||||
#elif defined(CONFIG_STM32_CONNECTIVITYLINE)
|
||||
# define STM32_FLASH_NPAGES 128
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
# elif defined(CONFIG_STM32_MEDIUMDENSITY)
|
||||
# define STM32_FLASH_NPAGES 128
|
||||
# define STM32_FLASH_PAGESIZE 1024
|
||||
|
||||
#elif defined(CONFIG_STM32_HIGHDENSITY)
|
||||
# define STM32_FLASH_NPAGES 256
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
# elif defined(CONFIG_STM32_CONNECTIVITYLINE)
|
||||
# define STM32_FLASH_NPAGES 128
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
|
||||
#elif defined(CONFIG_STM32_STM32F30XX)
|
||||
# define STM32_FLASH_NPAGES 128
|
||||
# define STM32_FLASH_PAGESIZE (2*1024)
|
||||
# elif defined(CONFIG_STM32_HIGHDENSITY)
|
||||
# define STM32_FLASH_NPAGES 256
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
|
||||
#elif defined(CONFIG_STM32_STM32F37XX)
|
||||
# define STM32_FLASH_NPAGES 128
|
||||
# define STM32_FLASH_PAGESIZE (2*1024)
|
||||
# elif defined(CONFIG_STM32_STM32F30XX)
|
||||
# define STM32_FLASH_NPAGES 128
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
|
||||
#elif defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX)
|
||||
# define STM32_FLASH_NPAGES 8
|
||||
/* STM32F4 has mixed page size */
|
||||
# undef STM32_FLASH_PAGESIZE
|
||||
/* TODO: add proper sizes for each chip in the family - maybe in chip.h? */
|
||||
# define STM32_FLASH_SIZE (8 * 128 * 1024)
|
||||
# elif defined(CONFIG_STM32_STM32F37XX)
|
||||
# define STM32_FLASH_NPAGES 128
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
|
||||
# elif defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX)
|
||||
# define STM32_FLASH_NPAGES 8
|
||||
# define STM32_FLASH_SIZE _K((4 * 16) + (1 * 64) + (3 * 128))
|
||||
# define STM32_FLASH_SIZES {_K(16), _K(16), _K(16), _K(16), \
|
||||
_K(64),_K(128), _K(128), _K(128)}
|
||||
|
||||
/* STM32F4 has mixed page size */
|
||||
|
||||
# undef STM32_FLASH_PAGESIZE
|
||||
# endif
|
||||
#endif /* CONFIG_STM32_FLASH_CONFIG_DEFAULT */
|
||||
|
||||
/* Override of the Flash Has been Chosen */
|
||||
|
||||
#if !defined(CONFIG_STM32_FLASH_CONFIG_DEFAULT)
|
||||
|
||||
/* Define the Valid Configuration the F2 and F4 */
|
||||
|
||||
# if defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX)
|
||||
|
||||
# if defined(CONFIG_STM32_FLASH_CONFIG_B)
|
||||
# define STM32_FLASH_NPAGES 5
|
||||
# define STM32_FLASH_SIZE _K((4 * 16) + (1 * 64))
|
||||
# define STM32_FLASH_SIZES {_K(16), _K(16), _K(16), _K(16), \
|
||||
_K(64)}
|
||||
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_C)
|
||||
# define STM32_FLASH_NPAGES 6
|
||||
# define STM32_FLASH_SIZE _K((4 * 16) + (1 * 64) + (1 * 128))
|
||||
# define STM32_FLASH_SIZES {_K(16), _K(16), _K(16), _K(16), \
|
||||
_K(64), _K(128)}
|
||||
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_D) && defined(CONFIG_STM32_STM32F40XX)
|
||||
# define STM32_FLASH_NPAGES 7
|
||||
# define STM32_FLASH_SIZE _K((4 * 16) + (1 * 64) + (2 * 128))
|
||||
# define STM32_FLASH_SIZES {_K(16), _K(16), _K(16), _K(16), \
|
||||
_K(64), _K(128), _K(128)}
|
||||
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_E)
|
||||
# define STM32_FLASH_NPAGES 8
|
||||
# define STM32_FLASH_SIZE _K((4 * 16) + (1 * 64) + (3 * 128))
|
||||
# define STM32_FLASH_SIZES {_K(16), _K(16), _K(16), _K(16), \
|
||||
_K(64), _K(128), _K(128), _K(128)}
|
||||
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_F) && defined(CONFIG_STM32_STM32F20XX)
|
||||
# define STM32_FLASH_NPAGES 9
|
||||
# define STM32_FLASH_SIZE _K((4 * 16) + (1 * 64) + (4 * 128))
|
||||
# define STM32_FLASH_SIZES {_K(16), _K(16), _K(16), _K(16), \
|
||||
_K(64), _K(128), _K(128), _K(128), \
|
||||
_K(128)}
|
||||
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_G)
|
||||
# define STM32_FLASH_NPAGES 12
|
||||
# define STM32_FLASH_SIZE _K((4 * 16) + (1 * 64) + (7 * 128))
|
||||
# define STM32_FLASH_SIZES {_K(16), _K(16), _K(16), _K(16), \
|
||||
_K(64), _K(128), _K(128), _K(128), \
|
||||
_K(128), _K(128), _K(128), _K(128)}
|
||||
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_I) && defined(CONFIG_STM32_STM32F40XX)
|
||||
# define STM32_FLASH_NPAGES 24
|
||||
# define STM32_FLASH_SIZE _K((4 * 16) + (1 * 64) + (7 * 128)) + \
|
||||
_K((4 * 16) + (1 * 64) + (7 * 128))
|
||||
# define STM32_FLASH_SIZES {_K(16), _K(16), _K(16), _K(16), \
|
||||
_K(64), _K(128), _K(128), _K(128), \
|
||||
_K(128), _K(128), _K(128), _K(128), \
|
||||
_K(16), _K(16), _K(16), _K(16), \
|
||||
_K(64), _K(128), _K(128), _K(128), \
|
||||
_K(128), _K(128), _K(128), _K(128)}
|
||||
# endif
|
||||
|
||||
/* Define the Valid Configuration the F1 and F3 */
|
||||
|
||||
# else
|
||||
# if defined(CONFIG_STM32_FLASH_CONFIG_4)
|
||||
# define STM32_FLASH_NPAGES 16
|
||||
# define STM32_FLASH_PAGESIZE 1024
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_6)
|
||||
# define STM32_FLASH_NPAGES 32
|
||||
# define STM32_FLASH_PAGESIZE 1024
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_8)
|
||||
# define STM32_FLASH_NPAGES 64
|
||||
# define STM32_FLASH_PAGESIZE 1024
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_B)
|
||||
# define STM32_FLASH_NPAGES 128
|
||||
# define STM32_FLASH_PAGESIZE 1024
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_C)
|
||||
# define STM32_FLASH_NPAGES 128
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_D)
|
||||
# define STM32_FLASH_NPAGES 192
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_E)
|
||||
# define STM32_FLASH_NPAGES 256
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_F)
|
||||
# define STM32_FLASH_NPAGES 384
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_G)
|
||||
# define STM32_FLASH_NPAGES 512
|
||||
# define STM32_FLASH_PAGESIZE 2048
|
||||
# elif defined(CONFIG_STM32_FLASH_CONFIG_I)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef STM32_FLASH_PAGESIZE
|
||||
@@ -264,5 +381,11 @@
|
||||
# define FLASH_OPTCR1_NWRP_MASK (0xff << FLASH_OPTCR_NWRP_SHIFT)
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32_CHIP_STM32_FLASH_H */
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
void stm32_flash_lock(void);
|
||||
void stm32_flash_unlock(void);
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32_CHIP_STM32_FLASH_H */
|
||||
|
||||
@@ -60,6 +60,11 @@
|
||||
#if defined(CONFIG_STM32_STM32F10XX) || defined(CONFIG_STM32_STM32F30XX) || \
|
||||
defined (CONFIG_STM32_STM32F40XX)
|
||||
|
||||
#if defined(CONFIG_STM32_FLASH_CONFIG_DEFAULT) && \
|
||||
(defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX))
|
||||
# warning "Default Flash Configuration Used - See Override Flash Size Designator"
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
@@ -79,6 +84,9 @@
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
void stm32_flash_unlock(void)
|
||||
{
|
||||
while (getreg32(STM32_FLASH_SR) & FLASH_SR_BSY)
|
||||
@@ -100,9 +108,6 @@ void stm32_flash_lock(void)
|
||||
modifyreg32(STM32_FLASH_CR, 0, FLASH_CR_LOCK);
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_STM32_STM32F10XX) || defined(CONFIG_STM32_STM32F30XX)
|
||||
|
||||
@@ -142,17 +147,7 @@ size_t up_progmem_getaddress(size_t page)
|
||||
|
||||
size_t up_progmem_pagesize(size_t page)
|
||||
{
|
||||
static const size_t page_sizes[STM32_FLASH_NPAGES] =
|
||||
{
|
||||
16 * 1024,
|
||||
16 * 1024,
|
||||
16 * 1024,
|
||||
16 * 1024,
|
||||
64 * 1024,
|
||||
128 * 1024,
|
||||
128 * 1024,
|
||||
128 * 1024,
|
||||
};
|
||||
static const size_t page_sizes[STM32_FLASH_NPAGES] = STM32_FLASH_SIZES;
|
||||
|
||||
if (page >= sizeof(page_sizes) / sizeof(*page_sizes))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user