Files
codezero/loader/SConstruct
Bahadir Balban 59f30a175a More progress on build scripts
Created a config directory for configuration files.
Moved all absolute path variables to a projpaths.py file
All scripts can now universally learn absolute paths via projpaths.py
Moved the config_symbols class to the configuration.py file.
Moved libs to loader since they are only referred by the loader
2009-09-12 13:42:30 +03:00

61 lines
1.8 KiB
Python

# -*- mode: python; coding: utf-8; -*-
#
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
import os, sys, shelve
# Get global paths
PROJRELROOT = '../'
cwd = os.getcwd()
os.chdir(PROJRELROOT)
execfile("configdata.py")
os.chdir(cwd)
# Get configuration information
config_shelve = shelve.open(CONFIG_SHELVE)
#symbols = config_shelve["config_symbols"]
arch = config_shelve["arch"]
subarch = config_shelve["subarch"]
platform = config_shelve["platform"]
all_syms = config_shelve["all_symbols"]
# Locally important paths are here
LIBC_PATH = '../libs/c'
LIBC_LIBPATH = LIBC_PATH
LIBC_INCPATH = [join(LIBC_PATH, 'include'), \
join(LIBC_PATH, 'include/arch/' + arch)]
LIBC_CRT_PATH = join(LIBC_PATH, "crt/sys-baremetal/arch-" + arch + "/crt0.o")
LIBELF_PATH = '../libs/elf'
LIBELF_LIBPATH = LIBELF_PATH
LIBELF_INCPATH = join(LIBELF_PATH, 'include')
env = Environment(CC = 'arm-none-eabi-gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-mcpu=arm926ej-s', '-nostdlib', '-ffreestanding', \
'-std=gnu99', '-Wall', '-Werror'],
LINKFLAGS = ['-nostdlib', '-T' + "linker.lds"],
ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf',
ENV = {'PATH' : os.environ['PATH']},
LIBS = ['gcc', 'c-baremetal', 'gcc'],
LIBPATH = [LIBC_LIBPATH, LIBELF_LIBPATH],
CPPPATH = ['#include', LIBC_INCPATH, LIBELF_INCPATH])
config_shelve = shelve.open(CONFIG_SHELVE)
#symbols = config_shelve["config_symbols"]
arch = config_shelve["arch"]
subarch = config_shelve["subarch"]
platform = config_shelve["platform"]
all_syms = config_shelve["all_symbols"]
src = Glob('*.[cS]')
crt0 = Glob(LIBC_CRT_PATH)
objs = env.Object(src)
env.Program('final.elf', objs + crt0)