From 9cb72efee1df4debe52424e895fe0f85fff20431 Mon Sep 17 00:00:00 2001 From: George Gekov Date: Mon, 18 Nov 2024 13:21:03 +0000 Subject: [PATCH] Arm backend: Move the rodata to the DDR and bring the ITCM limit back to 512KB This allows us to deploy models on the MPS3 FPGA board running the Corstone-300 design Change-Id: I0bd673c129f82418b962ad608b061de1b36a96df --- backends/arm/test/runner_utils.py | 2 - .../executorch-arm-delegate-tutorial.md | 1 - ...1-Add-.data-fixup-from-Corestone-300.patch | 24 ------------ .../patches/0001-Move-rodata-to-the-DDR.patch | 34 +++++++++++++++++ .../0001-New-phdr-for-.data-section.patch | 33 ----------------- .../patches/0003-Make-ITCM-1MB.patch | 37 ------------------- examples/arm/executor_runner/CMakeLists.txt | 1 + examples/arm/run.sh | 2 - 8 files changed, 35 insertions(+), 99 deletions(-) delete mode 100644 examples/arm/ethos-u-setup/core_platform/patches/0001-Add-.data-fixup-from-Corestone-300.patch create mode 100644 examples/arm/ethos-u-setup/core_platform/patches/0001-Move-rodata-to-the-DDR.patch delete mode 100644 examples/arm/ethos-u-setup/core_platform/patches/0001-New-phdr-for-.data-section.patch delete mode 100644 examples/arm/ethos-u-setup/core_platform/patches/0003-Make-ITCM-1MB.patch diff --git a/backends/arm/test/runner_utils.py b/backends/arm/test/runner_utils.py index 608761098e..92fa6ae00c 100644 --- a/backends/arm/test/runner_utils.py +++ b/backends/arm/test/runner_utils.py @@ -267,8 +267,6 @@ def run_corstone( "-C", "mps3_board.uart0.out_file='-'", "-C", - "cpu0.CFGITCMSZ=11", - "-C", "cpu0.semihosting-enable=1", "-C", "cpu0.semihosting-stack_base=0", diff --git a/docs/source/executorch-arm-delegate-tutorial.md b/docs/source/executorch-arm-delegate-tutorial.md index 25b5551b5e..855a828c23 100644 --- a/docs/source/executorch-arm-delegate-tutorial.md +++ b/docs/source/executorch-arm-delegate-tutorial.md @@ -322,7 +322,6 @@ ethos_u_build_dir=examples/arm/executor_runner/ elf=$(find ${ethos_u_build_dir} -name "arm_executor_runner") FVP_Corstone_SSE-320_Ethos-U85 \ - -C mps4_board.subsystem.cpu0.CFGITCMSZ=11 \ -C mps4_board.subsystem.ethosu.num_macs=${num_macs} \ -C mps4_board.visualisation.disable-visualisation=1 \ -C vis_hdlcd.disable_visualisation=1 \ diff --git a/examples/arm/ethos-u-setup/core_platform/patches/0001-Add-.data-fixup-from-Corestone-300.patch b/examples/arm/ethos-u-setup/core_platform/patches/0001-Add-.data-fixup-from-Corestone-300.patch deleted file mode 100644 index f2df3350d0..0000000000 --- a/examples/arm/ethos-u-setup/core_platform/patches/0001-Add-.data-fixup-from-Corestone-300.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 162ea6b51bd94fabf623cc6b63cf271497eaff8d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Per=20=C3=85strand?= -Date: Fri, 13 Sep 2024 11:47:03 +0200 -Subject: [PATCH] Add .data fixup from Corestone-300 - ---- - targets/corstone-320/platform.ld | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/targets/corstone-320/platform.ld b/targets/corstone-320/platform.ld -index 2010d14..fb4e7b7 100644 ---- a/targets/corstone-320/platform.ld -+++ b/targets/corstone-320/platform.ld -@@ -77,6 +77,7 @@ PHDRS - rom_boot PT_LOAD; - rom_exec PT_LOAD; - rom_dram PT_LOAD; -+ data PT_LOAD; /* HACK: New prog header for .data (and friends) going in DTCM */ - null PT_NULL; - } - --- -2.39.3 (Apple Git-146) - diff --git a/examples/arm/ethos-u-setup/core_platform/patches/0001-Move-rodata-to-the-DDR.patch b/examples/arm/ethos-u-setup/core_platform/patches/0001-Move-rodata-to-the-DDR.patch new file mode 100644 index 0000000000..4467185ae7 --- /dev/null +++ b/examples/arm/ethos-u-setup/core_platform/patches/0001-Move-rodata-to-the-DDR.patch @@ -0,0 +1,34 @@ +From 0fb46c2fe4a072546f87c6cb9202d5001f1eb9c5 Mon Sep 17 00:00:00 2001 +From: George Gekov +Date: Mon, 18 Nov 2024 11:24:11 +0000 +Subject: [PATCH] Move rodata to the DDR + +--- + targets/corstone-300/platform.ld | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/targets/corstone-300/platform.ld b/targets/corstone-300/platform.ld +index b458fc6..8d4bc73 100644 +--- a/targets/corstone-300/platform.ld ++++ b/targets/corstone-300/platform.ld +@@ -154,7 +154,7 @@ SECTIONS + *(SORT(.dtors.*)) + *(.dtors) + +- *(.rodata*) ++ + + KEEP(*(.eh_frame*)) + } > ITCM :rom_exec +@@ -280,7 +280,7 @@ SECTIONS + #endif + * (expected_output_data_sec) + * (sec_command_stream, sec_weight_data, sec_input_data) +- ++ *(.rodata*) + * (ethosu_core_in_queue) + * (ethosu_core_out_queue) + . = ALIGN(4); +-- +2.25.1 + diff --git a/examples/arm/ethos-u-setup/core_platform/patches/0001-New-phdr-for-.data-section.patch b/examples/arm/ethos-u-setup/core_platform/patches/0001-New-phdr-for-.data-section.patch deleted file mode 100644 index d3ece70d6c..0000000000 --- a/examples/arm/ethos-u-setup/core_platform/patches/0001-New-phdr-for-.data-section.patch +++ /dev/null @@ -1,33 +0,0 @@ -From fc2ff3e005999ec185a1ae20c78c06a45651f5bc Mon Sep 17 00:00:00 2001 -From: Digant Desai -Date: Mon, 2 Oct 2023 20:39:39 -0700 -Subject: [PATCH 1/2] New phdr for .data section - ---- - targets/corstone-300/platform.ld | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/targets/corstone-300/platform.ld b/targets/corstone-300/platform.ld -index 8d77329..8de77c4 100644 ---- a/targets/corstone-300/platform.ld -+++ b/targets/corstone-300/platform.ld -@@ -94,6 +94,7 @@ PHDRS - { - rom_exec PT_LOAD; - rom_dram PT_LOAD; -+ data PT_LOAD; /* HACK: New prog header for .data (and friends) going in DTCM */ - null PT_NULL; - } - -@@ -247,7 +248,7 @@ SECTIONS - /* All data end */ - __data_end__ = .; - -- } > DTCM :rom_exec -+ } > DTCM :data - - .sram.bss : - { --- -2.34.1 - diff --git a/examples/arm/ethos-u-setup/core_platform/patches/0003-Make-ITCM-1MB.patch b/examples/arm/ethos-u-setup/core_platform/patches/0003-Make-ITCM-1MB.patch deleted file mode 100644 index 54ca9f4c93..0000000000 --- a/examples/arm/ethos-u-setup/core_platform/patches/0003-Make-ITCM-1MB.patch +++ /dev/null @@ -1,37 +0,0 @@ -From aa65a514e5860267a6d9d52e80b1f8e03c720c6c Mon Sep 17 00:00:00 2001 -From: Zingo Andersen -Date: Tue, 4 Jun 2024 06:20:14 +0200 -Subject: [PATCH 3/3] Make ITCM 1MB - -Signed-off-by: Zingo Andersen ---- - targets/corstone-300/platform.ld | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/targets/corstone-300/platform.ld b/targets/corstone-300/platform.ld -index 476a2f8..080cc5e 100644 ---- a/targets/corstone-300/platform.ld -+++ b/targets/corstone-300/platform.ld -@@ -46,8 +46,8 @@ - * +-----------------------+-------------+-------------+----+--------------------------------------+ - * | Memory region name | Base addr | Size |IDAU| MCC load address + remarks | - * +-----------------------+-------------+-------------+----+--------------------------------------+ -- * | ITCM | 0x0000_0000 | 0x0008_0000 | NS | 0x0000_0000; 512 kiB | -- * | ITCM | 0x1000_0000 | 0x0008_0000 | S | Secure alias for NS ITCM | -+ * | ITCM | 0x0000_0000 | 0x0010_0000 | NS | 0x0000_0000; 1 MiB | -+ * | ITCM | 0x1000_0000 | 0x0010_0000 | S | Secure alias for NS ITCM | - * | FPGA Data SRAM; BRAM | 0x0100_0000 | 0x0010_0000 | NS | 0x0100_0000; 1 MiB | - * | FPGA data SRAM; BRAM | 0x1100_0000 | 0x0010_0000 | S | Secure alias for NS BRAM | - * | DTCM | 0x2000_0000 | 0x0008_0000 | NS | 512 kiB; 4 banks of 128k each | -@@ -82,7 +82,7 @@ __HEAP_SIZE = 0x00008000; - - MEMORY - { -- ITCM (rx) : ORIGIN = 0x10000000, LENGTH = 0x00080000 -+ ITCM (rx) : ORIGIN = 0x10000000, LENGTH = 0x00100000 - BRAM (rw) : ORIGIN = 0x11000000, LENGTH = 0x00100000 - DTCM (rw) : ORIGIN = 0x30000000, LENGTH = 0x00080000 - SRAM (rw) : ORIGIN = 0x31000000, LENGTH = 0x00200000 --- -2.25.1 - diff --git a/examples/arm/executor_runner/CMakeLists.txt b/examples/arm/executor_runner/CMakeLists.txt index 064023a70d..7da3462924 100644 --- a/examples/arm/executor_runner/CMakeLists.txt +++ b/examples/arm/executor_runner/CMakeLists.txt @@ -234,6 +234,7 @@ target_link_libraries( quantized_kernels portable_kernels "-Wl,--no-whole-archive" + -Xlinker -Map=arm_executor_runner.map ) # ET headers and generated headers includes diff --git a/examples/arm/run.sh b/examples/arm/run.sh index c2c04cd2fd..c31295da9b 100755 --- a/examples/arm/run.sh +++ b/examples/arm/run.sh @@ -226,7 +226,6 @@ function run_fvp() { if [[ ${target} == *"ethos-u55"* ]]; then echo "Running ${elf} for ${target} run with FVP:${fvp_model} num_macs:${num_macs}" ${fvp_model} \ - -C cpu0.CFGITCMSZ=11 \ -C ethosu.num_macs=${num_macs} \ -C mps3_board.visualisation.disable-visualisation=1 \ -C mps3_board.telnetterminal0.start_telnet=0 \ @@ -238,7 +237,6 @@ function run_fvp() { elif [[ ${target} == *"ethos-u85"* ]]; then echo "Running ${elf} for ${target} run with FVP:${fvp_model} num_macs:${num_macs}" ${fvp_model} \ - -C mps4_board.subsystem.cpu0.CFGITCMSZ=11 \ -C mps4_board.subsystem.ethosu.num_macs=${num_macs} \ -C mps4_board.visualisation.disable-visualisation=1 \ -C vis_hdlcd.disable_visualisation=1 \