| 1 |
2 |
drasko |
# -*- mode: python; coding: utf-8; -*-
|
| 2 |
|
|
|
| 3 |
|
|
# Codezero -- a microkernel for embedded systems.
|
| 4 |
|
|
#
|
| 5 |
|
|
# Copyright © 2009 B Labs Ltd
|
| 6 |
|
|
#
|
| 7 |
|
|
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
|
| 8 |
|
|
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
|
| 9 |
|
|
# (at your option) any later version.
|
| 10 |
|
|
#
|
| 11 |
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
| 12 |
|
|
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
| 13 |
|
|
# License for more details.
|
| 14 |
|
|
#
|
| 15 |
|
|
# You should have received a copy of the GNU General Public License along with this program. If not, see
|
| 16 |
|
|
# .
|
| 17 |
|
|
#
|
| 18 |
|
|
# Author: Russel Winder
|
| 19 |
|
|
|
| 20 |
|
|
import os.path
|
| 21 |
|
|
|
| 22 |
|
|
Import('environment')
|
| 23 |
|
|
|
| 24 |
|
|
e = environment.Clone()
|
| 25 |
|
|
e['CC'] = e['toolchains'][e['ARCH']][e['CPU']]['kernelCompiler']
|
| 26 |
|
|
e.Append(CPPPATH = ['#' + e['buildDirectory'], '#' + e['buildDirectory'] + '/l4', '#' + e['includeDirectory'], '#' + e['includeDirectory'] + '/l4'])
|
| 27 |
|
|
e.Append(LINKFLAGS = ['-T' + e['includeDirectory'] + '/l4/arch/' + e['ARCH'] + '/linker.lds'])
|
| 28 |
|
|
####
|
| 29 |
|
|
#### TODO: Why are these files forcibly included, why not just leave it up to the C code to include things?
|
| 30 |
|
|
####
|
| 31 |
|
|
e.Append(CPPFLAGS = ['-include', 'config.h', '-include', 'cml2Config.h', '-include', 'macros.h', '-include', 'types.h', '-D__KERNEL__'])
|
| 32 |
|
|
e.Append(LIBS = ['gcc'])
|
| 33 |
|
|
|
| 34 |
|
|
sources = \
|
| 35 |
|
|
Glob('api/*.[cS]') + \
|
| 36 |
|
|
Glob('generic/*.[cS]') + \
|
| 37 |
|
|
Glob('lib/*.[cS]') + \
|
| 38 |
|
|
Glob('arch/' + e['ARCH'] + '/*.[cS]') + \
|
| 39 |
|
|
Glob('arch/' + e['ARCH'] + '/' + e['SUBARCH'] +'/*.[cS]') + \
|
| 40 |
|
|
Glob('glue/' + e['ARCH'] + '/*.[cS]') + \
|
| 41 |
|
|
Glob('platform/' + e['PLATFORM'] + '/*.[cS]')
|
| 42 |
|
|
|
| 43 |
|
|
for item in e['DRIVER'] :
|
| 44 |
|
|
path = 'drivers/' + item
|
| 45 |
|
|
if not os.path.isdir(path):
|
| 46 |
|
|
feature , device = item.split ( '/' )
|
| 47 |
|
|
raise ValueError, 'Driver ' + device + ' for ' + feature + ' not available.'
|
| 48 |
|
|
sources += Glob(path + '/*.[cS]')
|
| 49 |
|
|
|
| 50 |
|
|
objects = e.Object(sources)
|
| 51 |
|
|
Depends(objects, e['configFiles'])
|
| 52 |
|
|
|
| 53 |
|
|
startAxf = e.Program('start.axf', objects)
|
| 54 |
|
|
Depends(startAxf, e['configFiles'])
|
| 55 |
|
|
|
| 56 |
|
|
Return('startAxf')
|