2022-06-07 00:59:27 -04:00
|
|
|
cxx = meson.get_compiler('cpp')
|
2022-07-31 22:57:40 -04:00
|
|
|
# gcc_dep = cxx.find_library('gcc', required: true)
|
2022-01-04 01:50:46 -05:00
|
|
|
objcopy = find_program('riscv64-linux-gnu-objcopy')
|
|
|
|
mkimage = find_program('mkimage')
|
|
|
|
|
|
|
|
arch_sources += [
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
elf = executable(
|
|
|
|
'kernel.elf',
|
|
|
|
arch_sources,
|
2022-01-05 02:47:30 -05:00
|
|
|
include_directories: includes,
|
2022-07-31 22:57:40 -04:00
|
|
|
# dependencies: gcc_dep,
|
|
|
|
cpp_args: arch_cpp_args,
|
2022-01-04 01:50:46 -05:00
|
|
|
link_args: [
|
2022-07-31 22:57:40 -04:00
|
|
|
arch_link_args,
|
2022-01-04 01:50:46 -05:00
|
|
|
'-Wl,-T,' + meson.current_source_dir() + '/platform.ld',
|
|
|
|
],
|
|
|
|
link_depends: files('platform.ld'),
|
|
|
|
install: true,
|
|
|
|
install_dir: meson.build_root()
|
|
|
|
)
|
|
|
|
|
|
|
|
bin = custom_target(
|
|
|
|
'kernel.bin',
|
|
|
|
command: [objcopy, '-O', 'binary', '@INPUT@', '@OUTPUT@'],
|
|
|
|
input: elf,
|
|
|
|
output: 'kernel.bin'
|
|
|
|
)
|
|
|
|
|
|
|
|
uboot_img = custom_target(
|
|
|
|
'kernel.uboot',
|
|
|
|
command: [
|
|
|
|
mkimage,
|
|
|
|
'-d', '@INPUT@',
|
|
|
|
'-A', 'riscv',
|
|
|
|
'-O', 'u-boot',
|
|
|
|
'-a', '0x45000000',
|
|
|
|
'-e', '0x45000000',
|
|
|
|
'-C', 'none',
|
|
|
|
'@OUTPUT@'
|
|
|
|
],
|
|
|
|
input: bin,
|
|
|
|
output: 'kernel.uboot',
|
|
|
|
install: true,
|
|
|
|
install_dir: meson.build_root()
|
|
|
|
)
|
|
|
|
|
|
|
|
run_target('uart',
|
|
|
|
command: [
|
|
|
|
find_program(meson.source_root() + '/tools/uboot_upload'),
|
|
|
|
elf
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|