Rewrite meson.build in a more compact form

replace/ed28500f704e08b1a81ab7ff3152cdc1a71fcf3e
Niccolò Izzo 2020-10-21 21:42:36 +02:00
rodzic 4a27aadcc2
commit f6df51c3c3
1 zmienionych plików z 55 dodań i 62 usunięć

Wyświetl plik

@ -132,78 +132,71 @@ foreach k, v : md380_def
endif endif
endforeach endforeach
linux = {'sources': linux_src, linux_opts = {'sources': linux_src,
'c_args': linux_args, 'c_args': linux_args,
'include_directories': linux_inc, 'include_directories': linux_inc,
'dependencies': linux_dep} 'dependencies': linux_dep}
md380 = {'sources': md380_src, md380_opts = {'sources': md380_src,
'c_args': md380_args, 'c_args': md380_args,
'include_directories': md380_inc} 'include_directories': md380_inc}
## ##
## Select your radio model among the supported ones: MD-380, MD-UV380 ## Targets
## ##
openrtx_linux = executable('openrtx_linux', kwargs:linux) targets = [
openrtx_md380 = executable('openrtx_md380', kwargs:md380)
openrtx_mduv380g = executable('openrtx_mduv380g', kwargs:md380) {'name': 'linux',
'opts': linux_opts,
'flashable': false},
{'name': 'md380',
'opts': md380_opts,
'flashable': true,
'wrap': 'MD380',
'load_addr': '0x0800C000'},
{'name': 'md390',
'opts': md380_opts,
'flashable': true,
'wrap': 'MD390',
'load_addr': '0x0800C000'},
{'name': 'mduv380g',
'opts': md380_opts,
'flashable': true,
'wrap': 'UV3X0',
'load_addr': '0x0800C000'},
]
objcopy = find_program('objcopy') objcopy = find_program('objcopy')
radio_tool = find_program('radio_tool') radio_tool = find_program('radio_tool')
openrtx_md380_bin = custom_target('openrtx_md380_bin', foreach t : targets
output : 'openrtx_md380_bin',
input : openrtx_md380,
command : [objcopy,
'-O', 'binary',
'@INPUT@', '@OUTPUT@'])
openrtx_mduv380g_bin = custom_target('openrtx_mduv380g_bin', name = 'openrtx_'+t['name']
output : 'openrtx_mduv380g_bin', exe = executable(name, kwargs:t['opts'])
input : openrtx_mduv380g,
command : [objcopy,
'-O', 'binary',
'@INPUT@', '@OUTPUT@'])
if t['flashable']
openrtx_md380_wrap = custom_target('openrtx_md380_wrap', bin = custom_target(name+'_bin',
output : 'openrtx_md380_wrap', output : name+'_bin',
input : openrtx_md380_bin, input : exe,
command : [radio_tool, command : [objcopy, '-O', 'binary', '@INPUT@', '@OUTPUT@'])
'--wrap',
'-o', '@OUTPUT@',
'-r', 'MD380',
'-s', '0x0800C000:@INPUT@'])
openrtx_md380_flash = custom_target('openrtx_md380_flash', wrap = custom_target(name+'_wrap',
input : openrtx_md380_wrap, output : name+'_wrap',
output : 'openrtx_md380_flash', input : bin,
command : [radio_tool, '-d', '0', '-f', '-i', '@INPUT@']) command : [radio_tool,
'--wrap',
'-o', '@OUTPUT@',
'-r', t['wrap'],
'-s', t['load_addr']+':@INPUT@'])
openrtx_md390_wrap = custom_target('openrtx_md390_wrap', custom_target(name+'_flash',
output : 'openrtx_md390_wrap', input : wrap,
input : openrtx_md380_bin, output : name+'_flash',
command : [radio_tool, command : [radio_tool, '-d', '0', '-f', '-i', '@INPUT@'])
'--wrap', endif
'-o', '@OUTPUT@', endforeach
'-r', 'MD390',
'-s', '0x0800C000:@INPUT@'])
openrtx_md390_flash = custom_target('openrtx_md390_flash',
input : openrtx_md390_wrap,
output : 'openrtx_md390_flash',
command : [radio_tool, '-d', '0', '-f', '-i', '@INPUT@'])
openrtx_mduv380g_wrap = custom_target('openrtx_mduv380g_wrap',
output : 'openrtx_mduv380g_wrap',
input : openrtx_mduv380g_bin,
command : [radio_tool,
'--wrap',
'-o', '@OUTPUT@',
'-r', 'UV3X0',
'-s', '0x0800C000:@INPUT@'])
openrtx_mduv380g_flash = custom_target('openrtx_mduv380g_flash',
input : openrtx_mduv380g_wrap,
output : 'openrtx_mduv380g_flash',
command : [radio_tool, '-d', '0', '-f', '-i', '@INPUT@'])