[Scons-users] How to generate symbols list on GNU Arm Embedded Toolchain
mpastorelli at gmail.com
Fri Jul 31 10:52:38 EDT 2020
I’m using SCons to build an Arm Cortex-M7 project based on GNU Arm Embedded
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
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)
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
with open('tmp_header_file.list', 'r') as filein:
lines = 
for line in filein:
path = Path(line.strip())
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
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
action=['type header_file.list', '$CC -E -dM @include.list $CCFLAGS
@header_file.list > $TARGET']
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Scons-users