Sky9x added to CMakeLists.txt

This commit is contained in:
Bertrand Songis
2016-01-03 11:06:15 +01:00
parent 8809a64d57
commit 77772287fe
5 changed files with 146 additions and 73 deletions
+86 -16
View File
@@ -157,6 +157,67 @@ elseif(PCB STREQUAL TARANIS)
if(MIXERS_MONITOR)
add_definitions(-DMIXERS_MONITOR)
endif()
elseif(PCB STREQUAL SKY9X OR PCB STREQUAL 9XRPRO OR PCB STREQUAL AR9X)
set(ARCH ARM)
if(PCB STREQUAL 9XRPRO)
add_definitions(-Dat91sam3s8 -DREVX)
set(FLAVOUR 9xrpro)
set(LINKER_SCRIPT targets/sky9x/sam3s8c_flash.ld)
elseif(PCB STREQUAL AR9X)
add_definitions(-Dat91sam3s8 -DAR9X)
set(FLAVOUR ar9x)
set(LINKER_SCRIPT targets/sky9x/sam3s8c_flash.ld)
else()
set(FLAVOUR sky9x)
option(PCBREV "PCB Revision" REVC)
set(TARGET_SRC ${TARGET_SRC} coproc_driver.cpp rotenc_driver.cpp)
add_definitions(-DROTARY_ENCODERS=1)
if(PCBREV STREQUAL REVA)
add_definitions(-DDREVA)
set(LINKER_SCRIPT targets/sky9x/sam3s2c_flash.ld)
elseif(PCBREV STREQUAL REVB)
add_definitions(-DDREVB -DCOPROCESSOR)
set(LINKER_SCRIPT targets/sky9x/sam3s4c_flash.ld)
else()
add_definitions(-DDREVC -DCOPROCESSOR)
set(LINKER_SCRIPT targets/sky9x/sam3s4c_flash.ld)
endif()
endif()
set(MCU cortex-m3)
set(SDCARD YES)
set(HAPTIC YES)
set(EEPROM EEPROM_RAW)
set(GUI_DIR 9x)
set(TARGET_DIR sky9x)
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps)
add_definitions(-DPCBSKY9X)
add_definitions(-DAUDIO -DVOICE -DRTCLOCK)
add_definitions(-DDBLKEYS -DVARIO -DBOLD_FONT -DBATTGRAPH)
add_definitions(-DEEPROM_VARIANT=0)
set(GUI_SRC ${GUI_SRC} menu_general_diagkeys.cpp menu_general_diaganas.cpp menu_general_hardware.cpp view_telemetry.cpp view_text.cpp view_about.cpp)
set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} core_cm3.c board_lowlevel.c crt.c vectors_sam3s.c)
set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} lcd_driver.cpp
usb/device/core/USBD_UDP.c usb/device/core/USBDDriver.c
usb/device/massstorage/MSDDriver.c usb/device/massstorage/MSDDStateMachine.c usb/device/massstorage/MSDLun.c
usb/device/massstorage/MSDDriverDescriptors.c usb/device/massstorage/SBCMethods.c usb/common/core/USBEndpointDescriptor.c
usb/common/core/USBGenericRequest.c usb/common/core/USBFeatureRequest.c usb/common/core/USBInterfaceRequest.c
usb/common/core/USBGetDescriptorRequest.c usb/common/core/USBSetAddressRequest.c usb/common/core/USBSetConfigurationRequest.c
usb/common/core/USBConfigurationDescriptor.c usb/common/core/USBGenericDescriptor.c MEDSdcard.c
)
set(TARGET_SRC
${TARGET_SRC}
rtc_driver.cpp
board_sky9x.cpp
telemetry_driver.cpp
serial2_driver.cpp
pwr_driver.cpp
adc_driver.cpp
eeprom_driver.cpp
pulses_driver.cpp
keys_driver.cpp audio_driver.cpp buzzer_driver.cpp haptic_driver.cpp sdcard_driver.cpp massstorage.cpp
)
set(SRC ${SRC} debug.cpp)
set(FIRMWARE_SRC ${FIRMWARE_SRC} loadboot.cpp)
elseif(PCB STREQUAL 9X OR PCB STREQUAL 9XR)
set(ARCH AVR)
set(MCU atmega64)
@@ -217,7 +278,7 @@ if(CPU_FAMILY STREQUAL STM32)
set(ARCH ARM)
set(STM32USB_DIR ${THIRDPARTY_DIR}/STM32_USB-Host-Device_Lib_V2.1.0/Libraries)
add_definitions(-DCPUSTM32)
add_definitions(-DFRSKY -DFRSKY_SPORT -DFRSKY_HUB -DGPS -DPXX -DDSM2 -DSBUS -DCROSSFIRE)
add_definitions(-DSBUS -DCROSSFIRE)
include_directories(${STM32USB_DIR}/STM32_USB_OTG_Driver/inc)
include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Core/inc)
include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Class/msc/inc)
@@ -256,20 +317,6 @@ if(CPU_FAMILY STREQUAL STM32)
set(FIRMWARE_SRC
${FIRMWARE_SRC}
serial.cpp
${FATFS_DIR}/ff.c
${FATFS_DIR}/fattime.c
${FATFS_DIR}/option/ccsbcs.c
${COOS_DIR}/kernel/core.c
${COOS_DIR}/kernel/hook.c
${COOS_DIR}/kernel/task.c
${COOS_DIR}/kernel/event.c
${COOS_DIR}/kernel/time.c
${COOS_DIR}/kernel/timer.c
${COOS_DIR}/kernel/flag.c
${COOS_DIR}/kernel/mutex.c
${COOS_DIR}/kernel/serviceReq.c
${COOS_DIR}/portable/GCC/port.c
${COOS_DIR}/portable/arch.c
syscalls.c
targets/taranis/configure_pins.cpp
)
@@ -335,6 +382,7 @@ if(ARCH STREQUAL ARM)
set(TARGET_SRC ${TARGET_SRC} haptic_driver.cpp)
endif()
add_definitions(-DCPUARM)
add_definitions(-DFRSKY -DFRSKY_SPORT -DFRSKY_HUB -DGPS -DPXX -DDSM2)
include_directories(targets/${TARGET_DIR} ${THIRDPARTY_DIR})
include_directories(${COOS_DIR} ${COOS_DIR}/kernel ${COOS_DIR}/portable)
foreach(LANGUAGE cz de en es fr it pt sk se pl hu) # TODO add nl
@@ -367,11 +415,28 @@ if(ARCH STREQUAL ARM)
pulses_driver.cpp
keys_driver.cpp
adc_driver.cpp
trainer_driver.cpp
# trainer_driver.cpp
audio_driver.cpp
serial2_driver.cpp
telemetry_driver.cpp
)
set(FIRMWARE_SRC
${FIRMWARE_SRC}
${FATFS_DIR}/ff.c
${FATFS_DIR}/fattime.c
${FATFS_DIR}/option/ccsbcs.c
${COOS_DIR}/kernel/core.c
${COOS_DIR}/kernel/hook.c
${COOS_DIR}/kernel/task.c
${COOS_DIR}/kernel/event.c
${COOS_DIR}/kernel/time.c
${COOS_DIR}/kernel/timer.c
${COOS_DIR}/kernel/flag.c
${COOS_DIR}/kernel/mutex.c
${COOS_DIR}/kernel/serviceReq.c
${COOS_DIR}/portable/GCC/port.c
${COOS_DIR}/portable/arch.c
)
set(PULSES_SRC
pulses_arm.cpp
ppm_arm.cpp
@@ -411,6 +476,9 @@ else()
if(BOLD)
add_definitions(-DBOLD_FONT)
endif()
if(BATTGRAPH)
add_definitions(-DBATTGRAPH)
endif()
if(${EXT} STREQUAL OFF)
add_definitions(-DEXTSTD)
elseif(EXT STREQUAL ARDUPILOT)
@@ -689,6 +757,8 @@ if(ARCH STREQUAL ARM)
)
add_custom_target(bootloader DEPENDS bootloader.lbm)
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} bootloader)
else()
file(DOWNLOAD http://ersky9x.googlecode.com/svn/trunk/src/bootloader/bootflash8.lbm ${CMAKE_CURRENT_BINARY_DIR}/bootloader.lbm)
endif()
add_executable(firmware.elf ${SRC} ${FIRMWARE_HEADERS})
+20 -22
View File
@@ -1,23 +1,23 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*/
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*/
#include "../../opentx.h"
uint16_t ResetReason;
@@ -468,8 +468,6 @@ void i2cInit()
NVIC_EnableIRQ(TWI0_IRQn) ;
}
extern const uint8_t BootCode[];
void boardInit()
{
// TODO this is not clean, completely unuseful, but prevents the bootloader from being optimized away...
+35 -28
View File
@@ -1,25 +1,25 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*/
#ifndef _BOARD_SKY9X_H_
#define _BOARD_SKY9X_H_
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*/
#ifndef _BOARD_SKY9X_H_
#define _BOARD_SKY9X_H_
#include <stdio.h>
#include "board.h"
@@ -155,12 +155,10 @@ extern uint16_t sessionTimer;
void calcConsumption();
#endif
// Trainer driver
#define SLAVE_MODE() (pwrCheck() == e_power_trainer)
// #define JACK_PPM_OUT() PIOC->PIO_PDR = PIO_PC22
// #define JACK_PPM_IN() PIOC->PIO_PER = PIO_PC22
void checkTrainerSettings();
void setSticksGain(uint8_t gains);
void init_trainer_capture();
// Write Flash driver
#define FLASH_PAGESIZE 256
@@ -229,7 +227,8 @@ enum Analogs {
};
void adcInit();
void adcRead(void);
inline uint16_t getAnalogValue(uint32_t value);
uint16_t getAnalogValue(uint32_t value);
void setSticksGain(uint8_t gains);
// Buzzer driver
void buzzerSound(uint8_t duration);
@@ -269,6 +268,11 @@ uint32_t pwrCheck();
// EEPROM driver
void eepromInit();
uint32_t eepromReadStatus();
extern volatile uint32_t Spi_complete;
void eepromWriteEnable();
void eepromBlockErase(uint32_t address);
void eepromReadArray(uint32_t address, uint8_t * buffer, uint32_t size);
void eepromByteProgram(uint32_t address, uint8_t * buffer, uint32_t size);
// Rotary Encoder driver
void rotencInit();
@@ -287,9 +291,12 @@ void debugPutc(const char c);
void telemetryPortInit(uint32_t baudrate);
uint32_t telemetryTransmitPending();
void telemetryTransmitBuffer(uint8_t * buffer, uint32_t size);
void rxPdcUsart( void (*pChProcess)(uint8_t x) );
// Second UART driver
void serial2TelemetryInit(unsigned int protocol);
bool telemetrySecondPortReceive(uint8_t & data);
#endif // _BOARD_SKY9X_H_
extern const uint8_t BootCode[];
#endif // _BOARD_SKY9X_H_
+3 -7
View File
@@ -24,13 +24,9 @@
/* Only rcvr_spi(), xmit_spi(), sdPoll10ms() and some macros */
/* are platform dependent. */
/*-----------------------------------------------------------------------*/
#include <string.h>
#include "debug.h"
#include "../FatFs/diskio.h"
#include "../FatFs/ff.h"
#include "../CoOS/kernel/CoOS.h"
#include "board.h"
#include "../../opentx.h"
#include "../FatFs/diskio.h"
#define CARD_TYPE_bmHC (1 << 0) /**< Bit for High-Capacity(Density) */
#define CARD_TYPE_bmSDMMC (0x3 << 1) /**< Bits mask for SD/MMC */
@@ -18,6 +18,8 @@
* GNU General Public License for more details.
*/
#include "../../opentx.h"
#define MCI_INITIAL_SPEED 400000
void init_SDcard()