mirror of https://github.com/g4klx/MMDVM.git
Merge remote-tracking branch 'g4klx/master'
This commit is contained in:
commit
ee1d512132
80
IOSTM.cpp
80
IOSTM.cpp
|
@ -164,6 +164,76 @@ EXT_CLK PA15 input
|
|||
#define PIN_TX GPIO_Pin_4
|
||||
#define PIN_TX_CH DAC_Channel_1
|
||||
|
||||
#elif defined(STM32F722_PI)
|
||||
/*
|
||||
Pin definitions for STM32F722 Pi Board:
|
||||
|
||||
PTT PB13 output
|
||||
COSLED PB14 output
|
||||
LED PB15 output
|
||||
COS PC0 input
|
||||
|
||||
DSTAR PC7 output
|
||||
DMR PC8 output
|
||||
YSF PA8 output
|
||||
P25 PC9 output
|
||||
|
||||
RX PA0 analog input
|
||||
RSSI PA7 analog input
|
||||
TX PA4 analog output
|
||||
|
||||
EXT_CLK PA15 input
|
||||
*/
|
||||
|
||||
#define PIN_COS GPIO_Pin_0
|
||||
#define PORT_COS GPIOC
|
||||
#define RCC_Per_COS RCC_AHB1Periph_GPIOC
|
||||
|
||||
#define PIN_PTT GPIO_Pin_13
|
||||
#define PORT_PTT GPIOB
|
||||
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||
|
||||
#define PIN_COSLED GPIO_Pin_14
|
||||
#define PORT_COSLED GPIOB
|
||||
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||
|
||||
#define PIN_LED GPIO_Pin_15
|
||||
#define PORT_LED GPIOB
|
||||
#define RCC_Per_LED RCC_AHB1Periph_GPIOB
|
||||
|
||||
#define PIN_P25 GPIO_Pin_9
|
||||
#define PORT_P25 GPIOC
|
||||
#define RCC_Per_P25 RCC_AHB1Periph_GPIOC
|
||||
|
||||
#define PIN_DSTAR GPIO_Pin_7
|
||||
#define PORT_DSTAR GPIOC
|
||||
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
||||
|
||||
#define PIN_DMR GPIO_Pin_8
|
||||
#define PORT_DMR GPIOC
|
||||
#define RCC_Per_DMR RCC_AHB1Periph_GPIOC
|
||||
|
||||
#define PIN_YSF GPIO_Pin_8
|
||||
#define PORT_YSF GPIOA
|
||||
#define RCC_Per_YSF RCC_AHB1Periph_GPIOA
|
||||
|
||||
#define PIN_EXT_CLK GPIO_Pin_15
|
||||
#define SRC_EXT_CLK GPIO_PinSource15
|
||||
#define PORT_EXT_CLK GPIOA
|
||||
|
||||
#define PIN_RX GPIO_Pin_0
|
||||
#define PIN_RX_CH ADC_Channel_0
|
||||
#define PORT_RX GPIOA
|
||||
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||
|
||||
#define PIN_RSSI GPIO_Pin_7
|
||||
#define PIN_RSSI_CH ADC_Channel_7
|
||||
#define PORT_RSSI GPIOA
|
||||
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
||||
|
||||
#define PIN_TX GPIO_Pin_4
|
||||
#define PIN_TX_CH DAC_Channel_1
|
||||
|
||||
#elif defined(STM32F4_F4M)
|
||||
/*
|
||||
Pin definitions for MMDVM-F4M Pi-Hat F0DEI board:
|
||||
|
@ -497,7 +567,7 @@ EXT_CLK PA15 input CN11 Pin17
|
|||
#define PIN_TX_CH DAC_Channel_1
|
||||
|
||||
#else
|
||||
#error "Either STM32F4_DISCOVERY, STM32F4_PI, STM32F4_F4M, STM32F4_NUCLEO or STM32F7_NUCLEO need to be defined"
|
||||
#error "Either STM32F4_DISCOVERY, STM32F4_PI, STM32F722_PI, STM32F4_F4M, STM32F4_NUCLEO or STM32F7_NUCLEO need to be defined"
|
||||
#endif
|
||||
|
||||
const uint16_t DC_OFFSET = 2048U;
|
||||
|
@ -698,7 +768,7 @@ void CIO::startInt()
|
|||
// Init the timer
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
|
||||
|
||||
#if defined(EXTERNAL_OSC) && !defined(STM32F4_PI)
|
||||
#if defined(EXTERNAL_OSC) && !(defined(STM32F4_PI) || defined(STM32F722_PI))
|
||||
// Configure a GPIO as external TIM2 clock source
|
||||
GPIO_PinAFConfig(PORT_EXT_CLK, SRC_EXT_CLK, GPIO_AF_TIM2);
|
||||
GPIO_InitStruct.GPIO_Pin = PIN_EXT_CLK;
|
||||
|
@ -710,7 +780,7 @@ void CIO::startInt()
|
|||
TIM_TimeBaseStructInit (&timerInitStructure);
|
||||
|
||||
// TIM2 output frequency
|
||||
#if defined(EXTERNAL_OSC) && !defined(STM32F4_PI)
|
||||
#if defined(EXTERNAL_OSC) && !(defined(STM32F4_PI) || defined(STM32F722_PI))
|
||||
timerInitStructure.TIM_Prescaler = (uint16_t) ((EXTERNAL_OSC/(2*SAMP_FREQ)) - 1);
|
||||
timerInitStructure.TIM_Period = 1;
|
||||
#else
|
||||
|
@ -723,7 +793,7 @@ void CIO::startInt()
|
|||
timerInitStructure.TIM_RepetitionCounter = 0;
|
||||
TIM_TimeBaseInit(TIM2, &timerInitStructure);
|
||||
|
||||
#if defined(EXTERNAL_OSC) && !defined(STM32F4_PI)
|
||||
#if defined(EXTERNAL_OSC) && !(defined(STM32F4_PI) || defined(STM32F722_PI))
|
||||
// Enable external clock
|
||||
TIM_ETRClockMode2Config(TIM2, TIM_ExtTRGPSC_OFF, TIM_ExtTRGPolarity_NonInverted, 0x00);
|
||||
#else
|
||||
|
@ -839,7 +909,7 @@ void CIO::setP25Int(bool on)
|
|||
// Example from: http://thehackerworkshop.com/?p=1209
|
||||
void CIO::delayInt(unsigned int dly)
|
||||
{
|
||||
#if defined(STM32F7_NUCLEO)
|
||||
#if defined(STM32F7XX)
|
||||
unsigned int loopsPerMillisecond = (SystemCoreClock/1000);
|
||||
#else
|
||||
unsigned int loopsPerMillisecond = (SystemCoreClock/1000) / 3;
|
||||
|
|
30
Makefile
30
Makefile
|
@ -91,6 +91,8 @@ endif
|
|||
ifndef $(OSC)
|
||||
ifeq ($(MAKECMDGOALS),pi)
|
||||
OSC=$(CLK_MMDVM_PI)
|
||||
else ifeq ($(MAKECMDGOALS),pi-f722)
|
||||
OSC=$(CLK_MMDVM_PI)
|
||||
else
|
||||
OSC=$(CLK_NUCLEO)
|
||||
endif
|
||||
|
@ -122,6 +124,8 @@ DEFS_F4M=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_F4M -DHSE_VA
|
|||
DEFS_NUCLEO=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_NUCLEO -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||
# STM32F7 Nucleo-144 F767ZI board:
|
||||
DEFS_NUCLEO_F767=-DUSE_HAL_DRIVER -DSTM32F767xx -DSTM32F7XX -DSTM32F7_NUCLEO -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||
# MMDVM-Pi F722 board:
|
||||
DEFS_PI_F722=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_PI -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||
|
||||
# Build compiler flags
|
||||
CFLAGS_F4=-c $(MCFLAGS_F4) $(INCLUDES_F4)
|
||||
|
@ -131,7 +135,8 @@ CXXFLAGS_F7=-c $(MCFLAGS_F7) $(INCLUDES_F7)
|
|||
|
||||
# Linker flags
|
||||
LDFLAGS_F4 =-T stm32f4xx_link.ld $(MCFLAGS_F4) --specs=nosys.specs $(INCLUDES_LIBS_F4)
|
||||
LDFLAGS_F7 =-T stm32f7xx_link.ld $(MCFLAGS_F7) --specs=nosys.specs $(INCLUDES_LIBS_F7)
|
||||
LDFLAGS_F767 =-T stm32f767_link.ld $(MCFLAGS_F7) --specs=nosys.specs $(INCLUDES_LIBS_F7)
|
||||
LDFLAGS_F722 =-T stm32f722_link.ld $(MCFLAGS_F7) --specs=nosys.specs $(INCLUDES_LIBS_F7)
|
||||
|
||||
# Common flags
|
||||
CFLAGS=-Os -ffunction-sections -fdata-sections -fno-builtin -Wno-implicit -DCUSTOM_NEW -DNO_EXCEPTIONS
|
||||
|
@ -139,7 +144,7 @@ CXXFLAGS=-Os -fno-exceptions -ffunction-sections -fdata-sections -fno-builtin -f
|
|||
LDFLAGS=-Os --specs=nano.specs
|
||||
|
||||
# Build Rules
|
||||
.PHONY: all release dis pi f4m nucleo f767 clean
|
||||
.PHONY: all release dis pi pi_f722 f4m nucleo f767 clean
|
||||
|
||||
# Default target: Nucleo-64 F446RE board
|
||||
all: nucleo
|
||||
|
@ -150,6 +155,12 @@ pi: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_PI)
|
|||
pi: LDFLAGS+=$(LDFLAGS_F4)
|
||||
pi: release_f4
|
||||
|
||||
pi-f722: GitVersion.h
|
||||
pi-f722: CFLAGS+=$(CFLAGS_F7) $(DEFS_PI_F722)
|
||||
pi-f722: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_PI_F722)
|
||||
pi-f722: LDFLAGS+=$(LDFLAGS_F722)
|
||||
pi-f722: release_f7
|
||||
|
||||
f4m: GitVersion.h
|
||||
f4m: CFLAGS+=$(CFLAGS_F4) $(DEFS_F4M)
|
||||
f4m: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_F4M)
|
||||
|
@ -171,7 +182,7 @@ dis: release_f4
|
|||
f767: GitVersion.h
|
||||
f767: CFLAGS+=$(CFLAGS_F7) $(DEFS_NUCLEO_F767)
|
||||
f767: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_NUCLEO_F767)
|
||||
f767: LDFLAGS+=$(LDFLAGS_F7)
|
||||
f767: LDFLAGS+=$(LDFLAGS_F767)
|
||||
f767: release_f7
|
||||
|
||||
release_f4: $(BINDIR)
|
||||
|
@ -295,6 +306,19 @@ endif
|
|||
|
||||
deploy-f4m: deploy-pi
|
||||
|
||||
deploy-pi-f7:
|
||||
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
||||
-/usr/local/bin/stm32flash -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||
-/usr/local/bin/stm32ld /dev/ttyAMA0 57600 bin/$(BINBIN_F7)
|
||||
/usr/local/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R -c /dev/ttyAMA0
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard /usr/bin/stm32flash),)
|
||||
-/usr/bin/stm32flash -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||
-/usr/bin/stm32ld /dev/ttyAMA0 57600 bin/$(BINBIN_F7)
|
||||
/usr/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R -c /dev/ttyAMA0
|
||||
endif
|
||||
|
||||
# Export the current git version if the index file exists, else 000...
|
||||
GitVersion.h:
|
||||
ifdef SYSTEMROOT
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
Pin definitions:
|
||||
|
||||
- Host communication:
|
||||
USART1 - TXD PA9 - RXD PA10 (MMDVM-Pi board, MMDVM-F4M board)
|
||||
USART1 - TXD PA9 - RXD PA10 (MMDVM-Pi board, MMDVM-Pi F722 board, MMDVM-F4M board)
|
||||
USART2 - TXD PA2 - RXD PA3 (Nucleo64 F446RE board, Morpho or Arduino header)
|
||||
USART3 - TXD PC10 - RXD PC11 (Discovery board)
|
||||
USART3 - TXD PD8 - RXD PD9 (Nucleo144 F767ZI board)
|
||||
|
||||
- Serial repeater:
|
||||
USART1 - TXD PA9 - RXD PA10 (Nucleo with Arduino header)
|
||||
UART5 - TXD PC12 - RXD PD2 (Discovery, MMDVM-Pi, MMDVM-F4M board, Nucleo64 with Morpho header and Nucleo144 F767ZI)
|
||||
UART5 - TXD PC12 - RXD PD2 (Discovery, MMDVM-Pi, MMDVM-Pi F722 board, MMDVM-F4M board, Nucleo64 with Morpho header and Nucleo144 F767ZI)
|
||||
*/
|
||||
|
||||
#if defined(STM32F4XX) || defined(STM32F7XX)
|
||||
|
@ -50,7 +50,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
/* ************* USART1 ***************** */
|
||||
#if defined(STM32F4_PI) || defined(STM32F4_F4M) || (defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER))
|
||||
#if defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || (defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER))
|
||||
|
||||
volatile uint8_t TXSerialfifo1[TX_SERIAL_FIFO_SIZE];
|
||||
volatile uint8_t RXSerialfifo1[RX_SERIAL_FIFO_SIZE];
|
||||
|
@ -841,7 +841,7 @@ void CSerialPort::beginInt(uint8_t n, int speed)
|
|||
case 1U:
|
||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||
InitUSART3(speed);
|
||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M)
|
||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI)
|
||||
InitUSART1(speed);
|
||||
#elif defined(STM32F4_NUCLEO)
|
||||
InitUSART2(speed);
|
||||
|
@ -865,7 +865,7 @@ int CSerialPort::availableInt(uint8_t n)
|
|||
case 1U:
|
||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||
return AvailUSART3();
|
||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M)
|
||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI)
|
||||
return AvailUSART1();
|
||||
#elif defined(STM32F4_NUCLEO)
|
||||
return AvailUSART2();
|
||||
|
@ -887,7 +887,7 @@ int CSerialPort::availableForWriteInt(uint8_t n)
|
|||
case 1U:
|
||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||
return AvailForWriteUSART3();
|
||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M)
|
||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI)
|
||||
return AvailForWriteUSART1();
|
||||
#elif defined(STM32F4_NUCLEO)
|
||||
return AvailForWriteUSART2();
|
||||
|
@ -909,7 +909,7 @@ uint8_t CSerialPort::readInt(uint8_t n)
|
|||
case 1U:
|
||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||
return ReadUSART3();
|
||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M)
|
||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI)
|
||||
return ReadUSART1();
|
||||
#elif defined(STM32F4_NUCLEO)
|
||||
return ReadUSART2();
|
||||
|
@ -933,7 +933,7 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool
|
|||
WriteUSART3(data, length);
|
||||
if (flush)
|
||||
TXSerialFlush3();
|
||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M)
|
||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI)
|
||||
WriteUSART1(data, length);
|
||||
if (flush)
|
||||
TXSerialFlush1();
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* Required amount of heap and stack */
|
||||
_min_heap_size = 0x1000;
|
||||
_min_stack_size = 0x0800;
|
||||
|
||||
/* The entry point in the interrupt vector table */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Memory areas */
|
||||
MEMORY
|
||||
{
|
||||
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* FLASH */
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K /* Main RAM */
|
||||
}
|
||||
|
||||
/* Stack start address (end of 256K RAM) */
|
||||
_estack = ORIGIN(RAM) + LENGTH(RAM);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
/* The interrupt vector table */
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector .isr_vector.*))
|
||||
|
||||
/* The program code */
|
||||
. = ALIGN(4);
|
||||
*(.text .text*)
|
||||
*(.rodata .rodata*)
|
||||
|
||||
/* ARM-Thumb code */
|
||||
*(.glue_7) *(.glue_7t)
|
||||
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* EABI C++ global constructors support */
|
||||
. = ALIGN(4);
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
|
||||
/* EABI C++ global constructors support */
|
||||
. = ALIGN(4);
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
__init_array_end = .;
|
||||
|
||||
/* EABI C++ global constructors support */
|
||||
. = ALIGN(4);
|
||||
__fini_array_start = .;
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
|
||||
} > ROM
|
||||
|
||||
/* ARM sections containing exception unwinding information */
|
||||
.ARM.extab : {
|
||||
__extab_start = .;
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
__extab_end = .;
|
||||
} > ROM
|
||||
|
||||
/* ARM index entries for section unwinding */
|
||||
.ARM.exidx : {
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
} > ROM
|
||||
|
||||
/* Start address for the initialization values of the .data section */
|
||||
_sidata = .;
|
||||
|
||||
/* The .data section (initialized data) */
|
||||
.data : AT ( _sidata )
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = . ; /* Start address for the .data section */
|
||||
*(.data .data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
_edata = . ; /* End address for the .data section */
|
||||
} > RAM
|
||||
|
||||
/* The .bss section (uninitialized data) */
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sbss = .; /* Start address for the .bss section */
|
||||
__bss_start__ = _sbss;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(4);
|
||||
_ebss = . ; /* End address for the .bss section */
|
||||
__bss_end__ = _ebss;
|
||||
} > RAM
|
||||
|
||||
/* Space for heap and stack */
|
||||
.heap_stack :
|
||||
{
|
||||
end = . ; /* 'end' symbol defines heap location */
|
||||
_end = end ;
|
||||
. = . + _min_heap_size; /* Additional space for heap and stack */
|
||||
. = . + _min_stack_size;
|
||||
} > RAM
|
||||
|
||||
/* Remove information from the standard libraries */
|
||||
/DISCARD/ :
|
||||
{
|
||||
libc.a ( * )
|
||||
libm.a ( * )
|
||||
libgcc.a ( * )
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue