-
Notifications
You must be signed in to change notification settings - Fork 1
/
meson.build
44 lines (36 loc) · 1.16 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
project('Bare metal Hi', ['c'])
pkgconfig_gen(
version : '0.1',
name : 'baremetal_hi',
filebase : 'baremetal-hi',
description : 'Write "Hi"')
# Initialize some globals
srcs = []
compiler_args = []
compilerArgs = ['-std=c11', '-O2']
linkArgs = []
linkDeps = []
# Get Platform and initialize appropriate variables
Platform = get_option('Platform')
if Platform == 'Posix'
compilerArgs += ['-DPosix']
srcs = ['test.c']
endif
if Platform == 'BmArm'
compilerArgs += ['-DRESET_ON_MAIN_COMPLETE', '-DBmArm', '-mcpu=arm926ej-s']
linkfile = 'link.meson.ld'
linkArgs = ['-Wl,-T,@0@/@1@'.format(meson.current_source_dir(), linkfile)]
linkDeps = [linkfile]
srcs = ['test.c', 'startup.S']
endif
# Create the executable
testit = executable( 'testit', srcs, c_args : compilerArgs, link_args : linkArgs, link_depends : linkDeps)
if Platform == 'BmArm'
testbin = custom_target( 'testbin',
output : ['test.bin'],
command : ['arm-eabi-objcopy', '-O', 'binary', 'testit', 'test.bin'],
depends : [testit])
run_target('run', 'qemu-system-arm', '-M', 'versatilepb', '-m', '128M', '-nographic', '-no-reboot', '-kernel', testbin)
else
run_target('run', testit)
endif