Ejemplo n.º 1
0
    def test_flag_order(self):
        # Test that the order in which the flags are specified is retained
        test_fragment = self.create_fragment_file(u"""
[mapping:map]
archive: libmain.a
entries:
    obj1 (default);
        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.Surround('sym1'),
            Mapping.Align(8, True, False),
            Mapping.Sort('name')
        ]),
                    ('rodata', 'flash_rodata', [
                        Mapping.Keep(),
                        Mapping.Align(4, True, False),
                        Mapping.Keep(),
                        Mapping.Surround('sym1'),
                        Mapping.Align(8, True, False),
                        Mapping.Align(4, True, False),
                        Mapping.Sort('name')
                    ])]
        actual = fragment.flags[('obj1', None, 'default')]
        self.assertEqual(expected, actual)
Ejemplo n.º 2
0
    def test_flags_entries_multiple_flags_and_entries(self):
        # Not an error, generation step handles this, since
        # it that step has a more complete information
        # about all mappings. This can happen across multiple
        # mapping fragments.
        test_fragment = self.create_fragment_file(u"""
[mapping:map]
archive: libmain.a
entries:
    obj1 (default);
        text->flash_text ALIGN(4) KEEP() SURROUND(sym1) SORT(name)
    obj1 (default);
        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.Surround('sym1'),
            Mapping.Sort('name')
        ]),
                    ('text', 'flash_text', [
                        Mapping.Align(4, True, False),
                        Mapping.Keep(),
                        Mapping.Surround('sym1'),
                        Mapping.Sort('name')
                    ])]
        actual = fragment.flags[('obj1', None, 'default')]
        self.assertEqual(expected, actual)
Ejemplo n.º 3
0
    def test_surround_flag(self):
        # Test parsing combinations and orders of flags
        test_fragment = self.create_fragment_file(u"""
[mapping:map]
archive: libmain.a
entries:
    obj1 (default);
        text->flash_text SURROUND(sym1)
""")

        fragment_file = FragmentFile(test_fragment, self.sdkconfig)
        fragment = fragment_file.fragments[0]

        expected = [('text', 'flash_text', [Mapping.Surround('sym1')])]
        actual = fragment.flags[('obj1', None, 'default')]
        self.assertEqual(expected, actual)