mirror of
https://github.com/drasko/codezero.git
synced 2026-02-04 06:03:12 +01:00
Added inclusion of test_exec binary to test0
This commit is contained in:
@@ -10,6 +10,7 @@ from os.path import *
|
|||||||
PROJRELROOT = '../../'
|
PROJRELROOT = '../../'
|
||||||
|
|
||||||
sys.path.append(PROJRELROOT)
|
sys.path.append(PROJRELROOT)
|
||||||
|
sys.path.append('../../../../')
|
||||||
|
|
||||||
from config.projpaths import *
|
from config.projpaths import *
|
||||||
from config.configuration import *
|
from config.configuration import *
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ def relocate_bootdesc(target, source, env):
|
|||||||
shutil.copyfile(bootdesc_raw.path, target[0].path)
|
shutil.copyfile(bootdesc_raw.path, target[0].path)
|
||||||
|
|
||||||
bootdesc_c = e.Command('bootdesc.c', images, generate_bootdesc)
|
bootdesc_c = e.Command('bootdesc.c', images, generate_bootdesc)
|
||||||
bootdesc_raw = e.Program('bootdesc_raw.elf', bootdesc_c)
|
bootdesc_raw = e.Program('bootdesc_raw', bootdesc_c)
|
||||||
bootdesc = e.Command('bootdesc.elf', [bootdesc_raw, images], relocate_bootdesc)
|
bootdesc = e.Command('bootdesc.elf', [bootdesc_raw, images], relocate_bootdesc)
|
||||||
|
|
||||||
Return('bootdesc')
|
Return('bootdesc')
|
||||||
|
|||||||
@@ -11,6 +11,17 @@ from tools.pyelf.lmanext import *
|
|||||||
|
|
||||||
src = [Glob('*.[cS]') + Glob('src/*.c') + Glob('src/arch/arm/*.c')]
|
src = [Glob('*.[cS]') + Glob('src/*.c') + Glob('src/arch/arm/*.c')]
|
||||||
|
|
||||||
|
asm_string = \
|
||||||
|
'''
|
||||||
|
.align 4
|
||||||
|
.section .testexec
|
||||||
|
.incbin "%s"
|
||||||
|
'''
|
||||||
|
|
||||||
|
def generate_incbin_asm(target, source, env):
|
||||||
|
with open(target[0].path, 'w+') as asm_out:
|
||||||
|
asm_out.write(asm_string % source[0].path)
|
||||||
|
|
||||||
def generate_lma_lds(target, source, env):
|
def generate_lma_lds(target, source, env):
|
||||||
with open(source[1].path, 'r') as lds_in:
|
with open(source[1].path, 'r') as lds_in:
|
||||||
with open(target[0].path, 'w+') as lds_out:
|
with open(target[0].path, 'w+') as lds_out:
|
||||||
@@ -20,21 +31,25 @@ def generate_lma_lds(target, source, env):
|
|||||||
lma_lds = Command('include/linker.lds', [previmage, 'include/linker.lds.in'], generate_lma_lds)
|
lma_lds = Command('include/linker.lds', [previmage, 'include/linker.lds.in'], generate_lma_lds)
|
||||||
|
|
||||||
env = environment.Clone()
|
env = environment.Clone()
|
||||||
test_env = environment.Clone()
|
test_exec_env = environment.Clone()
|
||||||
|
|
||||||
|
|
||||||
|
test_exec_env.Append(LIBS = ['posix', 'c-userspace'])
|
||||||
|
test_exec_env.Append(LINKFLAGS = ['-T' + "test0/include/test_exec_linker.lds", '-u_start'])
|
||||||
|
test_exec_env.Append(CPPFLAGS = ' -D__USERSPACE__')
|
||||||
|
test_exec_env.Replace(PROGSUFFIX = '')
|
||||||
|
test_exec_src = Glob('src/test_exec/*.[cS]')
|
||||||
|
test_exec_objs = test_exec_env.Object(test_exec_src)
|
||||||
|
test_exec = test_exec_env.Program('src/test_exec/test_exec', test_exec_objs)
|
||||||
|
test_exec_asm = Command('test_exec.S', test_exec, generate_incbin_asm)
|
||||||
|
|
||||||
env.Append(LIBS = ['posix', 'c-userspace'])
|
env.Append(LIBS = ['posix', 'c-userspace'])
|
||||||
env.Append(LINKFLAGS = ['-T' + lma_lds[0].path, '-u_start'])
|
env.Append(LINKFLAGS = ['-T' + lma_lds[0].path, '-u_start'])
|
||||||
env.Append(CPPFLAGS = ' -D__USERSPACE__')
|
env.Append(CPPFLAGS = ' -D__USERSPACE__')
|
||||||
objs = env.Object(src)
|
objs = env.Object(src + test_exec_asm)
|
||||||
test0 = env.Program('test0.elf', objs)
|
test0 = env.Program('test0.elf', objs)
|
||||||
Depends(test0, lma_lds)
|
|
||||||
|
|
||||||
test_env.Append(LIBS = ['posix', 'c-userspace'])
|
Depends(test0, lma_lds)
|
||||||
test_env.Append(LINKFLAGS = ['-T' + "test0/include/test_exec_linker.lds", '-u_start'])
|
|
||||||
test_env.Append(CPPFLAGS = ' -D__USERSPACE__')
|
|
||||||
test_src = Glob('src/test_exec/*.[cS]')
|
|
||||||
test_objs = test_env.Object(test_src)
|
|
||||||
test_exec = test_env.Program('test_exec.elf', test_objs)
|
|
||||||
env.Depends(test0, test_exec)
|
env.Depends(test0, test_exec)
|
||||||
|
|
||||||
Return('test0')
|
Return('test0')
|
||||||
|
|||||||
Reference in New Issue
Block a user