arch: arm: core: aarch32: support for On-Chip Memory (OCM) areas in aarch32

Introduce support for On-Chip Memory (OCM) areas in aarch32 Cortex-A
SoCs. This memory area is suitable for, amongst other things, un-
cached device DMA. The OCM memory can reside either at address zero
or at a high memory address, with configuration of the memory's lo-
cation similar to the configuration of the location of the exception
vectors. In both cases, it must be assured that the low/high OCM
area declaration doesn't overlap with the exception vectors memory
page at either the low/high address. Therefore, all possible OCM
location options shall be described in the SoC's device tree, the
current location shall be indicated via a "chosen" entry in the
target board's device tree.

This commit contains the necessary changes to the linker-related
files as well as the static region declaration for the MMU in-
itialization in the Zynq-7000 SoC-specific init code.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
This commit is contained in:
Immo Birnbaum 2021-07-15 13:15:53 +02:00 committed by Carles Cufí
commit 01882b8624
4 changed files with 41 additions and 2 deletions

View file

@ -15,6 +15,7 @@
#include <linker/sections.h>
#include <devicetree.h>
#include <linker/devicetree_regions.h>
#include <linker/linker-defs.h>
#include <linker/linker-tool.h>
@ -80,6 +81,7 @@ MEMORY
{
FLASH (rx) : ORIGIN = ROM_ADDR, LENGTH = ROM_SIZE
SRAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE
LINKER_DT_REGION_FROM_NODE(OCM, rw, DT_CHOSEN(zephyr_ocm))
/* Used by and documented in include/linker/intlist.ld */
IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K
}
@ -340,6 +342,32 @@ SECTIONS
GROUP_END(RAMABLE_REGION)
#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ocm), okay)
GROUP_START(OCM)
SECTION_PROLOGUE(_OCM_BSS_SECTION_NAME, (NOLOAD),SUBALIGN(4))
{
__ocm_start = .;
__ocm_bss_start = .;
*(.ocm_bss)
*(".ocm_bss.*")
__ocm_bss_end = .;
} GROUP_LINK_IN(OCM)
SECTION_PROLOGUE(_OCM_DATA_SECTION_NAME,,SUBALIGN(4))
{
__ocm_data_start = .;
*(.ocm_data)
*(".ocm_data.*")
__ocm_data_end = .;
} GROUP_LINK_IN(OCM)
__ocm_end = .;
__ocm_size = __ocm_end - __ocm_start;
GROUP_END(OCM)
#endif
/* Located in generated directory. This file is populated by the
* zephyr_linker_sources() Cmake function.
*/

View file

@ -306,6 +306,12 @@ extern char __dtcm_start[];
extern char __dtcm_end[];
#endif
#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ocm), okay)
extern char __ocm_start[];
extern char __ocm_end[];
extern char __ocm_size[];
#endif
/* Used by the Security Attribution Unit to configure the
* Non-Secure Callable region.
*/

View file

@ -28,6 +28,8 @@
#define __dtcm_data_section Z_GENERIC_SECTION(_DTCM_DATA_SECTION_NAME)
#define __dtcm_bss_section Z_GENERIC_SECTION(_DTCM_BSS_SECTION_NAME)
#define __dtcm_noinit_section Z_GENERIC_SECTION(_DTCM_NOINIT_SECTION_NAME)
#define __ocm_data_section Z_GENERIC_SECTION(_OCM_DATA_SECTION_NAME)
#define __ocm_bss_section Z_GENERIC_SECTION(_OCM_BSS_SECTION_NAME)
#define __imx_boot_conf_section Z_GENERIC_SECTION(_IMX_BOOT_CONF_SECTION_NAME)
#define __imx_boot_data_section Z_GENERIC_SECTION(_IMX_BOOT_DATA_SECTION_NAME)
#define __imx_boot_ivt_section Z_GENERIC_SECTION(_IMX_BOOT_IVT_SECTION_NAME)

View file

@ -42,7 +42,7 @@
/* Architecture-specific sections */
#if defined(CONFIG_ARM)
#define _KINETIS_FLASH_CONFIG_SECTION_NAME kinetis_flash_config
#define _TI_CCFG_SECTION_NAME .ti_ccfg
#define _TI_CCFG_SECTION_NAME .ti_ccfg
#define _CCM_DATA_SECTION_NAME .ccm_data
#define _CCM_BSS_SECTION_NAME .ccm_bss
@ -50,9 +50,12 @@
#define _ITCM_SECTION_NAME .itcm
#define _DTCM_DATA_SECTION_NAME .dtcm_data
#define _DTCM_DATA_SECTION_NAME .dtcm_data
#define _DTCM_BSS_SECTION_NAME .dtcm_bss
#define _DTCM_NOINIT_SECTION_NAME .dtcm_noinit
#define _OCM_DATA_SECTION_NAME .ocm_data
#define _OCM_BSS_SECTION_NAME .ocm_bss
#endif
#define _IMX_BOOT_CONF_SECTION_NAME .boot_hdr.conf