mirror of
https://github.com/drasko/codezero.git
synced 2026-11-27 19:33:53 +01:00
Refactor the build to try and get as much material as possible out of SConstruct.
This commit is contained in:
+29
-43
@@ -24,8 +24,9 @@ from __future__ import with_statement
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
posixServicesDirectory = "containers/posix/"
|
|
||||||
includeDirectory = 'include'
|
includeDirectory = 'include'
|
||||||
|
containersDirectory = 'containers'
|
||||||
|
posixServicesDirectory = containersDirectory + '/posix'
|
||||||
toolsDirectory = 'tools'
|
toolsDirectory = 'tools'
|
||||||
cml2ToolsDirectory = toolsDirectory + '/cml2-tools'
|
cml2ToolsDirectory = toolsDirectory + '/cml2-tools'
|
||||||
buildDirectory = 'build'
|
buildDirectory = 'build'
|
||||||
@@ -92,6 +93,12 @@ else :
|
|||||||
'kernelCompiler': 'arm-none-eabi-gcc',
|
'kernelCompiler': 'arm-none-eabi-gcc',
|
||||||
'cpuOption': 'arm926ej-s'}
|
'cpuOption': 'arm926ej-s'}
|
||||||
},
|
},
|
||||||
|
includeDirectory = includeDirectory,
|
||||||
|
containersDirectory = containersDirectory,
|
||||||
|
posixServicesDirectory = posixServicesDirectory,
|
||||||
|
toolsDirectory = toolsDirectory,
|
||||||
|
cml2ToolsDirectory = cml2ToolsDirectory,
|
||||||
|
buildDirectory = buildDirectory,
|
||||||
)
|
)
|
||||||
|
|
||||||
# It is assumed that the C code is assuming that the configuration file will be found at l4/config.h so create it there.
|
# It is assumed that the C code is assuming that the configuration file will be found at l4/config.h so create it there.
|
||||||
@@ -127,53 +134,43 @@ else :
|
|||||||
baseEnvironment = configuration.Finish()
|
baseEnvironment = configuration.Finish()
|
||||||
baseEnvironment.Append(configFiles = ('#' + configHPath,))
|
baseEnvironment.Append(configFiles = ('#' + configHPath,))
|
||||||
baseEnvironment['CC'] = baseEnvironment['toolChains'][configuration.env['CPU']]['mainCompiler']
|
baseEnvironment['CC'] = baseEnvironment['toolChains'][configuration.env['CPU']]['mainCompiler']
|
||||||
|
##
|
||||||
|
## Using the cpu option changes the behaviour of the test execution, it generates an illegal instruction exception :-(
|
||||||
|
##
|
||||||
#baseEnvironment.Append(CCFLAGS = ['-mcpu=' + baseEnvironment['toolChains'][baseEnvironment['CPU']]['cpuOption']])
|
#baseEnvironment.Append(CCFLAGS = ['-mcpu=' + baseEnvironment['toolChains'][baseEnvironment['CPU']]['cpuOption']])
|
||||||
|
|
||||||
########## Build the libraries ########################
|
########## Build the libraries ########################
|
||||||
|
|
||||||
libraryEnvironment = baseEnvironment.Clone()
|
|
||||||
libraryEnvironment.Append(CCFLAGS = '-nostdinc')
|
|
||||||
libraryEnvironment.Append(LIBS = ['gcc'])
|
|
||||||
|
|
||||||
libs = {}
|
libs = {}
|
||||||
crts = {}
|
crts = {}
|
||||||
for variant in ['baremetal']:
|
for variant in ['baremetal']:
|
||||||
(libs[variant], crts[variant]) = SConscript('libs/c/SConscript', variant_dir = buildDirectory + '/lib/c/' + variant, duplicate = 0, exports = {'environment': libraryEnvironment, 'variant': variant})
|
(libs[variant], crts[variant]) = SConscript('libs/c/SConscript', variant_dir = buildDirectory + '/lib/c/' + variant, duplicate = 0,
|
||||||
|
exports = {'environment': baseEnvironment, 'variant': variant})
|
||||||
|
|
||||||
baseEnvironment['baremetal_libc'] = libs['baremetal']
|
baseEnvironment['baremetal_libc'] = libs['baremetal']
|
||||||
baseEnvironment['baremetal_crt0'] = crts['baremetal']
|
baseEnvironment['baremetal_crt0'] = crts['baremetal']
|
||||||
|
|
||||||
libelf = SConscript('libs/elf/SConscript', variant_dir = buildDirectory + '/lib/elf', duplicate = 0, exports = {'environment': libraryEnvironment})
|
libelf = SConscript('libs/elf/SConscript', variant_dir = buildDirectory + '/lib/elf', duplicate = 0, exports = {'environment': baseEnvironment})
|
||||||
|
|
||||||
Alias('libs', crts.values() + libs.values() + [libelf])
|
Alias('libs', crts.values() + libs.values() + [libelf])
|
||||||
|
|
||||||
########## Build the kernel ########################
|
########## Build the kernel ########################
|
||||||
|
|
||||||
kernelEnvironment = baseEnvironment.Clone()
|
startAxf = SConscript('src/SConscript' , variant_dir = buildDirectory + '/kernel' , duplicate = 0, exports = {'environment': baseEnvironment})
|
||||||
kernelEnvironment['CC'] = baseEnvironment['toolChains'][baseEnvironment['CPU']]['kernelCompiler']
|
|
||||||
kernelEnvironment.Append(LINKFLAGS = ['-T' + includeDirectory + '/l4/arch/' + baseEnvironment['ARCH'] + '/linker.lds'])
|
|
||||||
kernelEnvironment.Append(LIBS = ['gcc'])
|
|
||||||
kernelEnvironment.Append(CPPPATH = ['#' + buildDirectory, '#' + buildDirectory + '/l4', '#' + includeDirectory, '#' + includeDirectory + '/l4'])
|
|
||||||
####
|
|
||||||
#### TODO: Why are these files forcibly included, why not just leave it up to the C code to include things?
|
|
||||||
####
|
|
||||||
kernelEnvironment.Append(CPPFLAGS = ['-include', 'config.h', '-include', 'cml2Config.h', '-include', 'macros.h', '-include', 'types.h', '-D__KERNEL__'])
|
|
||||||
|
|
||||||
startAxf = SConscript('src/SConscript' , variant_dir = buildDirectory + '/kernel' , duplicate = 0, exports = {'environment': kernelEnvironment})
|
|
||||||
|
|
||||||
Alias('kernel', startAxf)
|
Alias('kernel', startAxf)
|
||||||
|
|
||||||
########## Build the task libraries ########################
|
########## Build the task libraries ########################
|
||||||
|
|
||||||
taskSupportLibraryEnvironment = baseEnvironment.Clone()
|
taskSupportLibraryEnvironment = baseEnvironment.Clone()
|
||||||
taskSupportLibraryEnvironment.Append(LIBS = ['gcc'])
|
|
||||||
taskSupportLibraryEnvironment.Append(CPPPATH = ['#' + buildDirectory, '#' + buildDirectory + '/l4', '#' + includeDirectory])
|
taskSupportLibraryEnvironment.Append(CPPPATH = ['#' + buildDirectory, '#' + buildDirectory + '/l4', '#' + includeDirectory])
|
||||||
|
|
||||||
taskLibraryNames = [f.name for f in Glob(posixServicesDirectory + 'lib*')]
|
taskLibraryNames = [f.name for f in Glob(posixServicesDirectory + '/lib*')]
|
||||||
|
|
||||||
taskLibraries = []
|
taskLibraries = []
|
||||||
for library in taskLibraryNames:
|
for library in taskLibraryNames:
|
||||||
taskLibraries.append(SConscript(posixServicesDirectory + library + '/SConscript', variant_dir = buildDirectory + '/' + posixServicesDirectory + library, duplicate = 0, exports = {'environment': taskSupportLibraryEnvironment, 'posixServicesDirectory': posixServicesDirectory}))
|
taskLibraries.append(SConscript(posixServicesDirectory + '/' + library + '/SConscript', variant_dir = buildDirectory + '/' + posixServicesDirectory + '/' + library,
|
||||||
|
duplicate = 0, exports = {'environment': taskSupportLibraryEnvironment}))
|
||||||
|
|
||||||
Alias ('tasklibs', taskLibraries)
|
Alias ('tasklibs', taskLibraries)
|
||||||
|
|
||||||
@@ -181,8 +178,8 @@ else :
|
|||||||
|
|
||||||
def buildTask(programName, sources, environment, previousImage, extraCppPath=None):
|
def buildTask(programName, sources, environment, previousImage, extraCppPath=None):
|
||||||
e = environment.Clone()
|
e = environment.Clone()
|
||||||
e.Append(LINKFLAGS=['-T' + posixServicesDirectory + programName + '/include/linker.lds'])
|
e.Append(LINKFLAGS=['-T' + e['posixServicesDirectory'] + '/' + programName + '/include/linker.lds'])
|
||||||
e.Append(LIBPATH=['#build/' + posixServicesDirectory + programName])
|
e.Append(LIBPATH=['#build/' + e['posixServicesDirectory'] + '/' + programName])
|
||||||
if extraCppPath: e.Append(CPPPATH=extraCppPath)
|
if extraCppPath: e.Append(CPPPATH=extraCppPath)
|
||||||
objects = e.StaticObject(sources)
|
objects = e.StaticObject(sources)
|
||||||
Depends(objects, e['configFiles'])
|
Depends(objects, e['configFiles'])
|
||||||
@@ -195,8 +192,8 @@ else :
|
|||||||
tasksEnvironment.Append(LIBS = taskLibraries + ['gcc'] + taskLibraries)
|
tasksEnvironment.Append(LIBS = taskLibraries + ['gcc'] + taskLibraries)
|
||||||
tasksEnvironment.Append(CPPDEFINES = ['__USERSPACE__'])
|
tasksEnvironment.Append(CPPDEFINES = ['__USERSPACE__'])
|
||||||
tasksEnvironment.Append(CPPPATH = ['#' + buildDirectory, '#' + buildDirectory + '/l4', '#' + includeDirectory, 'include', \
|
tasksEnvironment.Append(CPPPATH = ['#' + buildDirectory, '#' + buildDirectory + '/l4', '#' + includeDirectory, 'include', \
|
||||||
'#' + posixServicesDirectory + 'libl4/include', '#' + posixServicesDirectory + 'libc/include', \
|
'#' + posixServicesDirectory + '/libl4/include', '#' + posixServicesDirectory + '/libc/include', \
|
||||||
'#' + posixServicesDirectory + 'libmem', '#' + posixServicesDirectory + 'libposix/include'])
|
'#' + posixServicesDirectory + '/libmem', '#' + posixServicesDirectory + '/libposix/include'])
|
||||||
tasksEnvironment.Append(buildTask = buildTask)
|
tasksEnvironment.Append(buildTask = buildTask)
|
||||||
|
|
||||||
####
|
####
|
||||||
@@ -206,14 +203,15 @@ else :
|
|||||||
|
|
||||||
#### taskNameList = [ f.name for f in Glob(posixServicesDirectory + '*') if f.name not in taskLibraryNames + ['bootdesc'] ]
|
#### taskNameList = [ f.name for f in Glob(posixServicesDirectory + '*') if f.name not in taskLibraryNames + ['bootdesc'] ]
|
||||||
#### imageOrderData = [(taskName, []) for taskName in taskNameList]
|
#### imageOrderData = [(taskName, []) for taskName in taskNameList]
|
||||||
execfile(posixServicesDirectory + 'taskOrder.py')
|
execfile(posixServicesDirectory + '/taskOrder.py')
|
||||||
imageOrderData = [(taskName, []) for taskName in taskOrder]
|
imageOrderData = [(taskName, []) for taskName in taskOrder]
|
||||||
imageOrderData[0][1].append(startAxf)
|
imageOrderData[0][1].append(startAxf)
|
||||||
tasks = []
|
tasks = []
|
||||||
for i in range(len(imageOrderData)):
|
for i in range(len(imageOrderData)):
|
||||||
taskName = imageOrderData[i][0]
|
taskName = imageOrderData[i][0]
|
||||||
dependency = imageOrderData[i][1]
|
dependency = imageOrderData[i][1]
|
||||||
program = SConscript(posixServicesDirectory + taskName + '/SConscript', variant_dir = buildDirectory + '/' + posixServicesDirectory + taskName, duplicate = 0, exports = {'environment': tasksEnvironment, 'previousImage': dependency[0], 'posixServicesDirectory':posixServicesDirectory})
|
program = SConscript(posixServicesDirectory + '/' + taskName + '/SConscript', variant_dir = buildDirectory + '/' + posixServicesDirectory + '/' + taskName,
|
||||||
|
duplicate = 0, exports = {'environment': tasksEnvironment, 'previousImage': dependency[0]})
|
||||||
tasks.append(program)
|
tasks.append(program)
|
||||||
if i < len(imageOrderData) - 1:
|
if i < len(imageOrderData) - 1:
|
||||||
imageOrderData[i+1][1].append(program)
|
imageOrderData[i+1][1].append(program)
|
||||||
@@ -222,27 +220,15 @@ else :
|
|||||||
|
|
||||||
########## Create the boot description ########################
|
########## Create the boot description ########################
|
||||||
|
|
||||||
taskName = 'bootdesc'
|
bootdesc = SConscript(posixServicesDirectory + '/bootdesc/SConscript', variant_dir = buildDirectory + '/' + posixServicesDirectory + '/bootdesc',
|
||||||
|
duplicate = 0, exports = {'environment': baseEnvironment, 'images': [startAxf] + tasks})
|
||||||
bootdescEnvironment = baseEnvironment.Clone()
|
|
||||||
bootdescEnvironment.Append(LINKFLAGS = ['-T' + posixServicesDirectory + taskName + '/linker.lds'])
|
|
||||||
bootdescEnvironment.Append(LIBS = ['gcc'])
|
|
||||||
bootdescEnvironment.Append(CPPPATH = ['#' + includeDirectory])
|
|
||||||
|
|
||||||
bootdesc = SConscript(posixServicesDirectory + taskName + '/SConscript', variant_dir = buildDirectory + '/' + posixServicesDirectory + taskName, duplicate = 0, exports = {'environment': bootdescEnvironment, 'images': [startAxf] + tasks})
|
|
||||||
|
|
||||||
Alias('bootdesc', bootdesc)
|
Alias('bootdesc', bootdesc)
|
||||||
|
|
||||||
########## Do the packing / create loadable ########################
|
########## Do the packing / create loadable ########################
|
||||||
|
|
||||||
loaderEnvironment = baseEnvironment.Clone()
|
loader = SConscript('loader/SConscript', variant_dir = buildDirectory + '/loader', duplicate = 0,
|
||||||
loaderEnvironment.Append(LINKFLAGS = ['-T' + buildDirectory + '/loader/linker.lds'])
|
exports = {'environment': baseEnvironment, 'images': [startAxf, bootdesc] + tasks, 'libsInOrder': [libelf, libs['baremetal'], 'gcc', libs['baremetal']]})
|
||||||
loaderEnvironment.Append(LIBS = [libelf, libs['baremetal'], 'gcc', libs['baremetal']])
|
|
||||||
loaderEnvironment.Append(CPPPATH = ['#libs/elf/include', '#' + buildDirectory + '/loader'])
|
|
||||||
|
|
||||||
#### TODO: Fix the tasks data structure so as to avoid all the assumptions.
|
|
||||||
|
|
||||||
loader = SConscript('loader/SConscript', variant_dir = buildDirectory + '/loader', duplicate = 0, exports = {'environment': loaderEnvironment, 'images':[startAxf, bootdesc] + tasks, 'posixServicesDirectory': posixServicesDirectory})
|
|
||||||
|
|
||||||
Alias('final', loader)
|
Alias('final', loader)
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ import shutil
|
|||||||
|
|
||||||
Import('environment', 'images')
|
Import('environment', 'images')
|
||||||
|
|
||||||
|
e = environment.Clone()
|
||||||
|
e.Append(LINKFLAGS = ['-T' + e['posixServicesDirectory'] + '/bootdesc/linker.lds'])
|
||||||
|
e.Append(CPPPATH = ['#' + e['includeDirectory']])
|
||||||
|
|
||||||
bootdescTemplate = \
|
bootdescTemplate = \
|
||||||
'''
|
'''
|
||||||
/* This file is autogenerated, do not edit by hand. */
|
/* 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)
|
os.system("arm-none-linux-gnueabi-objcopy --adjust-section-vma .data=" + end + " " + source[0].path)
|
||||||
shutil.copyfile(source[0].path, target[0].path)
|
shutil.copyfile(source[0].path, target[0].path)
|
||||||
|
|
||||||
bootdescSource = environment.Command('bootdesc.c', images, generateBootdesc)
|
objects = e.Object(e.Command('bootdesc.c', images, generateBootdesc))
|
||||||
objects = environment.Object(bootdescSource)
|
Depends(objects, e['configFiles'])
|
||||||
Depends(objects, environment['configFiles'])
|
bootdesc = e.Command('bootdesc.axf', e.Program('bootdesc_intermediate', objects) + [images[1]] , relocateBootdesc)
|
||||||
bootdesc = environment.Command('bootdesc.axf', environment.Program('bootdesc_intermediate', objects) + [images[1]] , relocateBootdesc)
|
Depends(bootdesc, e['configFiles'])
|
||||||
Depends(bootdesc, environment['configFiles'])
|
|
||||||
|
|
||||||
Return('bootdesc')
|
Return('bootdesc')
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#
|
#
|
||||||
# Author: Russel Winder
|
# Author: Russel Winder
|
||||||
|
|
||||||
Import('environment', 'posixServicesDirectory')
|
Import('environment')
|
||||||
|
|
||||||
e = environment.Clone()
|
e = environment.Clone()
|
||||||
e.Append(CPPPATH = ['include', 'include/arch'])
|
e.Append(CPPPATH = ['include', 'include/arch'])
|
||||||
|
|||||||
@@ -17,10 +17,10 @@
|
|||||||
#
|
#
|
||||||
# Author: Russel Winder
|
# Author: Russel Winder
|
||||||
|
|
||||||
Import('environment', 'posixServicesDirectory')
|
Import('environment')
|
||||||
|
|
||||||
e = environment.Clone()
|
e = environment.Clone()
|
||||||
e.Append(CPPPATH = ['#' + posixServicesDirectory + 'libl4/include' , '.' ])
|
e.Append(CPPPATH = ['#' + environment['posixServicesDirectory'] + '/libl4/include' , '.' ])
|
||||||
|
|
||||||
mmObjects = e.StaticObject(Glob('mm/*.c'))
|
mmObjects = e.StaticObject(Glob('mm/*.c'))
|
||||||
Depends(mmObjects, e['configFiles'])
|
Depends(mmObjects, e['configFiles'])
|
||||||
|
|||||||
@@ -17,10 +17,10 @@
|
|||||||
#
|
#
|
||||||
# Author: Russel Winder
|
# Author: Russel Winder
|
||||||
|
|
||||||
Import('environment', 'posixServicesDirectory')
|
Import('environment')
|
||||||
|
|
||||||
e = environment.Clone()
|
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.
|
# TODO: There are errors in this code that -Werror gives problems with.
|
||||||
|
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
#
|
#
|
||||||
# Author: Russel Winder
|
# Author: Russel Winder
|
||||||
|
|
||||||
Import('environment', 'previousImage', 'posixServicesDirectory')
|
Import('environment', 'previousImage')
|
||||||
|
|
||||||
taskName = 'test0'
|
taskName = 'test0'
|
||||||
|
|
||||||
def createTestExecLinkerScript(target, source, env):
|
def createTestExecLinkerScript(target, source, env):
|
||||||
with open(target[0].path, 'w') as outFile:
|
with open(target[0].path, 'w') as outFile:
|
||||||
outFile.write('''
|
outFile.write("""
|
||||||
/*
|
/*
|
||||||
* Simple linker script for userspace or svc tasks.
|
* Simple linker script for userspace or svc tasks.
|
||||||
*
|
*
|
||||||
@@ -61,7 +61,7 @@ SECTIONS
|
|||||||
.bss : AT (ADDR(.bss) - offset) { *(.bss) }
|
.bss : AT (ADDR(.bss) - offset) { *(.bss) }
|
||||||
_end = .;
|
_end = .;
|
||||||
}
|
}
|
||||||
''' % ( source[0].path ))
|
""" % ( source[0].path ))
|
||||||
|
|
||||||
def createTestExecS(target, source, env):
|
def createTestExecS(target, source, env):
|
||||||
with open(target[0].path, 'w') as outFile:
|
with open(target[0].path, 'w') as outFile:
|
||||||
@@ -74,13 +74,13 @@ def createTestExecS(target, source, env):
|
|||||||
''' % ( source[0].path ))
|
''' % ( source[0].path ))
|
||||||
|
|
||||||
testTaskEnvironment = environment.Clone()
|
testTaskEnvironment = environment.Clone()
|
||||||
testTaskEnvironment.Append(CPPPATH=['#' + posixServicesDirectory +'libposix/include/posix'])
|
testTaskEnvironment.Append(CPPPATH=['#' + testTaskEnvironment['posixServicesDirectory'] +'/libposix/include/posix'])
|
||||||
testExecLinkerScript = Command('#build/' + posixServicesDirectory + taskName + '/include/test_exec_linker.lds', testTaskEnvironment['physicalBaseLinkerScript'], createTestExecLinkerScript)
|
testExecLinkerScript = Command('#build/' + testTaskEnvironment['posixServicesDirectory'] +'/' + taskName + '/include/test_exec_linker.lds', testTaskEnvironment['physicalBaseLinkerScript'], createTestExecLinkerScript)
|
||||||
testExecEnvironment = testTaskEnvironment.Clone()
|
testExecEnvironment = testTaskEnvironment.Clone()
|
||||||
testExecEnvironment.Append(LINKFLAGS=['-T' + testExecLinkerScript[0].path])
|
testExecEnvironment.Append(LINKFLAGS=['-T' + testExecLinkerScript[0].path])
|
||||||
testExec = testExecEnvironment.Program('test_exec', Glob('src/test_exec/*.[cS]'))
|
testExec = testExecEnvironment.Program('test_exec', Glob('src/test_exec/*.[cS]'))
|
||||||
Depends(testExec, testExecLinkerScript)
|
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)
|
program = testTaskEnvironment['buildTask'](taskName, Glob('*.c') + Glob('src/*.[cS]') + testExecS, testTaskEnvironment, previousImage)
|
||||||
Depends(program, testExec)
|
Depends(program, testExec)
|
||||||
|
|
||||||
|
|||||||
+8
-7
@@ -19,16 +19,17 @@
|
|||||||
|
|
||||||
Import('environment', 'variant')
|
Import('environment', 'variant')
|
||||||
|
|
||||||
|
e = environment.Clone()
|
||||||
|
e.Append(CPPPATH = ['include', 'include/sys-' + variant + '/arch-' + environment['ARCH']])
|
||||||
|
e.Append(CCFLAGS = '-nostdinc')
|
||||||
|
|
||||||
source = \
|
source = \
|
||||||
Glob('src/*.c') + \
|
Glob('src/*.c') + \
|
||||||
Glob('src/sys-' + variant + '/*.c') + \
|
Glob('src/sys-' + variant + '/*.c') + \
|
||||||
Glob('src/sys-' + variant + '/arch-' + environment['ARCH'] + '/*.c') + \
|
Glob('src/sys-' + variant + '/arch-' + e['ARCH'] + '/*.c') + \
|
||||||
Glob('src/sys-' + variant + '/arch-' + environment['ARCH'] + '/plat-' + environment['PLATFORM'] + '/*.c') + \
|
Glob('src/sys-' + variant + '/arch-' + e['ARCH'] + '/plat-' + e['PLATFORM'] + '/*.c') + \
|
||||||
Glob('src/arch-' + environment['ARCH'] + '/*.c') + \
|
Glob('src/arch-' + e['ARCH'] + '/*.c') + \
|
||||||
Glob('src/arch-' + environment['ARCH'] + '/*.S')
|
Glob('src/arch-' + e['ARCH'] + '/*.S')
|
||||||
|
|
||||||
e = environment.Clone()
|
|
||||||
e.Append(CPPPATH = ['include', 'include/sys-' + variant + '/arch-' + environment['ARCH']])
|
|
||||||
|
|
||||||
objects = e.StaticObject(source)
|
objects = e.StaticObject(source)
|
||||||
Depends (objects, e['configFiles'])
|
Depends (objects, e['configFiles'])
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Import('environment')
|
|||||||
|
|
||||||
e = environment.Clone()
|
e = environment.Clone()
|
||||||
e.Append(CPPPATH = ['include', '#libs/c/include', '#libs/c/include/arch/' + e['ARCH']])
|
e.Append(CPPPATH = ['include', '#libs/c/include', '#libs/c/include/arch/' + e['ARCH']])
|
||||||
|
e.Append(CCFLAGS = '-nostdinc')
|
||||||
|
|
||||||
objects = e.StaticObject(Glob('src/*.c'))
|
objects = e.StaticObject(Glob('src/*.c'))
|
||||||
Depends(objects, e['configFiles'])
|
Depends(objects, e['configFiles'])
|
||||||
|
|||||||
+9
-4
@@ -20,7 +20,12 @@
|
|||||||
import os.path
|
import os.path
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
Import('environment', 'images', 'posixServicesDirectory')
|
Import('environment', 'images', 'libsInOrder')
|
||||||
|
|
||||||
|
e = environment.Clone()
|
||||||
|
e.Append(LINKFLAGS = ['-T' + e['buildDirectory'] + '/loader/linker.lds'])
|
||||||
|
e.Append(LIBS = libsInOrder)
|
||||||
|
e.Append(CPPPATH = ['#libs/elf/include', '#' + e['buildDirectory'] + '/loader'])
|
||||||
|
|
||||||
def convertAddress(address):
|
def convertAddress(address):
|
||||||
'''Convert the string representation of the address given as parameter to a string representation of the
|
'''Convert the string representation of the address given as parameter to a string representation of the
|
||||||
@@ -129,10 +134,10 @@ linkerScript = Command('linker.lds', ['linker.lds.in'] + images, createLinkerScr
|
|||||||
|
|
||||||
## TODO: deal with the situation where there are other .c and .S files in the directory.
|
## TODO: deal with the situation where there are other .c and .S files in the directory.
|
||||||
|
|
||||||
objects = environment.Object(['arch.c' , kernelS, startAxfS, mainC])
|
objects = e.Object(['arch.c' , kernelS, startAxfS, mainC])
|
||||||
Depends(objects, environment['configFiles'])
|
Depends(objects, e['configFiles'])
|
||||||
Depends(objects, images)
|
Depends(objects, images)
|
||||||
program = environment.Program('final', objects + [environment['baremetal_crt0']])
|
program = e.Program('final', objects + [e['baremetal_crt0']])
|
||||||
Depends(program, linkerScript)
|
Depends(program, linkerScript)
|
||||||
|
|
||||||
Return('program')
|
Return('program')
|
||||||
|
|||||||
+19
-9
@@ -21,26 +21,36 @@ import os.path
|
|||||||
|
|
||||||
Import('environment')
|
Import('environment')
|
||||||
|
|
||||||
|
e = environment.Clone()
|
||||||
|
e['CC'] = e['toolChains'][e['CPU']]['kernelCompiler']
|
||||||
|
e.Append(CPPPATH = ['#' + e['buildDirectory'], '#' + e['buildDirectory'] + '/l4', '#' + e['includeDirectory'], '#' + e['includeDirectory'] + '/l4'])
|
||||||
|
e.Append(LINKFLAGS = ['-T' + e['includeDirectory'] + '/l4/arch/' + e['ARCH'] + '/linker.lds'])
|
||||||
|
####
|
||||||
|
#### TODO: Why are these files forcibly included, why not just leave it up to the C code to include things?
|
||||||
|
####
|
||||||
|
e.Append(CPPFLAGS = ['-include', 'config.h', '-include', 'cml2Config.h', '-include', 'macros.h', '-include', 'types.h', '-D__KERNEL__'])
|
||||||
|
e.Append(LIBS = ['gcc'])
|
||||||
|
|
||||||
sources = \
|
sources = \
|
||||||
Glob('api/*.[cS]') + \
|
Glob('api/*.[cS]') + \
|
||||||
Glob('generic/*.[cS]') + \
|
Glob('generic/*.[cS]') + \
|
||||||
Glob('lib/*.[cS]') + \
|
Glob('lib/*.[cS]') + \
|
||||||
Glob('arch/' + environment['ARCH'] + '/*.[cS]') + \
|
Glob('arch/' + e['ARCH'] + '/*.[cS]') + \
|
||||||
Glob('arch/' + environment['ARCH'] + '/' + environment['SUBARCH'] +'/*.[cS]') + \
|
Glob('arch/' + e['ARCH'] + '/' + e['SUBARCH'] +'/*.[cS]') + \
|
||||||
Glob('glue/' + environment['ARCH'] + '/*.[cS]') + \
|
Glob('glue/' + e['ARCH'] + '/*.[cS]') + \
|
||||||
Glob('platform/' + environment['PLATFORM'] + '/*.[cS]')
|
Glob('platform/' + e['PLATFORM'] + '/*.[cS]')
|
||||||
|
|
||||||
for item in environment['DRIVER'] :
|
for item in e['DRIVER'] :
|
||||||
path = 'drivers/' + item
|
path = 'drivers/' + item
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
feature , device = item.split ( '/' )
|
feature , device = item.split ( '/' )
|
||||||
raise ValueError, 'Driver ' + device + ' for ' + feature + ' not available.'
|
raise ValueError, 'Driver ' + device + ' for ' + feature + ' not available.'
|
||||||
sources += Glob(path + '/*.[cS]')
|
sources += Glob(path + '/*.[cS]')
|
||||||
|
|
||||||
objects = environment.Object(sources)
|
objects = e.Object(sources)
|
||||||
Depends(objects, environment['configFiles'])
|
Depends(objects, e['configFiles'])
|
||||||
|
|
||||||
startAxf = environment.Program('start.axf', objects)
|
startAxf = e.Program('start.axf', objects)
|
||||||
Depends(startAxf, environment['configFiles'])
|
Depends(startAxf, e['configFiles'])
|
||||||
|
|
||||||
Return('startAxf')
|
Return('startAxf')
|
||||||
|
|||||||
Reference in New Issue
Block a user