1 |
2 |
drasko |
# -*- mode: python; coding: utf-8; -*-
|
2 |
|
|
#
|
3 |
|
|
# Codezero -- Virtualization microkernel for embedded systems.
|
4 |
|
|
#
|
5 |
|
|
# Copyright © 2009 B Labs Ltd
|
6 |
|
|
#
|
7 |
|
|
import os, shelve, sys
|
8 |
|
|
from os.path import *
|
9 |
|
|
|
10 |
|
|
PROJRELROOT = '../..'
|
11 |
|
|
|
12 |
|
|
sys.path.append(PROJRELROOT)
|
13 |
|
|
|
14 |
|
|
from config.projpaths import *
|
15 |
|
|
from config.configuration import *
|
16 |
|
|
from config.lib import *
|
17 |
|
|
|
18 |
|
|
config = configuration_retrieve()
|
19 |
|
|
arch = config.arch
|
20 |
|
|
platform = config.platform
|
21 |
|
|
gcc_arch_flag = config.gcc_arch_flag
|
22 |
|
|
|
23 |
|
|
LIBL4_RELDIR = 'conts/libl4'
|
24 |
|
|
KERNEL_INCLUDE = join(PROJROOT, 'include')
|
25 |
|
|
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
|
26 |
|
|
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
|
27 |
|
|
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
|
28 |
|
|
|
29 |
|
|
# Locally important paths are here
|
30 |
|
|
LIBC_RELDIR = 'conts/libc'
|
31 |
|
|
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
|
32 |
|
|
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
|
33 |
|
|
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
|
34 |
|
|
join(LIBC_DIR, 'include/arch' + '/' + arch)]
|
35 |
|
|
|
36 |
|
|
LIBDEV_RELDIR = 'conts/libdev'
|
37 |
|
|
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR)
|
38 |
|
|
LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace')
|
39 |
|
|
LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')]
|
40 |
|
|
|
41 |
|
|
LIBMEM_RELDIR = 'conts/libmem'
|
42 |
|
|
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
43 |
|
|
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
44 |
|
|
LIBMEM_INCLUDE = LIBMEM_DIR
|
45 |
|
|
|
46 |
|
|
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
47 |
|
|
# We don't use -nostdinc because sometimes we need standard headers,
|
48 |
|
|
# such as stdarg.h e.g. for variable args, as in printk().
|
49 |
|
|
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \
|
50 |
5 |
drasko |
'-Werror'],
|
51 |
2 |
drasko |
LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"],\
|
52 |
|
|
ASFLAGS = ['-D__ASSEMBLY__'], \
|
53 |
|
|
PROGSUFFIX = '.elf', # The suffix to use for final executable\
|
54 |
|
|
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path\
|
55 |
|
|
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace', 'gcc', 'libmalloc',
|
56 |
|
|
'c-userspace'], # libgcc.a - This is required for division routines.
|
57 |
|
|
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, LIBC_INCLUDE, LIBMEM_INCLUDE],
|
58 |
|
|
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
|
59 |
|
|
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
|
60 |
|
|
|
61 |
|
|
src = Glob('*.[cS]')
|
62 |
|
|
src += Glob('src/*.[cS]')
|
63 |
|
|
src += Glob('src/arch/*.[cS]')
|
64 |
|
|
|
65 |
|
|
objs = env.Object(src)
|
66 |
|
|
prog = env.Program('main.elf', objs)
|
67 |
|
|
Depends(prog, 'include/linker.lds')
|