<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.E-MailFormatvorlage18
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
/* List Definitions */
@list l0
        {mso-list-id:107815628;
        mso-list-type:hybrid;
        mso-list-template-ids:1000392558 67567617 67567619 67567621 67567617 67567619 67567621 67567617 67567619 67567621;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level2
        {mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level4
        {mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level7
        {mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=DE link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span lang=EN-US>Hello<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>When I started with my new platform by
writing the machine’s class definition I made a typo with a memory
definition: the end address of the range was lower than the begin address. The
outcome was an invalid syntax the file ‘weaver.xml’, something
like:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> <region
base="0x20000000" size="0x-1DC00000"
type="conventional" /><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Of course ELFWEAVER complained about the
invalid number. It was not a big deal to find the cause and correct the values
in ‘machines.py’. After that I just restarted the build and
“wham!”, the error reappeared. An inspection of the build log
showed that SCONS just did not rebuild ‘weaver.xml’. Apparently
SCONS does not have any knowledge about the way this file is created, and
therefore it does not know its dependencies.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>What I found is that the file is not
created within a SConstruct/SConscript file, but within the Python script
‘tools/build.py’. It is done by the method
‘GenWeaverXML()’ of class ‘KengeEnvironment’. I could
fix the problem with the following statements inserted before the
method’s ‘return’ statement:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>
mfile = "#" + os.path.join("platform",
self.machine.platform_dir, "tools", "machines.py")<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>
Depends(weaver, mfile)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>However, I thing this is not the whole
story. For instance, the platform class definition inherits items from a base
class defining the processor architecture (in my case it is
‘arch/arm/tools/machines.py’); changes there still would not
trigger a rebuild of ‘weaver.xml’. In general, for a reliable build
system any script content affecting the result of the build should establish a
dependency.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Another point is whether the build system
correctly maintains dependencies of all build artefacts to
‘weaver.xml’. To find out I made a test (command line is ‘<i>tools/build.py
MACHINE=sam9263 PROJECT=iguana BUILD_DIR=\"sam9263\" --debug=explain</i>’):<o:p></o:p></span></p>
<p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span
lang=EN-US style='font-family:Symbol'><span style='mso-list:Ignore'>·<span
style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span
lang=EN-US>I started the build two times with the same configuration and
command line so that I got an “up-to-date” message the 2<sup>nd</sup>
time.<o:p></o:p></span></p>
<p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span
lang=EN-US style='font-family:Symbol'><span style='mso-list:Ignore'>·<span
style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span
lang=EN-US>I modified the physical memory range of my machine.<o:p></o:p></span></p>
<p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span
lang=EN-US style='font-family:Symbol'><span style='mso-list:Ignore'>·<span
style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span
lang=EN-US>I started the build another time with the same configuration and
command line.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>With my additonal dependency check I get
this result:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/weaver.xml' because
`platform/at91/tools/machines.py' changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[XML ]
sam9263/images/weaver.xml<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.elf' because `sam9263/images/weaver.xml'
changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[ELF ]
sam9263/images/image.elf<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.sim' because `sam9263/images/image.elf'
changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[ELF ]
sam9263/images/image.sim<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.boot' because `sam9263/images/image.elf'
changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[ELF ]
sam9263/images/image.boot<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.boot.bin' because `sam9263/images/image.boot'
changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'>[BIN ]
sam9263/images/image.boot.bin<o:p></o:p></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons: done
building targets.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Only the artefacts of the ELFWEAVER are
rebuild, and I doubt that this is sufficient. For instance, what about the
bootinfo source files? Do they have no dependency to the machine’s class
definition?<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>For another test I removed a coprecessor
#define (extension of attribute ‘cpp_defines’) from my
machine’s class definition. That seems to be handled correctly, since I
get the following result (excerpt):<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/pistachio/l4kernel/object/src/asid.o' because the contents
of the build action changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
action: $CXX $_CXX_COM_FLAGS
$_CXXFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES -c -o $TARGET<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[CXX ]
sam9263/pistachio/l4kernel/object/src/asid.o<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/pistachio/l4kernel/object/src/assert.o' because the
contents of the build action changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
action: $CXX $_CXX_COM_FLAGS $_CXXFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES -c
-o $TARGET<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>…<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>That does look good.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Next try is adding a virtual timer to the
platform:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> v2_drivers = [<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>
(timer_driver, "vtimer", memory_timer, interrupt_timer)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>
]<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>This change is recognized by building some
additional Iguana stuff and rebuilding the image (excerpt):<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/weaver.xml' because:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
`sam9263/iguana/bin/vtimer' is a new dependency<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
`platform/at91/tools/machines.py' changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[XML ]
sam9263/images/weaver.xml<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.elf' because:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
`sam9263/images/weaver.xml' changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
`sam9263/iguana/bin/vtimer' is a new dependency<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[ELF ]
sam9263/images/image.elf<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.sim' because:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
`sam9263/images/image.elf' changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
`sam9263/iguana/bin/vtimer' is a new dependency<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[ELF ]
sam9263/images/image.sim<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.boot' because `sam9263/images/image.elf'
changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[ELF ]
sam9263/images/image.boot<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.boot.bin' because:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
`sam9263/images/image.boot' changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
`sam9263/iguana/bin/vtimer' is a new dependency<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'>[BIN ]
sam9263/images/image.boot.bin<o:p></o:p></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons: done
building targets.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>This shows that new dependencies are
recognized as long as build artefacts derived from source files defined in
SConstruct/SConscript files are affected. But what about changing a driver
property in ‘machines.py’, for instance the driver’s
interrupt number?<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons: done
reading SConscript files.<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons: Building
targets ...<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>Couldn't find a
header posix/limits.h when scanning sam9263/iguana_server/include/limits.h<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>Couldn't find a
header posix/limits.h when scanning sam9263/iguana/include/limits.h<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>Couldn't find a
header posix/limits.h when scanning sam9263/iguana/include/limits.h<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/weaver.xml' because
`platform/at91/tools/machines.py' changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[XML ]
sam9263/images/weaver.xml<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.elf' because `sam9263/images/weaver.xml'
changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[ELF ]
sam9263/images/image.elf<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.sim' because `sam9263/images/image.elf'
changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[ELF ] sam9263/images/image.sim<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.boot' because `sam9263/images/image.elf'
changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[ELF ]
sam9263/images/image.boot<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons:
rebuilding `sam9263/images/image.boot.bin' because `sam9263/images/image.boot'
changed<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'>[BIN ] sam9263/images/image.boot.bin<o:p></o:p></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons: done
building targets.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Got it: ‘weaver.xml’ is rebuilt
due to my change described earlier, but the timer driver code responsible for
the interrupt handling is not. The ‘v2_drivers’ attribute is
evaluated in method ‘KengeEnvironment.GenWeaverXML(), so the interrupt definitions
find their way into ‘weaver.xml’, but it is not clear how it gets
into the build image. There are also references ‘projects/iguana/SConstruct’
which are somehow connected to the examples in ‘iguana/example’, so
these references seem not to be relevant when the examples are not used.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>The outcome of all this is that I see room
for improvements regarding dependency checking on the OKL4 build system.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Regards<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Frank<o:p></o:p></span></p>
</div>
</body>
</html>