ldgen: fix sections info parsing

Fixes an issure where the first part of an object file name is not
included, due to matching the rule for a section entry previously.

Reduce depedency on matching literal strings in sections which might
change depending on toolchain (ex. matching 'elf32-xtensa-le')

Make sure parsing rule succeeds for the entirety of the sections info
string by adding 'parseAll=True'.

Add test for sections info parsing.
This commit is contained in:
Renz Bagaporo
2020-11-16 13:55:22 +08:00
parent 32206d3a7d
commit ef6c8e351b
4 changed files with 47 additions and 16 deletions

View File

@@ -1422,6 +1422,19 @@ entries:
self.assertListEqual(actual["flash_text"], expected["flash_text"])
self.assertListEqual(actual["iram0_text"], expected["iram0_text"])
def test_sections_info_parsing(self):
self.sections_info = SectionsInfo()
with open("data/sections_parse.info") as sections_info_file_obj:
self.sections_info.add_sections_info(sections_info_file_obj)
sections = self.sections_info.get_obj_sections("libsections_parse.a", "croutine")
self.assertEqual(set(sections), set([".text", ".data", ".bss"]))
sections = self.sections_info.get_obj_sections("libsections_parse.a", "FreeRTOS-openocd")
self.assertEqual(set(sections), set([".literal.prvCheckPendingReadyList"]))
if __name__ == "__main__":
unittest.main()