Skip to content

Commit 01882b8

Browse files
ibirnbaumcarlescufi
authored andcommitted
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 <[email protected]>
1 parent 266875e commit 01882b8

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

include/arch/arm/aarch32/cortex_a_r/scripts/linker.ld

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linker/sections.h>
1616
#include <devicetree.h>
1717

18+
#include <linker/devicetree_regions.h>
1819
#include <linker/linker-defs.h>
1920
#include <linker/linker-tool.h>
2021

@@ -80,6 +81,7 @@ MEMORY
8081
{
8182
FLASH (rx) : ORIGIN = ROM_ADDR, LENGTH = ROM_SIZE
8283
SRAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE
84+
LINKER_DT_REGION_FROM_NODE(OCM, rw, DT_CHOSEN(zephyr_ocm))
8385
/* Used by and documented in include/linker/intlist.ld */
8486
IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K
8587
}
@@ -340,6 +342,32 @@ SECTIONS
340342

341343
GROUP_END(RAMABLE_REGION)
342344

345+
#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ocm), okay)
346+
GROUP_START(OCM)
347+
348+
SECTION_PROLOGUE(_OCM_BSS_SECTION_NAME, (NOLOAD),SUBALIGN(4))
349+
{
350+
__ocm_start = .;
351+
__ocm_bss_start = .;
352+
*(.ocm_bss)
353+
*(".ocm_bss.*")
354+
__ocm_bss_end = .;
355+
} GROUP_LINK_IN(OCM)
356+
357+
SECTION_PROLOGUE(_OCM_DATA_SECTION_NAME,,SUBALIGN(4))
358+
{
359+
__ocm_data_start = .;
360+
*(.ocm_data)
361+
*(".ocm_data.*")
362+
__ocm_data_end = .;
363+
} GROUP_LINK_IN(OCM)
364+
365+
__ocm_end = .;
366+
__ocm_size = __ocm_end - __ocm_start;
367+
368+
GROUP_END(OCM)
369+
#endif
370+
343371
/* Located in generated directory. This file is populated by the
344372
* zephyr_linker_sources() Cmake function.
345373
*/

include/linker/linker-defs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,12 @@ extern char __dtcm_start[];
306306
extern char __dtcm_end[];
307307
#endif
308308

309+
#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ocm), okay)
310+
extern char __ocm_start[];
311+
extern char __ocm_end[];
312+
extern char __ocm_size[];
313+
#endif
314+
309315
/* Used by the Security Attribution Unit to configure the
310316
* Non-Secure Callable region.
311317
*/

include/linker/section_tags.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#define __dtcm_data_section Z_GENERIC_SECTION(_DTCM_DATA_SECTION_NAME)
2929
#define __dtcm_bss_section Z_GENERIC_SECTION(_DTCM_BSS_SECTION_NAME)
3030
#define __dtcm_noinit_section Z_GENERIC_SECTION(_DTCM_NOINIT_SECTION_NAME)
31+
#define __ocm_data_section Z_GENERIC_SECTION(_OCM_DATA_SECTION_NAME)
32+
#define __ocm_bss_section Z_GENERIC_SECTION(_OCM_BSS_SECTION_NAME)
3133
#define __imx_boot_conf_section Z_GENERIC_SECTION(_IMX_BOOT_CONF_SECTION_NAME)
3234
#define __imx_boot_data_section Z_GENERIC_SECTION(_IMX_BOOT_DATA_SECTION_NAME)
3335
#define __imx_boot_ivt_section Z_GENERIC_SECTION(_IMX_BOOT_IVT_SECTION_NAME)

include/linker/sections.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,20 @@
4242
/* Architecture-specific sections */
4343
#if defined(CONFIG_ARM)
4444
#define _KINETIS_FLASH_CONFIG_SECTION_NAME kinetis_flash_config
45-
#define _TI_CCFG_SECTION_NAME .ti_ccfg
45+
#define _TI_CCFG_SECTION_NAME .ti_ccfg
4646

4747
#define _CCM_DATA_SECTION_NAME .ccm_data
4848
#define _CCM_BSS_SECTION_NAME .ccm_bss
4949
#define _CCM_NOINIT_SECTION_NAME .ccm_noinit
5050

5151
#define _ITCM_SECTION_NAME .itcm
5252

53-
#define _DTCM_DATA_SECTION_NAME .dtcm_data
53+
#define _DTCM_DATA_SECTION_NAME .dtcm_data
5454
#define _DTCM_BSS_SECTION_NAME .dtcm_bss
5555
#define _DTCM_NOINIT_SECTION_NAME .dtcm_noinit
56+
57+
#define _OCM_DATA_SECTION_NAME .ocm_data
58+
#define _OCM_BSS_SECTION_NAME .ocm_bss
5659
#endif
5760

5861
#define _IMX_BOOT_CONF_SECTION_NAME .boot_hdr.conf

0 commit comments

Comments
 (0)