Add meson wrapper to build Zephyr targets

Now zephyr build process can be invoked from meson by running:

- meson setup build
- meson compile -C build openrtx_ttwrplus

TG-553
This commit is contained in:
Niccolò Izzo 2023-09-25 14:29:40 +02:00
parent 0126efe429
commit 7c09f7d2b0
No known key found for this signature in database
GPG Key ID: 52C4B7CBFC4C41A1
1 changed files with 112 additions and 73 deletions

View File

@ -535,6 +535,13 @@ mod17_opts = {'sources': mod17_src,
'dependencies': [codec2_dep], 'dependencies': [codec2_dep],
'include_directories': mod17_inc} 'include_directories': mod17_inc}
ttwrplus_opts = {'sources': ['CMakeLists.txt'],
'c_args': [],
'cpp_args': [],
'link_args' : [],
'dependencies': [codec2_dep],
'include_directories': []}
## ##
## ---------------------------- Compilation targets ---------------------------- ## ---------------------------- Compilation targets ----------------------------
## ##
@ -580,6 +587,12 @@ targets = [
'flashable': true, 'flashable': true,
'wrap': ' ', 'wrap': ' ',
'load_addr': ' '}, 'load_addr': ' '},
{'name': 'ttwrplus',
'opts': ttwrplus_opts,
'flashable': true,
'wrap': ' ',
'load_addr': ' '},
] ]
radio_tool = find_program('radio_tool') radio_tool = find_program('radio_tool')
@ -591,10 +604,34 @@ elif build_machine.system() == 'windows'
endif endif
gd77_loader = find_program('scripts/gd-77_firmware_loader.py', required:false, disabler:true) gd77_loader = find_program('scripts/gd-77_firmware_loader.py', required:false, disabler:true)
dfu_util = find_program('dfu-util', required:false, disabler:true) dfu_util = find_program('dfu-util', required:false, disabler:true)
west = find_program('west', required:false, disabler:true)
foreach t : targets foreach t : targets
name = 'openrtx_'+t['name'] name = 'openrtx_'+t['name']
# ttwrplus is a Zephyr target, thus we only wrap west
if name == 'openrtx_ttwrplus'
txt = custom_target('Copy CMakeLists.txt',
input : 'CMakeLists.txt',
output : 'CMakeLists.txt',
command : ['cp', '@INPUT@', '@OUTPUT@'],
install : false,
build_by_default : true)
bin = custom_target(name,
input : txt,
output : name+'_bin',
command : [west, 'build', '-b', 'ttwrplus', '-d', '.', '..'])
custom_target(name+'_flash',
input : bin,
output : name+'_flash',
command : [west, 'flash'])
else
exe = executable(name, kwargs:t['opts']) exe = executable(name, kwargs:t['opts'])
if t['flashable'] if t['flashable']
@ -682,6 +719,8 @@ foreach t : targets
endif endif
endif endif
endif
endforeach endforeach
## ##