mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(ldgen): fix linker script generation from a single-entry fragment file
This commit is contained in:
parent
ac8f354458
commit
a8bb279dff
@ -1157,7 +1157,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
|
||||
|
@ -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):
|
||||
|
@ -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))
|
||||
|
@ -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')
|
||||
|
@ -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")
|
||||
|
9
tools/test_apps/build_system/ldgen_test/main/consts.c
Normal file
9
tools/test_apps/build_system/ldgen_test/main/consts.c
Normal file
@ -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
|
||||
};
|
@ -9,3 +9,4 @@ entries:
|
||||
text->iram0_text KEEP()
|
||||
if SOC_RTC_MEM_SUPPORTED = y:
|
||||
src1:func2 (rtc)
|
||||
consts : const_array (noflash)
|
||||
|
@ -1,11 +1,25 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#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");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user