ca-1 builds (not properly)

trunk
alexis 2022-05-28 18:31:35 -06:00
parent dd359fc504
commit 867b423974
14 changed files with 125 additions and 9 deletions

3
.gitmodules vendored
View File

@ -7,3 +7,6 @@
[submodule "subprojects/c-rbtree"]
path = subprojects/c-rbtree
url = https://github.com/c-util/c-rbtree
[submodule "subprojects/picolibc"]
path = subprojects/picolibc
url = https://github.com/picolibc/picolibc

View File

@ -20,7 +20,8 @@ lib_arl = static_library(
'syn.c',
'types.c',
include_directories: [inc_arl, inc_mpdec],
include_directories: [inc_arl, inc],
dependencies: [libclist_dep, libcrbtree_dep],
link_with: [a_mpdec],
pic: false,
)

21
build.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -e
BDIR=build
TDIR=targets
TARGET="$1"
if ! [[ -d "$TDIR/$TARGET" ]]; then
echo "Invalid target: $TARGET" > /dev/stderr
exit 1
fi
if [[ -f "$TDIR/$TARGET/meson_cross.txt" ]]; then
meson . "$BDIR" --cross-file "$TDIR/$TARGET/meson_cross.txt"
else
meson . "$BDIR"
fi
meson configure -Dtarget_type="$TARGET" build
meson compile -C build

View File

@ -6,4 +6,5 @@ lib_ca1 = static_library(
include_directories: [inc_arl, inc_ca1, inc_mpdec],
link_with: [lib_arl],
dependencies: [libclist_dep, libcrbtree_dep],
pic: false,
)

View File

@ -19,4 +19,7 @@ a_mpdec = static_library(
'numbertheory.c',
'sixstep.c',
'transpose.c',
include_directories: [inc, inc_mpdec],
pic: false,
)

View File

@ -3,6 +3,31 @@ project('ca1fw', 'c',
'warning_level=2', 'c_std=gnu11'],
)
link_args = []
inc = []
linker_script = meson.get_external_property('linker_script', '')
if linker_script != ''
fn = meson.source_root() / linker_script
link_args += '-T' + fn
endif
if meson.get_external_property('use_picolibc', false)
picolibc_proj = subproject('picolibc', default_options: [
'multilib=false',
'picocrt=false',
'picolib=false',
'semihost=false',
'io-long-long=true',
'io-pos-args=true',
'atomic-ungetc=false',
'format-default=integer',
'newlib-iconv-encodings=us_ascii'
])
lib_c = picolibc_proj.get_variable('lib_c')
inc += picolibc_proj.get_variable('inc')
endif
libclist_proj = subproject('c-list')
libclist_dep = libclist_proj.get_variable('libclist_dep')
@ -13,8 +38,14 @@ cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required: false)
subdir('libmpdec')
subdir('arl')
subdir('ca1')
inc += inc_mpdec
target_dir = meson.get_external_property('target_dir', 'targets/unix')
subdir('arl')
inc += inc_arl
subdir('ca1')
inc += inc_ca1
target_type = get_option('target_type')
target_dir = 'targets' / target_type
subdir(target_dir)

2
meson_options.txt Normal file
View File

@ -0,0 +1,2 @@
option('target_type', type: 'string', value: 'unix',
description: 'Name of the target to build. See targets/')

@ -1 +0,0 @@
Subproject commit adda5ff3e9d98648a4e01ad800fafd584e4640ce

View File

@ -1,2 +0,0 @@
[wrap-redirect]
filename = c-rbtree/subprojects/libcstdaux-1.wrap

1
subprojects/picolibc Submodule

@ -0,0 +1 @@
Subproject commit f741d2340a443ef479548aefc12fa0c429095e4f

15
targets/ca1/main.c Normal file
View File

@ -0,0 +1,15 @@
// intellectual property is bullshit bgdc
#include <stdbool.h>
#include <stddef.h>
#include <inttypes.h>
int main(void)
{
for (;;);
}
void _start(void)
{
main();
}

11
targets/ca1/meson.build Normal file
View File

@ -0,0 +1,11 @@
inc_target = include_directories('.')
exe_ca1 = executable(
'ca1',
'main.c',
include_directories: [inc_target, inc],
link_with: [lib_ca1, lib_arl, lib_c],
dependencies: [libclist_dep, libcrbtree_dep, m_dep],
)

View File

@ -0,0 +1,30 @@
[properties]
sizeof_int = 4
sizeof_wchar_t = 4
sizeof_void* = 4
alignment_char = 1
alignment_void* = 2
alignment_double = 2
has_function_printf = false
use_picolibc = true
linker_script = 'targets/ca1/link.ld'
[constants]
arch = 'm68k-elf'
[host_machine]
system = ''
cpu_family = 'm68k'
cpu = '68000'
endian = 'big'
[binaries]
c = arch + '-gcc'
strip = arch + '-strip'
objcopy = arch + '-objcopy'
[built-in options]
c_args = ['-mcpu=68000', '-save-temps']
c_link_args = ['-nostdlib']

View File

@ -6,7 +6,7 @@ exe_ca1 = executable(
'main.c',
'target_builtins.c',
include_directories: [inc_target, inc_arl, inc_ca1, inc_mpdec],
link_with: [lib_ca1, lib_arl],
include_directories: [inc_target, inc],
link_with: [lib_ca1, lib_arl, lib_c],
dependencies: [libclist_dep, libcrbtree_dep, m_dep],
)