Very preliminary support for Module17, providing only the files and configurations essential for a minimal bootstrap of the OpenRTX firmware

pull/57/head
Silvano Seva 2021-09-19 22:26:35 +02:00
rodzic 036f74c69e
commit a0d9161e1d
7 zmienionych plików z 502 dodań i 3 usunięć

Wyświetl plik

@ -305,6 +305,16 @@ dm1801_src = src + gdx_src + mk22fn512_src + ['platform/targets/DM-1801/platform
dm1801_inc = inc + mk22fn512_inc + ['platform/targets/DM-1801']
dm1801_def = def + mk22fn512_def + {'PLATFORM_DM1801': ''}
##
## Module 17
##
mod17_src = src + stm32f405_src + ['platform/targets/Module17/platform.c',
'platform/drivers/baseband/radio_Mod17.cpp',
'platform/drivers/audio/audio_Mod17.c']
mod17_inc = inc + stm32f405_inc + ['platform/targets/Module17']
mod17_def = def + stm32f405_def + {'PLATFORM_MOD17': ''}
##
## -------------------------- Compilation arguments ----------------------------
##
@ -377,6 +387,15 @@ foreach k, v : md9600_def
endif
endforeach
mod17_args = []
foreach k, v : mod17_def
if v == ''
mod17_args += '-D@0@'.format(k)
else
mod17_args += '-D@0@=@1@'.format(k, v)
endif
endforeach
linux_opts = {'sources': linux_src,
'c_args': linux_c_args,
'cpp_args' : linux_cpp_args,
@ -387,7 +406,7 @@ linux_opts = {'sources': linux_src,
md3x0_opts = {'sources' : md3x0_src,
'c_args' : md3x0_args,
'cpp_args': md3x0_args,
'link_args' : ['-Wl,-T../platform/mcu/STM32F4xx/linker_script.ld',
'link_args' : ['-Wl,-T../platform/mcu/STM32F4xx/linker_script_MDx.ld',
'-Wl,--print-memory-usage'],
'dependencies': [codec2_dep],
'include_directories': md3x0_inc}
@ -395,7 +414,7 @@ md3x0_opts = {'sources' : md3x0_src,
mduv3x0_opts = {'sources': mduv3x0_src,
'c_args': mduv3x0_args,
'cpp_args': mduv3x0_args,
'link_args' : ['-Wl,-T../platform/mcu/STM32F4xx/linker_script.ld',
'link_args' : ['-Wl,-T../platform/mcu/STM32F4xx/linker_script_MDx.ld',
'-Wl,--print-memory-usage'],
'dependencies': [codec2_dep],
'include_directories': mduv3x0_inc}
@ -419,11 +438,18 @@ dm1801_opts = {'sources': dm1801_src,
md9600_opts = {'sources': md9600_src,
'c_args': md9600_args,
'cpp_args': md9600_args,
'link_args' : ['-Wl,-T../platform/mcu/STM32F4xx/linker_script.ld',
'link_args' : ['-Wl,-T../platform/mcu/STM32F4xx/linker_script_MDx.ld',
'-Wl,--print-memory-usage'],
'dependencies': [codec2_dep],
'include_directories': md9600_inc}
mod17_opts = {'sources': mod17_src,
'c_args': mod17_args,
'cpp_args': mod17_args,
'link_args' : ['-Wl,-T../platform/mcu/STM32F4xx/linker_script_Mod17.ld',
'-Wl,--print-memory-usage'],
'include_directories': mod17_inc}
##
## ---------------------------- Compilation targets ----------------------------
##
@ -463,6 +489,12 @@ targets = [
'flashable': true,
'wrap': 'MD9600',
'load_addr': '0x0800C000'},
{'name': 'mod17',
'opts': mod17_opts,
'flashable': true,
'wrap': ' ',
'load_addr': ' '},
]
radio_tool = find_program('radio_tool')

Wyświetl plik

@ -0,0 +1,54 @@
/***************************************************************************
* Copyright (C) 2021 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 <http://www.gnu.org/licenses/> *
***************************************************************************/
#include <interfaces/audio.h>
#include <interfaces/gpio.h>
#include <interfaces/delays.h>
#include <hwconfig.h>
void audio_init()
{
}
void audio_terminate()
{
}
void audio_enableMic()
{
}
void audio_disableMic()
{
}
void audio_enableAmp()
{
}
void audio_disableAmp()
{
}

Wyświetl plik

@ -0,0 +1,76 @@
/***************************************************************************
* Copyright (C) 2021 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 <http://www.gnu.org/licenses/> *
***************************************************************************/
#include <interfaces/platform.h>
#include <interfaces/radio.h>
void radio_init(const rtxStatus_t *rtxState)
{
(void) rtxState;
}
void radio_terminate()
{
}
void radio_tuneVcxo(const int16_t vhfOffset, const int16_t uhfOffset)
{
(void) vhfOffset;
(void) uhfOffset;
}
void radio_setOpmode(const enum opmode mode)
{
(void) mode;
}
bool radio_checkRxDigitalSquelch()
{
return false;
}
void radio_enableRx()
{
}
void radio_enableTx()
{
}
void radio_disableRtx()
{
}
void radio_updateConfiguration()
{
}
float radio_getRssi()
{
return -123.0f;
}
enum opstatus radio_getStatus()
{
return OFF;
}

Wyświetl plik

@ -0,0 +1,180 @@
/*
* C++ enabled linker script for stm32 (1M FLASH, 192K RAM)
* Developed by TFT: Terraneo Federico Technologies
* Optimized for use with the Miosix kernel
*/
/*
* This chip has an unusual quirk that the RAM is divided in two block mapped
* at two non contiguous memory addresses. I don't know why they've done that,
* probably doing the obvious thing would have made writing code too easy...
* Anyway, since hardware can't be changed, we've got to live with that and
* try to make use of both RAMs.
*
* Given the constraints above, this linker script puts:
* - read only data and code (.text, .rodata, .eh_*) in FLASH
* - the 512Byte main (IRQ) stack, .data and .bss in the "small" 64KB RAM
* - stacks and heap in the "large" 128KB RAM.
*
* Unfortunately thread stacks can't be put in the small RAM as Miosix
* allocates them inside the heap.
*/
/*
* The main stack is used for interrupt handling by the kernel.
*
* *** Readme ***
* This linker script places the main stack (used by the kernel for interrupts)
* at the bottom of the ram, instead of the top. This is done for two reasons:
*
* - as an optimization for microcontrollers with little ram memory. In fact
* the implementation of malloc from newlib requests memory to the OS in 4KB
* block (except the first block that can be smaller). This is probably done
* for compatibility with OSes with an MMU and paged memory. To see why this
* is bad, consider a microcontroller with 8KB of ram: when malloc finishes
* up the first 4KB it will call _sbrk_r asking for a 4KB block, but this will
* fail because the top part of the ram is used by the main stack. As a
* result, the top part of the memory will not be used by malloc, even if
* available (and it is nearly *half* the ram on an 8KB mcu). By placing the
* main stack at the bottom of the ram, the upper 4KB block will be entirely
* free and available as heap space.
*
* - In case of main stack overflow the cpu will fault because access to memory
* before the beginning of the ram faults. Instead with the default stack
* placement the main stack will silently collide with the heap.
* Note: if increasing the main stack size also increase the ORIGIN value in
* the MEMORY definitions below accordingly.
*/
_main_stack_size = 0x00000200; /* main stack = 512Bytes */
_main_stack_top = 0x10000000 + _main_stack_size;
ASSERT(_main_stack_size % 8 == 0, "MAIN stack size error");
/* Mapping the heap into the large 128KB RAM */
_end = 0x20000000;
_heap_end = 0x20020000; /* end of available ram */
/* identify the Entry Point */
ENTRY(_Z13Reset_Handlerv)
/* specify the memory areas */
MEMORY
{
flash(rx) : ORIGIN = 0x08000000, LENGTH = 1M
/*
* Note, the small ram starts at 0x10000000 but it is necessary to add the
* size of the main stack, so it is 0x10000200.
*/
smallram(wx) : ORIGIN = 0x10000200, LENGTH = 64K-0x200
largeram(wx) : ORIGIN = 0x20000000, LENGTH = 128K
}
/* now define the output sections */
SECTIONS
{
. = 0;
/* .text section: code goes to flash */
.text :
{
/* Startup code must go at address 0 */
KEEP(*(.isr_vector))
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
/* these sections for thumb interwork? */
*(.glue_7)
*(.glue_7t)
/* these sections for C++? */
*(.gcc_except_table)
*(.gcc_except_table.*)
*(.ARM.extab*)
*(.gnu.linkonce.armextab.*)
. = ALIGN(4);
/* .rodata: constant data */
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r.*)
/* C++ Static constructors/destructors (eabi) */
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__miosix_init_array_start = .;
KEEP (*(SORT(.miosix_init_array.*)))
KEEP (*(.miosix_init_array))
__miosix_init_array_end = .;
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
. = ALIGN(4);
KEEP(*(.fini))
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
/* C++ Static constructors/destructors (elf) */
. = ALIGN(4);
_ctor_start = .;
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
_ctor_end = .;
. = ALIGN(4);
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
} > flash
/* .ARM.exidx is sorted, so has to go in its own output section. */
__exidx_start = .;
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > flash
__exidx_end = .;
/* .data section: global variables go to ram, but also store a copy to
flash to initialize them */
.data : ALIGN(8)
{
_data = .;
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
. = ALIGN(8);
_edata = .;
} > smallram AT > flash
_etext = LOADADDR(.data);
/* .bss section: uninitialized global variables go to ram */
_bss_start = .;
.bss :
{
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
. = ALIGN(8);
} > smallram
_bss_end = .;
/*_end = .;*/
/*PROVIDE(end = .);*/
}

Wyświetl plik

@ -0,0 +1,44 @@
/***************************************************************************
* Copyright (C) 2021 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 <http://www.gnu.org/licenses/> *
***************************************************************************/
#ifndef HWCONFIG_H
#define HWCONFIG_H
#include <stm32f4xx.h>
/* Device has a working real time clock */
#define HAS_RTC
/* Screen dimensions */
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
/* Screen pixel format */
#define PIX_FMT_BW
/* Device has no battery */
#define BAT_NONE
/* Signalling LEDs */
#define PTT_LED GPIOE,13
#define SYNC_LED GPIOE,14
#define ERR_LED GPIOE,15
#endif

Wyświetl plik

@ -0,0 +1,113 @@
/***************************************************************************
* Copyright (C) 2021 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 <http://www.gnu.org/licenses/> *
***************************************************************************/
#include <interfaces/gpio.h>
#include <interfaces/nvmem.h>
#include <interfaces/platform.h>
#include <hwconfig.h>
#include <string.h>
#include <ADC1_MDx.h>
#include <backlight.h>
#include <calibInfo_MDx.h>
#include <toneGenerator_MDx.h>
#include <interfaces/rtc.h>
#include <interfaces/audio.h>
void platform_init()
{
/* Configure GPIOs */
gpio_setMode(PTT_LED, OUTPUT);
gpio_setMode(SYNC_LED, OUTPUT);
gpio_setMode(ERR_LED, OUTPUT);
}
void platform_terminate()
{
/* Shut down LEDs */
gpio_clearPin(PTT_LED);
gpio_clearPin(SYNC_LED);
gpio_clearPin(ERR_LED);
}
uint16_t platform_getVbat()
{
return 0;
}
uint8_t platform_getMicLevel()
{
return 0;
}
uint8_t platform_getVolumeLevel()
{
return 0;
}
int8_t platform_getChSelector()
{
return 0;
}
bool platform_getPttStatus()
{
return false;
}
bool platform_pwrButtonStatus()
{
return false;
}
void platform_ledOn(led_t led)
{
(void) led;
}
void platform_ledOff(led_t led)
{
(void) led;
}
void platform_beepStart(uint16_t freq)
{
/* TODO */
(void) freq;
}
void platform_beepStop()
{
/* TODO */
}
const void *platform_getCalibrationData()
{
return NULL;
}
const hwInfo_t *platform_getHwInfo()
{
return NULL;
}
void platform_setBacklightLevel(uint8_t level)
{
(void) level;
}