[Scons-users] Newbie needs advice - firmware building

Bill Brothers scons_mail at brothersland.com
Tue May 8 18:12:28 EDT 2018


Greetings scons folks:
I am working on setting up scons to build a fairly sophisticated build for firmware. I have been trying lots of small examples and have a couple of scenarios that I would like advice on. I have about 12 years of experience writing large Python projects, so this shouldn't be that hard. doh!
 
1. I have a Multi-directory hierarchical build (think I have got that covered) that uses SConscript to execute. Each directory uses a completely different tools set to generate executable bits. I've setup an environment for each and am focusing on getting the simplest build/directory running first. The first problem I've not been able to make work is a compile using "foreign compiler" from .c to .o. "local_tool" processes from .o to .de, then local_tool2 processes from .de to .fw.
 
Thus far I have tried building a construction environment, Replacing CC with my foreign compiler and setting the CPPFLAGS, CFLAGS, etc. to invoke the correct compiler. Running that with -n correctly spits out the compilation steps but fails to execute the compile, with error 1...
 
env.Append(BUILDERS={'GCC': foreign_build})
env.Append(BUILDERS={'FLINK': foreign_link})

sources = Split('apps/.../src/acme/acme.c '
 'apps/.../src/acme//cr_startup.c '
 'apps/.../src/acme//main.c ')

env.FLINK('acme.de', env.GCC(sources))
 
The first compile creates a .map, a .d, and a .o and so I had to use both a generator and an emitter to get that (almost) working correctly. Meaning -n shows the correct commands, but it fails to execute it.
 
So here is the problem: I need to create a dependency chain that is about nine steps long to run all of the necessary tools. It isn't clear to me how I do that in the way the writers intended. In the example above I just used the "All builders return nodes" rule to invoke the next step from the previous one. Is that the magic? (obviously I can use return values instead of nesting)
 
2. The second problem is that I am getting some errors and am having difficulty chasing down what is causing them.. Running with --debug=stacktrace  gets me  some information but assumes I understand the inner architecture.  I have setup to be able to debug and stepped through the action and generate code.
 
It seems to be an excellent tool, I am just missing something simple. Please provide a pointer to a conceptual example that doesn't use traditional c/c++/java tools that I can get a good idea of the structure that I need to be utilizing.
 
I plan to reread the man page tonight to see if I have just missed a key point somewhere.
 
Thanks,
Bill Brothers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180508/f367eaaa/attachment.html>


More information about the Scons-users mailing list