mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
ldgen: generate ld files with fixed order of entries
This commit is contained in:
parent
92d7e47ef6
commit
a65de0ab1f
@ -3952,17 +3952,14 @@ tools/kconfig_new/test/gen_kconfig_doc/test_kconfig_out.py
|
|||||||
tools/kconfig_new/test/gen_kconfig_doc/test_target_visibility.py
|
tools/kconfig_new/test/gen_kconfig_doc/test_target_visibility.py
|
||||||
tools/ldgen/entity.py
|
tools/ldgen/entity.py
|
||||||
tools/ldgen/fragments.py
|
tools/ldgen/fragments.py
|
||||||
tools/ldgen/generation.py
|
|
||||||
tools/ldgen/ldgen.py
|
tools/ldgen/ldgen.py
|
||||||
tools/ldgen/ldgen_common.py
|
tools/ldgen/ldgen_common.py
|
||||||
tools/ldgen/linker_script.py
|
|
||||||
tools/ldgen/output_commands.py
|
tools/ldgen/output_commands.py
|
||||||
tools/ldgen/samples/template.ld
|
tools/ldgen/samples/template.ld
|
||||||
tools/ldgen/sdkconfig.py
|
tools/ldgen/sdkconfig.py
|
||||||
tools/ldgen/test/data/linker_script.ld
|
tools/ldgen/test/data/linker_script.ld
|
||||||
tools/ldgen/test/test_entity.py
|
tools/ldgen/test/test_entity.py
|
||||||
tools/ldgen/test/test_fragments.py
|
tools/ldgen/test/test_fragments.py
|
||||||
tools/ldgen/test/test_generation.py
|
|
||||||
tools/ldgen/test/test_output_commands.py
|
tools/ldgen/test/test_output_commands.py
|
||||||
tools/mass_mfg/mfg_gen.py
|
tools/mass_mfg/mfg_gen.py
|
||||||
tools/mkdfu.py
|
tools/mkdfu.py
|
||||||
|
@ -1,17 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||||
#
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
# Licensed 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.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
@ -251,7 +240,7 @@ class EntityNode():
|
|||||||
self.child_placement(entity, sections, target, flags, sections_db)
|
self.child_placement(entity, sections, target, flags, sections_db)
|
||||||
|
|
||||||
def get_output_sections(self):
|
def get_output_sections(self):
|
||||||
return sorted(self.placements.keys(), key=' '.join)
|
return sorted(self.placements.keys(), key=lambda x: sorted(x)) # pylint: disable=W0108
|
||||||
|
|
||||||
|
|
||||||
class SymbolNode(EntityNode):
|
class SymbolNode(EntityNode):
|
||||||
|
@ -1,17 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||||
#
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
# Licensed 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.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
@ -69,8 +58,6 @@ class LinkerScript:
|
|||||||
target = member.target
|
target = member.target
|
||||||
rules = member.rules
|
rules = member.rules
|
||||||
|
|
||||||
del rules[:]
|
|
||||||
|
|
||||||
rules.extend(mapping_rules[target])
|
rules.extend(mapping_rules[target])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
message = GenerationException.UNDEFINED_REFERENCE + " to target '" + target + "'."
|
message = GenerationException.UNDEFINED_REFERENCE + " to target '" + target + "'."
|
||||||
|
@ -1,18 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
# Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||||
#
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
# Licensed 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.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
@ -102,32 +91,22 @@ class GenerationTest(unittest.TestCase):
|
|||||||
def generate_default_rules(self):
|
def generate_default_rules(self):
|
||||||
rules = collections.defaultdict(list)
|
rules = collections.defaultdict(list)
|
||||||
|
|
||||||
rules['flash_text'].append(InputSectionDesc(ROOT, ['.literal', '.literal.*', '.text', '.text.*'], []))
|
|
||||||
rules['flash_rodata'].append(InputSectionDesc(ROOT, ['.rodata', '.rodata.*'], []))
|
|
||||||
rules['dram0_data'].append(InputSectionDesc(ROOT, ['.data', '.data.*'], []))
|
|
||||||
rules['dram0_data'].append(InputSectionDesc(ROOT, ['.dram', '.dram.*'], []))
|
|
||||||
rules['dram0_bss'].append(InputSectionDesc(ROOT, ['.bss', '.bss.*'], []))
|
rules['dram0_bss'].append(InputSectionDesc(ROOT, ['.bss', '.bss.*'], []))
|
||||||
rules['dram0_bss'].append(InputSectionDesc(ROOT, ['COMMON'], []))
|
rules['dram0_bss'].append(InputSectionDesc(ROOT, ['COMMON'], []))
|
||||||
|
rules['dram0_data'].append(InputSectionDesc(ROOT, ['.data', '.data.*'], []))
|
||||||
|
rules['dram0_data'].append(InputSectionDesc(ROOT, ['.dram', '.dram.*'], []))
|
||||||
|
rules['flash_text'].append(InputSectionDesc(ROOT, ['.literal', '.literal.*', '.text', '.text.*'], []))
|
||||||
|
rules['flash_rodata'].append(InputSectionDesc(ROOT, ['.rodata', '.rodata.*'], []))
|
||||||
rules['iram0_text'].append(InputSectionDesc(ROOT, ['.iram', '.iram.*'], []))
|
rules['iram0_text'].append(InputSectionDesc(ROOT, ['.iram', '.iram.*'], []))
|
||||||
rules['rtc_text'].append(InputSectionDesc(ROOT, ['.rtc.text', '.rtc.literal'], []))
|
rules['rtc_bss'].append(InputSectionDesc(ROOT, ['.rtc.bss'], []))
|
||||||
rules['rtc_data'].append(InputSectionDesc(ROOT, ['.rtc.data'], []))
|
rules['rtc_data'].append(InputSectionDesc(ROOT, ['.rtc.data'], []))
|
||||||
rules['rtc_data'].append(InputSectionDesc(ROOT, ['.rtc.rodata'], []))
|
rules['rtc_data'].append(InputSectionDesc(ROOT, ['.rtc.rodata'], []))
|
||||||
rules['rtc_bss'].append(InputSectionDesc(ROOT, ['.rtc.bss'], []))
|
rules['rtc_text'].append(InputSectionDesc(ROOT, ['.rtc.text', '.rtc.literal'], []))
|
||||||
|
|
||||||
return rules
|
return rules
|
||||||
|
|
||||||
def compare_rules(self, expected, actual):
|
def compare_rules(self, expected, actual):
|
||||||
self.assertEqual(set(expected.keys()), set(actual.keys()))
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
for target in sorted(actual.keys()):
|
|
||||||
message = 'failed target %s' % target
|
|
||||||
a_cmds = actual[target]
|
|
||||||
e_cmds = expected[target]
|
|
||||||
|
|
||||||
self.assertEqual(len(a_cmds), len(e_cmds), message)
|
|
||||||
|
|
||||||
for a, e in zip(a_cmds, e_cmds):
|
|
||||||
self.assertEqual(a, e, message)
|
|
||||||
|
|
||||||
def get_default(self, target, rules):
|
def get_default(self, target, rules):
|
||||||
return rules[target][0]
|
return rules[target][0]
|
||||||
|
Loading…
Reference in New Issue
Block a user