diff --git a/samples/application_development/code_relocation/CMakeLists.txt b/samples/application_development/code_relocation/CMakeLists.txt deleted file mode 100644 index 079ef1fe1c1..00000000000 --- a/samples/application_development/code_relocation/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(code_relocation) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) - -# Code relocation feature -zephyr_code_relocate(src/test_file1.c SRAM2) - -zephyr_code_relocate(src/test_file2.c SRAM) - -zephyr_code_relocate(src/test_file3.c SRAM2_TEXT) -zephyr_code_relocate(src/test_file3.c SRAM_DATA) -zephyr_code_relocate(src/test_file3.c SRAM2_BSS) - -zephyr_code_relocate(../../../kernel/sem.c SRAM) - -zephyr_linker_sources(SECTIONS custom-sections.ld) diff --git a/samples/application_development/code_relocation/README.rst b/samples/application_development/code_relocation/README.rst deleted file mode 100644 index 71cbfe93cab..00000000000 --- a/samples/application_development/code_relocation/README.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. _code_relocation: - -Code relocation -################# - -Overview -******** -A simple example that demonstrates how relocation of code, data or bss sections -using a custom linker script. diff --git a/samples/application_development/code_relocation/custom-sections.ld b/samples/application_development/code_relocation/custom-sections.ld deleted file mode 100644 index fab5bf6eccc..00000000000 --- a/samples/application_development/code_relocation/custom-sections.ld +++ /dev/null @@ -1,6 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -SECTION_DATA_PROLOGUE(_CUSTOM_SECTION_NAME2,,) -{ - KEEP(*(".custom_section.*")); -} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) diff --git a/samples/application_development/code_relocation/linker_arm_sram2.ld b/samples/application_development/code_relocation/linker_arm_sram2.ld deleted file mode 100644 index 97f7d95bd37..00000000000 --- a/samples/application_development/code_relocation/linker_arm_sram2.ld +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2013-2014 Wind River Systems, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief Linker command/script file - * - * Linker script for the Cortex-M platforms. - */ - -#include -#include - -#include -#include - -/** enable CONFIG_SRAM2 or any other partition in soc Kconfig, - * this is just an example to show relocation of code/data/bss script - */ -#if defined CONFIG_ARM - #define CONFIG_SRAM2 1 - #define _SRAM2_DATA_SECTION_NAME .sram2_data - #define _SRAM2_BSS_SECTION_NAME .sram2_bss - #define _SRAM2_TEXT_SECTION_NAME .sram2_text - #define SRAM2_ADDR (CONFIG_SRAM_BASE_ADDRESS + RAM_SIZE2) -#endif - -#define RAM_SIZE2 (CONFIG_SRAM_SIZE * 512) -MEMORY - { -#ifdef CONFIG_SRAM2 - SRAM2 (wx) : ORIGIN = (CONFIG_SRAM_BASE_ADDRESS + RAM_SIZE2), LENGTH = RAM_SIZE2 -#endif - } - -#include diff --git a/samples/application_development/code_relocation/prj.conf b/samples/application_development/code_relocation/prj.conf deleted file mode 100644 index 0c2e455f30c..00000000000 --- a/samples/application_development/code_relocation/prj.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_CODE_DATA_RELOCATION=y -CONFIG_HAVE_CUSTOM_LINKER_SCRIPT=y -CONFIG_CUSTOM_LINKER_SCRIPT="linker_arm_sram2.ld" -CONFIG_COVERAGE=n diff --git a/samples/application_development/code_relocation/sample.yaml b/samples/application_development/code_relocation/sample.yaml deleted file mode 100644 index f43d795d9e8..00000000000 --- a/samples/application_development/code_relocation/sample.yaml +++ /dev/null @@ -1,13 +0,0 @@ -sample: - description: Code data relocation Sample - name: code relocation -tests: - sample.application_development.code_relocation: - harness: console - harness_config: - type: one_line - regex: - - "Hello World! (.*)" - platform_allow: qemu_cortex_m3 mps2_an385 sam_e70_xplained - tags: linker - extra_sections: _SRAM2_RODATA_SECTION_NAME _SRAM_TEXT_SECTION_NAME _SRAM_RODATA_SECTION_NAME _SRAM_DATA_SECTION_NAME _CUSTOM_SECTION_NAME2 diff --git a/samples/application_development/code_relocation/src/main.c b/samples/application_development/code_relocation/src/main.c deleted file mode 100644 index d39898e14b0..00000000000 --- a/samples/application_development/code_relocation/src/main.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2018 Intel Corporation. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - - -/* This function will allow execute from sram region. - * This is needed only for this sample because by default all soc will - * disable the execute from SRAM. - * An application that requires that the code be executed from SRAM will - * have to configure the region appropriately in arm_mpu_regions.c. - */ - -#ifdef CONFIG_ARM_MPU -#include -void disable_mpu_rasr_xn(void) -{ - uint32_t index; - /* Kept the max index as 8(irrespective of soc) because the sram - * would most likely be set at index 2. - */ - for (index = 0U; index < 8; index++) { - MPU->RNR = index; - if (MPU->RASR & MPU_RASR_XN_Msk) { - MPU->RASR ^= MPU_RASR_XN_Msk; - } - } - -} -#endif /* CONFIG_ARM_MPU */ - - -extern void function_in_sram2(void); -extern void function_in_split_multiple(void); - -void main(void) -{ -#ifdef CONFIG_ARM_MPU - disable_mpu_rasr_xn(); -#endif /* CONFIG_ARM_MPU */ - - printk("Address of main function %p\n\n", &main); - function_in_sram2(); - function_in_split_multiple(); -} diff --git a/samples/application_development/code_relocation/src/test_file1.c b/samples/application_development/code_relocation/src/test_file1.c deleted file mode 100644 index 76c7e21b4ef..00000000000 --- a/samples/application_development/code_relocation/src/test_file1.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2012-2014 Wind River Systems, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -uint32_t var_sram2_data = 10U; -uint32_t var_sram2_bss; -K_SEM_DEFINE(test, 0, 1); -const uint32_t var_sram2_rodata = 100U; - -__in_section(custom_section, static, var) uint32_t var_custom_data = 1U; - -extern void function_in_sram(int32_t value); -void function_in_custom_section(void); -void function_in_sram2(void) -{ - /* Print values from sram2 */ - printk("Address of function_in_sram2 %p\n", &function_in_sram2); - printk("Address of var_sram2_data %p\n", &var_sram2_data); - printk("Address of k_sem_give %p\n", &k_sem_give); - printk("Address of var_sram2_rodata %p\n", &var_sram2_rodata); - printk("Address of var_sram2_bss %p\n\n", &var_sram2_bss); - - /* Print values from sram */ - function_in_sram(var_sram2_data); - - /* Print values which were placed using attributes */ - printk("Address of custom_section, func placed using attributes %p\n", - &function_in_custom_section); - printk("Address of custom_section data placed using attributes %p\n\n", - &var_custom_data); - - k_sem_give(&test); -} - -__in_section(custom_section, static, fun) void function_in_custom_section(void) -{ - return; - -} diff --git a/samples/application_development/code_relocation/src/test_file2.c b/samples/application_development/code_relocation/src/test_file2.c deleted file mode 100644 index 9560220f954..00000000000 --- a/samples/application_development/code_relocation/src/test_file2.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2012-2014 Wind River Systems, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -void function_in_sram(int32_t value) -{ - printk("Address of function_in_sram %p\n", &function_in_sram); - printk("Hello World! %s\n", CONFIG_BOARD); -} diff --git a/samples/application_development/code_relocation/src/test_file3.c b/samples/application_development/code_relocation/src/test_file3.c deleted file mode 100644 index 0fda2b2907e..00000000000 --- a/samples/application_development/code_relocation/src/test_file3.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2012-2014 Wind River Systems, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -uint32_t var_file3_sram_data = 10U; -uint32_t var_file3_sram2_bss; - -void function_in_split_multiple(void) -{ - printk("Address of function_in_split_multiple %p\n", - &function_in_split_multiple); - printk("Address of var_file3_sram_data %p\n", &var_file3_sram_data); - printk("Address of var_file3_sram2_bss %p\n\n", &var_file3_sram2_bss); -}