From d3bcc567532b88d494289004dda59733bc420fe1 Mon Sep 17 00:00:00 2001 From: Jerzy Kasenberg Date: Fri, 24 Jan 2025 15:49:07 +0100 Subject: [PATCH] bsp/stm32f74x: Fix RAM and DTCM description Start or RAM and size of DTCM were taken from STM32F76x series. DTCM should be 64KB and RAM1 should start at 0x20010000 Signed-off-by: Jerzy Kasenberg --- .../link/include/memory_regions.ld.h | 2 +- hw/bsp/nucleo-f746zg/syscfg.yml | 2 +- .../link/include/mcu_config.ld.h | 38 +++++++++++++++++++ .../link/include/memory_regions.ld.h | 38 +++++++++++++++++++ hw/bsp/stm32f7discovery/syscfg.yml | 2 +- 5 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 hw/bsp/stm32f7discovery/link/include/mcu_config.ld.h create mode 100644 hw/bsp/stm32f7discovery/link/include/memory_regions.ld.h diff --git a/hw/bsp/nucleo-f746zg/link/include/memory_regions.ld.h b/hw/bsp/nucleo-f746zg/link/include/memory_regions.ld.h index 32e5efe161..c1301e2aca 100644 --- a/hw/bsp/nucleo-f746zg/link/include/memory_regions.ld.h +++ b/hw/bsp/nucleo-f746zg/link/include/memory_regions.ld.h @@ -22,7 +22,7 @@ #ifdef STACK_REGION DTCM (rwx) : ORIGIN = 0x20000000, LENGTH = (64K - STACK_SIZE) - STACK_RAM (rw) : ORIGIN = 0x20020000 - STACK_SIZE, LENGTH = STACK_SIZE + STACK_RAM (rw) : ORIGIN = 0x20010000 - STACK_SIZE, LENGTH = STACK_SIZE #else DTCM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K #endif diff --git a/hw/bsp/nucleo-f746zg/syscfg.yml b/hw/bsp/nucleo-f746zg/syscfg.yml index 7a863eb35f..aba218cba8 100644 --- a/hw/bsp/nucleo-f746zg/syscfg.yml +++ b/hw/bsp/nucleo-f746zg/syscfg.yml @@ -27,7 +27,7 @@ syscfg.defs: value: 8 syscfg.vals: - MCU_RAM_START: 0x20020000 + MCU_RAM_START: 0x20010000 MCU_RAM_SIZE: 240K REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS diff --git a/hw/bsp/stm32f7discovery/link/include/mcu_config.ld.h b/hw/bsp/stm32f7discovery/link/include/mcu_config.ld.h new file mode 100644 index 0000000000..cdf034b785 --- /dev/null +++ b/hw/bsp/stm32f7discovery/link/include/mcu_config.ld.h @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Memory regions placed in DTCM + * If stack or core data or other section should be place in RAM + * /link/include/target_config.ld.h should just do: + * #undef BSSNZ_RAM + * #undef COREBSS_RAM + * #undef COREDATA_RAM + * #undef STACK_REGION + * #undef VECTOR_RELOCATION_RAM DTCM + */ + +#define BSSNZ_RAM DTCM +#define COREBSS_RAM DTCM +#define COREDATA_RAM DTCM +#define STACK_REGION DTCM +#define VECTOR_RELOCATION_RAM DTCM + +#define TEXT_RAM ITCM + diff --git a/hw/bsp/stm32f7discovery/link/include/memory_regions.ld.h b/hw/bsp/stm32f7discovery/link/include/memory_regions.ld.h new file mode 100644 index 0000000000..c1301e2aca --- /dev/null +++ b/hw/bsp/stm32f7discovery/link/include/memory_regions.ld.h @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* Fragment that goes to MEMORY section */ +#ifndef SECTIONS_REGIONS + +#ifdef STACK_REGION + DTCM (rwx) : ORIGIN = 0x20000000, LENGTH = (64K - STACK_SIZE) + STACK_RAM (rw) : ORIGIN = 0x20010000 - STACK_SIZE, LENGTH = STACK_SIZE +#else + DTCM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K +#endif + ITCM (rx) : ORIGIN = 0x00000000, LENGTH = 16K + +#else +/* Fragment that goes into SECTIONS, can provide definition and sections if needed */ + _itcm_start = ORIGIN(ITCM); + _itcm_end = ORIGIN(ITCM) + LENGTH(ITCM); + _dtcm_start = ORIGIN(DTCM); + _dtcm_end = ORIGIN(DTCM) + LENGTH(DTCM); + +#endif diff --git a/hw/bsp/stm32f7discovery/syscfg.yml b/hw/bsp/stm32f7discovery/syscfg.yml index 878ea583a9..22ee4dfcc9 100644 --- a/hw/bsp/stm32f7discovery/syscfg.yml +++ b/hw/bsp/stm32f7discovery/syscfg.yml @@ -27,7 +27,7 @@ syscfg.defs: value: 8 syscfg.vals: - MCU_RAM_START: 0x20020000 + MCU_RAM_START: 0x20010000 MCU_RAM_SIZE: 240K REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS