mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Declaring section of the form: .align 4 .section "kernel" .incbin "path-to-kernel" And defining a linker variable before the section output does not always seem to work. The linker seems to add padding even though .align directive comes before .section modified: SConstruct.loader modified: loader/linker.lds modified: loader/main.c
52 lines
1.9 KiB
Python
52 lines
1.9 KiB
Python
# -*- 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)]
|
|
|
|
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', 'elf', 'c-baremetal', 'gcc'],
|
|
LIBPATH = [join('build', LIBELF_PATH), join('build', LIBC_PATH)],
|
|
CPPPATH = ['#include', LIBC_INCPATH, LIBELF_INCPATH])
|
|
|
|
libc = SConscript('loader/libs/c/SConscript', \
|
|
exports = { 'env' : env, 'arch' : arch, 'platform' : platform }, \
|
|
duplicate = 0, variant_dir = 'build/loader/libs/c')
|
|
libelf = SConscript('loader/libs/elf/SConscript', exports = { 'env' : env }, \
|
|
duplicate = 0, variant_dir = 'build/loader/libs/elf')
|
|
|
|
loader_objs = SConscript('loader/SConscript', exports = { 'env' : env }, \
|
|
duplicate = 0, variant_dir = 'build/loader')
|
|
|
|
env.Program('build/final.elf', [libelf + libc + loader_objs])
|
|
Depends(loader_objs, libelf)
|
|
Depends(loader_objs, libc)
|