[Scons-users] How to generate symbols list on GNU Arm Embedded Toolchain
Hans-Christian Wild
hchr.wild at gmail.com
Sat Aug 1 09:14:51 EDT 2020
Have you tried using the CDT build output parser? I would assume it's in
there by default. SCons is verbose by default (echos all build commands),
so this should be enough for the parser to pick up all includes, defines
etc. automatically.
-Hans
On Sat, Aug 1, 2020 at 10:36 AM Marco Pastorelli <mpastorelli at gmail.com>
wrote:
> Hi Bill,
>
> I'm using MCUXpresso, it's an Eclipse-based IDE provided by NXP
>
> Thanks!
> Marco
>
> On Fri, 31 Jul 2020 at 18:35, Bill Deegan <bill at baddogconsulting.com>
> wrote:
>
>> Which IDE are you using?
>>
>> On Fri, Jul 31, 2020 at 7:52 AM Marco Pastorelli <mpastorelli at gmail.com>
>> wrote:
>>
>>> Hi all!
>>>
>>> I’m using SCons to build an Arm Cortex-M7 project based on GNU Arm
>>> Embedded Toolchain.
>>> Other than compiling the project, I’d like to generate the list of
>>> symbols to import from my IDE to get an accurate code highlighting.
>>> I wrote some code to generate the list of header files included in the
>>> projects, then I’m trying to get the symbol form every header file.
>>> The main issue I’m facing is that the include hierarchy is not
>>> preserved, so for example I got errors from freertos because FreeRTOS.h
>>> must appear in source files before include task.h.
>>>
>>> Does anybody know how to fix this problem or a different method to
>>> generate the symbols list?
>>>
>>> Thanks! Below a snippet of my code
>>> Marco
>>>
>>>
>>> def generate_include_list(env, target, source):
>>> """create a file to store include paths in GNU style, to be loaded
>>> with @"""
>>> paths = []
>>> for p in env['CPPPATH']:
>>> path = Path(p)
>>> try:
>>> path.is_dir()
>>> paths.append(str(path))
>>> except OSError:
>>> pass
>>> with open('include.list', 'w') as fileout:
>>> for path in paths:
>>> fileout.write(' -I ' + path.replace('\\', '/'))
>>>
>>>
>>> def cleanup_header_list(env, target, source):
>>> """get rid of the toolchain comments, we only need a list of real
>>> file paths"""
>>> with open('tmp_header_file.list', 'r') as filein:
>>> lines = []
>>> for line in filein:
>>> path = Path(line.strip())
>>> try:
>>> path.is_file()
>>> lines.append(str(path))
>>> except OSError:
>>> pass
>>> lines.reverse()
>>> with open('header_file.list', 'w') as fileout:
>>> for line in reversed(lines):
>>> fileout.write(line.replace('\\', '/') + '\n')
>>>
>>>
>>> # get the list of the header files (except toolchain header files)
>>> # in case also the toolchain header files are needed, use the option -M
>>> env.Command(
>>> target='tmp_header_file.list',
>>> source='',
>>> action=[generate_include_list, '$CC -H -MM src/main.c @include.list
>>> $CCFLAGS > $TARGET', cleanup_header_list]
>>> )
>>>
>>>
>>> # from all the header files get the symbols
>>> env.Command(
>>> target='symbol.list',
>>> source='',
>>> action=['type header_file.list', '$CC -E -dM @include.list $CCFLAGS
>>> @header_file.list > $TARGET']
>>> )
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20200801/9b0ef472/attachment.html>
More information about the Scons-users
mailing list