You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.0 KiB
91 lines
2.0 KiB
project(
|
|
'firmware',
|
|
['c'],
|
|
default_options: ['optimization=2', 'cpp_std=c++17', 'b_staticpic=false']
|
|
)
|
|
|
|
## END USER MUST MODIFY: KEEP ONLY THE 10x or 30x BLOCK
|
|
ch32v10x_proj = subproject('ch32v10x')
|
|
ch32v10x_dep = ch32v10x_proj.get_variable('ch32v10x_dep')
|
|
ch32v10x_sys_dep = ch32v10x_proj.get_variable('ch32v10x_sys_dep')
|
|
dependencies = [ch32v10x_dep, ch32v10x_sys_dep]
|
|
|
|
## END USER MUST MODIFY: KEEP ONLY THE 10x or 30x BLOCK
|
|
ch32v30x_proj = subproject('ch32v30x', default_options: ['variant=CH32V307'])
|
|
ch32v30x_dep = ch32v30x_proj.get_variable('ch32v30x_dep')
|
|
ch32v30x_sys_dep = ch32v30x_proj.get_variable('ch32v30x_sys_dep')
|
|
dependencies = [ch32v30x_dep, ch32v30x_sys_dep]
|
|
|
|
sources = [
|
|
'src/main.c',
|
|
]
|
|
|
|
includes = [
|
|
'src',
|
|
]
|
|
|
|
_incl_dirs = include_directories(includes)
|
|
|
|
objcopy = find_program('objcopy')
|
|
objdump = find_program('objdump')
|
|
size = find_program('size')
|
|
|
|
main = executable(
|
|
meson.project_name() + '.elf',
|
|
sources,
|
|
include_directories: _incl_dirs,
|
|
dependencies: dependencies,
|
|
)
|
|
|
|
main_hex = custom_target(
|
|
meson.project_name() + '.hex',
|
|
command: [
|
|
objcopy,
|
|
'-O', 'ihex',
|
|
'@INPUT@', '@OUTPUT@'
|
|
],
|
|
input: main,
|
|
output: meson.project_name() + '.hex',
|
|
build_by_default: true,
|
|
)
|
|
|
|
# Copy files to generic names that make can find
|
|
hex_for_make = custom_target(
|
|
'firmware-for-make.hex',
|
|
command: ['cp', '@INPUT@', '@OUTPUT@'],
|
|
input: main_hex,
|
|
output: 'firmware-for-make.hex',
|
|
build_by_default: true,
|
|
)
|
|
elf_for_make = custom_target(
|
|
'firmware-for-make.elf',
|
|
command: ['cp', '@INPUT@', '@OUTPUT@'],
|
|
input: main,
|
|
output: 'firmware-for-make.elf',
|
|
build_by_default: true,
|
|
)
|
|
|
|
main_disas = custom_target(
|
|
meson.project_name() + '.disas',
|
|
command: [
|
|
objdump,
|
|
'-SC', '@INPUT@'
|
|
],
|
|
input: main,
|
|
output: meson.project_name() + '.disas',
|
|
build_by_default: true,
|
|
capture: true,
|
|
)
|
|
|
|
main_size = custom_target(
|
|
'size',
|
|
build_always_stale: true,
|
|
build_by_default: true,
|
|
command: [
|
|
size, '@INPUT@'
|
|
],
|
|
input: main,
|
|
console: true,
|
|
output: 'size',
|
|
)
|