From 8163eba67bfd7c3f051069227dfd1743b36834fb Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Fri, 1 Jan 2021 18:32:05 +0100 Subject: [PATCH] Add MD-9600 support, boot and USB serial working --- meson.build | 28 +++++++++++++++ openrtx/src/battery.c | 3 ++ platform/targets/MD-9600/hwconfig.h | 46 ++++++++++++++++++++++++ platform/targets/MD-9600/platform.c | 55 +++++++++++++++++++++++++++++ tests/platform/hello_world.c | 37 +++++++++++++++++++ 5 files changed, 169 insertions(+) create mode 100644 platform/targets/MD-9600/hwconfig.h create mode 100644 platform/targets/MD-9600/platform.c create mode 100644 tests/platform/hello_world.c diff --git a/meson.build b/meson.build index 88448b40..43a4fa30 100644 --- a/meson.build +++ b/meson.build @@ -245,6 +245,13 @@ dm1801_inc = inc + mk22fn512_inc + ['platform/targets/DM-1801'] dm1801_def = def + mk22fn512_def + {'PLATFORM_DM1801': ''} +## TYT MD-9600 +md9600_src = src + stm32f405_src + ['platform/targets/MD-9600/platform.c'] + +md9600_inc = inc + stm32f405_inc + ['platform/targets/MD-9600'] +md9600_def = def + stm32f405_def + {'PLATFORM_MDUV380': ''} + + ## ## Compilation defines ## @@ -310,6 +317,15 @@ foreach k, v : dm1801_def endif endforeach +md9600_args = [] +foreach k, v : md9600_def + if v == '' + md9600_args += '-D@0@'.format(k) + else + md9600_args += '-D@0@=@1@'.format(k, v) + endif +endforeach + linux_opts = {'sources': linux_src, 'c_args': linux_c_args, 'include_directories': linux_inc, @@ -346,6 +362,12 @@ dm1801_opts = {'sources': dm1801_src, '-Wl,--print-memory-usage'], 'include_directories':dm1801_inc} +md9600_opts = {'sources': md9600_src, + 'c_args': md9600_args, + 'link_args' : ['-Wl,-T../platform/mcu/STM32F4xx/linker_script.ld', + '-Wl,--print-memory-usage'], + 'include_directories': md9600_inc} + ## ## Targets ## @@ -384,6 +406,12 @@ targets = [ 'flashable': true, 'wrap': 'UV3X0', 'load_addr': '0x0800C000'}, + + {'name': 'md9600', + 'opts': md9600_opts, + 'flashable': true, + 'wrap': 'MD9600', + 'load_addr': '0x0800C000'}, ] objcopy = find_program('objcopy', required:false, disabler:true) diff --git a/openrtx/src/battery.c b/openrtx/src/battery.c index 8cbf5a73..88447b10 100644 --- a/openrtx/src/battery.c +++ b/openrtx/src/battery.c @@ -35,6 +35,9 @@ float bat_v_max = 8.30f; #elif defined BAT_LIPO_3S float bat_v_min = 10.83; float bat_v_max = 12.45; +#elif defined BAT_NONE +float bat_v_min = 0.0; +float bat_v_max = 0.0; #else #error Please define a battery type into platform/targets/.../hwconfig.h #endif diff --git a/platform/targets/MD-9600/hwconfig.h b/platform/targets/MD-9600/hwconfig.h new file mode 100644 index 00000000..2015ea46 --- /dev/null +++ b/platform/targets/MD-9600/hwconfig.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN, * + * Frederik Saraci IU2NRO, * + * Silvano Seva IU2KWO * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, see * + ***************************************************************************/ + +#ifndef HWCONFIG_H +#define HWCONFIG_H + +#include + +/* Supported radio bands */ +#define BAND_VHF +#define BAND_UHF + +/* Band limits in Hz */ +#define FREQ_LIMIT_VHF_LO 136000000 +#define FREQ_LIMIT_VHF_HI 174000000 +#define FREQ_LIMIT_UHF_LO 400000000 +#define FREQ_LIMIT_UHF_HI 480000000 + +/* Screen dimensions */ +#define SCREEN_WIDTH 128 +#define SCREEN_HEIGHT 64 + +/* Screen pixel format */ +#define PIX_FMT_BW + +/* Battery type */ +#define BAT_NONE + +#endif diff --git a/platform/targets/MD-9600/platform.c b/platform/targets/MD-9600/platform.c new file mode 100644 index 00000000..c4928b52 --- /dev/null +++ b/platform/targets/MD-9600/platform.c @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN, * + * Frederik Saraci IU2NRO, * + * Silvano Seva IU2KWO * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, see * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include + +void platform_init() +{ +} + +void platform_terminate() +{ +} + +float platform_getMicLevel() +{ + return 0.0f; +} + +float platform_getVolumeLevel() +{ + return 0.0f; +} + +void platform_beepStart(uint16_t freq) +{ + /* TODO */ + (void) freq; +} + +void platform_beepStop() +{ + /* TODO */ +} diff --git a/tests/platform/hello_world.c b/tests/platform/hello_world.c new file mode 100644 index 00000000..da6e7b86 --- /dev/null +++ b/tests/platform/hello_world.c @@ -0,0 +1,37 @@ +/*************************************************************************** + * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN, * + * Frederik Saraci IU2NRO, * + * Silvano Seva IU2KWO * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, see * + ***************************************************************************/ + +#include +#include +#include + +int main() +{ + platform_init(); + + while(1) + { + OS_ERR err; + printf("Hello world\n"); + OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &err); + } + + return 0; +}