mirror of
https://github.com/drasko/codezero.git
synced 2026-02-19 21:33:14 +01:00
Refactor the build to try and get as much material as possible out of SConstruct.
This commit is contained in:
@@ -23,6 +23,10 @@ import shutil
|
||||
|
||||
Import('environment', 'images')
|
||||
|
||||
e = environment.Clone()
|
||||
e.Append(LINKFLAGS = ['-T' + e['posixServicesDirectory'] + '/bootdesc/linker.lds'])
|
||||
e.Append(CPPPATH = ['#' + e['includeDirectory']])
|
||||
|
||||
bootdescTemplate = \
|
||||
'''
|
||||
/* This file is autogenerated, do not edit by hand. */
|
||||
@@ -85,10 +89,9 @@ def relocateBootdesc(target, source, env):
|
||||
os.system("arm-none-linux-gnueabi-objcopy --adjust-section-vma .data=" + end + " " + source[0].path)
|
||||
shutil.copyfile(source[0].path, target[0].path)
|
||||
|
||||
bootdescSource = environment.Command('bootdesc.c', images, generateBootdesc)
|
||||
objects = environment.Object(bootdescSource)
|
||||
Depends(objects, environment['configFiles'])
|
||||
bootdesc = environment.Command('bootdesc.axf', environment.Program('bootdesc_intermediate', objects) + [images[1]] , relocateBootdesc)
|
||||
Depends(bootdesc, environment['configFiles'])
|
||||
objects = e.Object(e.Command('bootdesc.c', images, generateBootdesc))
|
||||
Depends(objects, e['configFiles'])
|
||||
bootdesc = e.Command('bootdesc.axf', e.Program('bootdesc_intermediate', objects) + [images[1]] , relocateBootdesc)
|
||||
Depends(bootdesc, e['configFiles'])
|
||||
|
||||
Return('bootdesc')
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#
|
||||
# Author: Russel Winder
|
||||
|
||||
Import('environment', 'posixServicesDirectory')
|
||||
Import('environment')
|
||||
|
||||
e = environment.Clone()
|
||||
e.Append(CPPPATH = ['include', 'include/arch'])
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
#
|
||||
# Author: Russel Winder
|
||||
|
||||
Import('environment', 'posixServicesDirectory')
|
||||
Import('environment')
|
||||
|
||||
e = environment.Clone()
|
||||
e.Append(CPPPATH = ['#' + posixServicesDirectory + 'libl4/include' , '.' ])
|
||||
e.Append(CPPPATH = ['#' + environment['posixServicesDirectory'] + '/libl4/include' , '.' ])
|
||||
|
||||
mmObjects = e.StaticObject(Glob('mm/*.c'))
|
||||
Depends(mmObjects, e['configFiles'])
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
#
|
||||
# Author: Russel Winder
|
||||
|
||||
Import('environment', 'posixServicesDirectory')
|
||||
Import('environment')
|
||||
|
||||
e = environment.Clone()
|
||||
e.Append(CPPPATH = ['include', 'include/posix', '#' + posixServicesDirectory + 'libl4/include'])
|
||||
e.Append(CPPPATH = ['include', 'include/posix', '#' + environment['posixServicesDirectory'] + '/libl4/include'])
|
||||
|
||||
# TODO: There are errors in this code that -Werror gives problems with.
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
#
|
||||
# Author: Russel Winder
|
||||
|
||||
Import('environment', 'previousImage', 'posixServicesDirectory')
|
||||
Import('environment', 'previousImage')
|
||||
|
||||
taskName = 'test0'
|
||||
|
||||
def createTestExecLinkerScript(target, source, env):
|
||||
with open(target[0].path, 'w') as outFile:
|
||||
outFile.write('''
|
||||
outFile.write("""
|
||||
/*
|
||||
* Simple linker script for userspace or svc tasks.
|
||||
*
|
||||
@@ -61,7 +61,7 @@ SECTIONS
|
||||
.bss : AT (ADDR(.bss) - offset) { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
''' % ( source[0].path ))
|
||||
""" % ( source[0].path ))
|
||||
|
||||
def createTestExecS(target, source, env):
|
||||
with open(target[0].path, 'w') as outFile:
|
||||
@@ -74,13 +74,13 @@ def createTestExecS(target, source, env):
|
||||
''' % ( source[0].path ))
|
||||
|
||||
testTaskEnvironment = environment.Clone()
|
||||
testTaskEnvironment.Append(CPPPATH=['#' + posixServicesDirectory +'libposix/include/posix'])
|
||||
testExecLinkerScript = Command('#build/' + posixServicesDirectory + taskName + '/include/test_exec_linker.lds', testTaskEnvironment['physicalBaseLinkerScript'], createTestExecLinkerScript)
|
||||
testTaskEnvironment.Append(CPPPATH=['#' + testTaskEnvironment['posixServicesDirectory'] +'/libposix/include/posix'])
|
||||
testExecLinkerScript = Command('#build/' + testTaskEnvironment['posixServicesDirectory'] +'/' + taskName + '/include/test_exec_linker.lds', testTaskEnvironment['physicalBaseLinkerScript'], createTestExecLinkerScript)
|
||||
testExecEnvironment = testTaskEnvironment.Clone()
|
||||
testExecEnvironment.Append(LINKFLAGS=['-T' + testExecLinkerScript[0].path])
|
||||
testExec = testExecEnvironment.Program('test_exec', Glob('src/test_exec/*.[cS]'))
|
||||
Depends(testExec, testExecLinkerScript)
|
||||
testExecS = Command('#build/' + posixServicesDirectory + taskName + '/test_exec.S', testExec, createTestExecS)
|
||||
testExecS = Command('#build/' + testTaskEnvironment['posixServicesDirectory'] + '/' + taskName + '/test_exec.S', testExec, createTestExecS)
|
||||
program = testTaskEnvironment['buildTask'](taskName, Glob('*.c') + Glob('src/*.[cS]') + testExecS, testTaskEnvironment, previousImage)
|
||||
Depends(program, testExec)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user