2020-10-04 16:25:26 +00:00
|
|
|
##
|
|
|
|
## OpenRTX - Modular Open Source Radio Firmware
|
|
|
|
##
|
|
|
|
project('OpenRTX', 'c',
|
|
|
|
version : '0.1',
|
|
|
|
default_options : ['warning_level=3'])
|
|
|
|
|
|
|
|
##
|
|
|
|
## Here are listed all the platform independent source files
|
|
|
|
##
|
2020-10-31 08:17:42 +00:00
|
|
|
|
|
|
|
## OpenRTX
|
|
|
|
|
|
|
|
openrtx_src = ['openrtx/src/main.c',
|
|
|
|
'openrtx/src/bootstrap.c',
|
|
|
|
'openrtx/src/state.c',
|
|
|
|
'openrtx/src/ui.c']
|
|
|
|
|
|
|
|
openrtx_inc = ['openrtx/include/interfaces',
|
|
|
|
'openrtx/include/fonts']
|
|
|
|
|
|
|
|
## RTOS
|
2020-10-04 16:25:26 +00:00
|
|
|
rtos_src = ['rtos/uC-OS3/Source/__dbg_uCOS-III.c',
|
|
|
|
'rtos/uC-OS3/Source/os_cfg_app.c',
|
|
|
|
'rtos/uC-OS3/Source/os_core.c',
|
|
|
|
'rtos/uC-OS3/Source/os_dbg.c',
|
|
|
|
'rtos/uC-OS3/Source/os_flag.c',
|
|
|
|
'rtos/uC-OS3/Source/os_mem.c',
|
|
|
|
'rtos/uC-OS3/Source/os_msg.c',
|
|
|
|
'rtos/uC-OS3/Source/os_mutex.c',
|
|
|
|
'rtos/uC-OS3/Source/os_prio.c',
|
|
|
|
'rtos/uC-OS3/Source/os_q.c',
|
|
|
|
'rtos/uC-OS3/Source/os_sem.c',
|
|
|
|
'rtos/uC-OS3/Source/os_stat.c',
|
|
|
|
'rtos/uC-OS3/Source/os_task.c',
|
|
|
|
'rtos/uC-OS3/Source/os_tick.c',
|
|
|
|
'rtos/uC-OS3/Source/os_time.c',
|
|
|
|
'rtos/uC-OS3/Source/os_tmr.c',
|
|
|
|
'rtos/uC-OS3/Source/os_var.c',
|
|
|
|
'rtos/uC-OS3/Cfg/os_app_hooks.c',
|
|
|
|
'rtos/uC-CPU/cpu_core.c',
|
|
|
|
'rtos/uC-LIB/lib_ascii.c',
|
|
|
|
'rtos/uC-LIB/lib_math.c',
|
|
|
|
'rtos/uC-LIB/lib_mem.c',
|
|
|
|
'rtos/uC-LIB/lib_str.c']
|
|
|
|
|
2020-10-10 22:25:59 +00:00
|
|
|
rtos_inc = ['rtos/uC-OS3/Source',
|
|
|
|
'rtos/uC-OS3/Cfg',
|
|
|
|
'rtos/uC-CPU',
|
|
|
|
'rtos/uC-CPU/Cfg',
|
|
|
|
'rtos/uC-LIB',
|
|
|
|
'rtos/uC-LIB/Cfg']
|
2020-10-31 08:17:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
src = openrtx_src + rtos_src
|
|
|
|
inc = openrtx_inc + rtos_inc
|
2020-10-04 16:25:26 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
## Definitions
|
|
|
|
##
|
|
|
|
def = {'DONT_USE_CMSIS_INIT': ''}
|
|
|
|
|
2020-10-31 08:17:42 +00:00
|
|
|
##
|
|
|
|
## MCU-dependent sources and includes
|
|
|
|
##
|
|
|
|
|
|
|
|
## STM32F405
|
|
|
|
|
|
|
|
stm32f405_src = ['platform/mcu/STM32F4xx/boot/startup.c',
|
|
|
|
'platform/mcu/STM32F4xx/boot/libc_integration.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb/usb_bsp.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb/usb_core.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb/usb_dcd.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb/usb_dcd_int.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb/usbd_desc.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb/usbd_core.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb/usbd_ioreq.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb/usbd_req.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb/usbd_usr.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/gpio.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb_vcom.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/delays.c',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/rtc.c',
|
|
|
|
'platform/mcu/CMSIS/Device/ST/STM32F4xx/Source/system_stm32f4xx.c',
|
|
|
|
'rtos/uC-OS3/Ports/ARM-Cortex-M/ARMv7-M/os_cpu_c.c',
|
|
|
|
'rtos/uC-OS3/Ports/ARM-Cortex-M/ARMv7-M/os_cpu_a.s',
|
|
|
|
'rtos/uC-CPU/ARM-Cortex-M/ARMv7-M/cpu_c.c',
|
|
|
|
'rtos/uC-CPU/ARM-Cortex-M/ARMv7-M/cpu_a.s']
|
|
|
|
|
|
|
|
stm32f405_inc = ['platform/mcu/CMSIS/Include',
|
|
|
|
'platform/mcu/CMSIS/Device/ST/STM32F4xx/Include',
|
|
|
|
'platform/mcu/STM32F4xx',
|
|
|
|
'platform/mcu/STM32F4xx/drivers',
|
|
|
|
'platform/mcu/STM32F4xx/drivers/usb',
|
|
|
|
'rtos/uC-OS3/Ports/ARM-Cortex-M/ARMv7-M',
|
|
|
|
'rtos/uC-CPU/ARM-Cortex-M/ARMv7-M']
|
|
|
|
|
|
|
|
stm32f405_def = {'STM32F40_41xxx': ''}
|
|
|
|
|
2020-10-04 16:25:26 +00:00
|
|
|
##
|
2020-10-10 22:25:59 +00:00
|
|
|
## Platform specializations
|
2020-10-04 16:25:26 +00:00
|
|
|
##
|
|
|
|
|
2020-10-10 22:25:59 +00:00
|
|
|
## Linux
|
2020-10-31 08:17:42 +00:00
|
|
|
linux_src = src + ['platform/drivers/display/display_libSDL.c',
|
2020-10-30 21:58:15 +00:00
|
|
|
'platform/drivers/keyboard/keyboard_linux.c',
|
2020-10-23 08:29:34 +00:00
|
|
|
'platform/mcu/x86_64/drivers/gpio.c',
|
|
|
|
'platform/mcu/x86_64/drivers/delays.c',
|
|
|
|
'platform/targets/linux/platform.c',
|
2020-10-31 09:11:07 +00:00
|
|
|
'openrtx/src/graphics/graphics_rgb565.c',
|
2020-10-10 22:25:59 +00:00
|
|
|
'rtos/uC-OS3/Ports/POSIX/os_cpu_c.c',
|
|
|
|
'rtos/uC-CPU/Posix/cpu_c.c']
|
|
|
|
|
|
|
|
|
2020-10-31 09:11:07 +00:00
|
|
|
linux_def = def + {'SCREEN_WIDTH': '160', 'SCREEN_HEIGHT': '128', 'PIX_FMT_RGB565': ''}
|
2020-10-10 22:25:59 +00:00
|
|
|
|
|
|
|
linux_inc = inc + ['rtos/uC-OS3/Ports/POSIX',
|
2020-10-23 08:29:34 +00:00
|
|
|
'rtos/uC-CPU/Posix',
|
|
|
|
'platform/targets/linux']
|
2020-10-10 22:25:59 +00:00
|
|
|
|
|
|
|
if not meson.is_cross_build()
|
|
|
|
sdl_dep = dependency('SDL2')
|
|
|
|
threads_dep = dependency('threads')
|
|
|
|
linux_dep = [sdl_dep, threads_dep]
|
|
|
|
else
|
|
|
|
linux_dep = []
|
|
|
|
endif
|
|
|
|
|
|
|
|
## TYT MD380
|
2020-10-31 08:17:42 +00:00
|
|
|
md380_src = src + stm32f405_src + ['platform/drivers/display/HX83XX_MDxx380.c',
|
|
|
|
'platform/drivers/keyboard/keyboard_MDxx380.c',
|
|
|
|
'platform/targets/MD380/platform.c',
|
|
|
|
'platform/targets/MD380/adc1.c',
|
|
|
|
'openrtx/src/graphics/graphics_rgb565.c']
|
|
|
|
|
|
|
|
md380_def = def + stm32f405_def
|
|
|
|
|
|
|
|
md380_inc = inc + stm32f405_inc + ['platform/targets/MD380']
|
2020-10-04 16:25:26 +00:00
|
|
|
|
2020-10-25 10:54:16 +00:00
|
|
|
|
|
|
|
## TYT MD-UV380
|
2020-10-31 08:17:42 +00:00
|
|
|
mduv380_src = src + stm32f405_src + ['platform/drivers/display/HX83XX_MDxx380.c',
|
|
|
|
'platform/drivers/keyboard/keyboard_MDxx380.c',
|
|
|
|
'platform/targets/MD-UV380/platform.c',
|
|
|
|
'platform/targets/MD-UV380/adc1.c',
|
|
|
|
'openrtx/src/graphics/graphics_rgb565.c']
|
|
|
|
|
|
|
|
mduv380_def = def + stm32f405_def
|
|
|
|
|
|
|
|
mduv380_inc = inc + stm32f405_inc + ['platform/targets/MD-UV380']
|
2020-10-25 10:54:16 +00:00
|
|
|
|
2020-10-04 16:25:26 +00:00
|
|
|
##
|
2020-10-10 22:25:59 +00:00
|
|
|
## Compilation defines
|
2020-10-04 16:25:26 +00:00
|
|
|
##
|
|
|
|
linux_args = []
|
|
|
|
foreach k, v : linux_def
|
2020-10-10 22:25:59 +00:00
|
|
|
if v == ''
|
|
|
|
linux_args += '-D@0@'.format(k)
|
|
|
|
else
|
|
|
|
linux_args += '-D@0@=@1@'.format(k, v)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
md380_args = []
|
|
|
|
foreach k, v : md380_def
|
|
|
|
if v == ''
|
|
|
|
md380_args += '-D@0@'.format(k)
|
|
|
|
else
|
|
|
|
md380_args += '-D@0@=@1@'.format(k, v)
|
|
|
|
endif
|
2020-10-04 16:25:26 +00:00
|
|
|
endforeach
|
|
|
|
|
2020-10-25 10:54:16 +00:00
|
|
|
mduv380_args = []
|
|
|
|
foreach k, v : mduv380_def
|
|
|
|
if v == ''
|
|
|
|
mduv380_args += '-D@0@'.format(k)
|
|
|
|
else
|
|
|
|
mduv380_args += '-D@0@=@1@'.format(k, v)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2020-10-21 19:42:36 +00:00
|
|
|
linux_opts = {'sources': linux_src,
|
|
|
|
'c_args': linux_args,
|
|
|
|
'include_directories': linux_inc,
|
2020-10-23 08:29:34 +00:00
|
|
|
'dependencies': linux_dep,
|
|
|
|
'link_args' : '--entry=systemBootstrap'}
|
2020-10-10 22:25:59 +00:00
|
|
|
|
2020-10-21 19:42:36 +00:00
|
|
|
md380_opts = {'sources': md380_src,
|
|
|
|
'c_args': md380_args,
|
|
|
|
'include_directories': md380_inc}
|
2020-10-04 16:25:26 +00:00
|
|
|
|
2020-10-25 10:54:16 +00:00
|
|
|
|
|
|
|
mduv380_opts = {'sources': mduv380_src,
|
2020-10-31 08:17:42 +00:00
|
|
|
'c_args': mduv380_args,
|
|
|
|
'include_directories': mduv380_inc}
|
2020-10-25 10:54:16 +00:00
|
|
|
|
2020-10-04 16:25:26 +00:00
|
|
|
##
|
2020-10-21 19:42:36 +00:00
|
|
|
## Targets
|
2020-10-04 16:25:26 +00:00
|
|
|
##
|
2020-10-21 19:42:36 +00:00
|
|
|
targets = [
|
|
|
|
|
|
|
|
{'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',
|
2020-10-25 10:54:16 +00:00
|
|
|
'opts': mduv380_opts,
|
2020-10-21 19:42:36 +00:00
|
|
|
'flashable': true,
|
|
|
|
'wrap': 'UV3X0',
|
|
|
|
'load_addr': '0x0800C000'},
|
|
|
|
|
|
|
|
]
|
2020-10-19 13:02:18 +00:00
|
|
|
|
2020-10-22 19:55:54 +00:00
|
|
|
objcopy = find_program('objcopy', required:false, disabler:true)
|
|
|
|
radio_tool = find_program('radio_tool', required:false, disabler:true)
|
2020-10-19 13:02:18 +00:00
|
|
|
|
2020-10-21 19:42:36 +00:00
|
|
|
foreach t : targets
|
|
|
|
|
|
|
|
name = 'openrtx_'+t['name']
|
|
|
|
exe = executable(name, kwargs:t['opts'])
|
|
|
|
|
|
|
|
if t['flashable']
|
|
|
|
|
2020-10-22 19:55:54 +00:00
|
|
|
bin = custom_target(name+'_bin',
|
|
|
|
output : name+'_bin',
|
|
|
|
input : exe,
|
|
|
|
command : [objcopy, '-O', 'binary', '@INPUT@', '@OUTPUT@'])
|
|
|
|
|
|
|
|
wrap = custom_target(name+'_wrap',
|
|
|
|
output : name+'_wrap',
|
|
|
|
input : bin,
|
|
|
|
command : [radio_tool,
|
|
|
|
'--wrap',
|
|
|
|
'-o', '@OUTPUT@',
|
|
|
|
'-r', t['wrap'],
|
|
|
|
'-s', t['load_addr']+':@INPUT@'])
|
|
|
|
|
|
|
|
custom_target(name+'_flash',
|
|
|
|
input : wrap,
|
|
|
|
output : name+'_flash',
|
|
|
|
command : [radio_tool, '-d', '0', '-f', '-i', '@INPUT@'])
|
2020-10-21 19:42:36 +00:00
|
|
|
endif
|
|
|
|
endforeach
|