linker: Add dtcm section for Cortex M7 MCUs

This commit adds a DTCM (Device Tightly Coupled Memory) section for
Cortex F7 MCUs. The Address and length is defined in the corresponding
device tree file.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is contained in:
Alexander Wachter 2019-07-03 14:19:29 +02:00 committed by Carles Cufí
commit b4c5f4b32b
7 changed files with 85 additions and 1 deletions

View file

@ -0,0 +1,17 @@
# SPDX-License-Identifier: Apache-2.0
title: DTCM
version: 0.1
description: >
This binding gives a base representation of the Cortex M7 DTCM (Data Tightly Coupled Memory)
inherits:
!include base.yaml
properties:
compatible:
constraint: "arm,dtcm"
reg:
category: required

View file

@ -100,6 +100,9 @@ MEMORY
#endif
#ifdef DT_CCM_BASE_ADDRESS
CCM (rw) : ORIGIN = DT_CCM_BASE_ADDRESS, LENGTH = DT_CCM_SIZE * 1K
#endif
#ifdef DT_DTCM_BASE_ADDRESS
DTCM (rw) : ORIGIN = DT_DTCM_BASE_ADDRESS, LENGTH = DT_DTCM_SIZE * 1K
#endif
SRAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE
#ifdef CONFIG_BT_STM32_IPM
@ -425,6 +428,42 @@ SECTIONS
GROUP_END(RAMABLE_REGION)
#ifdef DT_DTCM_BASE_ADDRESS
GROUP_START(DTCM)
SECTION_PROLOGUE(_DTCM_BSS_SECTION_NAME, (NOLOAD),SUBALIGN(4))
{
__dtcm_start = .;
__dtcm_bss_start = .;
*(.dtcm_bss)
*(".dtcm_bss.*")
} GROUP_LINK_IN(DTCM)
__dtcm_bss_end = .;
SECTION_PROLOGUE(_DTCM_NOINIT_SECTION_NAME, (NOLOAD),SUBALIGN(4))
{
__dtcm_noinit_start = .;
*(.dtcm_noinit)
*(".dtcm_noinit.*")
} GROUP_LINK_IN(DTCM)
__dtcm_noinit_end = .;
SECTION_PROLOGUE(_DTCM_DATA_SECTION_NAME,,SUBALIGN(4))
{
__dtcm_data_start = .;
*(.dtcm_data)
*(".dtcm_data.*")
} GROUP_LINK_IN(DTCM AT> ROMABLE_REGION)
__dtcm_data_end = .;
__dtcm_end = .;
__dtcm_data_rom_start = LOADADDR(_DTCM_DATA_SECTION_NAME);
GROUP_END(DTCM)
#endif /* DT_DTCM_BASE_ADDRESS */
#ifdef CONFIG_CUSTOM_SECTIONS_LD
/* Located in project source directory */
#include <custom-sections.ld>

View file

@ -216,6 +216,18 @@ extern char __ccm_noinit_end[];
extern char __ccm_end[];
#endif /* DT_CCM_BASE_ADDRESS */
#ifdef DT_DTCM_BASE_ADDRESS
extern char __dtcm_data_start[];
extern char __dtcm_data_end[];
extern char __dtcm_bss_start[];
extern char __dtcm_bss_end[];
extern char __dtcm_noinit_start[];
extern char __dtcm_noinit_end[];
extern char __dtcm_data_rom_start[];
extern char __dtcm_start[];
extern char __dtcm_end[];
#endif /* DT_DTCM_BASE_ADDRESS */
/* Used by the Security Attribution Unit to configure the
* Non-Secure Callable region.
*/

View file

@ -23,6 +23,9 @@
#define __ccm_data_section Z_GENERIC_SECTION(_CCM_DATA_SECTION_NAME)
#define __ccm_bss_section Z_GENERIC_SECTION(_CCM_BSS_SECTION_NAME)
#define __ccm_noinit_section Z_GENERIC_SECTION(_CCM_NOINIT_SECTION_NAME)
#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 __imx_boot_conf_section Z_GENERIC_SECTION(IMX_BOOT_CONF)
#define __imx_boot_data_section Z_GENERIC_SECTION(IMX_BOOT_DATA)
#define __imx_boot_ivt_section Z_GENERIC_SECTION(IMX_BOOT_IVT)

View file

@ -56,6 +56,10 @@
#define _CCM_DATA_SECTION_NAME .ccm_data
#define _CCM_BSS_SECTION_NAME .ccm_bss
#define _CCM_NOINIT_SECTION_NAME .ccm_noinit
#define _DTCM_DATA_SECTION_NAME .dtcm_data
#define _DTCM_BSS_SECTION_NAME .dtcm_bss
#define _DTCM_NOINIT_SECTION_NAME .dtcm_noinit
#endif
#define IMX_BOOT_CONF .boot_hdr.conf

View file

@ -155,6 +155,10 @@ void z_bss_zero(void)
(void)memset(&__ccm_bss_start, 0,
((u32_t) &__ccm_bss_end - (u32_t) &__ccm_bss_start));
#endif
#ifdef DT_DTCM_BASE_ADDRESS
(void)memset(&__dtcm_bss_start, 0,
((u32_t) &__dtcm_bss_end - (u32_t) &__dtcm_bss_start));
#endif
#ifdef CONFIG_CODE_DATA_RELOCATION
extern void bss_zeroing_relocation(void);
@ -192,6 +196,10 @@ void z_data_copy(void)
(void)memcpy(&__ccm_data_start, &__ccm_data_rom_start,
__ccm_data_end - __ccm_data_start);
#endif
#ifdef DT_DTCM_BASE_ADDRESS
(void)memcpy(&__dtcm_data_start, &__dtcm_data_rom_start,
__dtcm_data_end - __dtcm_data_start);
#endif
#ifdef CONFIG_CODE_DATA_RELOCATION
extern void data_copy_xip_relocation(void);

View file

@ -24,7 +24,8 @@ old_alias_names = False
regs_config = {
'zephyr,sram' : 'DT_SRAM',
'zephyr,ccm' : 'DT_CCM'
'zephyr,ccm' : 'DT_CCM',
'zephyr,dtcm' : 'DT_DTCM'
}
name_config = {