mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Loader building from top-level SConstruct.loader
Need to add libc and libelf to it as well.
This commit is contained in:
45
SConstruct.loader
Normal file
45
SConstruct.loader
Normal file
@@ -0,0 +1,45 @@
|
||||
# -*- mode: python; coding: utf-8; -*-
|
||||
#
|
||||
# Codezero -- a microkernel for embedded systems.
|
||||
#
|
||||
# Copyright © 2009 B Labs Ltd
|
||||
|
||||
import os, sys, shelve
|
||||
from os.path import join
|
||||
|
||||
from config.configuration import *
|
||||
from config.projpaths import *
|
||||
|
||||
config = configuration_retrieve()
|
||||
arch = config.arch
|
||||
platform = config.platform
|
||||
|
||||
# Locally important paths are here
|
||||
LIBC_PATH = 'loader/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 = 'loader/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' + "loader/linker.lds", "-u_start"],
|
||||
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])
|
||||
|
||||
#e.Append(LIBPATH = [LIBC_LIBPATH, LIBELF_LIBPATH])
|
||||
#e.Append(CPPPATH = ['#include', LIBC_INCPATH, LIBELF_INCPATH])
|
||||
loader_objs = SConscript('loader/SConscript', exports = { 'env' : env }, duplicate = 0, variant_dir = 'build/loader')
|
||||
|
||||
env.Program('build/final.elf', loader_objs)
|
||||
24
loader/SConscript
Normal file
24
loader/SConscript
Normal file
@@ -0,0 +1,24 @@
|
||||
# -*- mode: python; coding: utf-8; -*-
|
||||
#
|
||||
# Codezero -- a microkernel for embedded systems.
|
||||
#
|
||||
# Copyright © 2009 B Labs Ltd
|
||||
|
||||
import os, sys, shelve
|
||||
from os.path import join
|
||||
|
||||
Import('env')
|
||||
|
||||
# Get global paths
|
||||
PROJRELROOT = '../'
|
||||
|
||||
sys.path.append(PROJRELROOT)
|
||||
|
||||
|
||||
e = env.Clone()
|
||||
|
||||
src = Glob('*.[cS]')
|
||||
|
||||
objs = e.Object(src)
|
||||
|
||||
Return('objs')
|
||||
@@ -1,42 +0,0 @@
|
||||
# -*- mode: python; coding: utf-8; -*-
|
||||
#
|
||||
# Codezero -- a microkernel for embedded systems.
|
||||
#
|
||||
# Copyright © 2009 B Labs Ltd
|
||||
|
||||
import os, sys, shelve
|
||||
from os.path import join
|
||||
|
||||
# Get global paths
|
||||
PROJRELROOT = '../'
|
||||
|
||||
arch = 'arm'
|
||||
platform = 'pb926'
|
||||
|
||||
# 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", "-u_start"],
|
||||
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])
|
||||
|
||||
src = Glob('*.[cS]')
|
||||
|
||||
objs = env.Object(src)
|
||||
env.Program('final.elf', objs)
|
||||
Reference in New Issue
Block a user