diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index db42d9fe3c..ff0fadb9aa 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -1197,7 +1197,6 @@ tools/templates/sample_component/main.c tools/test_apps/build_system/embed_test/main/test_main.c tools/test_apps/build_system/ldgen_test/main/src1.c tools/test_apps/build_system/ldgen_test/main/src2.c -tools/test_apps/build_system/ldgen_test/main/test_main.c tools/test_apps/peripherals/i2c_wifi/main/i2c_wifi_main.c tools/test_apps/protocols/esp_netif/build_config/main/init_macro.h tools/test_apps/protocols/esp_netif/build_config/main/main.cpp diff --git a/tools/ldgen/ldgen/output_commands.py b/tools/ldgen/ldgen/output_commands.py index e7d32dd64e..a5c58b7a8c 100644 --- a/tools/ldgen/ldgen/output_commands.py +++ b/tools/ldgen/ldgen/output_commands.py @@ -60,7 +60,7 @@ class InputSectionDesc: Outputs an input section description as described in https://www.acrc.bris.ac.uk/acrc/RedHat/rhel-ld-en-4/sections.html#INPUT-SECTION. - These commands are emmited from mapping fragment entries, specifically attaching + These commands are emitted from mapping fragment entries, specifically attaching a scheme onto an entity. Mapping fragment flags KEEP, SORT will also affect the emitted input section description. """ @@ -85,9 +85,10 @@ class InputSectionDesc: self.tied = tied def __str__(self): - sections_string = '( )' + sections_string = '' if self.sections: + sections_string = '( )' exclusion_strings = [] for exc in sorted(self.exclusions): diff --git a/tools/ldgen/test/test_output_commands.py b/tools/ldgen/test/test_output_commands.py index 4a6723626d..27906d1ed1 100755 --- a/tools/ldgen/test/test_output_commands.py +++ b/tools/ldgen/test/test_output_commands.py @@ -1,9 +1,8 @@ #!/usr/bin/env python # -# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 # - import os import sys import unittest @@ -122,14 +121,14 @@ class InputSectionDescTest(unittest.TestCase): def test_empty_sections(self): # Test empty sections - expected = '*libfreertos.a:croutine.*( )' + expected = '*libfreertos.a:croutine.*' desc = InputSectionDesc(Entity('libfreertos.a', 'croutine'), []) self.assertEqual(expected, str(desc)) def test_keep(self): # Test KEEP - expected = 'KEEP(*libfreertos.a:croutine.*( ))' + expected = 'KEEP(*libfreertos.a:croutine.*)' desc = InputSectionDesc(Entity('libfreertos.a', 'croutine'), [], keep=True) self.assertEqual(expected, str(desc)) diff --git a/tools/test_apps/build_system/ldgen_test/check_placements.py b/tools/test_apps/build_system/ldgen_test/check_placements.py index 174793e2eb..c465f7bf0e 100644 --- a/tools/test_apps/build_system/ldgen_test/check_placements.py +++ b/tools/test_apps/build_system/ldgen_test/check_placements.py @@ -80,3 +80,5 @@ if not args.no_rtc: check_location('func3', '.flash.text') check_location('func4', '.iram0.text') + +check_location('const_array', '.dram0.data') diff --git a/tools/test_apps/build_system/ldgen_test/main/CMakeLists.txt b/tools/test_apps/build_system/ldgen_test/main/CMakeLists.txt index 466b45c56c..6f10a09e80 100644 --- a/tools/test_apps/build_system/ldgen_test/main/CMakeLists.txt +++ b/tools/test_apps/build_system/ldgen_test/main/CMakeLists.txt @@ -1,3 +1,3 @@ -idf_component_register(SRCS "src1.c" "src2.c" "test_main.c" +idf_component_register(SRCS "src1.c" "src2.c" "test_main.c" "consts.c" INCLUDE_DIRS "." LDFRAGMENTS "linker.lf") diff --git a/tools/test_apps/build_system/ldgen_test/main/consts.c b/tools/test_apps/build_system/ldgen_test/main/consts.c new file mode 100644 index 0000000000..47ced23189 --- /dev/null +++ b/tools/test_apps/build_system/ldgen_test/main/consts.c @@ -0,0 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ + +const int const_array[] = { + 10, 20, 30, 40, 50, 60, 70, 80 +}; diff --git a/tools/test_apps/build_system/ldgen_test/main/linker.lf b/tools/test_apps/build_system/ldgen_test/main/linker.lf index 17f0490949..e2b06fb614 100644 --- a/tools/test_apps/build_system/ldgen_test/main/linker.lf +++ b/tools/test_apps/build_system/ldgen_test/main/linker.lf @@ -9,3 +9,4 @@ entries: text->iram0_text KEEP() if SOC_RTC_MEM_SUPPORTED = y: src1:func2 (rtc) + consts : const_array (noflash) diff --git a/tools/test_apps/build_system/ldgen_test/main/test_main.c b/tools/test_apps/build_system/ldgen_test/main/test_main.c index 9ebb9689c6..d01bec546e 100644 --- a/tools/test_apps/build_system/ldgen_test/main/test_main.c +++ b/tools/test_apps/build_system/ldgen_test/main/test_main.c @@ -1,11 +1,25 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "esp_memory_utils.h" extern void func2(void); extern void func3(void); extern void func4(void); +extern const int const_array[]; + void app_main(void) { func2(); func3(); func4(); + if (esp_ptr_in_dram(const_array)) { + printf("const_array placed in dram\n"); + } else { + printf("const_array NOT placed in dram\n"); + } }