Merge remote-tracking branch 'origin/master'

df8oe-master
df8oe 2017-06-06 08:23:59 +02:00
commit 0c3a4d5b72
7 zmienionych plików z 215 dodań i 23 usunięć

58
CMakeLists.txt 100644
Wyświetl plik

@ -0,0 +1,58 @@
cmake_minimum_required(VERSION 3.6)
include(CMakeForceCompiler)
SET(CMAKE_SYSTEM_NAME "Generic")
SET(CMAKE_SYSTEM_VERSION 1)
set(TOOLCHAIN_DIR D:/Programy/arm_gcc/bin/)
CMAKE_FORCE_C_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-gcc.exe GNU)
CMAKE_FORCE_CXX_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-g++.exe GNU)
project(STM32_RTTY C ASM CXX)
add_definitions(-DSTM32F100C8)
add_definitions(-DSTM32F10X_MD_VL)
add_definitions(-DUSE_STDPERIPH_DRIVER)
add_definitions(-D__ASSEMBLY__)
SET(LINKER_SCRIPT ${PROJECT_SOURCE_DIR}/arm-gcc-link.ld)
SET(COMMON_FLAGS " -mcpu=cortex-m3 -mthumb -Wall -ffunction-sections -g -O3 -g -nostartfiles ")
SET(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=c++11")
SET(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-Map=${CMAKE_BINARY_DIR}/${PROJECT_NAME}.map -O3 -Wl,--gc-sections -T ${LINKER_SCRIPT}")
file(GLOB_RECURSE USER_SOURCES "*.c")
file(GLOB_RECURSE USER_SOURCES_CXX "*.cpp")
file(GLOB_RECURSE USER_HEADERS "*.h")
#file(GLOB_RECURSE HAL_SOURCES "stm_lib/src/*.c")
#add_library(CMSIS
# cmsis_boot/system_stm32f10x.c
# cmsis_boot/startup/startup_stm32f10x_md_vl.c)
include_directories(cmsis
cmsis_boot
stm_lib/inc
.)
add_executable(${PROJECT_NAME}.elf ${USER_SOURCES} ${USER_SOURCES_CXX} ${USER_HEADERS} ${HAL_SOURCES} ${LINKER_SCRIPT})
#target_link_libraries(${PROJECT_NAME}.elf CMSIS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Map=${CMAKE_BINARY_DIR}/${PROJECT_NAME}.map")
set(HEX_FILE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.hex)
set(BIN_FILE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.bin)
add_custom_command(TARGET ${PROJECT_NAME}.elf POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${PROJECT_NAME}.elf> ${HEX_FILE}
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${PROJECT_NAME}.elf> ${BIN_FILE}
COMMENT "Building ${HEX_FILE} \nBuilding ${BIN_FILE}")
set(CMAKE_CXX_STANDARD 11)
add_custom_target(program
DEPENDS ${PROJECT_NAME}.elf
COMMAND D:/Programy/stlink-1.3.0-win64/bin/st-flash --reset write ${BIN_FILE} 0x08000000
COMMENT "flashing ${BIN_FILE}")

Wyświetl plik

@ -65,6 +65,7 @@ uint8_t QAPRSBase::canTransmit(){
*/
void QAPRSBase::ax25SendHeaderBegin() {
this->enableTransmission();
timerInterruptHandler();
this->ax25CRC = 0xFFFF;
this->currentTone = QAPRSMark;
//this->currentTone = QAPRSSpace;
@ -155,20 +156,7 @@ void QAPRSBase::ax25CalcCRC(uint8_t ls_bit) {
*/
inline void QAPRSBase::toggleTone() {
this->currentTone = (this->currentTone == QAPRSSpace) ? QAPRSMark : QAPRSSpace;
TIM2->CR1 &= (uint16_t)(~((uint16_t)TIM_CR1_CEN));
uint16_t used = TIM2->CNT;
this->timer1StartValue = (this->currentTone == QAPRSMark) ? MarkTimerValue : SpaceTimerValue;
if (used >= this->timer1StartValue){
this->timerInterruptHandler();
} else {
TIM2->ARR = this->timer1StartValue - used;
TIM2->CNT = 0;
}
TIM2->CR1 |= TIM_CR1_CEN;
}
/**
@ -216,6 +204,7 @@ void QAPRSBase::enableTransmission() {
#endif
radio_set_tx_frequency(APRS_FREQUENCY);
radio_rw_register(0x72, 5, 1);
GPIO_SetBits(GPIOC, radioNSELpin);
radio_rw_register(0x71, 0b00010010, 1);
spi_deinit();

Wyświetl plik

@ -58,7 +58,7 @@ private:
/**
* @brief ilosć bajtów synchronizacyjnych do nadania przed zawartoscią pakietu
*/
static const uint8_t ax25HeaderFlagFieldCount1200 = 45;
static const uint8_t ax25HeaderFlagFieldCount1200 = 25;
/**
* @brief ilosć bajtów synchronizacyjnych do nadania przed zawartoscią pakietu
*/
@ -82,7 +82,7 @@ private:
#elif F_CPU == 8000000UL
static const uint16_t toneSendTime1200 = 785;
#else
static const uint16_t toneSendTime1200 = 717;
//static const uint16_t toneSendTime1200 = 1000000/1200;
#endif
/**
* @brief Czas wysyłania podedynczego tonu. W ms.
@ -182,8 +182,10 @@ public:
private:
static const uint16_t toneSendTime = 833;
static const uint16_t MarkTimerValue = (uint16_t) ((1000000 / ((1245)*2)) - 1);
static const uint16_t SpaceTimerValue = (uint16_t) ((1000000 / ((2750)*2)) - 1);
static const uint16_t toneSendTime1200 = 795;
static const uint16_t MarkTimerValue = 393;
static const uint16_t SpaceTimerValue = 202;
void togglePin();
uint8_t pin;
public:

Wyświetl plik

@ -8,7 +8,9 @@
#include "ublox.h"
#include "config.h"
#if !defined(__OPTIMIZE__)
#error "APRS Works only when optimization enabled at level at least -O2"
#endif
QAPRSBase qaprs;
void aprs_init(){
@ -39,6 +41,14 @@ void calcDMH(long x, int8_t* degrees, uint8_t* minutes, uint8_t* h_minutes) {
}
}
void aprs_test(){
char packet_buffer[128];
sprintf(packet_buffer,
(":TEST1234567890")
);
qaprs.sendData(packet_buffer);
}
void aprs_send_position(GPSEntry gpsData, int8_t temperature, uint16_t voltage) {
char packet_buffer[128];
int8_t la_degrees, lo_degrees;

1
aprs.h
Wyświetl plik

@ -17,6 +17,7 @@ extern "C" {
uint8_t aprs_is_active();
void aprs_send_position(GPSEntry gpsData, int8_t temperature, uint16_t voltage);
void aprs_change_tone_time(uint16_t x);
void aprs_test();
#ifdef __cplusplus
};
#endif

132
arm-gcc-link.ld 100644
Wyświetl plik

@ -0,0 +1,132 @@
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
/* Internal Memory Map*/
MEMORY
{
rom (rx) : ORIGIN = 0x08000000, LENGTH = 0x00010000
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000
}
_eram = 0x20000000 + 0x00002000;
SECTIONS
{
.text :
{
KEEP(*(.isr_vector))
*(.text*)
KEEP(*(.init))
KEEP(*(.fini))
/* .ctors */
*crtbegin.o(.ctors)
*crtbegin?.o(.ctors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
*(SORT(.ctors.*))
*(.ctors)
/* .dtors */
*crtbegin.o(.dtors)
*crtbegin?.o(.dtors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
*(SORT(.dtors.*))
*(.dtors)
*(.rodata*)
KEEP(*(.eh_fram e*))
} > rom
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > rom
__exidx_start = .;
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > rom
__exidx_end = .;
__etext = .;
/* _sidata is used in coide startup code */
_sidata = __etext;
.data : AT (__etext)
{
__data_start__ = .;
/* _sdata is used in coide startup code */
_sdata = __data_start__;
*(vtable)
*(.data*)
. = ALIGN(4);
/* preinit data */
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP(*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(4);
/* init data */
PROVIDE_HIDDEN (__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
/* finit data */
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP(*(SORT(.fini_array.*)))
KEEP(*(.fini_array))
PROVIDE_HIDDEN (__fini_array_end = .);
KEEP(*(.jcr*))
. = ALIGN(4);
/* All data end */
__data_end__ = .;
/* _edata is used in coide startup code */
_edata = __data_end__;
} > ram
.bss :
{
. = ALIGN(4);
__bss_start__ = .;
_sbss = __bss_start__;
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
_ebss = __bss_end__;
} > ram
.heap (COPY):
{
__end__ = .;
_end = __end__;
end = __end__;
*(.heap*)
__HeapLimit = .;
} > ram
/* .stack_dummy section doesn't contains any symbols. It is only
* used for linker to calculate size of stack sections, and assign
* values to stack symbols later */
.co_stack (NOLOAD):
{
. = ALIGN(8);
*(.co_stack .co_stack.*)
} > ram
/* Set stack top to end of ram , and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(ram ) + LENGTH(ram );
__StackLimit = __StackTop - SIZEOF(.co_stack);
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds ram limit */
ASSERT(__StackLimit >= __HeapLimit, "region ram overflowed with stack")
}

Wyświetl plik

@ -4,7 +4,7 @@
<Device manufacturerId="9" manufacturerName="ST" chipId="252" chipName="STM32F100C8" boardId="" boardName=""/>
<BuildOption>
<Compile>
<Option name="OptimizationLevel" value="0"/>
<Option name="OptimizationLevel" value="3"/>
<Option name="UseFPU" value="0"/>
<Option name="UserEditCompiler" value=""/>
<Option name="SupportCPlusplus" value="1"/>
@ -86,8 +86,8 @@
<File name="cmsis_boot" path="" type="2"/>
<File name="delay.h" path="delay.h" type="1"/>
<File name="init.h" path="init.h" type="1"/>
<File name="stm_lib/inc/stm32f10x_pwr.h" path="stm_lib/inc/stm32f10x_pwr.h" type="1"/>
<File name="stm_lib/src/stm32f10x_tim.c" path="stm_lib/src/stm32f10x_tim.c" type="1"/>
<File name="stm_lib/inc/stm32f10x_pwr.h" path="stm_lib/inc/stm32f10x_pwr.h" type="1"/>
<File name="cmsis_boot/startup" path="" type="2"/>
<File name="cmsis/core_cmFunc.h" path="cmsis/core_cmFunc.h" type="1"/>
<File name="stm_lib/src/misc.c" path="stm_lib/src/misc.c" type="1"/>
@ -100,8 +100,8 @@
<File name="syscalls/syscalls.c" path="syscalls/syscalls.c" type="1"/>
<File name="stm_lib/inc/stm32f10x_spi.h" path="stm_lib/inc/stm32f10x_spi.h" type="1"/>
<File name="init.c" path="init.c" type="1"/>
<File name="stm_lib/src/stm32f10x_adc.c" path="stm_lib/src/stm32f10x_adc.c" type="1"/>
<File name="stm_lib/inc/stm32f10x_dma.h" path="stm_lib/inc/stm32f10x_dma.h" type="1"/>
<File name="stm_lib/src/stm32f10x_adc.c" path="stm_lib/src/stm32f10x_adc.c" type="1"/>
<File name="radio.c" path="radio.c" type="1"/>
<File name="ublox.h" path="ublox.h" type="1"/>
<File name="stm_lib/src/stm32f10x_usart.c" path="stm_lib/src/stm32f10x_usart.c" type="1"/>
@ -113,14 +113,14 @@
<File name="cmsis_boot/system_stm32f10x.c" path="cmsis_boot/system_stm32f10x.c" type="1"/>
<File name="stm_lib/inc/misc.h" path="stm_lib/inc/misc.h" type="1"/>
<File name="cmsis/core_cmInstr.h" path="cmsis/core_cmInstr.h" type="1"/>
<File name="cmsis/core_cm3.h" path="cmsis/core_cm3.h" type="1"/>
<File name="QAPRSCommon.h" path="QAPRSCommon.h" type="1"/>
<File name="cmsis/core_cm3.h" path="cmsis/core_cm3.h" type="1"/>
<File name="stm_lib/src/stm32f10x_rcc.c" path="stm_lib/src/stm32f10x_rcc.c" type="1"/>
<File name="fun.c" path="fun.c" type="1"/>
<File name="aprs.cpp" path="aprs.cpp" type="1"/>
<File name="radio.h" path="radio.h" type="1"/>
<File name="stm_lib/src/stm32f10x_dma.c" path="stm_lib/src/stm32f10x_dma.c" type="1"/>
<File name="f_rtty.h" path="f_rtty.h" type="1"/>
<File name="stm_lib/src/stm32f10x_dma.c" path="stm_lib/src/stm32f10x_dma.c" type="1"/>
<File name="stm_lib/src" path="" type="2"/>
<File name="cmsis" path="" type="2"/>
<File name="stm_lib" path="" type="2"/>