Răsfoiți Sursa

ldgen: rename emit to surround

Renz Bagaporo 5 ani în urmă
părinte
comite
dbdc17cced

+ 7 - 7
components/bt/linker.lf

@@ -9,7 +9,7 @@ entries:
     data -> dram0_data
 
 # For the following fragments, order matters for
-# 'align(4, post) emit(sym)', which generates:
+# 'align(4, post) surround(sym)', which generates:
 #
 #   _sym_start
 #   ...
@@ -20,8 +20,8 @@ entries:
 archive: libbt.a
 entries:
     * (bt_start_end);
-        bss_common -> dram0_bss align(4, post) emit(bt_bss),
-        data -> dram0_data  align(4, post) emit(bt_data)
+        bss_common -> dram0_bss align(4, post) surround(bt_bss),
+        data -> dram0_data  align(4, post) surround(bt_data)
     if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y:
         * (extram_bss)
 
@@ -29,12 +29,12 @@ entries:
 archive: libbtdm_app.a
 entries:
     * (bt_start_end);
-        bss_common -> dram0_bss align(4, post) emit(btdm_bss),
-        data -> dram0_data align(4, post) emit(btdm_data)
+        bss_common -> dram0_bss align(4, post) surround(btdm_bss),
+        data -> dram0_data align(4, post) surround(btdm_data)
 
 [mapping:nimble]
 archive: libnimble.a
 entries:
     * (bt_start_end);
-        bss_common -> dram0_bss align(4, post) emit(nimble_bss),
-        data -> dram0_data align(4, post) emit(nimble_data)
+        bss_common -> dram0_bss align(4, post) surround(nimble_bss),
+        data -> dram0_data align(4, post) surround(nimble_data)

+ 4 - 4
components/espcoredump/linker.lf

@@ -27,12 +27,12 @@ entries:
 archive: *
 entries:
     * (coredump_default);
-        rtc_fast_coredump -> rtc_force_fast emit(coredump_rtc_fast),
-        rtc_coredump -> rtc_data emit(coredump_rtc),
-        dram_coredump -> dram0_data emit(coredump_dram)
+        rtc_fast_coredump -> rtc_force_fast surround(coredump_rtc_fast),
+        rtc_coredump -> rtc_data surround(coredump_rtc),
+        dram_coredump -> dram0_data surround(coredump_dram)
     if IDF_TARGET_ESP32S2 = n:
         * (coredump_default);
-            iram_coredump -> iram0_data emit(coredump_iram)
+            iram_coredump -> iram0_data surround(coredump_iram)
 
 [mapping:espcoredump]
 archive: libespcoredump.a

+ 10 - 10
tools/ldgen/fragments.py

@@ -274,7 +274,7 @@ class Mapping(Fragment):
         PRE_POST = (Optional(Suppress(',') + Suppress('pre').setParseAction(lambda: True).setResultsName('pre')) +
                     Optional(Suppress(',') + Suppress('post').setParseAction(lambda: True).setResultsName('post')))
 
-    class Emit(Flag):
+    class Surround(Flag):
 
         def __init__(self, symbol, pre=True, post=True):
             self.symbol = symbol
@@ -283,11 +283,11 @@ class Mapping(Fragment):
 
         @staticmethod
         def get_grammar():
-            # emit(symbol [, pre, post])
+            # surround(symbol [, pre, post])
             #
             # __symbol_start, __symbol_end is generated before and after
             # the corresponding input section description, respectively.
-            grammar = (Keyword('emit').suppress() +
+            grammar = (Keyword('surround').suppress() +
                        Suppress('(') +
                        Fragment.IDENTIFIER.setResultsName('symbol') +
                        Mapping.Flag.PRE_POST +
@@ -295,20 +295,20 @@ class Mapping(Fragment):
 
             def on_parse(tok):
                 if tok.pre == '' and tok.post == '':
-                    res = Mapping.Emit(tok.symbol)
+                    res = Mapping.Surround(tok.symbol)
                 elif tok.pre != '' and tok.post == '':
-                    res = Mapping.Emit(tok.symbol, tok.pre, False)
+                    res = Mapping.Surround(tok.symbol, tok.pre, False)
                 elif tok.pre == '' and tok.post != '':
-                    res = Mapping.Emit(tok.symbol, False, tok.post)
+                    res = Mapping.Surround(tok.symbol, False, tok.post)
                 else:
-                    res = Mapping.Emit(tok.symbol, tok.pre, tok.post)
+                    res = Mapping.Surround(tok.symbol, tok.pre, tok.post)
                 return res
 
             grammar.setParseAction(on_parse)
             return grammar
 
         def __eq__(self, other):
-            return (isinstance(other, Mapping.Emit) and
+            return (isinstance(other, Mapping.Surround) and
                     self.symbol == other.symbol and
                     self.pre == other.pre and
                     self.post == other.post)
@@ -442,7 +442,7 @@ class Mapping(Fragment):
         #       obj (scheme)
         #       * (scheme)
         # Flags can be specified for section->target in the scheme specified, ex:
-        #       obj (scheme); section->target emit(symbol), section2->target2 align(4)
+        #       obj (scheme); section->target surround(symbol), section2->target2 align(4)
         obj = Fragment.ENTITY.setResultsName('object')
         symbol = Suppress(':') + Fragment.IDENTIFIER.setResultsName('symbol')
         scheme = Suppress('(') + Fragment.IDENTIFIER.setResultsName('scheme') + Suppress(')')
@@ -450,7 +450,7 @@ class Mapping(Fragment):
         # The flags are specified for section->target in the scheme specified
         sections_target = Scheme.grammars['entries'].grammar
 
-        flag = Or([f.get_grammar() for f in [Mapping.Keep, Mapping.Align, Mapping.Emit, Mapping.Sort]])
+        flag = Or([f.get_grammar() for f in [Mapping.Keep, Mapping.Align, Mapping.Surround, Mapping.Sort]])
 
         section_target_flags = Group(sections_target + Group(OneOrMore(flag)).setResultsName('flags'))
 

+ 7 - 7
tools/ldgen/generation.py

@@ -146,7 +146,7 @@ class EntityNode():
 
                 keep = False
                 sort = None
-                surround = []
+                surround_type = []
 
                 placement_flags = placement.flags if placement.flags is not None else []
 
@@ -155,12 +155,12 @@ class EntityNode():
                         keep = True
                     elif isinstance(flag, Mapping.Sort):
                         sort = (flag.first, flag.second)
-                    else:  # emit or align
-                        surround.append(flag)
+                    else:  # surround or align
+                        surround_type.append(flag)
 
-                for flag in surround:
+                for flag in surround_type:
                     if flag.pre:
-                        if isinstance(flag, Mapping.Emit):
+                        if isinstance(flag, Mapping.Surround):
                             commands[placement.target].append(SymbolAtAddress('_%s_start' % flag.symbol))
                         else:  # align
                             commands[placement.target].append(AlignAtAddress(flag.alignment))
@@ -181,9 +181,9 @@ class EntityNode():
                                                    [e.node.entity for e in subplacement.exclusions], keep, sort)
                         commands[placement.target].append(command)
 
-                for flag in surround:
+                for flag in surround_type:
                     if flag.post:
-                        if isinstance(flag, Mapping.Emit):
+                        if isinstance(flag, Mapping.Surround):
                             commands[placement.target].append(SymbolAtAddress('_%s_end' % flag.symbol))
                         else:  # align
                             commands[placement.target].append(AlignAtAddress(flag.alignment))

+ 22 - 22
tools/ldgen/test/test_fragments.py

@@ -913,21 +913,21 @@ entries:
 archive: libmain.a
 entries:
     obj1 (default);
-        text->flash_text emit(sym1),
-        rodata->flash_rodata emit(sym2, pre),
-        data->dram0_data emit(sym3, post),
-        bss->dram0_bss emit(sym4, pre, post),
-        common->dram0_bss emit(sym5, pre, post) emit(sym6)
+        text->flash_text surround(sym1),
+        rodata->flash_rodata surround(sym2, pre),
+        data->dram0_data surround(sym3, post),
+        bss->dram0_bss surround(sym4, pre, post),
+        common->dram0_bss surround(sym5, pre, post) surround(sym6)
 """)
 
         fragment_file = FragmentFile(test_fragment, self.sdkconfig)
         fragment = fragment_file.fragments[0]
 
-        expected = [('text', 'flash_text', [Mapping.Emit('sym1', True, True)]),
-                    ('rodata', 'flash_rodata', [Mapping.Emit('sym2', True, False)]),
-                    ('data', 'dram0_data', [Mapping.Emit('sym3', False, True)]),
-                    ('bss', 'dram0_bss', [Mapping.Emit('sym4', True, True)]),
-                    ('common', 'dram0_bss', [Mapping.Emit('sym5', True, True), Mapping.Emit('sym6', True, True)])]
+        expected = [('text', 'flash_text', [Mapping.Surround('sym1', True, True)]),
+                    ('rodata', 'flash_rodata', [Mapping.Surround('sym2', True, False)]),
+                    ('data', 'dram0_data', [Mapping.Surround('sym3', False, True)]),
+                    ('bss', 'dram0_bss', [Mapping.Surround('sym4', True, True)]),
+                    ('common', 'dram0_bss', [Mapping.Surround('sym5', True, True), Mapping.Surround('sym6', True, True)])]
         actual = fragment.flags[('obj1', None, 'default')]
         self.assertEqual(expected, actual)
 
@@ -938,21 +938,21 @@ entries:
 archive: libmain.a
 entries:
     obj1 (default);
-        text->flash_text align(4) keep emit(sym1) align(8) sort(name),
-        rodata->flash_rodata keep align(4) keep emit(sym1) align(8) align(4) sort(name)
+        text->flash_text align(4) keep surround(sym1) align(8) sort(name),
+        rodata->flash_rodata keep align(4) keep surround(sym1) align(8) align(4) sort(name)
 """)
         fragment_file = FragmentFile(test_fragment, self.sdkconfig)
         fragment = fragment_file.fragments[0]
 
         expected = [('text', 'flash_text', [Mapping.Align(4, True, False),
                                             Mapping.Keep(),
-                                            Mapping.Emit('sym1', True, True),
+                                            Mapping.Surround('sym1', True, True),
                                             Mapping.Align(8, True, False),
                                             Mapping.Sort('name')]),
                     ('rodata', 'flash_rodata', [Mapping.Keep(),
                                                 Mapping.Align(4, True, False),
                                                 Mapping.Keep(),
-                                                Mapping.Emit('sym1', True, True),
+                                                Mapping.Surround('sym1', True, True),
                                                 Mapping.Align(8, True, False),
                                                 Mapping.Align(4, True, False),
                                                 Mapping.Sort('name')])]
@@ -968,19 +968,19 @@ entries:
 archive: libmain.a
 entries:
     obj1 (default);
-        text->flash_text align(4) keep emit(sym1) sort(name),
-        text->flash_text align(4) keep emit(sym1) sort(name)
+        text->flash_text align(4) keep surround(sym1) sort(name),
+        text->flash_text align(4) keep surround(sym1) sort(name)
 """)
         fragment_file = FragmentFile(test_fragment, self.sdkconfig)
         fragment = fragment_file.fragments[0]
 
         expected = [('text', 'flash_text', [Mapping.Align(4, True, False),
                                             Mapping.Keep(),
-                                            Mapping.Emit('sym1', True, True),
+                                            Mapping.Surround('sym1', True, True),
                                             Mapping.Sort('name')]),
                     ('text', 'flash_text', [Mapping.Align(4, True, False),
                                             Mapping.Keep(),
-                                            Mapping.Emit('sym1', True, True),
+                                            Mapping.Surround('sym1', True, True),
                                             Mapping.Sort('name')])]
         actual = fragment.flags[('obj1', None, 'default')]
         self.assertEqual(expected, actual)
@@ -995,20 +995,20 @@ entries:
 archive: libmain.a
 entries:
     obj1 (default);
-        text->flash_text align(4) keep emit(sym1) sort(name)
+        text->flash_text align(4) keep surround(sym1) sort(name)
     obj1 (default);
-        text->flash_text align(4) keep emit(sym1) sort(name)
+        text->flash_text align(4) keep surround(sym1) sort(name)
 """)
         fragment_file = FragmentFile(test_fragment, self.sdkconfig)
         fragment = fragment_file.fragments[0]
 
         expected = [('text', 'flash_text', [Mapping.Align(4, True, False),
                                             Mapping.Keep(),
-                                            Mapping.Emit('sym1', True, True),
+                                            Mapping.Surround('sym1', True, True),
                                             Mapping.Sort('name')]),
                     ('text', 'flash_text', [Mapping.Align(4, True, False),
                                             Mapping.Keep(),
-                                            Mapping.Emit('sym1', True, True),
+                                            Mapping.Surround('sym1', True, True),
                                             Mapping.Sort('name')])]
         actual = fragment.flags[('obj1', None, 'default')]
         self.assertEqual(expected, actual)

+ 9 - 9
tools/ldgen/test/test_generation.py

@@ -1398,7 +1398,7 @@ class FlagTest(GenerationTest):
 
     def test_flags_basics(self):
         # Test that input section commands additions are done (keep, sort).
-        # Test that order dependent commands are properly generated (align, emit)
+        # Test that order dependent commands are properly generated (align, surround)
         # Normally, if an entry has the same mapping as parent, commands.
         #   are not emitted for them. However, if there are flags, they should be -
         #   only for the scheme entries that have flags, though.
@@ -1428,11 +1428,11 @@ class FlagTest(GenerationTest):
 archive: libfreertos.a
 entries:
     croutine (noflash_text);
-        text->iram0_text align(4, pre, post) emit(sym1, pre, post)                      #1
+        text->iram0_text align(4, pre, post) surround(sym1, pre, post)                      #1
     timers (default);
         text->flash_text keep sort(name)                                                #2
     timers (default);
-        rodata->flash_rodata emit(sym2, pre, post) align(4, pre, post)                  #3
+        rodata->flash_rodata surround(sym2, pre, post) align(4, pre, post)                  #3
 """
 
         self.add_fragments(mapping)
@@ -1489,7 +1489,7 @@ archive: *
 entries:
     # 1
     * (default);
-        text->flash_text emit(sym1) keep                            #2
+        text->flash_text surround(sym1) keep                            #2
 
 [mapping:test]
 archive: libfreertos.a
@@ -1551,7 +1551,7 @@ archive: libfreertos.a
 entries:
     # 1
     * (default);
-        text->flash_text emit(sym1) keep                            #2
+        text->flash_text surround(sym1) keep                            #2
     croutine:prvCheckPendingReadyList (noflash_text)                #3
 """
 
@@ -1607,7 +1607,7 @@ archive: libfreertos.a
 entries:
     # 1
     croutine (default);
-        text->flash_text emit(sym1) keep                            #2
+        text->flash_text surround(sym1) keep                            #2
     croutine:prvCheckPendingReadyList (noflash_text)                #3
 """
 
@@ -1658,7 +1658,7 @@ archive: *
 entries:
     # 1
     * (default);
-        text->flash_text emit(sym1) keep                            #2
+        text->flash_text surround(sym1) keep                            #2
 
 [mapping:test]
 archive: libfreertos.a
@@ -1720,7 +1720,7 @@ archive: libfreertos.a
 entries:
     # 1
     * (default);
-        text->flash_text emit(sym1) keep
+        text->flash_text surround(sym1) keep
     croutine (default)                                              #2
     croutine:prvCheckPendingReadyList (noflash_text)                #3
 """
@@ -1820,7 +1820,7 @@ entries:
 archive: *
 entries:
     * (default);
-        text->flash_text emit(sym1)
+        text->flash_text surround(sym1)
 """
         self.add_fragments(mapping)
 

+ 1 - 1
tools/test_apps/build_system/ldgen_test/main/linker.lf

@@ -4,5 +4,5 @@ entries:
     * (noflash)
     src1 (default)
     src1:func1 (noflash);
-        text->iram0_text keep align(9) align(12, post) emit(sym1)
+        text->iram0_text keep align(9) align(12, post) surround(sym1)
     src1:func2 (rtc)