mirror of
https://github.com/drasko/codezero.git
synced 2026-01-10 17:56:38 +01:00
A few changes to allow development on conts/test directory.
Now, bare containers get their files from conts/bare_src instead of conts/test. test directory will be used for the next generation test programs. Also bare_src is tracked by git now with a minor mod to .gitignore.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,7 +9,7 @@ cscope*out
|
||||
loader/images.S
|
||||
loader/ksyms.S
|
||||
tags
|
||||
conts/bare*
|
||||
conts/bare[0-9]
|
||||
conts/linux
|
||||
src/generic/cinfo.c
|
||||
.gdbinit
|
||||
|
||||
55
conts/bare_src/SConstruct
Normal file
55
conts/bare_src/SConstruct
Normal file
@@ -0,0 +1,55 @@
|
||||
# -*- mode: python; coding: utf-8; -*-
|
||||
#
|
||||
# Codezero -- Virtualization microkernel for embedded systems.
|
||||
#
|
||||
# Copyright © 2009 B Labs Ltd
|
||||
#
|
||||
import os, shelve, sys
|
||||
from os.path import *
|
||||
|
||||
PROJRELROOT = '../..'
|
||||
|
||||
sys.path.append(PROJRELROOT)
|
||||
|
||||
from config.projpaths import *
|
||||
from config.configuration import *
|
||||
|
||||
|
||||
config = configuration_retrieve()
|
||||
|
||||
arch = config.arch
|
||||
|
||||
LIBL4_RELDIR = 'conts/libl4'
|
||||
KERNEL_INCLUDE = join(PROJROOT, 'include')
|
||||
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
|
||||
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
|
||||
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
|
||||
|
||||
# Locally important paths are here
|
||||
LIBC_RELDIR = 'conts/libc'
|
||||
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
|
||||
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
|
||||
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
|
||||
join(LIBC_DIR, 'include/arch' + '/' + arch)]
|
||||
|
||||
|
||||
env = Environment(CC = 'arm-none-linux-gnueabi-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' + "include/linker.lds", "-u_start"],\
|
||||
ASFLAGS = ['-D__ASSEMBLY__'], \
|
||||
PROGSUFFIX = '.elf', # The suffix to use for final executable\
|
||||
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path\
|
||||
LIBS = ['gcc', 'libl4', 'c-userspace', 'gcc', 'c-userspace'], # libgcc.a - This is required for division routines.
|
||||
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBC_INCLUDE],
|
||||
LIBPATH = [LIBL4_LIBPATH, LIBC_LIBPATH],
|
||||
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
|
||||
|
||||
src = Glob('*.[cS]')
|
||||
src += Glob('src/*.[cS]')
|
||||
|
||||
objs = env.Object(src)
|
||||
prog = env.Program('main.elf', objs)
|
||||
Depends(prog, 'include/linker.lds')
|
||||
21
conts/bare_src/container.c
Normal file
21
conts/bare_src/container.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Container entry point for pager
|
||||
*
|
||||
* Copyright (C) 2007-2009 B Labs Ltd.
|
||||
*/
|
||||
|
||||
#include <l4lib/init.h>
|
||||
#include <l4lib/utcb.h>
|
||||
|
||||
|
||||
void main(void);
|
||||
|
||||
void __container_init(void)
|
||||
{
|
||||
/* Generic L4 initialisation */
|
||||
__l4_init();
|
||||
|
||||
/* Entry to main */
|
||||
main();
|
||||
}
|
||||
|
||||
13
conts/bare_src/hello.c
Normal file
13
conts/bare_src/hello.c
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Autogenerated hello world print function
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <container.h>
|
||||
|
||||
int print_hello_world(void)
|
||||
{
|
||||
printf("%s: Hello world from %s!\n", __CONTAINER__, __CONTAINER_NAME__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
34
conts/bare_src/include/linker.lds
Normal file
34
conts/bare_src/include/linker.lds
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Example working linker script for this container.
|
||||
*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
|
||||
vma_start = 0x0;
|
||||
lma_start = 0x1000000;
|
||||
offset = vma_start - lma_start;
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = vma_start;
|
||||
.text : AT (ADDR(.text) - offset) {
|
||||
/*
|
||||
* NOTE:
|
||||
* crt0.S must be in .text.head. This is necessary because
|
||||
* the kernel does not know any _start address, it assumes
|
||||
* the start address of pager region as the start address.
|
||||
*/
|
||||
*(.text.head) *(.text)
|
||||
}
|
||||
.rodata : AT (ADDR(.rodata) - offset) { *(.rodata) }
|
||||
.rodata1 : AT (ADDR(.rodata1) - offset) { *(.rodata1) }
|
||||
|
||||
. = ALIGN(4K);
|
||||
.data : AT (ADDR(.data) - offset) { *(.data) }
|
||||
.bss : AT (ADDR(.bss) - offset) { *(.bss) }
|
||||
. += 0x1000;
|
||||
. = ALIGN(8);
|
||||
__stack = .;
|
||||
}
|
||||
0
conts/bare_src/include/test.h
Normal file
0
conts/bare_src/include/test.h
Normal file
16
conts/bare_src/main.c
Normal file
16
conts/bare_src/main.c
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Main function for this container
|
||||
*/
|
||||
#include <l4lib/arch/syslib.h>
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
#include <l4/api/space.h>
|
||||
|
||||
extern int print_hello_world(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
print_hello_world();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
0
conts/bare_src/src/test.c
Normal file
0
conts/bare_src/src/test.c
Normal file
@@ -23,7 +23,7 @@ class BareContGenerator:
|
||||
def __init__(self):
|
||||
self.CONT_SRC_DIR = '' # Set when container is selected
|
||||
self.BARE_SRC_BASEDIR = join(PROJROOT, 'conts')
|
||||
self.EXAMPLE_PROJ_SRC_DIR = join(PROJROOT, 'conts/test')
|
||||
self.EXAMPLE_PROJ_SRC_DIR = join(PROJROOT, 'conts/bare_src')
|
||||
|
||||
self.main_builder_name = 'build.py'
|
||||
self.main_configurator_name = 'configure.py'
|
||||
|
||||
Reference in New Issue
Block a user