From 8c6f24afefcf7b35fc7d137adc41db4ddf858ecf Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Tue, 12 Mar 2013 12:54:07 +0200 Subject: [PATCH 01/68] version-info.py: fix coding style --- make/scripts/version-info.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/make/scripts/version-info.py b/make/scripts/version-info.py index 1d9187467..6dd025fe8 100644 --- a/make/scripts/version-info.py +++ b/make/scripts/version-info.py @@ -41,8 +41,8 @@ class Repo: def _exec(self, cmd): """Execute git using cmd as arguments""" self._git = 'git' - git = Popen(self._git + " " + cmd, cwd=self._path, - shell=True, stdout=PIPE, stderr=PIPE) + git = Popen(self._git + " " + cmd, cwd = self._path, + shell = True, stdout = PIPE, stderr = PIPE) self._out, self._err = git.communicate() self._rc = git.poll() @@ -262,15 +262,15 @@ def xtrim(string, suffix, length): if len(string) + len(suffix) <= length: return ''.join([string, suffix]) else: - n = length-1-len(suffix) + n = length - 1 - len(suffix) assert n > 0, "length of truncated string+suffix exceeds maximum length" return ''.join([string[:n], '+', suffix]) -def GetHashofDirs(directory, verbose=0, raw=0): +def get_hash_of_dirs(directory, verbose = 0, raw = 0): """Return hash of XML files from UAVObject definition directory""" import hashlib, os SHAhash = hashlib.sha1() - if not os.path.exists (directory): + if not os.path.exists(directory): return -1 try: @@ -288,7 +288,6 @@ def GetHashofDirs(directory, verbose=0, raw=0): f1 = open(filepath, 'rU') except: # You can't open the file for some reason - f1.close() continue # Compute file hash. Same as running "sha1sum ". @@ -296,7 +295,8 @@ def GetHashofDirs(directory, verbose=0, raw=0): while 1: # Read file in as little chunks buf = f1.read(4096) - if not buf : break + if not buf: + break f1hash.update(buf) f1.close() @@ -412,8 +412,8 @@ string given. BOARD_TYPE = args.type, BOARD_REVISION = args.revision, SHA1 = sha1(args.image), - UAVOSHA1TXT = GetHashofDirs(args.uavodir, verbose=0, raw=1), - UAVOSHA1 = GetHashofDirs(args.uavodir, verbose=0, raw=0), + UAVOSHA1TXT = get_hash_of_dirs(args.uavodir, verbose = 0, raw = 1), + UAVOSHA1 = get_hash_of_dirs(args.uavodir, verbose = 0, raw = 0), ) # Process positional arguments in the form of: From 304f36633807c2d14eaf7fdb5a8ed3f8e978b522 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Fri, 15 Mar 2013 08:20:01 +0200 Subject: [PATCH 02/68] Remove discontinued AHRS files --- flight/Doc/Architecture/ahrs_spi_link_fsm.dot | 90 ---- flight/Doc/Architecture/ahrs_spi_link_fsm.jpg | Bin 106599 -> 0 bytes flight/Libraries/ahrs_comm_objects.c | 164 ------- flight/Libraries/ahrs_spi_comm.c | 452 ------------------ flight/Libraries/inc/ahrs_comm_objects.h | 95 ---- flight/Libraries/inc/ahrs_spi_comm.h | 136 ------ flight/Modules/AHRSComms/ahrs_comms.c | 143 ------ flight/Modules/AHRSComms/inc/ahrs_comms.h | 37 -- flight/PiOS/Boards/STM32103CB_AHRS.h | 243 ---------- flight/PiOS/Boards/STM32103CB_CC_Rev1.h | 2 +- flight/PiOS/Boards/pios_board.h | 4 +- flight/PiOS/Common/pios_opahrs.c | 343 ------------- flight/PiOS/Common/pios_opahrs_proto.c | 76 --- flight/PiOS/Common/pios_opahrs_v0.c | 330 ------------- .../link_STM32103CB_AHRS_BL_sections.ld | 56 --- .../STM32F10x/link_STM32103CB_AHRS_memory.ld | 7 - .../link_STM32103CB_AHRS_sections.ld | 51 -- flight/PiOS/inc/pios_opahrs.h | 77 --- flight/PiOS/inc/pios_opahrs_proto.h | 406 ---------------- .../Project/OpenOCD/foss-jtag.revb.ahrs.cfg | 15 - make/boards/ahrs/board-info.mk | 20 - 21 files changed, 2 insertions(+), 2745 deletions(-) delete mode 100644 flight/Doc/Architecture/ahrs_spi_link_fsm.dot delete mode 100644 flight/Doc/Architecture/ahrs_spi_link_fsm.jpg delete mode 100644 flight/Libraries/ahrs_comm_objects.c delete mode 100644 flight/Libraries/ahrs_spi_comm.c delete mode 100644 flight/Libraries/inc/ahrs_comm_objects.h delete mode 100644 flight/Libraries/inc/ahrs_spi_comm.h delete mode 100644 flight/Modules/AHRSComms/ahrs_comms.c delete mode 100644 flight/Modules/AHRSComms/inc/ahrs_comms.h delete mode 100644 flight/PiOS/Boards/STM32103CB_AHRS.h delete mode 100644 flight/PiOS/Common/pios_opahrs.c delete mode 100644 flight/PiOS/Common/pios_opahrs_proto.c delete mode 100644 flight/PiOS/Common/pios_opahrs_v0.c delete mode 100644 flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld delete mode 100644 flight/PiOS/STM32F10x/link_STM32103CB_AHRS_memory.ld delete mode 100644 flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld delete mode 100644 flight/PiOS/inc/pios_opahrs.h delete mode 100644 flight/PiOS/inc/pios_opahrs_proto.h delete mode 100644 flight/Project/OpenOCD/foss-jtag.revb.ahrs.cfg delete mode 100644 make/boards/ahrs/board-info.mk diff --git a/flight/Doc/Architecture/ahrs_spi_link_fsm.dot b/flight/Doc/Architecture/ahrs_spi_link_fsm.dot deleted file mode 100644 index c53a748fb..000000000 --- a/flight/Doc/Architecture/ahrs_spi_link_fsm.dot +++ /dev/null @@ -1,90 +0,0 @@ -// Regenerate using graphviz/dotty with this command -// dot -Tjpg ./flight/Doc/Architecture/ahrs_spi_link_fsm.dot > ./flight/Doc/Architecture/ahrs_spi_link_fsm.jpg - -digraph ahrs_spi_protocol { - label="AHRS SPI Link State Machine" - labelloc=t - labeljust = l - - // Stopped -- Undefined Wire State - { - node [ style=filled,color=lightgray ] - - stopped [ shape="doublecircle" ] - stopping - } - - // Wire State Inactive - { - node [ style=filled,color=lightblue ] - - inactive - } - - // Wire State Busy - { - node [ style=filled,color=red ] - - user_busy - user_busy_tx_pending - user_busy_rx_pending - user_busy_rxtx_pending - } - { - node [ style=filled,color=yellow ] - - user_tx_pending - user_rx_pending - user_rxtx_pending - } - - // Wire State Ready - { - node [ style=filled,color=green ] - - user_rx_active - user_tx_active - user_rxtx_active - } - - // - // State transitions driven by the user - // - stopped -> inactive [ label="init link" ] - - inactive -> stopping [ label="stop" ] - inactive -> user_busy_rx_pending [ label="user set rx" ] - inactive -> user_busy_tx_pending [ label="user set tx" ] - - user_busy -> user_busy_tx_pending [ label="user set tx" ] - user_busy -> user_busy_rx_pending [ label="user set rx" ] - user_busy -> inactive [ label="user done" ] - user_busy -> stopping [ label="stop" ] - - user_busy_tx_pending -> user_busy_rxtx_pending [ label="user set rx" ] - user_busy_tx_pending -> user_tx_pending [ label="user done" ] - - user_busy_rx_pending -> user_busy_rxtx_pending [ label="user set tx" ] - user_busy_rx_pending -> user_rx_pending [ label="user done" ] - - user_busy_rxtx_pending -> user_rxtx_pending [ label="user done" ] - - // - // State transitions driven by messaging from the OP board - // - stopping -> stopped [ label="rx any" ] - - user_tx_pending -> user_tx_active [ label="rx any" ] - user_rx_pending -> user_rx_active [ label="rx any" ] - - user_rxtx_pending -> user_rxtx_active [ label="rx any" ] - - // Active -> Busy - user_rx_active -> user_busy [ label="rx user" ] - - user_tx_active -> inactive [ label="rx any" ] - - user_rxtx_active -> user_busy [ label="rx user" ] - user_rxtx_active -> user_rx_active [ label="rx link" ] - user_rxtx_active -> user_rx_active [ label="rx unknown" ] -} diff --git a/flight/Doc/Architecture/ahrs_spi_link_fsm.jpg b/flight/Doc/Architecture/ahrs_spi_link_fsm.jpg deleted file mode 100644 index 4f5eaae27cc50df9a187be934b9f7e23f6e4e176..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 106599 zcmd?R2T)Ya)-JpebVM=&k_QC^B}tYzC;|c^NphB)C1-{pQ6wrTNX}Vu28lxu$sjrB zoCg?Y?)E*m?m73Q?>qO_U-jQ}Hr3SBOxNsQy}Q?X*0Y`-%rDG5KrAaIBL!e#0RR^G z2Vl^En1r(A)7J{hLJVfc?3Qm$%otp_I36>wI6GR{nlZ@8N;AkRN=h@h@N++8V=y)` zHFUOiVz75Mw6<_^zlE6sB!HVYZa{8azX^draB*+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-WuK|Hi7@7nlSIQLL^ane1|2+By{2&!gtiX)+`UN_o0yK0$R)ac52N9MM$3Q6b zWghj1a7&~tph<&70d46;Ny^gydF%hV;s1nXHpG*gtqIEBy0fhV{|D<0*KrY`?PuH> zB>x2>F=E~j%!48@^!OFZcCvTr{L$L^g}<-u-`914aFrKXVe9QnFPTI=w#KoG&BEx! zs4zJ=rj^P{D@SeW&zWa8GN*Z)9^84&@nf9unMcU*g6lu+2FP!pjLqMbkkSax;@Ij# zAE6N*bRBJREX%t+0Uw*3VZI&=zhN!Hq9*Ef%ly;MG`aAR`to*<6gl@9aZ;f3;pm!A z0(`+teW58~TsVhZNHCCcliw1jh}=&vfdgnAbhmQp+0U4q)dvXzBEuPoL2iH~T0*bS{v)$4R&YNEg49no&gK_7E>hQ%#laLe@1eD$0PXp-Be- z3-|ZTnd5NhlP|LZK-a9R-I0@~q1j>ekMmYNBOFVz3oeq#pZjdTK+l4vD#|L#6rvAg zh_C2A=>SC7f7b#UoctWI0Q5&$Xw#_~??Rfq4FgA0ijlt=V3j``-wI&@T{gDAyR05# zY6f-v*~rTL>GpvB@#R1AS>*lQJ&^Q2Z~Ygq_WM5mpBw(~zWjfd8R+i6(&mzc{F?k< Dc5r%- diff --git a/flight/Libraries/ahrs_comm_objects.c b/flight/Libraries/ahrs_comm_objects.c deleted file mode 100644 index 3bc3bff3c..000000000 --- a/flight/Libraries/ahrs_comm_objects.c +++ /dev/null @@ -1,164 +0,0 @@ -/** - ****************************************************************************** - * - * @file ahrs_comm_objects.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief AHRS comms AUVObjects. This file defined teh objects to be used. - * - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "pios.h" -#include "ahrs_spi_comm.h" -#include "pios_debug.h" - -static AttitudeRawData AttitudeRaw; -static AttitudeActualData AttitudeActual; -static BaroAltitudeData BaroAltitude; -static GPSPositionData GPSPosition; -static HomeLocationData HomeLocation; -static InsStatusData InsStatus; -static InsSettingsData InsSettings; -static FirmwareIAPObjData FirmwareIAPObj; -static PositionActualData PositionActual; -static VelocityActualData VelocityActual; -static GPSSatellitesData GPSSatellites; -static GPSTimeData GPSTime; - -AhrsSharedObject objectHandles[MAX_AHRS_OBJECTS]; - -#ifndef NULL -#define NULL ((void *)0) -#endif - -#ifdef IN_AHRS - -//slightly hacky - implement our own version of the xxxHandle() functions -#define CREATEHANDLE(n,obj) \ - void * obj##Handle() {return (&objectHandles[n]);} - -CREATEHANDLE(0, AttitudeRaw); -CREATEHANDLE(1, AttitudeActual); -CREATEHANDLE(2, InsSettings); -CREATEHANDLE(3, InsStatus); -CREATEHANDLE(4, BaroAltitude); -CREATEHANDLE(5, GPSPosition); -CREATEHANDLE(6, PositionActual); -CREATEHANDLE(7, VelocityActual); -CREATEHANDLE(8, HomeLocation); -CREATEHANDLE(9, FirmwareIAPObj); -CREATEHANDLE(10, GPSSatellites); -CREATEHANDLE(11, GPSTime); - -#if 12 != MAX_AHRS_OBJECTS //sanity check -#error We did not create the correct number of xxxHandle() functions -#endif - -#define ADDHANDLE(idx,obj) {\ - int n = idx;\ - objectHandles[n].data = &obj;\ - objectHandles[n].size = sizeof(obj);\ - objectHandles[n].index = n;\ - } - -#else - -static void ObjectUpdatedCb(UAVObjEvent * ev); - -#define ADDHANDLE(idx,obj) {\ - obj##Initialize();\ - int n = idx;\ - objectHandles[n].data = &obj;\ - objectHandles[n].uavHandle = obj##Handle();\ - objectHandles[n].size = sizeof(obj);\ - objectHandles[n].index = n;\ - } - -#endif - -void AhrsInitHandles(void) -{ - int idx = 0; -//Note: the first item in this list has the highest priority -//the last has the lowest priority - ADDHANDLE(idx++, AttitudeRaw); - ADDHANDLE(idx++, AttitudeActual); - ADDHANDLE(idx++, InsSettings); - ADDHANDLE(idx++, InsStatus); - ADDHANDLE(idx++, BaroAltitude); - ADDHANDLE(idx++, GPSPosition); - ADDHANDLE(idx++, PositionActual); - ADDHANDLE(idx++, VelocityActual); - ADDHANDLE(idx++, HomeLocation); - ADDHANDLE(idx++, FirmwareIAPObj); - ADDHANDLE(idx++, GPSSatellites); - ADDHANDLE(idx++, GPSTime); - - if (idx != MAX_AHRS_OBJECTS) { - PIOS_DEBUG_Assert(0); - } -//Note: Only connect objects that the AHRS needs to read -//When the AHRS writes to these the data does a round trip -//AHRS->OP->AHRS due to these events -#ifndef IN_AHRS - InsSettingsConnectCallback(ObjectUpdatedCb); - HomeLocationConnectCallback(ObjectUpdatedCb); - FirmwareIAPObjConnectCallback(ObjectUpdatedCb); -#endif -} - -AhrsObjHandle AhrsFromIndex(uint8_t index) -{ - if (index >= MAX_AHRS_OBJECTS) { - return (NULL); - } - return (&objectHandles[index]); -} - -#ifndef IN_AHRS - -AhrsObjHandle AhrsFromUAV(UAVObjHandle obj) -{ - if (objectHandles[0].uavHandle == NULL) { //Oops - we haven't been initialised! - PIOS_DEBUG_Assert(0); - } - for (int ct = 0; ct < MAX_AHRS_OBJECTS; ct++) { - if (objectHandles[ct].uavHandle == obj) { - return (&objectHandles[ct]); - } - } - return (NULL); -} - -/** Callback to update AHRS from UAVObjects -*/ -static void ObjectUpdatedCb(UAVObjEvent * ev) -{ - if (!(ev->event & EV_MASK_ALL_UPDATES)) { - return; - } - AhrsObjHandle hdl = AhrsFromUAV(ev->obj); - if (hdl) { - AhrsSharedData data; //this is guaranteed to be big enough - UAVObjGetData(ev->obj, &data); - AhrsSetData(hdl, &data); - } -} - -#endif diff --git a/flight/Libraries/ahrs_spi_comm.c b/flight/Libraries/ahrs_spi_comm.c deleted file mode 100644 index 9c6f65d70..000000000 --- a/flight/Libraries/ahrs_spi_comm.c +++ /dev/null @@ -1,452 +0,0 @@ -/** - ****************************************************************************** - * - * @file ahrs_spi_comm.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief AHRS SPI communications. - * - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include -#include "ahrs_spi_comm.h" -#include "ahrs_spi_program.h" - -#ifdef IN_AHRS -#include -#include "pios_debug.h" -#include "pios_spi.h" -#include "pios_irq.h" -#include "ahrs_spi_program_slave.h" -//#include "STM32103CB_AHRS.h" -#endif - -/*transmit and receive packet magic numbers. -These numbers are chosen to be very unlikely to occur due to noise. -CRC8 does not always catch noise from cross-coupling between data lines. -*/ -#ifdef IN_AHRS -#define TXMAGIC 0xA55AF0C3 -#define RXMAGIC 0x3C5AA50F -#else -#define RXMAGIC 0xA55AF0C3 -#define TXMAGIC 0x3C5AA50F -#endif - -//packet types -typedef enum { COMMS_NULL, COMMS_OBJECT } COMMSCOMMAND; - -//The maximum number of objects that can be updated in one cycle. -//Currently the link is capable of sending 3 packets per cycle but 2 is enough -#define MAX_UPDATE_OBJECTS 2 - -//Number of transmissions + 1 before we expect to see the data acknowledge -//This is controlled by the SPI hardware. -#define ACK_LATENCY 4 - -/** All data for one object -*/ -typedef struct { - uint8_t done; - uint8_t index; - AhrsSharedData object; -} ObjectPacketData; - -/** One complete packet. -Other packet types are allowed for. The frame size will be the size of this -structure. -*/ -typedef struct { - uint32_t magicNumber; - COMMSCOMMAND command; - AhrsEndStatus status; - union { //allow for expansion to other packet types. - ObjectPacketData objects[MAX_UPDATE_OBJECTS]; - }; - uint8_t dummy; //For some reason comms trashes the last byte -} CommsDataPacket; - -static void FillObjectPacket(); -static void CommsCallback(uint8_t crc_ok, uint8_t crc_val); -static void SetObjectDirty(const int idx); -static void HandleObjectPacket(); -static void HandleRxPacket(); -static void PollEvents(); -#ifndef IN_AHRS -static void SendPacket(void); -static void AhrsUpdatedCb(AhrsObjHandle handle); -#endif - -/** Receive data buffer -*/ -static CommsDataPacket rxPacket; - -/** Transmit data buffer -*/ - -static CommsDataPacket txPacket; -/** Objects that have changed and so should be transmitted -*/ -static unsigned int dirtyObjects[MAX_AHRS_OBJECTS]; - -/** Objects that have been updated at startup -*/ -static bool readyObjects[MAX_AHRS_OBJECTS]; - -/** List of event callbacks -*/ -static AhrsEventCallback objCallbacks[MAX_AHRS_OBJECTS]; - -/** True for objects for which new data is received and callback needs to be called -*/ -static bool callbackPending[MAX_AHRS_OBJECTS]; - -//More than this number of errors in a row will indicate the link is down -#define MAX_CRC_ERRORS 50 -//At least this number of good frames are needed to indicate the link is up. -#define MIN_OK_FRAMES 50 -//At least this number of empty objects are needed before the initial flood of events is over. -#define MIN_EMPTY_OBJECTS 10 - -static uint8_t linkOk = false; -static int okCount = MIN_OK_FRAMES; -static int emptyCount = MIN_EMPTY_OBJECTS; -static bool programReceive = false; - -void AhrsInitComms(void) -{ - programReceive = false; - AhrsInitHandles(); - memset(objCallbacks, 0, sizeof(AhrsEventCallback) * MAX_AHRS_OBJECTS); - memset(callbackPending, 0, sizeof(bool) * MAX_AHRS_OBJECTS); - memset(dirtyObjects, 0, sizeof(unsigned int) * MAX_AHRS_OBJECTS); - memset(&txPacket, 0, sizeof(txPacket)); - memset(&rxPacket, 0, sizeof(rxPacket)); - memset(&readyObjects, 0, sizeof(bool) * MAX_AHRS_OBJECTS); - txPacket.command = COMMS_NULL; - rxPacket.command = COMMS_NULL; -} - -static uint32_t opahrs_spi_id; -void AhrsConnect(uint32_t spi_id) -{ - /* Bind this comms layer to the appropriate SPI id */ - opahrs_spi_id = spi_id; -#ifndef IN_AHRS - /* Comms already init in OP code */ - for (int ct = 0; ct < MAX_AHRS_OBJECTS; ct++) { - AhrsObjHandle hdl = AhrsFromIndex(ct); - if (hdl) { - AhrsConnectCallBack(hdl, AhrsUpdatedCb); - } - } -#endif -} - -int32_t AhrsSetData(AhrsObjHandle obj, const void *dataIn) -{ - if (obj == NULL || dataIn == NULL || obj->data == NULL) { - return (-1); - } - if (memcmp(obj->data, dataIn, obj->size) == 0) { //nothing to do, don't generate an event - return (0); - } - memcpy(obj->data, dataIn, obj->size); - SetObjectDirty(obj->index); - return (0); -} - -int32_t AhrsGetData(AhrsObjHandle obj, void *dataOut) -{ - - if (obj == NULL || dataOut == NULL || obj->data == NULL) { - return (-1); - } - memcpy(dataOut, obj->data, obj->size); - return (0); -} - -/** Mark an object to be sent -*/ -void SetObjectDirty(const int idx) -{ - if (idx < 0 || idx >= MAX_AHRS_OBJECTS) { - return; - } - dirtyObjects[idx] = ACK_LATENCY; -} -/** Work out what data needs to be sent. - If an object was not sent it will be retried 4 frames later -*/ -static void FillObjectPacket() -{ - txPacket.command = COMMS_OBJECT; - txPacket.magicNumber = TXMAGIC; - int idx = 0; - for (int ct = 0; ct < MAX_UPDATE_OBJECTS; ct++) { - txPacket.objects[ct].index = AHRS_NO_OBJECT; - for (; idx < MAX_AHRS_OBJECTS; idx++) { - if (dirtyObjects[idx] > 0) { - if (dirtyObjects[idx] == ACK_LATENCY) { - dirtyObjects[idx]--; - txPacket.objects[ct].index = idx; - AhrsObjHandle hdl = AhrsFromIndex(idx); - if (hdl) { - memcpy(&txPacket.objects[ct].object, hdl->data, hdl->size); - break; - } - } else { - dirtyObjects[idx]--; - if (dirtyObjects[idx] == 0) { //timed out - dirtyObjects[idx] = ACK_LATENCY; - txPacket.status.retries++; - } - } - } - } - } - for (; idx < MAX_AHRS_OBJECTS; idx++) { - if (dirtyObjects[idx] > 0 && dirtyObjects[idx] != ACK_LATENCY) { - dirtyObjects[idx]--; - if (dirtyObjects[idx] == 0) { //timed out - dirtyObjects[idx] = ACK_LATENCY; - txPacket.status.retries++; - } - } - } -} - -/** Process a received packet -*/ -static void HandleRxPacket() -{ - switch (rxPacket.command) { - case COMMS_NULL: - // Empty packet, nothing to do - break; - - case COMMS_OBJECT: - HandleObjectPacket(); - break; - - default: - txPacket.status.invalidPacket++; - } -} - -/** Process a received UAVObject packet -*/ -static void HandleObjectPacket() -{ - for (int ct = 0; ct < MAX_UPDATE_OBJECTS; ct++) { - uint8_t idx; - - // Flag objects that have been successfully received at the other end - idx = rxPacket.objects[ct].done; - txPacket.objects[ct].done = AHRS_NO_OBJECT; - if (idx < MAX_AHRS_OBJECTS) { - - if (dirtyObjects[idx] == 1) { //this ack is the correct one for the last send - dirtyObjects[idx] = 0; - } - } - - // Handle received object if there is one in this packet - idx = rxPacket.objects[ct].index; - if (idx == AHRS_NO_OBJECT) { - if (emptyCount > 0) { - emptyCount--; - } - continue; - } - AhrsObjHandle obj = AhrsFromIndex(idx); - if (obj) { - memcpy(obj->data, &rxPacket.objects[ct].object, obj->size); - txPacket.objects[ct].done = idx; - callbackPending[idx] = true; // New data available, call callback - readyObjects[idx] = true; - } else { - txPacket.status.invalidPacket++; - } - } -#ifdef IN_AHRS - FillObjectPacket(); //ready for the next frame -#endif -} - -int32_t AhrsConnectCallBack(AhrsObjHandle obj, AhrsEventCallback cb) -{ - if (obj == NULL || obj->data == NULL) { - return (-1); - } - objCallbacks[obj->index] = cb; - return (0); -} - -void AhrsGetStatus(AhrsCommStatus * status) -{ - status->remote = rxPacket.status; - status->local = txPacket.status; - status->linkOk = linkOk; -} - - -/** Function called after an SPI transfer - */ -static void CommsCallback(uint8_t crc_ok, uint8_t crc_val) -{ -#ifndef IN_AHRS - PIOS_SPI_RC_PinSet(opahrs_spi_id, 1); //signal the end of the transfer -#endif - txPacket.command = COMMS_NULL; //we must send something so default to null - - // While the crc is ok, there is a magic value in the received data for extra security - if (rxPacket.magicNumber != RXMAGIC) { - crc_ok = false; - } - - - if (crc_ok) { - // The received data is OK, update link state and handle data - if (!linkOk && okCount > 0) { - okCount--; - if (okCount == 0) { - linkOk = true; - okCount = MAX_CRC_ERRORS; - emptyCount = MIN_EMPTY_OBJECTS; - } - } - HandleRxPacket(); - } else { - // The received data is incorrect, update state -#ifdef IN_AHRS //AHRS - do we neeed to enter program mode? - if (memcmp(&rxPacket, SPI_PROGRAM_REQUEST, SPI_PROGRAM_REQUEST_LENGTH) == 0) - { - rxPacket.magicNumber = 0; - programReceive = true; //flag it to be executed in program space - return; - } -#endif - txPacket.status.crcErrors++; - if (linkOk && okCount > 0) { - okCount--; - if (okCount == 0) { - linkOk = false; - okCount = MIN_OK_FRAMES; - } - } - } - rxPacket.magicNumber = 0; -#ifdef IN_AHRS - /*queue next frame - If PIOS_SPI_TransferBlock() fails for any reason, comms will stop working. - In that case, AhrsPoll() should kick start things again. - */ - PIOS_SPI_TransferBlock(opahrs_spi_id, (uint8_t *) & txPacket, (uint8_t *) & rxPacket, sizeof(CommsDataPacket), &CommsCallback); -#endif -} - -/** Call callbacks for object where new data is received - */ -static void PollEvents(void) -{ - for (int idx = 0; idx < MAX_AHRS_OBJECTS; idx++) { - if (objCallbacks[idx]) { - PIOS_IRQ_Disable(); - if (callbackPending[idx]) { - callbackPending[idx] = false; - PIOS_IRQ_Enable(); - objCallbacks[idx] (AhrsFromIndex(idx)); - } else { - PIOS_IRQ_Enable(); - } - } - } -} - -#ifdef IN_AHRS -void AhrsPoll() -{ - if(programReceive) - { - AhrsProgramReceive(opahrs_spi_id); - programReceive = false; - } - PollEvents(); - if (PIOS_SPI_Busy(opahrs_spi_id) != 0) { //Everything is working correctly - return; - } - txPacket.status.kickStarts++; -//comms have broken down - try kick starting it. - txPacket.command = COMMS_NULL; //we must send something so default to null - PIOS_SPI_TransferBlock(opahrs_spi_id, (uint8_t *) & txPacket, (uint8_t *) & rxPacket, sizeof(CommsDataPacket), &CommsCallback); -} - -bool AhrsLinkReady(void) -{ - - for (int ct = 0; ct < MAX_AHRS_OBJECTS; ct++) { - if (!readyObjects[ct]) { - return (false); - } - } - return (linkOk); -} - -#else - -void AhrsSendObjects(void) -{ - static bool oldLink = false; - - PollEvents(); - - if (oldLink != linkOk) { - oldLink = linkOk; - if (linkOk) { - for (int ct = 0; ct < MAX_AHRS_OBJECTS; ct++) { - AhrsObjHandle hdl = AhrsFromIndex(ct); - if (!hdl) { //paranoid - shouldn't ever happen - continue; - } - AhrsSharedData data; - UAVObjGetData(hdl->uavHandle, &data); - AhrsSetData(hdl, &data); - SetObjectDirty(ct); //force even unchanged data to be sent - } - } - } - FillObjectPacket(); - SendPacket(); -} - -void SendPacket(void) -{ -#ifndef IN_AHRS - PIOS_SPI_RC_PinSet(opahrs_spi_id, 0); -#endif - //no point checking if this failed. There isn't much we could do about it if it did fail - PIOS_SPI_TransferBlock(opahrs_spi_id, (uint8_t *) & txPacket, (uint8_t *) & rxPacket, sizeof(CommsDataPacket), &CommsCallback); -} - -static void AhrsUpdatedCb(AhrsObjHandle handle) -{ - UAVObjSetData(handle->uavHandle, handle->data); - return; -} -#endif diff --git a/flight/Libraries/inc/ahrs_comm_objects.h b/flight/Libraries/inc/ahrs_comm_objects.h deleted file mode 100644 index f6c0cb380..000000000 --- a/flight/Libraries/inc/ahrs_comm_objects.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - ****************************************************************************** - * - * @file ahrs_comm_objects.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief AHRS SPI comms UAVObject definitions. - * - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - #ifndef AHRS_COMM_OBJECTS_H -#define AHRS_COMM_OBJECTS_H - -#include "attitudeactual.h" -#include "attituderaw.h" -#include "baroaltitude.h" -#include "gpsposition.h" -#include "homelocation.h" -#include "insstatus.h" -#include "inssettings.h" -#include "positionactual.h" -#include "velocityactual.h" -#include "firmwareiapobj.h" -#include "gpsposition.h" -#include "gpssatellites.h" -#include "gpstime.h" -/** union that will fit any UAVObject. -*/ - -typedef union { - AttitudeRawData AttitudeRaw; - AttitudeActualData AttitudeActual; - InsStatusData AhrsStatus; - BaroAltitudeData BaroAltitude; - GPSPositionData GPSPosition; - PositionActualData PositionActual; - VelocityActualData VelocityActual; - HomeLocationData HomeLocation; - InsSettingsData InsSettings; - FirmwareIAPObjData FirmwareIAPObj; - GPSSatellitesData GPSSatellites; - GPSTimeData GPSTime; -} __attribute__ ((packed)) AhrsSharedData; - -/** The number of UAVObjects we will be dealing with. -*/ -#define MAX_AHRS_OBJECTS 12 - -/** Our own version of a UAVObject. -*/ -typedef struct { - void *data; - int size; - uint8_t index; -#ifndef IN_AHRS - UAVObjHandle uavHandle; -#endif -} AhrsSharedObject; - -typedef AhrsSharedObject *AhrsObjHandle; - -/** Initialise the object mapping. -It is important that this is called before any of the following functions. -*/ -void AhrsInitHandles(void); - -/** the AHRS object related to the given index. -Returns the AHRS object or NULL if not found -*/ -AhrsObjHandle AhrsFromIndex(uint8_t index); - -#ifndef IN_AHRS -/** Get the AHRS object associated with the UAVObject. -Returns the AHRS object or NULL if not found -*/ -AhrsObjHandle AhrsFromUAV(UAVObjHandle obj); -#endif - -#endif //#ifndef AHRS_COMMS_OBJECTS_H diff --git a/flight/Libraries/inc/ahrs_spi_comm.h b/flight/Libraries/inc/ahrs_spi_comm.h deleted file mode 100644 index e86a1bb46..000000000 --- a/flight/Libraries/inc/ahrs_spi_comm.h +++ /dev/null @@ -1,136 +0,0 @@ -/** - ****************************************************************************** - * - * @file ahrs_spi_comm.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Include file of the AHRS SPI comms exposed functionality. - * - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef AHRS_SPI_COMM_H_INCLUDED -#define AHRS_SPI_COMM_H_INCLUDED - -#ifdef IN_AHRS //AHRS only -#include -#include - -/** Redirect UAVObjGetData call -*/ -#define UAVObjGetData(obj, data) AhrsGetData(obj, data) - -/** Redirect UAVObjSetData call -*/ -#define UAVObjSetData(obj, data) AhrsSetData(obj, data) - -/** Redirect UAVObjConnectCallback call -Note: in AHRS, mask is unused because there is only one event type -*/ -#define UAVObjConnectCallback(obj, callback, mask) AhrsConnectCallBack(obj,callback) - -/** define our own UAVObjHandle -*/ -typedef void *UAVObjHandle; - -#else - -#include "openpilot.h" -#include "uavobjectmanager.h" - -#endif - -#define AHRS_NO_OBJECT 0xff - -#include "ahrs_comm_objects.h" - -/** Status of each end of the link -*/ -typedef struct { //try to keep this short and in multiples of 4 bytes - uint8_t kickStarts; //AHRS end only - uint8_t crcErrors; - uint8_t retries; - uint8_t invalidPacket; -} AhrsEndStatus; - -/** AHRS comms status -*/ -typedef struct { - uint8_t linkOk; - AhrsEndStatus remote; - AhrsEndStatus local; -} AhrsCommStatus; - -/** Event callback, this function is called when an object changes. - */ -typedef void (*AhrsEventCallback) (AhrsObjHandle obj); - -/** Initialise comms. -Note: this must be called before you do anything else. -Comms will not start until the first call to AhrsPoll() or -AhrsSendObjects() - */ -void AhrsInitComms(void); - -/** Connect Comms to a specific SPI interface instance. - */ -void AhrsConnect(uint32_t spi_id); - -/** AHRS version of UAVObject xxxSetData. -Returns: 0 if ok, -1 if an error - */ -int32_t AhrsSetData(AhrsObjHandle obj, const void *dataIn); - -/** AHRS version of UAVObject xxxGetData. -Returns: 0 if ok, -1 if an error - */ -int32_t AhrsGetData(AhrsObjHandle obj, void *dataOut); - -/** Connect a callback for any changes to AHRS data. -Returns: 0 if ok, -1 if an error - */ -int32_t AhrsConnectCallBack(AhrsObjHandle obj, AhrsEventCallback cb); - -/** Get the current link status. -Returns: the status. -Note: the remote status will only be valid if the link is up and running - */ -void AhrsGetStatus(AhrsCommStatus * status); - -#ifdef IN_AHRS //slave only -/** Send the latest objects to the OP -This also polls any pending events and kick starts the DMA -if needed -*/ -void AhrsPoll(); - -/** Check if the link is up and we have received the first batch of updates -Returns: True if the link is up and all objects are up to date -*/ -bool AhrsLinkReady(); - -#else //master only - -/** Send the latest objects to the AHRS -This also polls any pending events -*/ -void AhrsSendObjects(void); - -#endif - -#endif //#ifndef AHRS_SPI_COMM_H_INCLUDED diff --git a/flight/Modules/AHRSComms/ahrs_comms.c b/flight/Modules/AHRSComms/ahrs_comms.c deleted file mode 100644 index abda58ee0..000000000 --- a/flight/Modules/AHRSComms/ahrs_comms.c +++ /dev/null @@ -1,143 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotModules OpenPilot Modules - * @{ - * @addtogroup AHRSCommsModule AHRSComms Module - * @brief Handles communication with AHRS and updating position - * Specifically updates the the @ref AttitudeActual "AttitudeActual" and @ref AttitudeRaw "AttitudeRaw" settings objects - * @{ - * - * @file ahrs_comms.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Module to handle all comms to the AHRS on a periodic basis. - * - * @see The GNU Public License (GPL) Version 3 - * - ******************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/** - * Input objects: As defined in PiOS/inc/pios_ahrs_comms.h - * Output objects: As defined in PiOS/inc/pios_ahrs_comms.h - * - * This module will periodically update the values of latest attitude solution - * and other objects that are transferred to and from the AHRS - * The module settings can configure how often AHRS is polled for a new solution. - * - * The module executes in its own thread. - * - * UAVObjects are automatically generated by the UAVObjectGenerator from - * the object definition XML file. - * - * Modules have no API, all communication to other modules is done through UAVObjects. - * However modules may use the API exposed by shared libraries. - * See the OpenPilot wiki for more details. - * http://www.openpilot.org/OpenPilot_Application_Architecture - * - */ - -#include "ahrs_comms.h" -#include "ahrs_spi_comm.h" -#include "insstatus.h" - -// Private constants -#define STACK_SIZE configMINIMAL_STACK_SIZE -#define TASK_PRIORITY (tskIDLE_PRIORITY+4) - -// Private types - -// Private variables -static xTaskHandle taskHandle; - -// Private functions -static void ahrscommsTask(void *parameters); - -/** - * Initialise the module, called on startup - * \returns 0 on success or -1 if initialisation failed - */ -int32_t AHRSCommsStart(void) -{ - // Start main task - xTaskCreate(ahrscommsTask, (signed char *)"AHRSComms", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle); - TaskMonitorAdd(TASKINFO_RUNNING_AHRSCOMMS, taskHandle); - PIOS_WDG_RegisterFlag(PIOS_WDG_AHRS); - - return 0; -} - -/** - * Initialise the module, called on startup - * \returns 0 on success or -1 if initialisation failed - */ -int32_t AHRSCommsInitialize(void) -{ - InsStatusInitialize(); - InsSettingsInitialize(); - AttitudeRawInitialize(); - AttitudeActualInitialize(); - VelocityActualInitialize(); - PositionActualInitialize(); - - return 0; -} -MODULE_INITCALL(AHRSCommsInitialize, AHRSCommsStart) - -/** - * Module thread, should not return. - */ -static void ahrscommsTask(void *parameters) -{ - portTickType lastSysTime; - - AlarmsSet(SYSTEMALARMS_ALARM_AHRSCOMMS, SYSTEMALARMS_ALARM_CRITICAL); - - // Main task loop - while (1) { - PIOS_WDG_UpdateFlag(PIOS_WDG_AHRS); - AhrsCommStatus stat; - - AhrsSendObjects(); - AhrsGetStatus(&stat); - if (stat.linkOk) { - AlarmsClear(SYSTEMALARMS_ALARM_AHRSCOMMS); - } else { - AlarmsSet(SYSTEMALARMS_ALARM_AHRSCOMMS, SYSTEMALARMS_ALARM_WARNING); - } - InsStatusData sData; - InsStatusGet(&sData); - - sData.LinkRunning = stat.linkOk; - sData.AhrsKickstarts = stat.remote.kickStarts; - sData.AhrsCrcErrors = stat.remote.crcErrors; - sData.AhrsRetries = stat.remote.retries; - sData.AhrsInvalidPackets = stat.remote.invalidPacket; - sData.OpCrcErrors = stat.local.crcErrors; - sData.OpRetries = stat.local.retries; - sData.OpInvalidPackets = stat.local.invalidPacket; - - InsStatusSet(&sData); - /* Wait for the next update interval */ - vTaskDelayUntil(&lastSysTime, 2 / portTICK_RATE_MS); - - } -} - -/** - * @} - * @} - */ diff --git a/flight/Modules/AHRSComms/inc/ahrs_comms.h b/flight/Modules/AHRSComms/inc/ahrs_comms.h deleted file mode 100644 index 6dd6c2a1a..000000000 --- a/flight/Modules/AHRSComms/inc/ahrs_comms.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotModules OpenPilot Modules - * @{ - * @addtogroup AHRSCommsModule AHRSComms Module - * @{ - * - * @file ahrs_comms.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Module to handle all comms to the AHRS on a periodic basis. - * - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#ifndef AHRS_COMMS_H -#define AHRS_COMMS_H - -#include "openpilot.h" - -int32_t AHRSCommsInitialize(void); - -#endif // AHRS_COMMS_H diff --git a/flight/PiOS/Boards/STM32103CB_AHRS.h b/flight/PiOS/Boards/STM32103CB_AHRS.h deleted file mode 100644 index 1852d60fb..000000000 --- a/flight/PiOS/Boards/STM32103CB_AHRS.h +++ /dev/null @@ -1,243 +0,0 @@ - /** - ****************************************************************************** - * - * @file pios_board.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Defines board hardware for the OpenPilot Version 1.1 hardware. - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef STM32103CB_AHRS_H_ -#define STM32103CB_AHRS_H_ - -//------------------------ -// Timers and Channels Used -//------------------------ -/* -Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4 -------+-----------+-----------+-----------+---------- -TIM1 | | | | -TIM2 | --------------- PIOS_DELAY ----------------- -TIM3 | | | | -TIM4 | | | | -TIM5 | | | | -TIM6 | | | | -TIM7 | | | | -TIM8 | | | | -------+-----------+-----------+-----------+---------- -*/ - -//------------------------ -// DMA Channels Used -//------------------------ -/* Channel 1 - */ -/* Channel 2 - */ -/* Channel 3 - */ -/* Channel 4 - */ -/* Channel 5 - */ -/* Channel 6 - */ -/* Channel 7 - */ -/* Channel 8 - */ -/* Channel 9 - */ -/* Channel 10 - */ -/* Channel 11 - */ -/* Channel 12 - */ - - -//------------------------ -// BOOTLOADER_SETTINGS -//------------------------ -#define BOARD_READABLE TRUE -#define BOARD_WRITABLE TRUE -#define MAX_DEL_RETRYS 3 - -//------------------------ -// PIOS_LED -//------------------------ -#define PIOS_LED_HEARTBEAT 0 - -//------------------------- -// System Settings -//------------------------- -#define PIOS_MASTER_CLOCK 72000000 -#define PIOS_PERIPHERAL_CLOCK (PIOS_MASTER_CLOCK / 2) - -//------------------------- -// Interrupt Priorities -//------------------------- -#define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS -#define PIOS_IRQ_PRIO_MID 8 // higher than RTOS -#define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc... -#define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc... - -//------------------------ -// PIOS_I2C -// See also pios_board.c -//------------------------ -#define PIOS_I2C_MAX_DEVS 1 -extern uint32_t pios_i2c_main_adapter_id; -#define PIOS_I2C_MAIN_ADAPTER (pios_i2c_main_adapter_id) - -//------------------------- -// SPI -// -// See also pios_board.c -//------------------------- -#define PIOS_SPI_MAX_DEVS 1 - -//------------------------- -// PIOS_USART -//------------------------- -#define PIOS_USART_MAX_DEVS 2 - -//------------------------- -// PIOS_COM -// -// See also pios_board.c -//------------------------- -#define PIOS_COM_MAX_DEVS 2 - -extern uint32_t pios_com_aux_id; -#define PIOS_COM_AUX (pios_com_aux_id) -#define PIOS_COM_DEBUG PIOS_COM_AUX - -//------------------------- -// ADC -// PIOS_ADC_PinGet(0) = Accel Z -// PIOS_ADC_PinGet(2) = Accel Y -// PIOS_ADC_PinGet(4) = Accel X -// PIOS_ADC_PinGet(1) = Gyro X -// PIOS_ADC_PinGet(3) = Gyro Y -// PIOS_ADC_PinGet(5) = Gyro Z -// PIOS_ADC_PinGet(6) = XY Temp -// PIOS_ADC_PinGet(7) = Z Temp -//------------------------- -//#define PIOS_ADC_OVERSAMPLING_RATE 1 -#define PIOS_ADC_USE_TEMP_SENSOR 0 -#define PIOS_ADC_TEMP_SENSOR_ADC ADC1 -#define PIOS_ADC_TEMP_SENSOR_ADC_CHANNEL 1 - -#define PIOS_ADC_PIN1_GPIO_PORT GPIOA // PA2 (Accel X) -#define PIOS_ADC_PIN1_GPIO_PIN GPIO_Pin_2 // ADC12_IN2 -#define PIOS_ADC_PIN1_GPIO_CHANNEL ADC_Channel_2 -#define PIOS_ADC_PIN1_ADC ADC1 -#define PIOS_ADC_PIN1_ADC_NUMBER 1 - -#define PIOS_ADC_PIN2_GPIO_PORT GPIOA // PA1 (Accel Y) -#define PIOS_ADC_PIN2_GPIO_PIN GPIO_Pin_1 // ADC123_IN1 -#define PIOS_ADC_PIN2_GPIO_CHANNEL ADC_Channel_1 -#define PIOS_ADC_PIN2_ADC ADC1 -#define PIOS_ADC_PIN2_ADC_NUMBER 2 - -#define PIOS_ADC_PIN3_GPIO_PORT GPIOA // PA0 (Accel Z) -#define PIOS_ADC_PIN3_GPIO_PIN GPIO_Pin_0 // ADC12_IN0 -#define PIOS_ADC_PIN3_GPIO_CHANNEL ADC_Channel_0 -#define PIOS_ADC_PIN3_ADC ADC1 -#define PIOS_ADC_PIN3_ADC_NUMBER 3 - -#define PIOS_ADC_PIN4_GPIO_PORT GPIOA // PA6 (Temp_XY) -#define PIOS_ADC_PIN4_GPIO_PIN GPIO_Pin_6 // ADC12_IN6 -#define PIOS_ADC_PIN4_GPIO_CHANNEL ADC_Channel_6 -#define PIOS_ADC_PIN4_ADC ADC1 -#define PIOS_ADC_PIN4_ADC_NUMBER 4 - -#define PIOS_ADC_PIN5_GPIO_PORT GPIOA // PA4 (Gyro X) -#define PIOS_ADC_PIN5_GPIO_PIN GPIO_Pin_4 // ADC12_IN4 -#define PIOS_ADC_PIN5_GPIO_CHANNEL ADC_Channel_4 -#define PIOS_ADC_PIN5_ADC ADC2 -#define PIOS_ADC_PIN5_ADC_NUMBER 1 - -#define PIOS_ADC_PIN6_GPIO_PORT GPIOA // PA5 (Gyro Y) -#define PIOS_ADC_PIN6_GPIO_PIN GPIO_Pin_5 // ADC12_IN5 -#define PIOS_ADC_PIN6_GPIO_CHANNEL ADC_Channel_5 -#define PIOS_ADC_PIN6_ADC ADC2 -#define PIOS_ADC_PIN6_ADC_NUMBER 2 - -#define PIOS_ADC_PIN7_GPIO_PORT GPIOA // PA7 (Gyro Z) -#define PIOS_ADC_PIN7_GPIO_PIN GPIO_Pin_7 // ADC12_IN7 -#define PIOS_ADC_PIN7_GPIO_CHANNEL ADC_Channel_7 -#define PIOS_ADC_PIN7_ADC ADC2 -#define PIOS_ADC_PIN7_ADC_NUMBER 3 - -#define PIOS_ADC_PIN8_GPIO_PORT GPIOB // PB1 (Z Temp) -#define PIOS_ADC_PIN8_GPIO_PIN GPIO_Pin_1 // ADC12_IN9 -#define PIOS_ADC_PIN8_GPIO_CHANNEL ADC_Channel_9 -#define PIOS_ADC_PIN8_ADC ADC2 -#define PIOS_ADC_PIN8_ADC_NUMBER 4 - -#define PIOS_ADC_NUM_PINS 8 - -#define PIOS_ADC_PORTS { PIOS_ADC_PIN1_GPIO_PORT, PIOS_ADC_PIN2_GPIO_PORT, PIOS_ADC_PIN3_GPIO_PORT, PIOS_ADC_PIN4_GPIO_PORT, PIOS_ADC_PIN5_GPIO_PORT, PIOS_ADC_PIN6_GPIO_PORT, PIOS_ADC_PIN7_GPIO_PORT, PIOS_ADC_PIN8_GPIO_PORT } -#define PIOS_ADC_PINS { PIOS_ADC_PIN1_GPIO_PIN, PIOS_ADC_PIN2_GPIO_PIN, PIOS_ADC_PIN3_GPIO_PIN, PIOS_ADC_PIN4_GPIO_PIN, PIOS_ADC_PIN5_GPIO_PIN, PIOS_ADC_PIN6_GPIO_PIN, PIOS_ADC_PIN7_GPIO_PIN, PIOS_ADC_PIN8_GPIO_PIN } -#define PIOS_ADC_CHANNELS { PIOS_ADC_PIN1_GPIO_CHANNEL, PIOS_ADC_PIN2_GPIO_CHANNEL, PIOS_ADC_PIN3_GPIO_CHANNEL, PIOS_ADC_PIN4_GPIO_CHANNEL, PIOS_ADC_PIN5_GPIO_CHANNEL, PIOS_ADC_PIN6_GPIO_CHANNEL, PIOS_ADC_PIN7_GPIO_CHANNEL, PIOS_ADC_PIN8_GPIO_CHANNEL } -#define PIOS_ADC_MAPPING { PIOS_ADC_PIN1_ADC, PIOS_ADC_PIN2_ADC, PIOS_ADC_PIN3_ADC, PIOS_ADC_PIN4_ADC, PIOS_ADC_PIN5_ADC, PIOS_ADC_PIN6_ADC, PIOS_ADC_PIN7_ADC, PIOS_ADC_PIN8_ADC } -#define PIOS_ADC_CHANNEL_MAPPING { PIOS_ADC_PIN1_ADC_NUMBER, PIOS_ADC_PIN2_ADC_NUMBER, PIOS_ADC_PIN3_ADC_NUMBER, PIOS_ADC_PIN4_ADC_NUMBER, PIOS_ADC_PIN5_ADC_NUMBER, PIOS_ADC_PIN6_ADC_NUMBER, PIOS_ADC_PIN7_ADC_NUMBER, PIOS_ADC_PIN8_ADC_NUMBER } -#define PIOS_ADC_NUM_CHANNELS (PIOS_ADC_NUM_PINS + PIOS_ADC_USE_TEMP_SENSOR) -#define PIOS_ADC_NUM_ADC_CHANNELS 2 -#define PIOS_ADC_USE_ADC2 1 -#define PIOS_ADC_ADCCLK RCC_PCLK2_Div2 -#define PIOS_ADC_PCLK2 RCC_HCLK_Div16 -#define PIOS_ADC_CLOCK_FUNCTION RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2, ENABLE); RCC_PCLK2Config(PIOS_ADC_PCLK2); -/* RCC_PCLK2_Div2: ADC clock = PCLK2/2 */ -/* RCC_PCLK2_Div4: ADC clock = PCLK2/4 */ -/* RCC_PCLK2_Div6: ADC clock = PCLK2/6 */ -/* RCC_PCLK2_Div8: ADC clock = PCLK2/8 */ -#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_239Cycles5 -/* Sample time: */ -/* With an ADCCLK = 14 MHz and a sampling time of 239.5 cycles: */ -/* Tconv = 239.5 + 12.5 = 252 cycles = 18�s */ -/* (1 / (ADCCLK / CYCLES)) = Sample Time (�S) */ -#define PIOS_ADC_IRQ_PRIO PIOS_IRQ_PRIO_LOW - -// Currently analog acquistion hard coded at 480 Hz -// PCKL2 = HCLK / 16 -// ADCCLK = PCLK2 / 2 -#define PIOS_ADC_RATE (72.0e6 / 16 / 2 / 252 / (PIOS_ADC_NUM_PINS / 2)) -#define EKF_RATE (PIOS_ADC_RATE / adc_oversampling / 2) -#define PIOS_ADC_MAX_OVERSAMPLING 50 - -//------------------------- -// GPIO -//------------------------- -#define PIOS_GPIO_1_PORT GPIOB -#define PIOS_GPIO_1_PIN GPIO_Pin_9 -#define PIOS_GPIO_1_GPIO_CLK RCC_APB2Periph_GPIOB -#define PIOS_GPIO_PORTS { PIOS_GPIO_1_PORT } -#define PIOS_GPIO_PINS { PIOS_GPIO_1_PIN } -#define PIOS_GPIO_CLKS { PIOS_GPIO_1_GPIO_CLK } -#define PIOS_GPIO_NUM 1 -#define SET_ACCEL_2G PIOS_GPIO_On(0); -#define SET_ACCEL_6G PIOS_GPIO_Off(0) - -//------------------------ -// PIOS_HMC5843 -//------------------------ -#define PIOS_HMC5843_DRDY_GPIO_PORT GPIOB -#define PIOS_HMC5843_DRDY_GPIO_PIN GPIO_Pin_8 -#define PIOS_HMC5843_DRDY_PORT_SOURCE GPIO_PortSourceGPIOB -#define PIOS_HMC5843_DRDY_PIN_SOURCE GPIO_PinSource8 -#define PIOS_HMC5843_DRDY_CLK RCC_APB2Periph_GPIOB -#define PIOS_HMC5843_DRDY_EXTI_LINE EXTI_Line8 -#define PIOS_HMC5843_DRDY_IRQn EXTI9_5_IRQn -#define PIOS_HMC5843_DRDY_PRIO PIOS_IRQ_PRIO_HIGH - - - -#endif /* STM32103CB_AHRS_H_ */ diff --git a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h index 292594ee9..f5ba3b067 100644 --- a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h @@ -275,4 +275,4 @@ extern uint32_t pios_com_debug_id; #define PIOS_USB_DETECT_GPIO_PORT GPIOC #define PIOS_USB_MAX_DEVS 1 #define PIOS_USB_DETECT_GPIO_PIN GPIO_Pin_15 -#endif /* STM32103CB_AHRS_H_ */ +#endif /* STM32103CB_CC_H_ */ diff --git a/flight/PiOS/Boards/pios_board.h b/flight/PiOS/Boards/pios_board.h index aced5f898..9a2340e2e 100644 --- a/flight/PiOS/Boards/pios_board.h +++ b/flight/PiOS/Boards/pios_board.h @@ -1,9 +1,7 @@ #ifndef PIOS_BOARD_H_ #define PIOS_BOARD_H_ -#ifdef USE_STM32103CB_AHRS -#include "STM32103CB_AHRS.h" -#elif USE_STM3210E_OP +#ifdef USE_STM3210E_OP #include "STM3210E_OP.h" #elif USE_STM32103CB_PIPXTREME #include "STM32103CB_PIPXTREME_Rev1.h" diff --git a/flight/PiOS/Common/pios_opahrs.c b/flight/PiOS/Common/pios_opahrs.c deleted file mode 100644 index c97691aec..000000000 --- a/flight/PiOS/Common/pios_opahrs.c +++ /dev/null @@ -1,343 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup PIOS_OPAHRS OPAHRS Functions - * @brief HAL code to interface to the OpenPilot AHRS module - * @{ - * - * @file pios_opahrs.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Hardware commands to communicate with the AHRS - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* Project Includes */ -#include "pios.h" - -#if defined(PIOS_INCLUDE_OPAHRS) - -#include "pios_opahrs_proto.h" -#include "pios_opahrs.h" - -/** - * Initialise the OpenPilot AHRS - */ -void PIOS_OPAHRS_Init(void) -{ - PIOS_SPI_SetClockSpeed(PIOS_OPAHRS_SPI, PIOS_SPI_PRESCALER_8); -} - -static int32_t opahrs_msg_txrx(const uint8_t * tx, uint8_t * rx, uint32_t len) -{ - int32_t rc; - - PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 0); -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(1 / portTICK_RATE_MS); -#else - PIOS_DELAY_WaitmS(20); -#endif - rc = PIOS_SPI_TransferBlock(PIOS_OPAHRS_SPI, tx, rx, len, NULL); - PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 1); - return (rc); -} - -static enum opahrs_result opahrs_msg_v1_send_req(const struct opahrs_msg_v1 *req) -{ - int32_t rc; - struct opahrs_msg_v1 link_rx; - - for (uint8_t retries = 0; retries < 20; retries++) { - struct opahrs_msg_v1 *rsp = &link_rx; - - if ((rc = opahrs_msg_txrx((const uint8_t *)req, (uint8_t *) rsp, sizeof(*rsp))) < 0) { - return OPAHRS_RESULT_FAILED; - } - - /* Make sure we got a sane response by checking the magic */ - if ((rsp->head.magic != OPAHRS_MSG_MAGIC_HEAD) || (rsp->tail.magic != OPAHRS_MSG_MAGIC_TAIL)) { - return OPAHRS_RESULT_FAILED; - } - - switch (rsp->head.type) { - case OPAHRS_MSG_TYPE_LINK: - switch (rsp->payload.link.state) { - case OPAHRS_MSG_LINK_STATE_BUSY: - case OPAHRS_MSG_LINK_STATE_INACTIVE: - /* Wait for a small delay and retry */ -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(1 / portTICK_RATE_MS); -#else - PIOS_DELAY_WaitmS(20); -#endif - continue; - case OPAHRS_MSG_LINK_STATE_READY: - /* Peer was ready when we Tx'd so they have now Rx'd our message */ - return OPAHRS_RESULT_OK; - } - break; - case OPAHRS_MSG_TYPE_USER_V0: - case OPAHRS_MSG_TYPE_USER_V1: - /* Wait for a small delay and retry */ -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(1 / portTICK_RATE_MS); -#else - PIOS_DELAY_WaitmS(50); -#endif - continue; - } - } - - return OPAHRS_RESULT_TIMEOUT; -} - -static enum opahrs_result opahrs_msg_v1_recv_rsp(enum opahrs_msg_v1_tag tag, struct opahrs_msg_v1 *rsp) -{ - struct opahrs_msg_v1 link_tx; - - opahrs_msg_v1_init_link_tx(&link_tx, OPAHRS_MSG_LINK_TAG_NOP); - - for (uint8_t retries = 0; retries < 20; retries++) { - if (opahrs_msg_txrx((const uint8_t *)&link_tx, (uint8_t *) rsp, sizeof(*rsp)) < 0) { - return OPAHRS_RESULT_FAILED; - } - - /* Make sure we got a sane response by checking the magic */ - if ((rsp->head.magic != OPAHRS_MSG_MAGIC_HEAD) || (rsp->tail.magic != OPAHRS_MSG_MAGIC_TAIL)) { - return OPAHRS_RESULT_FAILED; - } - - switch (rsp->head.type) { - case OPAHRS_MSG_TYPE_LINK: - switch (rsp->payload.link.state) { - case OPAHRS_MSG_LINK_STATE_BUSY: - /* Wait for a small delay and retry */ -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(1 / portTICK_RATE_MS); -#else - PIOS_DELAY_WaitmS(20); -#endif - continue; - case OPAHRS_MSG_LINK_STATE_INACTIVE: - case OPAHRS_MSG_LINK_STATE_READY: - /* somehow, we've missed our response */ - return OPAHRS_RESULT_FAILED; - } - break; - case OPAHRS_MSG_TYPE_USER_V0: - /* This isn't the type we expected */ - return OPAHRS_RESULT_FAILED; - break; - case OPAHRS_MSG_TYPE_USER_V1: - if (rsp->payload.user.t == tag) { - return OPAHRS_RESULT_OK; - } else { - return OPAHRS_RESULT_FAILED; - } - break; - } - } - - return OPAHRS_RESULT_TIMEOUT; -} - -static enum opahrs_result PIOS_OPAHRS_v1_simple_req(enum opahrs_msg_v1_tag req_type, struct opahrs_msg_v1 *rsp, enum opahrs_msg_v1_tag rsp_type) -{ - struct opahrs_msg_v1 req; - enum opahrs_result rc; - - /* Make up an empty request */ - opahrs_msg_v1_init_user_tx(&req, req_type); - - /* Send the message until it is received */ - rc = opahrs_msg_v1_send_req(&req); - if ((rc == OPAHRS_RESULT_OK) && rsp) { - /* We need a specific kind of reply, go get it */ - return opahrs_msg_v1_recv_rsp(rsp_type, rsp); - } - - return rc; -} - -enum opahrs_result PIOS_OPAHRS_GetSerial(struct opahrs_msg_v1 *rsp) -{ - if (!rsp) - return OPAHRS_RESULT_FAILED; - - return (PIOS_OPAHRS_v1_simple_req(OPAHRS_MSG_V1_REQ_SERIAL, rsp, OPAHRS_MSG_V1_RSP_SERIAL)); -} - -enum opahrs_result PIOS_OPAHRS_resync(void) -{ - struct opahrs_msg_v1 req; - struct opahrs_msg_v1 rsp; - - enum opahrs_result rc = OPAHRS_RESULT_FAILED; - - opahrs_msg_v1_init_link_tx(&req, OPAHRS_MSG_LINK_TAG_NOP); - - PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 0); -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(1 / portTICK_RATE_MS); -#else - PIOS_DELAY_WaitmS(20); -#endif - - for (uint32_t i = 0; i < sizeof(req); i++) { - /* Tx a shortened (by one byte) message to walk through all byte positions */ - opahrs_msg_v1_init_rx(&rsp); - PIOS_SPI_TransferBlock(PIOS_OPAHRS_SPI, (uint8_t *) & req, (uint8_t *) & rsp, sizeof(req) - 1, NULL); - - /* Good magic means we're sync'd */ - if ((rsp.head.magic == OPAHRS_MSG_MAGIC_HEAD) && (rsp.tail.magic == OPAHRS_MSG_MAGIC_TAIL)) { - /* We need to shift out one more byte to compensate for the short tx */ - PIOS_SPI_TransferByte(PIOS_OPAHRS_SPI, 0x00); - rc = OPAHRS_RESULT_OK; - break; - } -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(1 / portTICK_RATE_MS); -#else - PIOS_DELAY_WaitmS(10); -#endif - } - - PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 1); - //vTaskDelay(5 / portTICK_RATE_MS); - - return rc; -} - -enum opahrs_result PIOS_OPAHRS_GetAttitudeRaw(struct opahrs_msg_v1 *rsp) -{ - if (!rsp) - return OPAHRS_RESULT_FAILED; - - return (PIOS_OPAHRS_v1_simple_req(OPAHRS_MSG_V1_REQ_ATTITUDERAW, rsp, OPAHRS_MSG_V1_RSP_ATTITUDERAW)); -} - -extern enum opahrs_result PIOS_OPAHRS_SetAlgorithm(struct opahrs_msg_v1 *req) -{ - struct opahrs_msg_v1 rsp; - enum opahrs_result rc; - - if (!req) - return OPAHRS_RESULT_FAILED; - - /* Make up an attituderaw request */ - opahrs_msg_v1_init_user_tx(req, OPAHRS_MSG_V1_REQ_ALGORITHM); - - /* Send the message until it is received */ - rc = opahrs_msg_v1_send_req(req); - if (rc != OPAHRS_RESULT_OK) { - /* Failed to send the request, bail out */ - return rc; - } - - return opahrs_msg_v1_recv_rsp(OPAHRS_MSG_V1_RSP_ALGORITHM, &rsp); -} - -enum opahrs_result PIOS_OPAHRS_SetMagNorth(struct opahrs_msg_v1 *req) -{ - struct opahrs_msg_v1 rsp; - enum opahrs_result rc; - - if (!req) - return OPAHRS_RESULT_FAILED; - - /* Make up an attituderaw request */ - opahrs_msg_v1_init_user_tx(req, OPAHRS_MSG_V1_REQ_NORTH); - - /* Send the message until it is received */ - rc = opahrs_msg_v1_send_req(req); - if (rc != OPAHRS_RESULT_OK) { - /* Failed to send the request, bail out */ - return rc; - } - - return opahrs_msg_v1_recv_rsp(OPAHRS_MSG_V1_RSP_NORTH, &rsp); -} - -enum opahrs_result PIOS_OPAHRS_SetGetUpdate(struct opahrs_msg_v1 *req, struct opahrs_msg_v1 *rsp) -{ - enum opahrs_result rc; - - if (!req) - return OPAHRS_RESULT_FAILED; - - /* Make up an attituderaw request */ - opahrs_msg_v1_init_user_tx(req, OPAHRS_MSG_V1_REQ_UPDATE); - - /* Send the message until it is received */ - rc = opahrs_msg_v1_send_req(req); - if (rc != OPAHRS_RESULT_OK) { - /* Failed to send the request, bail out */ - return rc; - } - - return opahrs_msg_v1_recv_rsp(OPAHRS_MSG_V1_RSP_UPDATE, rsp); -} - -enum opahrs_result PIOS_OPAHRS_SetGetCalibration(struct opahrs_msg_v1 *req, struct opahrs_msg_v1 *rsp) -{ - enum opahrs_result rc; - - if (!req) - return OPAHRS_RESULT_FAILED; - - /* Make up an attituderaw request */ - opahrs_msg_v1_init_user_tx(req, OPAHRS_MSG_V1_REQ_CALIBRATION); - - /* Send the message until it is received */ - rc = opahrs_msg_v1_send_req(req); - if (rc != OPAHRS_RESULT_OK) { - /* Failed to send the request, bail out */ - return rc; - } - - return opahrs_msg_v1_recv_rsp(OPAHRS_MSG_V1_RSP_CALIBRATION, rsp); -} - -enum opahrs_result PIOS_OPAHRS_SetGetInitialized(struct opahrs_msg_v1 *req, struct opahrs_msg_v1 *rsp) -{ - enum opahrs_result rc; - - if (!req) - return OPAHRS_RESULT_FAILED; - - /* Make up an attituderaw request */ - opahrs_msg_v1_init_user_tx(req, OPAHRS_MSG_V1_REQ_INITIALIZED); - - /* Send the message until it is received */ - rc = opahrs_msg_v1_send_req(req); - if (rc != OPAHRS_RESULT_OK) { - /* Failed to send the request, bail out */ - return rc; - } - - return opahrs_msg_v1_recv_rsp(OPAHRS_MSG_V1_RSP_INITIALIZED, rsp); -} - -#endif /* PIOS_INCLUDE_OPAHRS */ - -/** - * @} - * @} - */ diff --git a/flight/PiOS/Common/pios_opahrs_proto.c b/flight/PiOS/Common/pios_opahrs_proto.c deleted file mode 100644 index b4c7f822c..000000000 --- a/flight/PiOS/Common/pios_opahrs_proto.c +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup PIOS_OPAHRS OPAHRS Functions - * @{ - * - * @file pios_opahrs_proto.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief PPM Input functions - * @see The GNU Public License (GPL) Version 3 - * - */ - -#include "pios_opahrs_proto.h" -#include /* memset */ - -void opahrs_msg_v0_init_rx(struct opahrs_msg_v0 *msg) -{ - /* Make sure we start with bad magic in the rx buffer */ - msg->head.magic = 0; - msg->head.type = 0; - msg->tail.magic = 0; -} - -void opahrs_msg_v0_init_user_tx(struct opahrs_msg_v0 *msg, enum opahrs_msg_v0_tag tag) -{ - msg->head.magic = OPAHRS_MSG_MAGIC_HEAD; - msg->head.type = OPAHRS_MSG_TYPE_USER_V0; - - msg->payload.user.t = tag; - - msg->tail.magic = OPAHRS_MSG_MAGIC_TAIL; -} - -void opahrs_msg_v0_init_link_tx(struct opahrs_msg_v0 *msg, enum opahrs_msg_link_tag tag) -{ - msg->head.magic = OPAHRS_MSG_MAGIC_HEAD; - msg->head.type = OPAHRS_MSG_TYPE_LINK; - - msg->payload.link.t = tag; - - msg->tail.magic = OPAHRS_MSG_MAGIC_TAIL; -} - -void opahrs_msg_v1_init_rx(struct opahrs_msg_v1 *msg) -{ - /* Make sure we start with bad magic in the rx buffer */ - msg->head.magic = 0; - msg->head.type = 0; - msg->tail.magic = 0; -} - -void opahrs_msg_v1_init_user_tx(struct opahrs_msg_v1 *msg, enum opahrs_msg_v1_tag tag) -{ - msg->head.magic = OPAHRS_MSG_MAGIC_HEAD; - msg->head.type = OPAHRS_MSG_TYPE_USER_V1; - - msg->payload.user.t = tag; - - msg->tail.magic = OPAHRS_MSG_MAGIC_TAIL; -} - -void opahrs_msg_v1_init_link_tx(struct opahrs_msg_v1 *msg, enum opahrs_msg_link_tag tag) -{ - msg->head.magic = OPAHRS_MSG_MAGIC_HEAD; - msg->head.type = OPAHRS_MSG_TYPE_LINK; - - msg->payload.link.t = tag; - - msg->tail.magic = OPAHRS_MSG_MAGIC_TAIL; -} - -/** - * @} - * @} - */ diff --git a/flight/PiOS/Common/pios_opahrs_v0.c b/flight/PiOS/Common/pios_opahrs_v0.c deleted file mode 100644 index 3dbc71a1d..000000000 --- a/flight/PiOS/Common/pios_opahrs_v0.c +++ /dev/null @@ -1,330 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup PIOS_OPAHRS OPAHRS Functions - * @brief HAL code to interface to the OpenPilot AHRS module's bootloader - * @{ - * - * @file pios_opahrs_download.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Hardware commands to communicate with the AHRS bootloader - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* Project Includes */ -#include "pios.h" - -#if defined(PIOS_INCLUDE_OPAHRS) - -#include "pios_opahrs_proto.h" -#include "pios_opahrs.h" - -static uint32_t PIOS_OPAHRS_SPI; - -void PIOS_OPAHRS_Attach(uint32_t spi_id) -{ - PIOS_OPAHRS_SPI = spi_id; -} - -void PIOS_OPAHRS_ForceSlaveSelected(bool selected) -{ - if (selected) { - PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 0); - } else { - PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 1); - } -} - -static int32_t opahrs_msg_txrx(const uint8_t * tx, uint8_t * rx, uint32_t len) -{ - int32_t rc; - - PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 0); -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(20 / portTICK_RATE_MS); -#else - PIOS_DELAY_WaitmS(1); -#endif - rc = PIOS_SPI_TransferBlock(PIOS_OPAHRS_SPI, tx, rx, len, NULL); - PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 1); - return (rc); -} - -static enum opahrs_result opahrs_msg_v0_send_req(const struct opahrs_msg_v0 *req) -{ - int32_t rc; - struct opahrs_msg_v0 link_rx; - - for (uint8_t retries = 0; retries < 20; retries++) { - struct opahrs_msg_v0 *rsp = &link_rx; - - if ((rc = opahrs_msg_txrx((const uint8_t *)req, (uint8_t *) rsp, sizeof(*rsp))) < 0) { - return OPAHRS_RESULT_FAILED; - } - - /* Make sure we got a sane response by checking the magic */ - if ((rsp->head.magic != OPAHRS_MSG_MAGIC_HEAD) || (rsp->tail.magic != OPAHRS_MSG_MAGIC_TAIL)) { - return OPAHRS_RESULT_FAILED; - } - - switch (rsp->head.type) { - case OPAHRS_MSG_TYPE_LINK: - switch (rsp->payload.link.state) { - case OPAHRS_MSG_LINK_STATE_BUSY: - case OPAHRS_MSG_LINK_STATE_INACTIVE: - /* Wait for a small delay and retry */ -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(20 / portTICK_RATE_MS); -#else - //PIOS_DELAY_WaitmS(1); -#endif - continue; - case OPAHRS_MSG_LINK_STATE_READY: - /* Peer was ready when we Tx'd so they have now Rx'd our message */ - return OPAHRS_RESULT_OK; - } - break; - case OPAHRS_MSG_TYPE_USER_V0: - case OPAHRS_MSG_TYPE_USER_V1: - /* Wait for a small delay and retry */ -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(50 / portTICK_RATE_MS); -#else - //PIOS_DELAY_WaitmS(1); -#endif - continue; - } - } - - return OPAHRS_RESULT_TIMEOUT; -} - -static enum opahrs_result opahrs_msg_v0_recv_rsp(enum opahrs_msg_v0_tag tag, struct opahrs_msg_v0 *rsp) -{ - struct opahrs_msg_v0 link_tx; - - opahrs_msg_v0_init_link_tx(&link_tx, OPAHRS_MSG_LINK_TAG_NOP); - - for (uint8_t retries = 0; retries < 20; retries++) { - if (opahrs_msg_txrx((const uint8_t *)&link_tx, (uint8_t *) rsp, sizeof(*rsp)) < 0) { - return OPAHRS_RESULT_FAILED; - } - - /* Make sure we got a sane response by checking the magic */ - if ((rsp->head.magic != OPAHRS_MSG_MAGIC_HEAD) || (rsp->tail.magic != OPAHRS_MSG_MAGIC_TAIL)) { - return OPAHRS_RESULT_FAILED; - } - - switch (rsp->head.type) { - case OPAHRS_MSG_TYPE_LINK: - switch (rsp->payload.link.state) { - case OPAHRS_MSG_LINK_STATE_BUSY: - /* Wait for a small delay and retry */ -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(20 / portTICK_RATE_MS); -#else - PIOS_DELAY_WaitmS(1); -#endif - continue; - case OPAHRS_MSG_LINK_STATE_INACTIVE: - case OPAHRS_MSG_LINK_STATE_READY: - /* somehow, we've missed our response */ - return OPAHRS_RESULT_FAILED; - } - break; - case OPAHRS_MSG_TYPE_USER_V0: - if (rsp->payload.user.t == tag) { - return OPAHRS_RESULT_OK; - } else { - return OPAHRS_RESULT_FAILED; - } - break; - case OPAHRS_MSG_TYPE_USER_V1: - /* This isn't the type we expected */ - return OPAHRS_RESULT_FAILED; - break; - } - } - - return OPAHRS_RESULT_TIMEOUT; -} - -static enum opahrs_result PIOS_OPAHRS_v0_simple_req(enum opahrs_msg_v0_tag req_type, struct opahrs_msg_v0 *rsp, enum opahrs_msg_v0_tag rsp_type) -{ - struct opahrs_msg_v0 req; - enum opahrs_result rc; - - /* Make up an empty request */ - opahrs_msg_v0_init_user_tx(&req, req_type); - - /* Send the message until it is received */ - - rc = opahrs_msg_v0_send_req(&req); - if ((rc == OPAHRS_RESULT_OK) && rsp) { - /* We need a specific kind of reply, go get it */ - return opahrs_msg_v0_recv_rsp(rsp_type, rsp); - } - - return rc; -} - -enum opahrs_result PIOS_OPAHRS_bl_GetVersions(struct opahrs_msg_v0 *rsp) -{ - if (!rsp) - return OPAHRS_RESULT_FAILED; - - return (PIOS_OPAHRS_v0_simple_req(OPAHRS_MSG_V0_REQ_VERSIONS, rsp, OPAHRS_MSG_V0_RSP_VERSIONS)); -} - -enum opahrs_result PIOS_OPAHRS_bl_GetMemMap(struct opahrs_msg_v0 *rsp) -{ - if (!rsp) - return OPAHRS_RESULT_FAILED; - - return (PIOS_OPAHRS_v0_simple_req(OPAHRS_MSG_V0_REQ_MEM_MAP, rsp, OPAHRS_MSG_V0_RSP_MEM_MAP)); -} - -enum opahrs_result PIOS_OPAHRS_bl_GetSerial(struct opahrs_msg_v0 *rsp) -{ - if (!rsp) - return OPAHRS_RESULT_FAILED; - - return (PIOS_OPAHRS_v0_simple_req(OPAHRS_MSG_V0_REQ_SERIAL, rsp, OPAHRS_MSG_V0_RSP_SERIAL)); -} - -enum opahrs_result PIOS_OPAHRS_bl_FwupStart(struct opahrs_msg_v0 *rsp) -{ - if (!rsp) - return OPAHRS_RESULT_FAILED; - return (PIOS_OPAHRS_v0_simple_req(OPAHRS_MSG_V0_REQ_FWUP_START, rsp, OPAHRS_MSG_V0_RSP_FWUP_STATUS)); -} - -enum opahrs_result PIOS_OPAHRS_bl_FwupStatus(struct opahrs_msg_v0 *rsp) -{ - if (!rsp) - return OPAHRS_RESULT_FAILED; - return (PIOS_OPAHRS_v0_simple_req(OPAHRS_MSG_V0_REQ_FWUP_STATUS, rsp, OPAHRS_MSG_V0_RSP_FWUP_STATUS)); -} - -enum opahrs_result PIOS_OPAHRS_bl_FwupData(struct opahrs_msg_v0 *req, struct opahrs_msg_v0 *rsp) -{ - if (!req || !rsp) - return OPAHRS_RESULT_FAILED; - - /* Make up an attituderaw request */ - opahrs_msg_v0_init_user_tx(req, OPAHRS_MSG_V0_REQ_FWUP_DATA); - enum opahrs_result rc; - /* Send the message until it is received */ - rc = opahrs_msg_v0_send_req(req); - if (rc != OPAHRS_RESULT_OK) { - /* Failed to send the request, bail out */ - return rc; - } - - return opahrs_msg_v0_recv_rsp(OPAHRS_MSG_V0_RSP_FWUP_STATUS, rsp); -} - -enum opahrs_result PIOS_OPAHRS_bl_FwDlData(struct opahrs_msg_v0 *req, struct opahrs_msg_v0 *rsp) -{ - if (!req || !rsp) - return OPAHRS_RESULT_FAILED; - - /* Make up an attituderaw request */ - opahrs_msg_v0_init_user_tx(req, OPAHRS_MSG_V0_REQ_FWDN_DATA); - enum opahrs_result rc; - /* Send the message until it is received */ - rc = opahrs_msg_v0_send_req(req); - if (rc != OPAHRS_RESULT_OK) { - /* Failed to send the request, bail out */ - return rc; - } - - return opahrs_msg_v0_recv_rsp(OPAHRS_MSG_V0_RSP_FWDN_DATA, rsp); -} - -enum opahrs_result PIOS_OPAHRS_bl_FwupVerify(struct opahrs_msg_v0 *rsp) -{ - if (!rsp) - return OPAHRS_RESULT_FAILED; - - return (PIOS_OPAHRS_v0_simple_req(OPAHRS_MSG_V0_REQ_FWUP_VERIFY, rsp, OPAHRS_MSG_V0_RSP_FWUP_STATUS)); -} - -enum opahrs_result PIOS_OPAHRS_bl_resync(void) -{ - struct opahrs_msg_v0 req; - struct opahrs_msg_v0 rsp; - - enum opahrs_result rc = OPAHRS_RESULT_FAILED; - - opahrs_msg_v0_init_link_tx(&req, OPAHRS_MSG_LINK_TAG_NOP); - - PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 0); -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(20 / portTICK_RATE_MS); -#else - //PIOS_DELAY_WaitmS(1); -#endif - - for (uint32_t i = 0; i < sizeof(req); i++) { - /* Tx a shortened (by one byte) message to walk through all byte positions */ - opahrs_msg_v0_init_rx(&rsp); - PIOS_SPI_TransferBlock(PIOS_OPAHRS_SPI, (uint8_t *) & req, (uint8_t *) & rsp, sizeof(req) - 1, NULL); - - /* Good magic means we're sync'd */ - if ((rsp.head.magic == OPAHRS_MSG_MAGIC_HEAD) && (rsp.tail.magic == OPAHRS_MSG_MAGIC_TAIL)) { - /* We need to shift out one more byte to compensate for the short tx */ - PIOS_SPI_TransferByte(PIOS_OPAHRS_SPI, 0x00); - rc = OPAHRS_RESULT_OK; - break; - } -#ifdef PIOS_INCLUDE_FREERTOS - vTaskDelay(10 / portTICK_RATE_MS); -#else - PIOS_DELAY_WaitmS(1); -#endif - } - - PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 1); - //vTaskDelay(5 / portTICK_RATE_MS); - - return rc; -} - -enum opahrs_result PIOS_OPAHRS_bl_reset(uint32_t delay) -{ - struct opahrs_msg_v0 req; - /* Make up an attituderaw request */ - opahrs_msg_v0_init_user_tx(&req, OPAHRS_MSG_V0_REQ_RESET); - req.payload.user.v.req.reset.reset_delay_in_ms = delay; - /* Send the message until it is received */ - return opahrs_msg_v0_send_req(&req); -} - -enum opahrs_result PIOS_OPAHRS_bl_boot(uint32_t delay) -{ - struct opahrs_msg_v0 req; - /* Make up an attituderaw request */ - opahrs_msg_v0_init_user_tx(&req, OPAHRS_MSG_V0_REQ_BOOT); - req.payload.user.v.req.boot.boot_delay_in_ms = delay; - /* Send the message until it is received */ - return opahrs_msg_v0_send_req(&req); -} -#endif /* PIOS_INCLUDE_OPAHRS */ diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld deleted file mode 100644 index d411c3e4f..000000000 --- a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld +++ /dev/null @@ -1,56 +0,0 @@ -_estack = 0x20004FF0; - -/* Section Definitions */ -SECTIONS -{ - .text : - { - PROVIDE (pios_isr_vector_table_base = .); - KEEP(*(.isr_vector .isr_vector.*)) - *(.text .text.* .gnu.linkonce.t.*) - *(.glue_7t) *(.glue_7) - *(.rodata .rodata* .gnu.linkonce.r.*) - } > BL_FLASH - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > BL_FLASH - - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > BL_FLASH - - . = ALIGN(4); - _etext = .; - _sidata = .; - - .data : AT (_etext) - { - _sdata = .; - *(.data .data.*) - . = ALIGN(4); - _edata = . ; - } > SRAM - - /* .bss section which is used for uninitialized data */ - .bss (NOLOAD) : - { - _sbss = . ; - *(.bss .bss.*) - *(COMMON) - . = ALIGN(4); - _ebss = . ; - } > SRAM - - . = ALIGN(4); - _end = . ; - - .boardinfo : - { - . = ALIGN(4); - KEEP(*(.boardinfo)) - . = ALIGN(4); - } > BD_INFO -} diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_memory.ld b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_memory.ld deleted file mode 100644 index 9f7bf0f19..000000000 --- a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_memory.ld +++ /dev/null @@ -1,7 +0,0 @@ -MEMORY -{ - BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x02000 - 0x00080 - BD_INFO (r) : ORIGIN = 0x08002000 - 0x80, LENGTH = 0x00080 - FLASH (rx) : ORIGIN = 0x08002000, LENGTH = 0x20000 - 0x02000 - SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x05000 -} diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld deleted file mode 100644 index dd814f561..000000000 --- a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld +++ /dev/null @@ -1,51 +0,0 @@ -PROVIDE(pios_board_info_blob = ORIGIN(BD_INFO)); - -_estack = 0x20004FF0; - -/* Section Definitions */ -SECTIONS -{ - .text : - { - PROVIDE (pios_isr_vector_table_base = .); - KEEP(*(.isr_vector .isr_vector.*)) - *(.text .text.* .gnu.linkonce.t.*) - *(.glue_7t) *(.glue_7) - *(.rodata .rodata* .gnu.linkonce.r.*) - } > FLASH - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > FLASH - - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > FLASH - - . = ALIGN(4); - _etext = .; - _sidata = .; - - .data : AT (_etext) - { - _sdata = .; - *(.data .data.*) - . = ALIGN(4); - _edata = . ; - } > SRAM - - /* .bss section which is used for uninitialized data */ - .bss (NOLOAD) : - { - _sbss = . ; - *(.bss .bss.*) - *(COMMON) - . = ALIGN(4); - _ebss = . ; - } > SRAM - - . = ALIGN(4); - _end = . ; -} diff --git a/flight/PiOS/inc/pios_opahrs.h b/flight/PiOS/inc/pios_opahrs.h deleted file mode 100644 index 3b995ba7a..000000000 --- a/flight/PiOS/inc/pios_opahrs.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup PIOS_OPAHRS OPAHRS Functions - * @{ - * - * @file pios_opahrs.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief OpenPilot AHRS functions header. - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PIOS_OPAHRS_H -#define PIOS_OPAHRS_H - -#include "pios_opahrs_proto.h" /* opahrs message structs */ - -enum opahrs_result { - OPAHRS_RESULT_OK = 0, - OPAHRS_RESULT_TIMEOUT, - OPAHRS_RESULT_FAILED, -}; - -extern void PIOS_OPAHRS_Attach(uint32_t spi_id); -extern void PIOS_OPAHRS_ForceSlaveSelected(bool selected); - -/* - * Protocol V0 messages used to talk to bootloaders - */ - -extern enum opahrs_result PIOS_OPAHRS_bl_GetVersions(struct opahrs_msg_v0 *rsp); -extern enum opahrs_result PIOS_OPAHRS_bl_GetSerial(struct opahrs_msg_v0 *rsp); -extern enum opahrs_result PIOS_OPAHRS_bl_FwupStart(struct opahrs_msg_v0 *rsp); -extern enum opahrs_result PIOS_OPAHRS_bl_FwupStatus(struct opahrs_msg_v0 *rsp); -extern enum opahrs_result PIOS_OPAHRS_bl_FwupData(struct opahrs_msg_v0 *req, struct opahrs_msg_v0 *rsp); -extern enum opahrs_result PIOS_OPAHRS_bl_FwupVerify(struct opahrs_msg_v0 *rsp); -extern enum opahrs_result PIOS_OPAHRS_bl_resync(void); -extern enum opahrs_result PIOS_OPAHRS_bl_GetMemMap(struct opahrs_msg_v0 *rsp); -extern enum opahrs_result PIOS_OPAHRS_bl_reset(uint32_t delay); -extern enum opahrs_result PIOS_OPAHRS_bl_boot(uint32_t delay); -extern enum opahrs_result PIOS_OPAHRS_bl_FwDlData(struct opahrs_msg_v0 *req, struct opahrs_msg_v0 *rsp); -/* - * Protocol V1 messages used by application - */ -extern enum opahrs_result PIOS_OPAHRS_Sync(struct opahrs_msg_v1 *rsp); -extern enum opahrs_result PIOS_OPAHRS_GetSerial(struct opahrs_msg_v1 *rsp); -extern enum opahrs_result PIOS_OPAHRS_SetGetUpdate(struct opahrs_msg_v1 *rsp, struct opahrs_msg_v1 *req); -extern enum opahrs_result PIOS_OPAHRS_GetAttitudeRaw(struct opahrs_msg_v1 *rsp); -extern enum opahrs_result PIOS_OPAHRS_SetAlgorithm(struct opahrs_msg_v1 *req); -extern enum opahrs_result PIOS_OPAHRS_SetMagNorth(struct opahrs_msg_v1 *req); -extern enum opahrs_result PIOS_OPAHRS_SetGetCalibration(struct opahrs_msg_v1 *req, struct opahrs_msg_v1 *rsp); -extern enum opahrs_result PIOS_OPAHRS_SetGetInitialized(struct opahrs_msg_v1 *req, struct opahrs_msg_v1 *rsp); -extern enum opahrs_result PIOS_OPAHRS_resync(void); - -#endif /* PIOS_OPAHRS_H */ - -/** - * @} - * @} - */ diff --git a/flight/PiOS/inc/pios_opahrs_proto.h b/flight/PiOS/inc/pios_opahrs_proto.h deleted file mode 100644 index 554ed00e5..000000000 --- a/flight/PiOS/inc/pios_opahrs_proto.h +++ /dev/null @@ -1,406 +0,0 @@ -/** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup PIOS_OPAHRS OPAHRS Functions - * @{ - * - * @file pios_opahrs_proto.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief PPM Input functions - * @see The GNU Public License (GPL) Version 3 - * - */ - -#ifndef PIOS_OPAHRS_PROTO_H -#define PIOS_OPAHRS_PROTO_H - -#include - -enum opahrs_msg_type { - OPAHRS_MSG_TYPE_LINK = 0x00, - - OPAHRS_MSG_TYPE_USER_V0, - OPAHRS_MSG_TYPE_USER_V1, -}; - -enum opahrs_msg_link_state { - OPAHRS_MSG_LINK_STATE_INACTIVE, - OPAHRS_MSG_LINK_STATE_BUSY, - OPAHRS_MSG_LINK_STATE_READY, -}; - -#define OPAHRS_MSG_MAGIC_HEAD 0x53524841 /* ASCII "AHRS" */ -struct opahrs_msg_link_head { - uint32_t magic; /* Set to OPAHRS_MSG_MAGIC_HEAD */ - enum opahrs_msg_type type; -} __attribute__ ((__packed__)); - -#define OPAHRS_MSG_MAGIC_TAIL 0xFEFE -struct opahrs_msg_link_tail { - uint16_t magic; - uint8_t crc8; -} __attribute__ ((__packed__)); - -enum opahrs_msg_link_tag { - OPAHRS_MSG_LINK_TAG_NOP, -}; - -#define SPI_MSG_LINK_ERROR_BADCRC 0x00000001 -struct opahrs_msg_link { - enum opahrs_msg_link_state state; - uint16_t errors; - - enum opahrs_msg_link_tag t; - union { - } v; -} __attribute__ ((__packed__)); - -/******** - * SPI protocol v0 definitions - * - * This protocol version is NOT to be changed after release since it is the - * protocol used for upgrading the firmware of AHRS boards that are already - * in end user hands. - * - ********/ - -struct opahrs_msg_v0_req_nop { -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_req_versions { -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_req_reset { - uint32_t reset_delay_in_ms; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_req_boot { - uint32_t boot_delay_in_ms; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_req_serial { -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_req_fwup_start { -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_req_fwup_status { -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_req_fwup_data { - uint32_t adress; - uint32_t data[14]; - uint8_t size; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_req_fwdn_data { - uint32_t adress; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_req_mem_map { -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_req_fwup_verify { -} __attribute__ ((__packed__)); - -union opahrs_msg_v0_req { - struct opahrs_msg_v0_req_nop nop; - struct opahrs_msg_v0_req_versions versions; - struct opahrs_msg_v0_req_reset reset; - struct opahrs_msg_v0_req_boot boot; - struct opahrs_msg_v0_req_serial serial; - struct opahrs_msg_v0_req_fwup_status status_req; - struct opahrs_msg_v0_req_fwdn_data fwdn_data; - struct opahrs_msg_v0_req_mem_map mem_map; - struct opahrs_msg_v0_req_fwup_start fwup_start; - struct opahrs_msg_v0_req_fwup_data fwup_data; - struct opahrs_msg_v0_req_fwup_verify fwup_verify; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_rsp_fwdn_data { - uint8_t data[4]; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_rsp_versions { - uint16_t hw_version; - uint16_t bl_version; - uint32_t fw_crc; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0_rsp_serial { - uint8_t serial_bcd[24]; -} __attribute__ ((__packed__)); - -enum bootloader_status { idle, started, start_failed, write_error, outside_dev_capabilities, jump_failed }; -struct opahrs_msg_v0_rsp_fwup_status { - enum bootloader_status status; -} __attribute__ ((__packed__)); - -enum hw_density { high_density, medium_density }; -struct opahrs_msg_v0_rsp_mem_map { - uint32_t start_of_user_code; - uint32_t size_of_code_memory; - uint8_t size_of_description; - uint8_t rw_flags; - enum hw_density density; -} __attribute__ ((__packed__)); - -union opahrs_msg_v0_rsp { - struct opahrs_msg_v0_rsp_versions versions; - struct opahrs_msg_v0_rsp_serial serial; - struct opahrs_msg_v0_rsp_fwup_status fwup_status; - struct opahrs_msg_v0_rsp_mem_map mem_map; - struct opahrs_msg_v0_rsp_fwdn_data fw_dn; -} __attribute__ ((__packed__)); - -enum opahrs_msg_v0_tag { - OPAHRS_MSG_V0_REQ_NOP = 0x00, - OPAHRS_MSG_V0_REQ_VERSIONS, - OPAHRS_MSG_V0_REQ_RESET, - OPAHRS_MSG_V0_REQ_BOOT, - OPAHRS_MSG_V0_REQ_SERIAL, - OPAHRS_MSG_V0_REQ_FWDN_DATA, - OPAHRS_MSG_V0_REQ_MEM_MAP, - - OPAHRS_MSG_V0_REQ_FWUP_START, - OPAHRS_MSG_V0_REQ_FWUP_DATA, - OPAHRS_MSG_V0_REQ_FWUP_VERIFY, - OPAHRS_MSG_V0_REQ_FWUP_STATUS, - - OPAHRS_MSG_V0_RSP_VERSIONS, - OPAHRS_MSG_V0_RSP_SERIAL, - OPAHRS_MSG_V0_RSP_FWUP_STATUS, - OPAHRS_MSG_V0_RSP_FWDN_DATA, - OPAHRS_MSG_V0_RSP_MEM_MAP, -}; - -struct opahrs_msg_v0_payload { - enum opahrs_msg_v0_tag t; - union { - union opahrs_msg_v0_req req; - union opahrs_msg_v0_rsp rsp; - } v; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v0 { - struct opahrs_msg_link_head head; - union { - struct opahrs_msg_link link; - struct opahrs_msg_v0_payload user; - } payload; - struct opahrs_msg_link_tail tail; -} __attribute__ ((__packed__)); - -/******** - * SPI protocol v1 definitions - ********/ - -struct opahrs_msg_v1_req_nop { -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_req_versions { -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_req_reset { - uint32_t reset_delay_in_ms; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_req_serial { -} __attribute__ ((__packed__)); - -enum initialized_mode { AHRS_UNINITIALIZED, AHRS_INITIALIZED, AHRS_INIT_QUERY }; - -struct opahrs_msg_v1_req_initialized { - enum initialized_mode initialized; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_req_north { - float Be[3]; -} __attribute__ ((__packed__)); - -enum algorithms { SIMPLE_Algo, INSGPS_Algo }; - -struct opahrs_msg_v1_req_algorithm { - enum algorithms algorithm; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_req_update { - struct { - uint8_t updated; - float NED[3]; - float groundspeed; - float heading; - float quality; - } gps; - struct { - uint8_t updated; - float altitude; - } barometer; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_req_attituderaw { -} __attribute__ ((__packed__)); - -enum measure_mode { AHRS_SET, AHRS_MEASURE, AHRS_ECHO }; - -struct opahrs_msg_v1_req_calibration { - enum measure_mode measure_var; - float accel_bias[3]; - float accel_scale[3]; - float accel_var[3]; - float gyro_bias[3]; - float gyro_scale[3]; - float gyro_var[3]; - float mag_bias[3]; - float mag_scale[3]; - float mag_var[3]; -} __attribute__ ((__packed__)); - -union opahrs_msg_v1_req { - struct opahrs_msg_v1_req_nop nop; - struct opahrs_msg_v1_req_versions versions; - struct opahrs_msg_v1_req_reset reset; - struct opahrs_msg_v1_req_initialized initialized; - struct opahrs_msg_v1_req_serial serial; - struct opahrs_msg_v1_req_update update; - struct opahrs_msg_v1_req_algorithm algorithm; - struct opahrs_msg_v1_req_north north; - struct opahrs_msg_v1_req_attituderaw attituderaw; - struct opahrs_msg_v1_req_calibration calibration; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_rsp_versions { - uint8_t hw_version; - uint16_t bl_version; - uint32_t fw_crc; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_rsp_serial { - uint8_t serial_bcd[25]; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_rsp_initialized { - enum initialized_mode initialized; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_rsp_north { -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_rsp_algorithm { -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_rsp_attituderaw { - struct { - int16_t x; - int16_t y; - int16_t z; - } mags; - struct { - uint16_t x; - uint16_t y; - uint16_t z; - uint16_t xy_temp; - uint16_t z_temp; - } gyros; - struct { - float x; - float y; - float z; - } gyros_filtered; - struct { - uint16_t x; - uint16_t y; - uint16_t z; - } accels; - struct { - float x; - float y; - float z; - } accels_filtered; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_rsp_update { - struct { - float q1; - float q2; - float q3; - float q4; - } quaternion; - int32_t NED[3]; - int32_t Vel[3]; - uint8_t load; - uint8_t idle_time; - uint8_t run_time; - uint8_t dropped_updates; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1_rsp_calibration { - float accel_var[3]; - float gyro_var[3]; - float mag_var[3]; -} __attribute__ ((__packed__)); - -union opahrs_msg_v1_rsp { - struct opahrs_msg_v1_rsp_versions versions; - struct opahrs_msg_v1_rsp_serial serial; - struct opahrs_msg_v1_rsp_initialized initialized; - struct opahrs_msg_v1_rsp_north north; - struct opahrs_msg_v1_rsp_algorithm algorithm; - struct opahrs_msg_v1_rsp_attituderaw attituderaw; - struct opahrs_msg_v1_rsp_update update; - struct opahrs_msg_v1_rsp_calibration calibration; -} __attribute__ ((__packed__)); - -enum opahrs_msg_v1_tag { - OPAHRS_MSG_V1_REQ_NOP = 0x02000000, - OPAHRS_MSG_V1_REQ_VERSIONS, - OPAHRS_MSG_V1_REQ_RESET, - OPAHRS_MSG_V1_REQ_SERIAL, - OPAHRS_MSG_V1_REQ_INITIALIZED, - OPAHRS_MSG_V1_REQ_NORTH, - OPAHRS_MSG_V1_REQ_ALGORITHM, - OPAHRS_MSG_V1_REQ_UPDATE, - OPAHRS_MSG_V1_REQ_ATTITUDERAW, - OPAHRS_MSG_V1_REQ_CALIBRATION, - - OPAHRS_MSG_V1_RSP_VERSIONS, - OPAHRS_MSG_V1_RSP_SERIAL, - OPAHRS_MSG_V1_RSP_INITIALIZED, - OPAHRS_MSG_V1_RSP_NORTH, - OPAHRS_MSG_V1_RSP_ALGORITHM, - OPAHRS_MSG_V1_RSP_UPDATE, - OPAHRS_MSG_V1_RSP_ATTITUDERAW, - OPAHRS_MSG_V1_RSP_CALIBRATION, -}; - -struct opahrs_msg_v1_payload { - enum opahrs_msg_v1_tag t; - union { - union opahrs_msg_v1_req req; - union opahrs_msg_v1_rsp rsp; - } v; -} __attribute__ ((__packed__)); - -struct opahrs_msg_v1 { - struct opahrs_msg_link_head head; - union { - struct opahrs_msg_link link; - struct opahrs_msg_v1_payload user; - } payload; - struct opahrs_msg_link_tail tail; -} __attribute__ ((__packed__)); - -/* Helper functions for setting up messages */ -extern void opahrs_msg_v0_init_rx(struct opahrs_msg_v0 *msg); -extern void opahrs_msg_v0_init_user_tx(struct opahrs_msg_v0 *msg, enum opahrs_msg_v0_tag tag); -extern void opahrs_msg_v0_init_link_tx(struct opahrs_msg_v0 *msg, enum opahrs_msg_link_tag tag); -extern void opahrs_msg_v1_init_rx(struct opahrs_msg_v1 *msg); -extern void opahrs_msg_v1_init_user_tx(struct opahrs_msg_v1 *msg, enum opahrs_msg_v1_tag tag); -extern void opahrs_msg_v1_init_link_tx(struct opahrs_msg_v1 *msg, enum opahrs_msg_link_tag tag); - -#endif /* PIOS_OPAHRS_PROTO_H */ - -/** - * @} - * @} - */ diff --git a/flight/Project/OpenOCD/foss-jtag.revb.ahrs.cfg b/flight/Project/OpenOCD/foss-jtag.revb.ahrs.cfg deleted file mode 100644 index a2214c6f4..000000000 --- a/flight/Project/OpenOCD/foss-jtag.revb.ahrs.cfg +++ /dev/null @@ -1,15 +0,0 @@ -# -# Floss JTAG OpenPilot -# - -interface ft2232 -ft2232_vid_pid 0x0403 0x6010 -#ft2232_device_desc "Dual RS232-HS" -#ft2232_bus_addr "002:088" -#ft2232_serial "1234567890" -ft2232_layout "usbjtag" -ft2232_latency 2 - -gdb_port 3334 -tcl_port 6666 -telnet_port 4444 diff --git a/make/boards/ahrs/board-info.mk b/make/boards/ahrs/board-info.mk deleted file mode 100644 index 85135ea25..000000000 --- a/make/boards/ahrs/board-info.mk +++ /dev/null @@ -1,20 +0,0 @@ -BOARD_TYPE := 0x02 -BOARD_REVISION := 0x01 -BOOTLOADER_VERSION := 0x00 -HW_TYPE := 0x00 - -MCU := cortex-m3 -CHIP := STM32F103CBT -BOARD := STM32103CB_AHRS -MODEL := MD -MODEL_SUFFIX := - -OPENOCD_CONFIG := stm32f1x.cfg - -# Note: These must match the values in link_$(BOARD)_memory.ld -BL_BANK_BASE := 0x08000000 # Start of bootloader flash -BL_BANK_SIZE := 0x00002000 # Should include BD_INFO region -FW_BANK_BASE := 0x08002000 # Start of firmware flash -FW_BANK_SIZE := 0x0001E000 # Should include FW_DESC_SIZE - -FW_DESC_SIZE := 0x00000064 From 39363d9efac2e0f7791a1348077a4254ce9fa600 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Fri, 15 Mar 2013 08:19:33 +0200 Subject: [PATCH 03/68] pios: main pios.h header cleanup Conflicts: flight/PiOS/pios.h --- flight/PiOS/pios.h | 316 +++++++++++++++++++++++++++++---------------- 1 file changed, 208 insertions(+), 108 deletions(-) diff --git a/flight/PiOS/pios.h b/flight/PiOS/pios.h index 924f7d16b..73a0815e3 100644 --- a/flight/PiOS/pios.h +++ b/flight/PiOS/pios.h @@ -1,13 +1,10 @@ /** ****************************************************************************** - * * @file pios.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2013 * @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012 - * @brief Main PiOS header. - * - Central header for the project. + * @brief Main PiOS header. * @see The GNU Public License (GPL) Version 3 - * *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify @@ -25,162 +22,265 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* + * To add new PIOS options, drivers or functions please insert their + * includes below into a corresponding group. If new driver has optional + * features, add them as comments before including the driver header. + * Finally update all pios_config.h files for every board in the same order + * as in this file. Include new definition and all options, but comment + * out unused ones. + */ #ifndef PIOS_H #define PIOS_H + +/* Used in pios_*.* files macro */ +#define NELEMENTS(x) (sizeof(x) / sizeof((x)[0])) + #ifdef USE_SIM_POSIX +/* SimPosix version of this file. This will probably be removed later */ #include #else -/* PIOS Feature Selection */ -#include "pios_config.h" -#if defined(PIOS_INCLUDE_FREERTOS) -/* FreeRTOS Includes */ -#include "FreeRTOS.h" -#include "task.h" -#include "queue.h" -#include "semphr.h" -#endif - -/* C Lib Includes */ +/* C Lib includes */ #include #include #include #include #include -#include "pios_config.h" -/* STM32 Std Perf Lib */ -#if defined(STM32F4XX) -# include -# include -#elif defined(STM32F2XX) -#include -#include +/* STM32 Std Peripherals Lib */ +#ifdef STM32F4XX +#include +#include #else #include #endif -#if defined(PIOS_INCLUDE_SDCARD) -/* Dosfs Includes */ -#include +/* PIOS board specific feature selection */ +#include "pios_config.h" -/* Mass Storage Device Includes */ -//#include -#endif - -/* Generic initcall infrastructure */ -#if defined(PIOS_INCLUDE_INITCALL) -#include "pios_initcall.h" -#endif - -/* PIOS Board Specific Device Configuration */ +/* PIOS board specific device configuration */ #include "pios_board.h" -/* PIOS Hardware Includes (STM32F10x) */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +/* PIOS debug interface */ +/* #define PIOS_INCLUDE_DEBUG_CONSOLE */ +/* #define DEBUG_LEVEL 0 */ #include -#include -#include -#include -/* PIOS Hardware Includes (Common) */ -#include -#include -#if defined(PIOS_INCLUDE_MPXV) -#include +/* PIOS common functions */ +#include + +/* PIOS system functions */ +#ifdef PIOS_INCLUDE_FREERTOS +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" +#include "semphr.h" #endif -#if defined(PIOS_INCLUDE_ETASV3) -#include +#ifdef PIOS_INCLUDE_DELAY +#include #endif -#if defined(PIOS_INCLUDE_BMP085) -#include +#ifdef PIOS_INCLUDE_INITCALL +#include "pios_initcall.h" #endif -#if defined(PIOS_INCLUDE_HCSR04) -#include +#ifdef PIOS_INCLUDE_SYS +#include #endif -#if defined(PIOS_INCLUDE_HMC5843) -#include + +/* PIOS hardware peripherals */ +#ifdef PIOS_INCLUDE_IRQ +#include #endif -#if defined(PIOS_INCLUDE_HMC5883) -#include +#ifdef PIOS_INCLUDE_RTC +#include #endif -#if defined(PIOS_INCLUDE_I2C_ESC) -#include +#ifdef PIOS_INCLUDE_TIM +#include #endif -#if defined(PIOS_INCLUDE_IMU3000) -#include +#ifdef PIOS_INCLUDE_USART +#include #endif -#if defined(PIOS_INCLUDE_MPU6050) -#include +#ifdef PIOS_INCLUDE_ADC +#include #endif -#if defined(PIOS_INCLUDE_MPU6000) -#include +#ifdef PIOS_INCLUDE_I2C +#include #endif -#if defined(PIOS_INCLUDE_L3GD20) -#include +#ifdef PIOS_INCLUDE_SPI +#include #endif -#if defined(PIOS_INCLUDE_MS5611) -#include +#ifdef PIOS_INCLUDE_GPIO +#include #endif -#if defined(PIOS_INCLUDE_IAP) -#include +#ifdef PIOS_INCLUDE_EXTI +#include #endif -#if defined(PIOS_INCLUDE_ADXL345) +#ifdef PIOS_INCLUDE_WDG +#include +#endif + +/* PIOS USB functions */ +#ifdef PIOS_INCLUDE_USB +/* #define PIOS_INCLUDE_USB_HID */ +/* #define PIOS_INCLUDE_USB_CDC */ +/* #define PIOS_INCLUDE_USB_RCTX */ +#include +#ifdef PIOS_INCLUDE_USB_HID +#include +#endif +#ifdef PIOS_INCLUDE_USB_RCTX +#include +#endif +#endif + +/* PIOS sensor interfaces */ +#ifdef PIOS_INCLUDE_ADXL345 +/* ADXL345 3-Axis Accelerometer */ #include #endif -#if defined(PIOS_INCLUDE_BMA180) +#ifdef PIOS_INCLUDE_BMA180 +/* BMA180 3-Axis Accelerometer */ #include #endif -#if defined(PIOS_INCLUDE_VIDEO) -#include +#ifdef PIOS_INCLUDE_L3GD20 +/* L3GD20 3-Axis Gyro */ +#include #endif -#if defined(PIOS_INCLUDE_WAVE) -#include +#ifdef PIOS_INCLUDE_MPU6000 +/* MPU6000 3-Axis Gyro/Accelerometer */ +/* #define PIOS_MPU6000_ACCEL */ +#include +#endif +#ifdef PIOS_INCLUDE_HMC5843 +/* HMC5843 3-Axis Digital Compass */ +#include +#endif +#ifdef PIOS_INCLUDE_HMC5883 +/* HMC5883 3-Axis Digital Compass */ +/* #define PIOS_HMC5883_HAS_GPIOS */ +#include +#endif +#ifdef PIOS_INCLUDE_BMP085 +/* BMP085 Barometric Pressure Sensor */ +#include +#endif +#ifdef PIOS_INCLUDE_MS5611 +/* MS5611 Barometric Pressure Sensor */ +#include +#endif +#ifdef PIOS_INCLUDE_MPXV +/* MPXV5004, MPXV7002 based Airspeed Sensor */ +#include +#endif +#ifdef PIOS_INCLUDE_ETASV3 +/* Eagle Tree Systems Airspeed MicroSensor V3 */ +#include +#endif +#ifdef PIOS_INCLUDE_HCSR04 +/* HC-SR04 Ultrasonic Sensor */ +#include #endif -#if defined(PIOS_INCLUDE_FLASH) +/* PIOS receiver drivers */ +#ifdef PIOS_INCLUDE_PWM +#include +#endif +#ifdef PIOS_INCLUDE_PPM +#include +#endif +#ifdef PIOS_INCLUDE_DSM +#include +#endif +#ifdef PIOS_INCLUDE_SBUS +#include +#endif +#ifdef PIOS_INCLUDE_GCSRCVR +/* only priv header */ +#endif + +/* PIOS common peripherals */ +#ifdef PIOS_INCLUDE_LED +#include +#endif +#ifdef PIOS_INCLUDE_IAP +#include +#endif +#ifdef PIOS_INCLUDE_SERVO +#include +#endif +#ifdef PIOS_INCLUDE_I2C_ESC +#include +#endif +#ifdef PIOS_INCLUDE_OVERO +/* #define PIOS_OVERO_SPI */ +#include +#endif +#ifdef PIOS_INCLUDE_SDCARD +/* #define LOG_FILENAME "startup.log" */ +#include +#include +#endif +#ifdef PIOS_INCLUDE_FLASH +/* #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS */ +/* #define FLASH_FREERTOS */ #include #include #endif - -#if defined(PIOS_INCLUDE_BL_HELPER) -#include +#ifdef PIOS_INCLUDE_FLASH_EEPROM +#include #endif - -#if defined(PIOS_INCLUDE_USB) -#include -#endif - -#if defined(PIOS_INCLUDE_RFM22B) -#include +#ifdef PIOS_INCLUDE_RFM22B +/* #define PIOS_INCLUDE_PACKET_HANDLER */ #ifdef PIOS_INCLUDE_RFM22B_COM #include #endif #ifdef PIOS_INCLUDE_RFM22B_RCVR #include #endif + +#include +#endif +#ifdef PIOS_INCLUDE_VIDEO +#include +#endif +#ifdef PIOS_INCLUDE_WAVE +#include +#endif +#ifdef PIOS_INCLUDE_UDP +#include #endif -#include +/* PIOS abstract receiver interface */ +#ifdef PIOS_INCLUDE_RCVR +#include +#endif -#define NELEMENTS(x) (sizeof(x) / sizeof(*(x))) -#endif /* USE_SIMPOSIX */ +/* PIOS abstract comms interface with options */ +#ifdef PIOS_INCLUDE_COM +/* #define PIOS_INCLUDE_COM_MSG */ +/* #define PIOS_INCLUDE_TELEMETRY_RF */ +/* #define PIOS_INCLUDE_COM_TELEM */ +/* #define PIOS_INCLUDE_COM_FLEXI */ +/* #define PIOS_INCLUDE_COM_AUX */ +/* #define PIOS_TELEM_PRIORITY_QUEUE */ +/* #define PIOS_INCLUDE_GPS */ +/* #define PIOS_GPS_MINIMAL */ +/* #define PIOS_INCLUDE_GPS_NMEA_PARSER */ +/* #define PIOS_INCLUDE_GPS_UBX_PARSER */ +/* #define PIOS_GPS_SETS_HOMELOCATION */ +#include +#endif + +/* PIOS bootloader helper */ +#ifdef PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +#include +#endif + +/* Performance counters */ +/* #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 995998 */ + + +#endif /* USE_SIM_POSIX */ #endif /* PIOS_H */ From fc6024d23e76a5821120a8d3e93fec7cdbe54a7f Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Fri, 15 Mar 2013 12:32:06 +0200 Subject: [PATCH 04/68] pios: pios_config.h cleanup (CopterControl) Conflicts: flight/targets/CopterControl/System/inc/pios_config.h --- flight/PiOS/pios.h | 61 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/flight/PiOS/pios.h b/flight/PiOS/pios.h index 73a0815e3..63329921e 100644 --- a/flight/PiOS/pios.h +++ b/flight/PiOS/pios.h @@ -71,19 +71,29 @@ /* PIOS common functions */ #include -/* PIOS system functions */ +/* PIOS bootloader helper */ +#ifdef PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +#include +#endif + +/* PIOS FreeRTOS support */ #ifdef PIOS_INCLUDE_FREERTOS #include "FreeRTOS.h" #include "task.h" #include "queue.h" #include "semphr.h" #endif + +/* PIOS system functions */ #ifdef PIOS_INCLUDE_DELAY #include #endif + #ifdef PIOS_INCLUDE_INITCALL #include "pios_initcall.h" #endif + #ifdef PIOS_INCLUDE_SYS #include #endif @@ -92,30 +102,39 @@ #ifdef PIOS_INCLUDE_IRQ #include #endif + #ifdef PIOS_INCLUDE_RTC #include #endif + #ifdef PIOS_INCLUDE_TIM #include #endif + #ifdef PIOS_INCLUDE_USART #include #endif + #ifdef PIOS_INCLUDE_ADC #include #endif + #ifdef PIOS_INCLUDE_I2C #include #endif + #ifdef PIOS_INCLUDE_SPI #include #endif + #ifdef PIOS_INCLUDE_GPIO #include #endif + #ifdef PIOS_INCLUDE_EXTI #include #endif + #ifdef PIOS_INCLUDE_WDG #include #endif @@ -139,44 +158,54 @@ /* ADXL345 3-Axis Accelerometer */ #include #endif + #ifdef PIOS_INCLUDE_BMA180 /* BMA180 3-Axis Accelerometer */ #include #endif + #ifdef PIOS_INCLUDE_L3GD20 /* L3GD20 3-Axis Gyro */ #include #endif + #ifdef PIOS_INCLUDE_MPU6000 /* MPU6000 3-Axis Gyro/Accelerometer */ /* #define PIOS_MPU6000_ACCEL */ #include #endif + #ifdef PIOS_INCLUDE_HMC5843 /* HMC5843 3-Axis Digital Compass */ #include #endif + #ifdef PIOS_INCLUDE_HMC5883 /* HMC5883 3-Axis Digital Compass */ /* #define PIOS_HMC5883_HAS_GPIOS */ #include #endif + #ifdef PIOS_INCLUDE_BMP085 /* BMP085 Barometric Pressure Sensor */ #include #endif + #ifdef PIOS_INCLUDE_MS5611 /* MS5611 Barometric Pressure Sensor */ #include #endif + #ifdef PIOS_INCLUDE_MPXV /* MPXV5004, MPXV7002 based Airspeed Sensor */ #include #endif + #ifdef PIOS_INCLUDE_ETASV3 /* Eagle Tree Systems Airspeed MicroSensor V3 */ #include #endif + #ifdef PIOS_INCLUDE_HCSR04 /* HC-SR04 Ultrasonic Sensor */ #include @@ -186,15 +215,19 @@ #ifdef PIOS_INCLUDE_PWM #include #endif + #ifdef PIOS_INCLUDE_PPM #include #endif + #ifdef PIOS_INCLUDE_DSM #include #endif + #ifdef PIOS_INCLUDE_SBUS #include #endif + #ifdef PIOS_INCLUDE_GCSRCVR /* only priv header */ #endif @@ -203,50 +236,65 @@ #ifdef PIOS_INCLUDE_LED #include #endif + #ifdef PIOS_INCLUDE_IAP #include #endif + #ifdef PIOS_INCLUDE_SERVO #include #endif + #ifdef PIOS_INCLUDE_I2C_ESC #include #endif + #ifdef PIOS_INCLUDE_OVERO /* #define PIOS_OVERO_SPI */ #include #endif + #ifdef PIOS_INCLUDE_SDCARD /* #define LOG_FILENAME "startup.log" */ #include #include #endif + #ifdef PIOS_INCLUDE_FLASH /* #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS */ /* #define FLASH_FREERTOS */ #include #include #endif + #ifdef PIOS_INCLUDE_FLASH_EEPROM #include #endif + +/* PIOS Radio modules */ #ifdef PIOS_INCLUDE_RFM22B /* #define PIOS_INCLUDE_PACKET_HANDLER */ +#include + #ifdef PIOS_INCLUDE_RFM22B_COM #include #endif + #ifdef PIOS_INCLUDE_RFM22B_RCVR #include #endif -#include -#endif +#endif /* PIOS_INCLUDE_RFM22B */ + +/* PIOS misc peripherals */ #ifdef PIOS_INCLUDE_VIDEO #include #endif + #ifdef PIOS_INCLUDE_WAVE #include #endif + #ifdef PIOS_INCLUDE_UDP #include #endif @@ -272,15 +320,8 @@ #include #endif -/* PIOS bootloader helper */ -#ifdef PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ -#include -#endif - /* Performance counters */ /* #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 995998 */ - #endif /* USE_SIM_POSIX */ #endif /* PIOS_H */ From e96f717b9426c691827568c0b250d726fe3b6c45 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Fri, 15 Mar 2013 13:09:19 +0200 Subject: [PATCH 05/68] pios: common PIOS header guards --- flight/PiOS/inc/pios_adxl345.h | 2 +- flight/PiOS/inc/pios_bl_helper.h | 6 +++--- flight/PiOS/inc/pios_bma180.h | 4 ++-- flight/PiOS/inc/pios_crc.h | 5 +++++ flight/PiOS/inc/pios_debug.h | 2 +- flight/PiOS/inc/pios_etasv3.h | 6 +++++- flight/PiOS/inc/pios_flash.h | 6 +++--- flight/PiOS/inc/pios_flash_internal_priv.h | 6 +++--- flight/PiOS/inc/pios_flash_jedec_priv.h | 6 +++--- flight/PiOS/inc/pios_flashfs.h | 6 +++--- flight/PiOS/inc/pios_flashfs_logfs_priv.h | 6 +++--- flight/PiOS/inc/pios_hmc5883.h | 3 +-- flight/PiOS/inc/pios_iap.h | 6 +++--- flight/PiOS/inc/pios_initcall.h | 1 + flight/PiOS/inc/pios_l3gd20.h | 2 -- flight/PiOS/inc/pios_mpu6000.h | 2 -- flight/PiOS/inc/pios_mpxv.h | 6 +++--- flight/PiOS/inc/pios_ms5611.h | 16 +++++++--------- flight/PiOS/inc/pios_posix.h | 3 +-- flight/PiOS/inc/pios_sdcard.h | 4 ---- flight/PiOS/inc/pios_spi_priv.h | 1 + flight/PiOS/inc/pios_struct_helper.h | 6 ++++++ flight/PiOS/inc/pios_usart.h | 2 -- flight/PiOS/inc/pios_usb_desc_hid_cdc_priv.h | 2 +- flight/PiOS/inc/pios_usb_desc_hid_only_priv.h | 2 +- flight/PiOS/inc/pios_usb_priv.h | 1 - flight/PiOS/inc/pios_usb_rctx.h | 5 +++++ flight/PiOS/inc/pios_video.h | 6 ------ flight/PiOS/inc/pios_wavplay.h | 9 ++------- flight/PiOS/inc/pios_wdg.h | 6 +++--- 30 files changed, 67 insertions(+), 71 deletions(-) diff --git a/flight/PiOS/inc/pios_adxl345.h b/flight/PiOS/inc/pios_adxl345.h index 4701aaf55..10022569f 100644 --- a/flight/PiOS/inc/pios_adxl345.h +++ b/flight/PiOS/inc/pios_adxl345.h @@ -75,7 +75,7 @@ uint8_t PIOS_ADXL345_Read(struct pios_adxl345_data * data); int32_t PIOS_ADXL345_FifoElements(); int32_t PIOS_ADXL345_Test(); -#endif +#endif /* PIOS_ADXL345_H */ /** * @} diff --git a/flight/PiOS/inc/pios_bl_helper.h b/flight/PiOS/inc/pios_bl_helper.h index e2e9e694e..668effd29 100644 --- a/flight/PiOS/inc/pios_bl_helper.h +++ b/flight/PiOS/inc/pios_bl_helper.h @@ -28,8 +28,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef PIOS_BL_HELPER_H_ -#define PIOS_BL_HELPER_H_ +#ifndef PIOS_BL_HELPER_H +#define PIOS_BL_HELPER_H extern uint8_t *PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress); @@ -43,4 +43,4 @@ extern uint8_t PIOS_BL_HELPER_FLASH_Start(); extern void PIOS_BL_HELPER_CRC_Ini(); -#endif /* PIOS_BL_HELPER_H_ */ +#endif /* PIOS_BL_HELPER_H */ diff --git a/flight/PiOS/inc/pios_bma180.h b/flight/PiOS/inc/pios_bma180.h index 51e65a6ec..84c310dd8 100644 --- a/flight/PiOS/inc/pios_bma180.h +++ b/flight/PiOS/inc/pios_bma180.h @@ -29,11 +29,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "fifo_buffer.h" - #ifndef PIOS_BMA180_H #define PIOS_BMA180_H +#include "fifo_buffer.h" + #include /* BMA180 Addresses */ diff --git a/flight/PiOS/inc/pios_crc.h b/flight/PiOS/inc/pios_crc.h index 612c89e49..7e35dee02 100644 --- a/flight/PiOS/inc/pios_crc.h +++ b/flight/PiOS/inc/pios_crc.h @@ -27,6 +27,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef PIOS_CRC_H +#define PIOS_CRC_H + uint8_t PIOS_CRC_updateByte(uint8_t crc, const uint8_t data); uint8_t PIOS_CRC_updateCRC(uint8_t crc, const uint8_t* data, int32_t length); @@ -35,3 +38,5 @@ uint16_t PIOS_CRC16_updateCRC(uint16_t crc, const uint8_t* data, int32_t length) uint32_t PIOS_CRC32_updateByte(uint32_t crc, const uint8_t data); uint32_t PIOS_CRC32_updateCRC(uint32_t crc, const uint8_t* data, int32_t length); + +#endif /* PIOS_CRC_H */ diff --git a/flight/PiOS/inc/pios_debug.h b/flight/PiOS/inc/pios_debug.h index aa3eb3332..0915ad071 100644 --- a/flight/PiOS/inc/pios_debug.h +++ b/flight/PiOS/inc/pios_debug.h @@ -37,9 +37,9 @@ extern const char *PIOS_DEBUG_AssertMsg; void PIOS_DEBUG_Init(void); #else #include - void PIOS_DEBUG_Init(const struct pios_tim_channel * channels, uint8_t num_channels); #endif + void PIOS_DEBUG_PinHigh(uint8_t pin); void PIOS_DEBUG_PinLow(uint8_t pin); void PIOS_DEBUG_PinValue8Bit(uint8_t value); diff --git a/flight/PiOS/inc/pios_etasv3.h b/flight/PiOS/inc/pios_etasv3.h index afa038d3d..fab354e5a 100644 --- a/flight/PiOS/inc/pios_etasv3.h +++ b/flight/PiOS/inc/pios_etasv3.h @@ -28,7 +28,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef PIOS_ETASV3_H +#define PIOS_ETASV3_H + #define ETASV3_I2C_ADDR 0x75 - int16_t PIOS_ETASV3_ReadAirspeed (void); + +#endif /* PIOS_ETASV3_H */ diff --git a/flight/PiOS/inc/pios_flash.h b/flight/PiOS/inc/pios_flash.h index 8ae69ab3f..a9de63593 100644 --- a/flight/PiOS/inc/pios_flash.h +++ b/flight/PiOS/inc/pios_flash.h @@ -24,8 +24,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef PIOS_FLASH_H_ -#define PIOS_FLASH_H_ +#ifndef PIOS_FLASH_H +#define PIOS_FLASH_H #include @@ -44,4 +44,4 @@ struct pios_flash_driver { int32_t (*read_data)(uintptr_t flash_id, uint32_t addr, uint8_t * data, uint16_t len); }; -#endif /* PIOS_FLASH_H_ */ +#endif /* PIOS_FLASH_H */ diff --git a/flight/PiOS/inc/pios_flash_internal_priv.h b/flight/PiOS/inc/pios_flash_internal_priv.h index 4c690fefb..15be5df5f 100644 --- a/flight/PiOS/inc/pios_flash_internal_priv.h +++ b/flight/PiOS/inc/pios_flash_internal_priv.h @@ -24,8 +24,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef PIOS_FLASH_INTERNAL_H_ -#define PIOS_FLASH_INTERNAL_H_ +#ifndef PIOS_FLASH_INTERNAL_H +#define PIOS_FLASH_INTERNAL_H #include "pios_flash.h" /* API definition for flash drivers */ @@ -37,4 +37,4 @@ struct pios_flash_internal_cfg { extern int32_t PIOS_Flash_Internal_Init(uintptr_t * flash_id, const struct pios_flash_internal_cfg * cfg); -#endif /* PIOS_FLASH_INTERNAL_H_ */ +#endif /* PIOS_FLASH_INTERNAL_H */ diff --git a/flight/PiOS/inc/pios_flash_jedec_priv.h b/flight/PiOS/inc/pios_flash_jedec_priv.h index 8b772c0b9..b1d4f369f 100644 --- a/flight/PiOS/inc/pios_flash_jedec_priv.h +++ b/flight/PiOS/inc/pios_flash_jedec_priv.h @@ -28,8 +28,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef PIOS_FLASH_JEDEC_H_ -#define PIOS_FLASH_JEDEC_H_ +#ifndef PIOS_FLASH_JEDEC_H +#define PIOS_FLASH_JEDEC_H #include "pios_flash.h" /* API definition for flash drivers */ @@ -49,4 +49,4 @@ struct pios_flash_jedec_cfg { int32_t PIOS_Flash_Jedec_Init(uintptr_t * flash_id, uint32_t spi_id, uint32_t slave_num, const struct pios_flash_jedec_cfg * cfg); -#endif /* PIOS_FLASH_JEDEC_H_ */ +#endif /* PIOS_FLASH_JEDEC_H */ diff --git a/flight/PiOS/inc/pios_flashfs.h b/flight/PiOS/inc/pios_flashfs.h index b59cac48f..073cf9490 100644 --- a/flight/PiOS/inc/pios_flashfs.h +++ b/flight/PiOS/inc/pios_flashfs.h @@ -24,8 +24,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef PIOS_FLASHFS_H_ -#define PIOS_FLASHFS_H_ +#ifndef PIOS_FLASHFS_H +#define PIOS_FLASHFS_H #include @@ -34,4 +34,4 @@ int32_t PIOS_FLASHFS_ObjSave(uint32_t fs_id, uint32_t obj_id, uint16_t obj_inst_ int32_t PIOS_FLASHFS_ObjLoad(uint32_t fs_id, uint32_t obj_id, uint16_t obj_inst_id, uint8_t * obj_data, uint16_t obj_size); int32_t PIOS_FLASHFS_ObjDelete(uint32_t fs_id, uint32_t obj_id, uint16_t obj_inst_id); -#endif /* PIOS_FLASHFS_H_ */ +#endif /* PIOS_FLASHFS_H */ diff --git a/flight/PiOS/inc/pios_flashfs_logfs_priv.h b/flight/PiOS/inc/pios_flashfs_logfs_priv.h index d948f4f76..88ce65109 100644 --- a/flight/PiOS/inc/pios_flashfs_logfs_priv.h +++ b/flight/PiOS/inc/pios_flashfs_logfs_priv.h @@ -24,8 +24,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef PIOS_FLASHFS_LOGFS_PRIV_H_ -#define PIOS_FLASHFS_LOGFS_PRIV_H_ +#ifndef PIOS_FLASHFS_LOGFS_PRIV_H +#define PIOS_FLASHFS_LOGFS_PRIV_H #include #include "pios_flash.h" /* struct pios_flash_driver */ @@ -43,4 +43,4 @@ struct flashfs_logfs_cfg { int32_t PIOS_FLASHFS_Logfs_Init(uintptr_t * fs_id, const struct flashfs_logfs_cfg * cfg, const struct pios_flash_driver * driver, uintptr_t flash_id); -#endif /* PIOS_FLASHFS_LOGFS_PRIV_H_ */ +#endif /* PIOS_FLASHFS_LOGFS_PRIV_H */ diff --git a/flight/PiOS/inc/pios_hmc5883.h b/flight/PiOS/inc/pios_hmc5883.h index daa9437b8..921b99d07 100644 --- a/flight/PiOS/inc/pios_hmc5883.h +++ b/flight/PiOS/inc/pios_hmc5883.h @@ -31,8 +31,6 @@ #ifndef PIOS_HMC5883_H #define PIOS_HMC5883_H -#include - /* HMC5883 Addresses */ #define PIOS_HMC5883_I2C_ADDR 0x1E #define PIOS_HMC5883_I2C_READ_ADDR 0x3D @@ -110,6 +108,7 @@ extern int32_t PIOS_HMC5883_ReadMag(int16_t out[3]); extern uint8_t PIOS_HMC5883_ReadID(uint8_t out[4]); extern int32_t PIOS_HMC5883_Test(void); extern bool PIOS_HMC5883_IRQHandler(); + #endif /* PIOS_HMC5883_H */ /** diff --git a/flight/PiOS/inc/pios_iap.h b/flight/PiOS/inc/pios_iap.h index d9b41170b..5ea916970 100644 --- a/flight/PiOS/inc/pios_iap.h +++ b/flight/PiOS/inc/pios_iap.h @@ -6,8 +6,8 @@ * Author: joe */ -#ifndef PIOS_IAP_H_ -#define PIOS_IAP_H_ +#ifndef PIOS_IAP_H +#define PIOS_IAP_H /**************************************************************************************** @@ -42,4 +42,4 @@ void PIOS_IAP_WriteBootCount(uint16_t); * Public Data ****************************************************************************************/ -#endif /* PIOS_IAP_H_ */ +#endif /* PIOS_IAP_H */ diff --git a/flight/PiOS/inc/pios_initcall.h b/flight/PiOS/inc/pios_initcall.h index 1f1dea393..410c3c72a 100644 --- a/flight/PiOS/inc/pios_initcall.h +++ b/flight/PiOS/inc/pios_initcall.h @@ -98,6 +98,7 @@ extern void StartModules(); (fn->fn_tinit)(); } #endif /* USE_SIM_POSIX */ + #endif /* PIOS_INITCALL_H */ /** diff --git a/flight/PiOS/inc/pios_l3gd20.h b/flight/PiOS/inc/pios_l3gd20.h index 241f983c6..794c5c2f2 100644 --- a/flight/PiOS/inc/pios_l3gd20.h +++ b/flight/PiOS/inc/pios_l3gd20.h @@ -32,8 +32,6 @@ #ifndef PIOS_L3GD20_H #define PIOS_L3GD20_H -#include "pios.h" - /* L3GD20 Addresses */ #define PIOS_L3GD20_WHOAMI 0x0F #define PIOS_L3GD20_CTRL_REG1 0X20 diff --git a/flight/PiOS/inc/pios_mpu6000.h b/flight/PiOS/inc/pios_mpu6000.h index 1be368575..80b924331 100644 --- a/flight/PiOS/inc/pios_mpu6000.h +++ b/flight/PiOS/inc/pios_mpu6000.h @@ -32,8 +32,6 @@ #ifndef PIOS_MPU6000_H #define PIOS_MPU6000_H -#include "pios.h" - /* MPU6000 Addresses */ #define PIOS_MPU6000_SMPLRT_DIV_REG 0X19 #define PIOS_MPU6000_DLPF_CFG_REG 0X1A diff --git a/flight/PiOS/inc/pios_mpxv.h b/flight/PiOS/inc/pios_mpxv.h index 824f0aa7b..4e7dffaba 100644 --- a/flight/PiOS/inc/pios_mpxv.h +++ b/flight/PiOS/inc/pios_mpxv.h @@ -28,8 +28,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef PIOS_MPXV_H__ -#define PIOS_MPXV_H__ +#ifndef PIOS_MPXV_H +#define PIOS_MPXV_H typedef enum{ PIOS_MPXV_UNKNOWN,PIOS_MPXV_5004,PIOS_MPXV_7002 } PIOS_MPXV_sensortype; typedef struct{ @@ -63,4 +63,4 @@ uint16_t PIOS_MPXV_Measure(PIOS_MPXV_descriptor *desc); uint16_t PIOS_MPXV_Calibrate(PIOS_MPXV_descriptor *desc, uint16_t measurement); float PIOS_MPXV_CalcAirspeed (PIOS_MPXV_descriptor *desc,uint16_t measurement); -#endif // PIOS_MPXV_H__ +#endif /* PIOS_MPXV_H */ diff --git a/flight/PiOS/inc/pios_ms5611.h b/flight/PiOS/inc/pios_ms5611.h index 7068988c4..ac0a79305 100644 --- a/flight/PiOS/inc/pios_ms5611.h +++ b/flight/PiOS/inc/pios_ms5611.h @@ -31,18 +31,16 @@ #ifndef PIOS_MS5611_H #define PIOS_MS5611_H -#include - /* BMP085 Addresses */ #define MS5611_I2C_ADDR 0x77 #define MS5611_RESET 0x1E -#define MS5611_CALIB_ADDR 0xA2 /* First sample is factory stuff */ -#define MS5611_CALIB_LEN 16 -#define MS5611_ADC_READ 0x00 -#define MS5611_PRES_ADDR 0x40 -#define MS5611_TEMP_ADDR 0x50 -#define MS5611_ADC_MSB 0xF6 -#define MS5611_P0 101.3250f +#define MS5611_CALIB_ADDR 0xA2 /* First sample is factory stuff */ +#define MS5611_CALIB_LEN 16 +#define MS5611_ADC_READ 0x00 +#define MS5611_PRES_ADDR 0x40 +#define MS5611_TEMP_ADDR 0x50 +#define MS5611_ADC_MSB 0xF6 +#define MS5611_P0 101.3250f /* Local Types */ typedef struct { diff --git a/flight/PiOS/inc/pios_posix.h b/flight/PiOS/inc/pios_posix.h index 2b411d270..7b6fe7fb1 100644 --- a/flight/PiOS/inc/pios_posix.h +++ b/flight/PiOS/inc/pios_posix.h @@ -40,5 +40,4 @@ typedef enum {FALSE = 0, TRUE = !FALSE} bool; //#define PIOS_SERVO_NUM_OUTPUTS 8 //#define PIOS_SERVO_NUM_TIMERS PIOS_SERVO_NUM_OUTPUTS -#endif - +#endif /* PIOS_POSIX_H */ diff --git a/flight/PiOS/inc/pios_sdcard.h b/flight/PiOS/inc/pios_sdcard.h index 8cbe3fd9f..df55d83f8 100644 --- a/flight/PiOS/inc/pios_sdcard.h +++ b/flight/PiOS/inc/pios_sdcard.h @@ -31,8 +31,6 @@ #ifndef PIOS_SDCARD_H #define PIOS_SDCARD_H -#if defined(PIOS_INCLUDE_SDCARD) - /* Public Functions */ typedef struct { uint8_t CSDStruct; /* CSD structure */ @@ -113,6 +111,4 @@ extern int32_t PIOS_SDCARD_ReadLine(PFILEINFO fileinfo, uint8_t * buffer, uint32 extern int32_t PIOS_SDCARD_FileCopy(char *Source, char *Destination); extern int32_t PIOS_SDCARD_FileDelete(char *Filename); -#endif - #endif /* PIOS_SDCARD_H */ diff --git a/flight/PiOS/inc/pios_spi_priv.h b/flight/PiOS/inc/pios_spi_priv.h index fd8a6a4e5..f89f52495 100644 --- a/flight/PiOS/inc/pios_spi_priv.h +++ b/flight/PiOS/inc/pios_spi_priv.h @@ -60,6 +60,7 @@ struct pios_spi_dev { }; extern int32_t PIOS_SPI_Init(uint32_t * spi_id, const struct pios_spi_cfg * cfg); + #endif /* PIOS_SPI_PRIV_H */ /** diff --git a/flight/PiOS/inc/pios_struct_helper.h b/flight/PiOS/inc/pios_struct_helper.h index 6196d9b26..f061a6e01 100644 --- a/flight/PiOS/inc/pios_struct_helper.h +++ b/flight/PiOS/inc/pios_struct_helper.h @@ -7,6 +7,12 @@ * @member: the name of the member within the struct. * */ + +#ifndef PIOS_STRUCT_HELPER_H +#define PIOS_STRUCT_HELPER_H + #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) + +#endif /* PIOS_STRUCT_HELPER_H */ diff --git a/flight/PiOS/inc/pios_usart.h b/flight/PiOS/inc/pios_usart.h index d7bebc18e..dd98a660f 100644 --- a/flight/PiOS/inc/pios_usart.h +++ b/flight/PiOS/inc/pios_usart.h @@ -31,8 +31,6 @@ #ifndef PIOS_USART_H #define PIOS_USART_H -#include - /* Global Types */ /* Public Functions */ diff --git a/flight/PiOS/inc/pios_usb_desc_hid_cdc_priv.h b/flight/PiOS/inc/pios_usb_desc_hid_cdc_priv.h index 2ae94c74e..8a56d6b19 100644 --- a/flight/PiOS/inc/pios_usb_desc_hid_cdc_priv.h +++ b/flight/PiOS/inc/pios_usb_desc_hid_cdc_priv.h @@ -34,7 +34,7 @@ extern int32_t PIOS_USB_DESC_HID_CDC_Init(void); -#endif /* PIOS_USB_DESC_HID_CDC_PRIV_H */ +#endif /* PIOS_USB_DESC_HID_CDC_PRIV_H */ /** * @} diff --git a/flight/PiOS/inc/pios_usb_desc_hid_only_priv.h b/flight/PiOS/inc/pios_usb_desc_hid_only_priv.h index 321d15efa..9e7d12401 100644 --- a/flight/PiOS/inc/pios_usb_desc_hid_only_priv.h +++ b/flight/PiOS/inc/pios_usb_desc_hid_only_priv.h @@ -34,7 +34,7 @@ extern int32_t PIOS_USB_DESC_HID_ONLY_Init(void); -#endif /* PIOS_USB_DESC_HID_ONLY_PRIV_H */ +#endif /* PIOS_USB_DESC_HID_ONLY_PRIV_H */ /** * @} diff --git a/flight/PiOS/inc/pios_usb_priv.h b/flight/PiOS/inc/pios_usb_priv.h index 6f7edf652..76b430a99 100644 --- a/flight/PiOS/inc/pios_usb_priv.h +++ b/flight/PiOS/inc/pios_usb_priv.h @@ -47,4 +47,3 @@ extern int32_t PIOS_USB_Init(uint32_t * usb_id, const struct pios_usb_cfg * cfg) * @} * @} */ - diff --git a/flight/PiOS/inc/pios_usb_rctx.h b/flight/PiOS/inc/pios_usb_rctx.h index ea07a6d7f..a97581c1a 100644 --- a/flight/PiOS/inc/pios_usb_rctx.h +++ b/flight/PiOS/inc/pios_usb_rctx.h @@ -1,3 +1,8 @@ +#ifndef PIOS_USB_RCTX_H +#define PIOS_USB_RCTX_H + extern uint32_t pios_usb_rctx_id; extern void PIOS_USB_RCTX_Update(uint32_t usbrctx_id, const uint16_t channel[], const int16_t channel_min[], const int16_t channel_max[], uint8_t num_channels); + +#endif /* PIOS_USB_RCTX_H */ diff --git a/flight/PiOS/inc/pios_video.h b/flight/PiOS/inc/pios_video.h index 029a19fbf..4be4a2f7d 100644 --- a/flight/PiOS/inc/pios_video.h +++ b/flight/PiOS/inc/pios_video.h @@ -32,11 +32,6 @@ #ifndef PIOS_VIDEO_H #define PIOS_VIDEO_H -#include - -// ***************************************************************************** -#if defined(PIOS_INCLUDE_VIDEO) - #include #include @@ -107,5 +102,4 @@ extern bool PIOS_Vsync_ISR(); // Macro to swap buffers given a temporary pointer. #define SWAP_BUFFS(tmp, a, b) { tmp = a; a = b; b = tmp; } -#endif #endif /* PIOS_VIDEO_H */ diff --git a/flight/PiOS/inc/pios_wavplay.h b/flight/PiOS/inc/pios_wavplay.h index e2ac9c0ae..8d55ec5c4 100644 --- a/flight/PiOS/inc/pios_wavplay.h +++ b/flight/PiOS/inc/pios_wavplay.h @@ -32,12 +32,8 @@ #ifndef PIOS_WAVPLAY_H #define PIOS_WAVPLAY_H -#include - -// ***************************************************************************** -#if defined(PIOS_INCLUDE_WAVE) - #include + #define BUFFERSIZE 512 //Defines the buffer size to hold data from the SD card. struct pios_dac_cfg { @@ -53,5 +49,4 @@ struct pios_dac_cfg { extern void PIOS_WavPlay_Init(const struct pios_dac_cfg * cfg); extern uint8_t WavePlayer_Start(void); -#endif -#endif /* PIOS_VIDEO_H */ +#endif /* PIOS_WAVPLAY_H */ diff --git a/flight/PiOS/inc/pios_wdg.h b/flight/PiOS/inc/pios_wdg.h index 9c51a2ec2..b8fa1bae5 100644 --- a/flight/PiOS/inc/pios_wdg.h +++ b/flight/PiOS/inc/pios_wdg.h @@ -28,8 +28,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef PIOS_WDG -#define PIOS_WDG +#ifndef PIOS_WDG_H +#define PIOS_WDG_H uint16_t PIOS_WDG_Init(); bool PIOS_WDG_RegisterFlag(uint16_t flag_requested); @@ -38,4 +38,4 @@ uint16_t PIOS_WDG_GetBootupFlags(); uint16_t PIOS_WDG_GetActiveFlags(); void PIOS_WDG_Clear(void); -#endif +#endif /* PIOS_WDG_H */ From 285cad290b826883f4c556f32d5d4fbe4d9e089c Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Fri, 15 Mar 2013 16:28:53 +0200 Subject: [PATCH 06/68] pios: common PIOS #ifdef guards Conflicts: flight/PiOS/Common/pios_com.c flight/PiOS/Common/pios_mpu6000.c --- flight/PiOS/Common/pios_adxl345.c | 4 ++++ flight/PiOS/Common/pios_bma180.c | 3 ++- flight/PiOS/Common/pios_bmp085.c | 10 ++++------ flight/PiOS/Common/pios_board_info.c | 1 - flight/PiOS/Common/pios_com.c | 7 +++---- flight/PiOS/Common/pios_com_msg.c | 3 +-- flight/PiOS/Common/pios_etasv3.c | 5 +---- flight/PiOS/Common/pios_flash_jedec.c | 5 +++++ flight/PiOS/Common/pios_flashfs_logfs.c | 7 +++++++ flight/PiOS/Common/pios_gcsrcvr.c | 7 +++---- flight/PiOS/Common/pios_hcsr04.c | 8 ++++---- flight/PiOS/Common/pios_hmc5843.c | 5 ++--- flight/PiOS/Common/pios_hmc5883.c | 3 +-- flight/PiOS/Common/pios_i2c_esc.c | 7 +++---- flight/PiOS/Common/pios_l3gd20.c | 5 ++--- flight/PiOS/Common/pios_mpu6000.c | 6 +++--- flight/PiOS/Common/pios_mpxv.c | 3 +-- flight/PiOS/Common/pios_ms5611.c | 11 ++++++----- flight/PiOS/Common/pios_rcvr.c | 5 ++--- flight/PiOS/Common/pios_rfm22b.c | 5 ++--- flight/PiOS/Common/pios_sbus.c | 8 ++++---- flight/PiOS/Common/pios_sdcard.c | 5 ++--- flight/PiOS/Common/pios_usb_desc_hid_cdc.c | 6 ++++++ flight/PiOS/Common/pios_usb_desc_hid_only.c | 6 ++++++ flight/PiOS/Common/pios_usb_util.c | 6 ++++++ flight/PiOS/Common/pios_video.c | 8 +++----- flight/PiOS/Common/pios_wavplay.c | 8 +++----- 27 files changed, 86 insertions(+), 71 deletions(-) diff --git a/flight/PiOS/Common/pios_adxl345.c b/flight/PiOS/Common/pios_adxl345.c index 248c985b2..3f3ba88f8 100644 --- a/flight/PiOS/Common/pios_adxl345.c +++ b/flight/PiOS/Common/pios_adxl345.c @@ -30,6 +30,8 @@ #include "pios.h" +#ifdef PIOS_INCLUDE_ADXL345 + enum pios_adxl345_dev_magic { PIOS_ADXL345_DEV_MAGIC = 0xcb55aa55, }; @@ -306,3 +308,5 @@ uint8_t PIOS_ADXL345_Read(struct pios_adxl345_data * data) return rec[8] & 0x7F; // return number of remaining entries } + +#endif /* PIOS_INCLUDE_ADXL345 */ diff --git a/flight/PiOS/Common/pios_bma180.c b/flight/PiOS/Common/pios_bma180.c index 3a2e32d95..a5f64a121 100644 --- a/flight/PiOS/Common/pios_bma180.c +++ b/flight/PiOS/Common/pios_bma180.c @@ -31,7 +31,7 @@ #include "pios.h" -#if defined(PIOS_INCLUDE_BMA180) +#ifdef PIOS_INCLUDE_BMA180 #include "fifo_buffer.h" @@ -475,6 +475,7 @@ bool PIOS_BMA180_IRQHandler(void) } #endif /* PIOS_INCLUDE_BMA180 */ + /** * @} * @} diff --git a/flight/PiOS/Common/pios_bmp085.c b/flight/PiOS/Common/pios_bmp085.c index c12174d0f..0b1201caf 100644 --- a/flight/PiOS/Common/pios_bmp085.c +++ b/flight/PiOS/Common/pios_bmp085.c @@ -28,15 +28,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_BMP085) -#if !defined(PIOS_INCLUDE_EXTI) -#error PIOS_EXTI Must be included in the project! -#endif /* PIOS_INCLUDE_EXTI */ +#ifdef PIOS_INCLUDE_BMP085 -#include +#ifndef PIOS_INCLUDE_EXTI +#error PIOS_EXTI must be included in the project +#endif /* PIOS_INCLUDE_EXTI */ /* Glocal Variables */ ConversionTypeTypeDef CurrentRead; diff --git a/flight/PiOS/Common/pios_board_info.c b/flight/PiOS/Common/pios_board_info.c index 8905a5c08..c3a5a4dfb 100644 --- a/flight/PiOS/Common/pios_board_info.c +++ b/flight/PiOS/Common/pios_board_info.c @@ -1,6 +1,5 @@ #include #include - #include "pios_board_info.h" const struct pios_board_info __attribute__((__used__)) __attribute__((__section__(".boardinfo"))) pios_board_info_blob = { diff --git a/flight/PiOS/Common/pios_com.c b/flight/PiOS/Common/pios_com.c index 422f3ecc9..b15a176ef 100644 --- a/flight/PiOS/Common/pios_com.c +++ b/flight/PiOS/Common/pios_com.c @@ -28,15 +28,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_COM) +#ifdef PIOS_INCLUDE_COM #include "fifo_buffer.h" #include -#if !defined(PIOS_INCLUDE_FREERTOS) +#ifndef PIOS_INCLUDE_FREERTOS #include "pios_delay.h" /* PIOS_DELAY_WaitmS */ #endif @@ -524,7 +523,7 @@ bool PIOS_COM_Available(uint32_t com_id) return (com_dev->driver->available)(com_dev->lower_id); } -#endif +#endif /* PIOS_INCLUDE_COM */ /** * @} diff --git a/flight/PiOS/Common/pios_com_msg.c b/flight/PiOS/Common/pios_com_msg.c index c1cebe1d9..afc68c1ec 100644 --- a/flight/PiOS/Common/pios_com_msg.c +++ b/flight/PiOS/Common/pios_com_msg.c @@ -28,10 +28,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_COM_MSG) +#ifdef PIOS_INCLUDE_COM_MSG #include "pios_com.h" diff --git a/flight/PiOS/Common/pios_etasv3.c b/flight/PiOS/Common/pios_etasv3.c index 2a0ca9b52..33090ba5e 100644 --- a/flight/PiOS/Common/pios_etasv3.c +++ b/flight/PiOS/Common/pios_etasv3.c @@ -28,12 +28,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_ETASV3) - -#include "pios_etasv3.h" +#ifdef PIOS_INCLUDE_ETASV3 static bool PIOS_ETASV3_Read(uint8_t * buffer, uint8_t len) { diff --git a/flight/PiOS/Common/pios_flash_jedec.c b/flight/PiOS/Common/pios_flash_jedec.c index 6d382a1c1..2294b598d 100644 --- a/flight/PiOS/Common/pios_flash_jedec.c +++ b/flight/PiOS/Common/pios_flash_jedec.c @@ -28,7 +28,11 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "pios.h" + +#ifdef PIOS_INCLUDE_FLASH + #include "pios_flash_jedec_priv.h" #define JEDEC_WRITE_ENABLE 0x06 @@ -562,3 +566,4 @@ const struct pios_flash_driver pios_jedec_flash_driver = { .read_data = PIOS_Flash_Jedec_ReadData, }; +#endif /* PIOS_INCLUDE_FLASH */ diff --git a/flight/PiOS/Common/pios_flashfs_logfs.c b/flight/PiOS/Common/pios_flashfs_logfs.c index 5bad06383..0873e5987 100644 --- a/flight/PiOS/Common/pios_flashfs_logfs.c +++ b/flight/PiOS/Common/pios_flashfs_logfs.c @@ -24,6 +24,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "pios.h" + +#ifdef PIOS_INCLUDE_FLASH + #include "openpilot.h" #include "pios_flashfs_logfs_priv.h" @@ -1020,6 +1025,8 @@ out_exit: return rc; } +#endif /* PIOS_INCLUDE_FLASH */ + /** * @} * @} diff --git a/flight/PiOS/Common/pios_gcsrcvr.c b/flight/PiOS/Common/pios_gcsrcvr.c index d5451157e..674a88481 100644 --- a/flight/PiOS/Common/pios_gcsrcvr.c +++ b/flight/PiOS/Common/pios_gcsrcvr.c @@ -28,12 +28,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#include "uavobjectmanager.h" +#ifdef PIOS_INCLUDE_GCSRCVR -#if defined(PIOS_INCLUDE_GCSRCVR) +#include "uavobjectmanager.h" #include "pios_gcsrcvr_priv.h" @@ -168,7 +167,7 @@ static void PIOS_gcsrcvr_Supervisor(uint32_t gcsrcvr_id) { gcsrcvr_dev->Fresh = false; } -#endif /* PIOS_INCLUDE_GCSRCVR */ +#endif /* PIOS_INCLUDE_GCSRCVR */ /** * @} diff --git a/flight/PiOS/Common/pios_hcsr04.c b/flight/PiOS/Common/pios_hcsr04.c index cbdb31e7e..02177fac0 100644 --- a/flight/PiOS/Common/pios_hcsr04.c +++ b/flight/PiOS/Common/pios_hcsr04.c @@ -28,12 +28,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_HCSR04) +#ifdef PIOS_INCLUDE_HCSR04 + #if !(defined(PIOS_INCLUDE_DSM) || defined(PIOS_INCLUDE_SBUS)) -#error Only supported with Spektrum/JR DSM or S.Bus interface! +#error Only supported with Spektrum/JR DSM or S.Bus interface #endif /* Local Variables */ @@ -206,5 +206,5 @@ void TIM3_IRQHandler(void) } } +#endif /* PIOS_INCLUDE_HCSR04 */ -#endif diff --git a/flight/PiOS/Common/pios_hmc5843.c b/flight/PiOS/Common/pios_hmc5843.c index 4f6b562d6..83dcc07bf 100644 --- a/flight/PiOS/Common/pios_hmc5843.c +++ b/flight/PiOS/Common/pios_hmc5843.c @@ -29,10 +29,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_HMC5843) +#ifdef PIOS_INCLUDE_HMC5843 #include @@ -376,7 +375,7 @@ static bool PIOS_HMC5843_Write(uint8_t address, uint8_t buffer) return PIOS_I2C_Transfer(PIOS_I2C_MAIN_ADAPTER, txn_list, NELEMENTS(txn_list)); } -#endif +#endif /* PIOS_INCLUDE_HMC5843 */ /** * @} diff --git a/flight/PiOS/Common/pios_hmc5883.c b/flight/PiOS/Common/pios_hmc5883.c index 0eb14e28a..1e676fbcb 100644 --- a/flight/PiOS/Common/pios_hmc5883.c +++ b/flight/PiOS/Common/pios_hmc5883.c @@ -28,10 +28,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_HMC5883) +#ifdef PIOS_INCLUDE_HMC5883 /* Global Variables */ diff --git a/flight/PiOS/Common/pios_i2c_esc.c b/flight/PiOS/Common/pios_i2c_esc.c index d440bfa48..9409b9a68 100644 --- a/flight/PiOS/Common/pios_i2c_esc.c +++ b/flight/PiOS/Common/pios_i2c_esc.c @@ -29,12 +29,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_I2C_ESC) +#ifdef PIOS_INCLUDE_I2C_ESC -/* HMC5843 Addresses */ +/* Known i2c ESC addresses */ #define MK_I2C_ADDR 0x29 #define ASTEC4_I2C_ADDR 0x02 @@ -164,7 +163,7 @@ bool PIOS_SetAstec4Speed(uint8_t motornum, uint8_t speed) { return PIOS_I2C_Transfer(PIOS_I2C_ESC_ADAPTER, txn_list, NELEMENTS(txn_list)); } -#endif +#endif /* PIOS_INCLUDE_I2C_ESC */ /** * @} diff --git a/flight/PiOS/Common/pios_l3gd20.c b/flight/PiOS/Common/pios_l3gd20.c index 6876db16d..399eaa785 100644 --- a/flight/PiOS/Common/pios_l3gd20.c +++ b/flight/PiOS/Common/pios_l3gd20.c @@ -29,10 +29,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_L3GD20) +#ifdef PIOS_INCLUDE_L3GD20 #include "fifo_buffer.h" @@ -381,7 +380,7 @@ bool PIOS_L3GD20_IRQHandler(void) return xHigherPriorityTaskWoken == pdTRUE; } -#endif /* L3GD20 */ +#endif /* PIOS_INCLUDE_L3GD20 */ /** * @} diff --git a/flight/PiOS/Common/pios_mpu6000.c b/flight/PiOS/Common/pios_mpu6000.c index 973332fae..7820efe62 100644 --- a/flight/PiOS/Common/pios_mpu6000.c +++ b/flight/PiOS/Common/pios_mpu6000.c @@ -29,9 +29,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_MPU6000) + +#ifdef PIOS_INCLUDE_MPU6000 #include "fifo_buffer.h" @@ -551,7 +551,7 @@ bool PIOS_MPU6000_IRQHandler(void) return xHigherPriorityTaskWoken == pdTRUE; } -#endif +#endif /* PIOS_INCLUDE_MPU6000 */ /** * @} diff --git a/flight/PiOS/Common/pios_mpxv.c b/flight/PiOS/Common/pios_mpxv.c index ff02a0266..80e0b648d 100644 --- a/flight/PiOS/Common/pios_mpxv.c +++ b/flight/PiOS/Common/pios_mpxv.c @@ -30,10 +30,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_MPXV) +#ifdef PIOS_INCLUDE_MPXV #define A0 340.27f //speed of sound at standard sea level in [m/s] #define P0 101.325f //static air pressure at standard sea level in kPa diff --git a/flight/PiOS/Common/pios_ms5611.c b/flight/PiOS/Common/pios_ms5611.c index 41bf7c80e..7e4358b35 100644 --- a/flight/PiOS/Common/pios_ms5611.c +++ b/flight/PiOS/Common/pios_ms5611.c @@ -28,13 +28,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ +#include "pios.h" + +#ifdef PIOS_INCLUDE_MS5611 + + // TODO: Clean this up. Getting around old constant. #define PIOS_MS5611_OVERSAMPLING oversampling -#include "pios.h" - -#if defined(PIOS_INCLUDE_MS5611) /* Glocal Variables */ ConversionTypeTypeDef CurrentRead; @@ -261,7 +262,7 @@ int32_t PIOS_MS5611_Test() return 0; } -#endif +#endif /* PIOS_INCLUDE_MS5611 */ /** * @} diff --git a/flight/PiOS/Common/pios_rcvr.c b/flight/PiOS/Common/pios_rcvr.c index 0f3988d7f..4533d874b 100644 --- a/flight/PiOS/Common/pios_rcvr.c +++ b/flight/PiOS/Common/pios_rcvr.c @@ -1,7 +1,6 @@ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_RCVR) +#ifdef PIOS_INCLUDE_RCVR #include @@ -108,7 +107,7 @@ int32_t PIOS_RCVR_Read(uint32_t rcvr_id, uint8_t channel) return rcvr_dev->driver->read(rcvr_dev->lower_id, channel); } -#endif +#endif /* PIOS_INCLUDE_RCVR */ /** * @} diff --git a/flight/PiOS/Common/pios_rfm22b.c b/flight/PiOS/Common/pios_rfm22b.c index 306e96062..20eecc112 100644 --- a/flight/PiOS/Common/pios_rfm22b.c +++ b/flight/PiOS/Common/pios_rfm22b.c @@ -46,10 +46,9 @@ // // ***************************************************************** -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_RFM22B) +#ifdef PIOS_INCLUDE_RFM22B #include #include @@ -2455,7 +2454,7 @@ static enum pios_rfm22b_event rfm22_fatal_error(struct pios_rfm22b_dev *rfm22b_d // ************************************ -#endif +#endif /* PIOS_INCLUDE_RFM22B */ /** * @} diff --git a/flight/PiOS/Common/pios_sbus.c b/flight/PiOS/Common/pios_sbus.c index 53730b16b..ec8daab62 100644 --- a/flight/PiOS/Common/pios_sbus.c +++ b/flight/PiOS/Common/pios_sbus.c @@ -28,11 +28,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#include "pios_sbus_priv.h" -#if defined(PIOS_INCLUDE_SBUS) +#ifdef PIOS_INCLUDE_SBUS + +#include "pios_sbus_priv.h" /* Forward Declarations */ static int32_t PIOS_SBus_Get(uint32_t rcvr_id, uint8_t channel); @@ -332,7 +332,7 @@ static void PIOS_SBus_Supervisor(uint32_t sbus_id) } } -#endif /* PIOS_INCLUDE_SBUS */ +#endif /* PIOS_INCLUDE_SBUS */ /** * @} diff --git a/flight/PiOS/Common/pios_sdcard.c b/flight/PiOS/Common/pios_sdcard.c index c404fa718..1ae2ea50e 100644 --- a/flight/PiOS/Common/pios_sdcard.c +++ b/flight/PiOS/Common/pios_sdcard.c @@ -29,10 +29,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_SDCARD) +#ifdef PIOS_INCLUDE_SDCARD /* Global Variables */ VOLINFO PIOS_SDCARD_VolInfo; @@ -1000,7 +999,7 @@ int32_t PIOS_SDCARD_FileDelete(char *Filename) return 0; } -#endif +#endif /* PIOS_INCLUDE_SDCARD */ /** * @} diff --git a/flight/PiOS/Common/pios_usb_desc_hid_cdc.c b/flight/PiOS/Common/pios_usb_desc_hid_cdc.c index 747eda3d4..e102aefe3 100644 --- a/flight/PiOS/Common/pios_usb_desc_hid_cdc.c +++ b/flight/PiOS/Common/pios_usb_desc_hid_cdc.c @@ -28,6 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "pios.h" + +#ifdef PIOS_INCLUDE_USB + #include "pios_usb_desc_hid_cdc_priv.h" /* exported API */ #include "pios_usb_defs.h" /* struct usb_*, USB_* */ #include "pios_usb_board_data.h" /* PIOS_USB_BOARD_* */ @@ -324,3 +328,5 @@ int32_t PIOS_USB_DESC_HID_CDC_Init(void) return 0; } + +#endif /* PIOS_INCLUDE_USB */ diff --git a/flight/PiOS/Common/pios_usb_desc_hid_only.c b/flight/PiOS/Common/pios_usb_desc_hid_only.c index b15a02b32..0757d0937 100644 --- a/flight/PiOS/Common/pios_usb_desc_hid_only.c +++ b/flight/PiOS/Common/pios_usb_desc_hid_only.c @@ -28,6 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "pios.h" + +#ifdef PIOS_INCLUDE_USB + #include "pios_usb_desc_hid_only_priv.h" /* exported API */ #include "pios_usb_defs.h" /* struct usb_*, USB_* */ #include "pios_usb_board_data.h" /* PIOS_USB_BOARD_* */ @@ -163,3 +167,5 @@ int32_t PIOS_USB_DESC_HID_ONLY_Init(void) return 0; } + +#endif /* PIOS_INCLUDE_USB */ diff --git a/flight/PiOS/Common/pios_usb_util.c b/flight/PiOS/Common/pios_usb_util.c index 4bbf98d23..9f7c8c94e 100644 --- a/flight/PiOS/Common/pios_usb_util.c +++ b/flight/PiOS/Common/pios_usb_util.c @@ -28,6 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "pios.h" + +#ifdef PIOS_INCLUDE_USB + #include "pios_usb_util.h" uint8_t * PIOS_USB_UTIL_AsciiToUtf8(uint8_t * dst, uint8_t * src, uint16_t srclen) @@ -40,3 +44,5 @@ uint8_t * PIOS_USB_UTIL_AsciiToUtf8(uint8_t * dst, uint8_t * src, uint16_t srcle return dst; } + +#endif /* PIOS_INCLUDE_USB */ diff --git a/flight/PiOS/Common/pios_video.c b/flight/PiOS/Common/pios_video.c index 22e6060ce..5d7452f9d 100644 --- a/flight/PiOS/Common/pios_video.c +++ b/flight/PiOS/Common/pios_video.c @@ -30,7 +30,8 @@ */ #include "pios.h" -#if defined(PIOS_INCLUDE_VIDEO) + +#ifdef PIOS_INCLUDE_VIDEO extern xSemaphoreHandle osdSemaphore; @@ -277,7 +278,4 @@ void PIOS_VIDEO_DMA_Handler(void) } - -#endif - - +#endif /* PIOS_INCLUDE_VIDEO */ diff --git a/flight/PiOS/Common/pios_wavplay.c b/flight/PiOS/Common/pios_wavplay.c index cc0335c07..d2b82d65a 100644 --- a/flight/PiOS/Common/pios_wavplay.c +++ b/flight/PiOS/Common/pios_wavplay.c @@ -30,7 +30,8 @@ */ #include "pios.h" -#if defined(PIOS_INCLUDE_WAVE) + +#ifdef PIOS_INCLUDE_WAVE static const struct pios_dac_cfg * dev_cfg; @@ -606,7 +607,4 @@ void DAC_DMA_Handler(void) } } - -#endif - - +#endif /* PIOS_INCLUDE_WAVE */ From b73ddffbf077df0a6275234f99e420b7d73acba1 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Fri, 15 Mar 2013 20:25:30 +0200 Subject: [PATCH 07/68] pios: STM32F10x PIOS #ifdef guards --- flight/PiOS/STM32F10x/pios_adc.c | 5 +++++ flight/PiOS/STM32F10x/pios_bl_helper.c | 8 +++++--- flight/PiOS/STM32F10x/pios_debug.c | 1 - flight/PiOS/STM32F10x/pios_delay.c | 5 ++--- flight/PiOS/STM32F10x/pios_dsm.c | 7 ++++--- flight/PiOS/STM32F10x/pios_eeprom.c | 9 +++++---- flight/PiOS/STM32F10x/pios_exti.c | 3 +-- flight/PiOS/STM32F10x/pios_gpio.c | 5 ++--- flight/PiOS/STM32F10x/pios_i2c.c | 5 ++--- flight/PiOS/STM32F10x/pios_iap.c | 4 ++++ flight/PiOS/STM32F10x/pios_irq.c | 5 ++--- flight/PiOS/STM32F10x/pios_led.c | 5 ++--- flight/PiOS/STM32F10x/pios_ppm.c | 7 ++++--- flight/PiOS/STM32F10x/pios_pwm.c | 7 ++++--- flight/PiOS/STM32F10x/pios_rtc.c | 7 ++++--- flight/PiOS/STM32F10x/pios_servo.c | 6 +++++- flight/PiOS/STM32F10x/pios_spi.c | 4 ++-- flight/PiOS/STM32F10x/pios_sys.c | 5 ++--- flight/PiOS/STM32F10x/pios_tim.c | 4 +++- flight/PiOS/STM32F10x/pios_usart.c | 5 ++--- flight/PiOS/STM32F10x/pios_usb.c | 17 ++++++++++------- flight/PiOS/STM32F10x/pios_usb_cdc.c | 6 ++---- flight/PiOS/STM32F10x/pios_usb_hid.c | 10 ++++------ flight/PiOS/STM32F10x/pios_usb_hid_istr.c | 2 +- flight/PiOS/STM32F10x/pios_usb_rctx.c | 12 +++++------- flight/PiOS/STM32F10x/pios_wdg.c | 5 +++++ 26 files changed, 87 insertions(+), 72 deletions(-) diff --git a/flight/PiOS/STM32F10x/pios_adc.c b/flight/PiOS/STM32F10x/pios_adc.c index 66eb8f92e..2f5ed4198 100644 --- a/flight/PiOS/STM32F10x/pios_adc.c +++ b/flight/PiOS/STM32F10x/pios_adc.c @@ -28,6 +28,9 @@ */ #include "pios.h" + +#ifdef PIOS_INCLUDE_ADC + #include // Private types @@ -361,6 +364,8 @@ void PIOS_ADC_DMA_Handler(void) } } +#endif /* PIOS_INCLUDE_ADC */ + /** * @} * @} diff --git a/flight/PiOS/STM32F10x/pios_bl_helper.c b/flight/PiOS/STM32F10x/pios_bl_helper.c index 967c3c7e6..f8c8e1db3 100644 --- a/flight/PiOS/STM32F10x/pios_bl_helper.c +++ b/flight/PiOS/STM32F10x/pios_bl_helper.c @@ -28,9 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_BL_HELPER) + +#ifdef PIOS_INCLUDE_BL_HELPER + #include #include "stm32f10x_flash.h" @@ -99,4 +100,5 @@ void PIOS_BL_HELPER_CRC_Ini() { RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE); } -#endif + +#endif /* PIOS_INCLUDE_BL_HELPER */ diff --git a/flight/PiOS/STM32F10x/pios_debug.c b/flight/PiOS/STM32F10x/pios_debug.c index 18ea0071b..96cde1370 100644 --- a/flight/PiOS/STM32F10x/pios_debug.c +++ b/flight/PiOS/STM32F10x/pios_debug.c @@ -28,7 +28,6 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" // Global variables diff --git a/flight/PiOS/STM32F10x/pios_delay.c b/flight/PiOS/STM32F10x/pios_delay.c index 7c04e2426..a61ab45f8 100644 --- a/flight/PiOS/STM32F10x/pios_delay.c +++ b/flight/PiOS/STM32F10x/pios_delay.c @@ -30,10 +30,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include -#if defined(PIOS_INCLUDE_DELAY) +#ifdef PIOS_INCLUDE_DELAY /* these should be defined by CMSIS, but they aren't */ #define DWT_CTRL (*(volatile uint32_t *)0xe0001000) @@ -167,7 +166,7 @@ uint32_t PIOS_DELAY_DiffuS(uint32_t raw) return diff / us_ticks; } -#endif +#endif /* PIOS_INCLUDE_DELAY */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_dsm.c b/flight/PiOS/STM32F10x/pios_dsm.c index b35560d5d..b7e3dcbca 100644 --- a/flight/PiOS/STM32F10x/pios_dsm.c +++ b/flight/PiOS/STM32F10x/pios_dsm.c @@ -28,11 +28,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" + +#ifdef PIOS_INCLUDE_DSM + #include "pios_dsm_priv.h" -#if defined(PIOS_INCLUDE_DSM) /* Forward Declarations */ static int32_t PIOS_DSM_Get(uint32_t rcvr_id, uint8_t channel); @@ -399,7 +400,7 @@ static void PIOS_DSM_Supervisor(uint32_t dsm_id) } } -#endif /* PIOS_INCLUDE_DSM */ +#endif /* PIOS_INCLUDE_DSM */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_eeprom.c b/flight/PiOS/STM32F10x/pios_eeprom.c index f604f417b..182e3f4ed 100644 --- a/flight/PiOS/STM32F10x/pios_eeprom.c +++ b/flight/PiOS/STM32F10x/pios_eeprom.c @@ -28,14 +28,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include -#include + +#ifdef PIOS_INCLUDE_FLASH_EEPROM + #include #include -#include - static struct pios_eeprom_cfg config; /** @@ -153,3 +152,5 @@ int32_t PIOS_EEPROM_Load(uint8_t *data, uint32_t len) return 0; } + +#endif /* PIOS_INCLUDE_FLASH_EEPROM */ diff --git a/flight/PiOS/STM32F10x/pios_exti.c b/flight/PiOS/STM32F10x/pios_exti.c index 9b8221bbe..9d1980bcc 100644 --- a/flight/PiOS/STM32F10x/pios_exti.c +++ b/flight/PiOS/STM32F10x/pios_exti.c @@ -29,10 +29,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_EXTI) +#ifdef PIOS_INCLUDE_EXTI /* Map EXTI line to full config */ #define EXTI_MAX_LINES 16 diff --git a/flight/PiOS/STM32F10x/pios_gpio.c b/flight/PiOS/STM32F10x/pios_gpio.c index 009780306..abedc162d 100644 --- a/flight/PiOS/STM32F10x/pios_gpio.c +++ b/flight/PiOS/STM32F10x/pios_gpio.c @@ -28,10 +28,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_GPIO) +#ifdef PIOS_INCLUDE_GPIO /* Private Function Prototypes */ @@ -93,7 +92,7 @@ void PIOS_GPIO_Toggle(uint8_t Pin) GPIO_PORT[Pin]->ODR ^= GPIO_PIN[Pin]; } -#endif +#endif /* PIOS_INCLUDE_GPIO */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_i2c.c b/flight/PiOS/STM32F10x/pios_i2c.c index 9fb8c529f..f61d00c14 100644 --- a/flight/PiOS/STM32F10x/pios_i2c.c +++ b/flight/PiOS/STM32F10x/pios_i2c.c @@ -28,10 +28,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_I2C) +#ifdef PIOS_INCLUDE_I2C #if defined(PIOS_INCLUDE_FREERTOS) #define USE_FREERTOS @@ -1146,7 +1145,7 @@ void PIOS_I2C_ER_IRQ_Handler(uint32_t i2c_id) } } -#endif +#endif /* PIOS_INCLUDE_I2C */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_iap.c b/flight/PiOS/STM32F10x/pios_iap.c index bb679f067..ae286e231 100644 --- a/flight/PiOS/STM32F10x/pios_iap.c +++ b/flight/PiOS/STM32F10x/pios_iap.c @@ -12,6 +12,8 @@ ****************************************************************************************/ #include +#ifdef PIOS_INCLUDE_IAP + /**************************************************************************************** * Private Definitions/Macros ****************************************************************************************/ @@ -120,3 +122,5 @@ void PIOS_IAP_WriteBootCount (uint16_t boot_count) { BKP_WriteBackupRegister ( IAP_BOOTCOUNT, boot_count ); } + +#endif /* PIOS_INCLUDE_IAP */ diff --git a/flight/PiOS/STM32F10x/pios_irq.c b/flight/PiOS/STM32F10x/pios_irq.c index 46ecf398b..77b3a3b7a 100644 --- a/flight/PiOS/STM32F10x/pios_irq.c +++ b/flight/PiOS/STM32F10x/pios_irq.c @@ -29,10 +29,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_IRQ) +#ifdef PIOS_INCLUDE_IRQ /* Private Function Prototypes */ @@ -90,7 +89,7 @@ int32_t PIOS_IRQ_Enable(void) return 0; } -#endif +#endif /* PIOS_INCLUDE_IRQ */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_led.c b/flight/PiOS/STM32F10x/pios_led.c index 1714a9165..79dad8a8c 100644 --- a/flight/PiOS/STM32F10x/pios_led.c +++ b/flight/PiOS/STM32F10x/pios_led.c @@ -28,10 +28,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_LED) +#ifdef PIOS_INCLUDE_LED #include @@ -148,7 +147,7 @@ void PIOS_LED_Toggle(uint32_t led_id) } } -#endif +#endif /* PIOS_INCLUDE_LED */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_ppm.c b/flight/PiOS/STM32F10x/pios_ppm.c index 64d1196f9..153b331a4 100644 --- a/flight/PiOS/STM32F10x/pios_ppm.c +++ b/flight/PiOS/STM32F10x/pios_ppm.c @@ -28,11 +28,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" + +#ifdef PIOS_INCLUDE_PPM + #include "pios_ppm_priv.h" -#if defined(PIOS_INCLUDE_PPM) /* Provide a RCVR driver */ static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel); @@ -349,7 +350,7 @@ static void PIOS_PPM_Supervisor(uint32_t ppm_id) { ppm_dev->Fresh = FALSE; } -#endif +#endif /* PIOS_INCLUDE_PPM */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_pwm.c b/flight/PiOS/STM32F10x/pios_pwm.c index 4e7c98b14..b4996fc4d 100644 --- a/flight/PiOS/STM32F10x/pios_pwm.c +++ b/flight/PiOS/STM32F10x/pios_pwm.c @@ -28,11 +28,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" + +#ifdef PIOS_INCLUDE_PWM + #include "pios_pwm_priv.h" -#if defined(PIOS_INCLUDE_PWM) /* Provide a RCVR driver */ static int32_t PIOS_PWM_Get(uint32_t rcvr_id, uint8_t channel); @@ -274,7 +275,7 @@ static void PIOS_PWM_tim_edge_cb (uint32_t tim_id, uint32_t context, uint8_t cha } -#endif +#endif /* PIOS_INCLUDE_PWM */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_rtc.c b/flight/PiOS/STM32F10x/pios_rtc.c index b80a9e0d1..77f67a2f4 100644 --- a/flight/PiOS/STM32F10x/pios_rtc.c +++ b/flight/PiOS/STM32F10x/pios_rtc.c @@ -28,10 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_RTC) +#ifdef PIOS_INCLUDE_RTC + #include #ifndef PIOS_RTC_PRESCALER @@ -121,7 +121,8 @@ void PIOS_RTC_irq_handler (void) RTC_ClearITPendingBit(RTC_IT_SEC); } } -#endif + +#endif /* PIOS_INCLUDE_RTC */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_servo.c b/flight/PiOS/STM32F10x/pios_servo.c index 46be375c2..5ec4a3550 100644 --- a/flight/PiOS/STM32F10x/pios_servo.c +++ b/flight/PiOS/STM32F10x/pios_servo.c @@ -28,8 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" + +#ifdef PIOS_INCLUDE_SERVO + #include "pios_servo_priv.h" #include "pios_tim_priv.h" @@ -145,3 +147,5 @@ void PIOS_Servo_Set(uint8_t servo, uint16_t position) break; } } + +#endif /* PIOS_INCLUDE_SERVO */ diff --git a/flight/PiOS/STM32F10x/pios_spi.c b/flight/PiOS/STM32F10x/pios_spi.c index f8b2f0e63..320f6385d 100644 --- a/flight/PiOS/STM32F10x/pios_spi.c +++ b/flight/PiOS/STM32F10x/pios_spi.c @@ -35,7 +35,7 @@ #include -#if defined(PIOS_INCLUDE_SPI) +#ifdef PIOS_INCLUDE_SPI #include @@ -577,7 +577,7 @@ void PIOS_SPI_IRQ_Handler(uint32_t spi_id) } } -#endif +#endif /* PIOS_INCLUDE_SPI */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_sys.c b/flight/PiOS/STM32F10x/pios_sys.c index 6b59afbad..5a73d338b 100644 --- a/flight/PiOS/STM32F10x/pios_sys.c +++ b/flight/PiOS/STM32F10x/pios_sys.c @@ -29,10 +29,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_SYS) +#ifdef PIOS_INCLUDE_SYS /* Private Function Prototypes */ void NVIC_Configuration(void); @@ -212,7 +211,7 @@ void assert_failed(uint8_t * file, uint32_t line) } #endif -#endif +#endif /* PIOS_INCLUDE_SYS */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_tim.c b/flight/PiOS/STM32F10x/pios_tim.c index dcdd07670..d160c2c51 100644 --- a/flight/PiOS/STM32F10x/pios_tim.c +++ b/flight/PiOS/STM32F10x/pios_tim.c @@ -1,6 +1,7 @@ #include "pios.h" -#include "pios_tim.h" +#ifdef PIOS_INCLUDE_TIM + #include "pios_tim_priv.h" enum pios_tim_dev_magic { @@ -425,3 +426,4 @@ static void PIOS_TIM_8_CC_irq_handler (void) PIOS_TIM_generic_irq_handler (TIM8); } +#endif /* PIOS_INCLUDE_TIM */ diff --git a/flight/PiOS/STM32F10x/pios_usart.c b/flight/PiOS/STM32F10x/pios_usart.c index 041738f70..3054c09e3 100644 --- a/flight/PiOS/STM32F10x/pios_usart.c +++ b/flight/PiOS/STM32F10x/pios_usart.c @@ -28,10 +28,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_USART) +#ifdef PIOS_INCLUDE_USART #include @@ -324,7 +323,7 @@ static void PIOS_USART_generic_irq_handler(uint32_t usart_id) #endif /* PIOS_INCLUDE_FREERTOS */ } -#endif +#endif /* PIOS_INCLUDE_USART */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_usb.c b/flight/PiOS/STM32F10x/pios_usb.c index bdbc0adc7..6a5d676e5 100644 --- a/flight/PiOS/STM32F10x/pios_usb.c +++ b/flight/PiOS/STM32F10x/pios_usb.c @@ -28,16 +28,17 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" + +#ifdef PIOS_INCLUDE_USB + #include "usb_lib.h" #include "pios_usb_board_data.h" #include "stm32f10x.h" -#include "pios_usb.h" #include "pios_usb_priv.h" -#if defined(PIOS_INCLUDE_USB_HID) +#ifdef PIOS_INCLUDE_USB_HID /* Rx/Tx status */ static bool transfer_possible = false; @@ -66,7 +67,7 @@ static int32_t PIOS_USB_validate(struct pios_usb_dev * usb_dev) return 0; } -#if defined(PIOS_INCLUDE_FREERTOS) +#ifdef PIOS_INCLUDE_FREERTOS static struct pios_usb_dev * PIOS_USB_alloc(void) { struct pios_usb_dev * usb_dev; @@ -156,14 +157,14 @@ int32_t PIOS_USB_ChangeConnectionState(bool Connected) //TODO: Check SetEPRxValid(ENDP1); -#if defined(USB_LED_ON) +#ifdef USB_LED_ON USB_LED_ON; // turn the USB led on #endif } else { // Cable disconnected: disable transfers transfer_possible = false; -#if defined(USB_LED_OFF) +#ifdef USB_LED_OFF USB_LED_OFF; // turn the USB led off #endif } @@ -233,7 +234,9 @@ bool PIOS_USB_CheckAvailable(uint32_t id) return PIOS_USB_CableConnected(id) && transfer_possible; } -#endif +#endif /* PIOS_INCLUDE_USB_HID */ + +#endif /* PIOS_INCLUDE_USB */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_usb_cdc.c b/flight/PiOS/STM32F10x/pios_usb_cdc.c index abe4b7d3c..0da873966 100644 --- a/flight/PiOS/STM32F10x/pios_usb_cdc.c +++ b/flight/PiOS/STM32F10x/pios_usb_cdc.c @@ -29,12 +29,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_USB_CDC) +#ifdef PIOS_INCLUDE_USB_CDC -#include "pios_usb.h" #include "pios_usb_cdc_priv.h" #include "pios_usb_board_data.h" /* PIOS_BOARD_*_DATA_LENGTH */ @@ -417,4 +415,4 @@ static void PIOS_USB_CDC_CTRL_EP_IN_Callback(void) SetEPTxValid(usb_cdc_dev->cfg->data_tx_ep); } -#endif /* PIOS_INCLUDE_USB_CDC */ +#endif /* PIOS_INCLUDE_USB_CDC */ diff --git a/flight/PiOS/STM32F10x/pios_usb_hid.c b/flight/PiOS/STM32F10x/pios_usb_hid.c index 0047c7196..ba49ceb5a 100644 --- a/flight/PiOS/STM32F10x/pios_usb_hid.c +++ b/flight/PiOS/STM32F10x/pios_usb_hid.c @@ -29,12 +29,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_USB_HID) +#ifdef PIOS_INCLUDE_USB_HID -#include "pios_usb.h" #include "pios_usb_hid_priv.h" #include "pios_usb_board_data.h" /* PIOS_BOARD_*_DATA_LENGTH */ @@ -81,7 +79,7 @@ static bool PIOS_USB_HID_validate(struct pios_usb_hid_dev * usb_hid_dev) return (usb_hid_dev->magic == PIOS_USB_HID_DEV_MAGIC); } -#if defined(PIOS_INCLUDE_FREERTOS) +#ifdef PIOS_INCLUDE_FREERTOS static struct pios_usb_hid_dev * PIOS_USB_HID_alloc(void) { struct pios_usb_hid_dev * usb_hid_dev; @@ -193,7 +191,7 @@ static void PIOS_USB_HID_SendReport(struct pios_usb_hid_dev * usb_hid_dev) SetEPTxCount(usb_hid_dev->cfg->data_tx_ep, sizeof(usb_hid_dev->tx_packet_buffer)); SetEPTxValid(usb_hid_dev->cfg->data_tx_ep); -#if defined(PIOS_INCLUDE_FREERTOS) +#ifdef PIOS_INCLUDE_FREERTOS if (need_yield) { vPortYieldFromISR(); } @@ -354,7 +352,7 @@ static void PIOS_USB_HID_EP_OUT_Callback(void) SetEPRxStatus(usb_hid_dev->cfg->data_rx_ep, EP_RX_NAK); } -#if defined(PIOS_INCLUDE_FREERTOS) +#ifdef PIOS_INCLUDE_FREERTOS if (need_yield) { vPortYieldFromISR(); } diff --git a/flight/PiOS/STM32F10x/pios_usb_hid_istr.c b/flight/PiOS/STM32F10x/pios_usb_hid_istr.c index 89204d07f..7426b6a9c 100644 --- a/flight/PiOS/STM32F10x/pios_usb_hid_istr.c +++ b/flight/PiOS/STM32F10x/pios_usb_hid_istr.c @@ -14,8 +14,8 @@ *******************************************************************************/ /* Includes ------------------------------------------------------------------*/ -#include "usb_lib.h" #include "pios.h" +#include "usb_lib.h" #include "pios_usb_hid_pwr.h" #include "pios_usb_hid_istr.h" #include "pios_usb_hid.h" diff --git a/flight/PiOS/STM32F10x/pios_usb_rctx.c b/flight/PiOS/STM32F10x/pios_usb_rctx.c index 3976eafc3..11e333295 100644 --- a/flight/PiOS/STM32F10x/pios_usb_rctx.c +++ b/flight/PiOS/STM32F10x/pios_usb_rctx.c @@ -28,12 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_USB_RCTX) +#ifdef PIOS_INCLUDE_USB_RCTX -#include "pios_usb.h" #include "pios_usb_rctx_priv.h" /* STM32 USB Library Definitions */ @@ -62,7 +60,7 @@ static bool PIOS_USB_RCTX_validate(struct pios_usb_rctx_dev * usb_rctx_dev) return (usb_rctx_dev->magic == PIOS_USB_RCTX_DEV_MAGIC); } -#if defined(PIOS_INCLUDE_FREERTOS) +#ifdef PIOS_INCLUDE_FREERTOS static struct pios_usb_rctx_dev * PIOS_USB_RCTX_alloc(void) { struct pios_usb_rctx_dev * usb_rctx_dev; @@ -126,7 +124,7 @@ out_fail: static void PIOS_USB_RCTX_SendReport(struct pios_usb_rctx_dev * usb_rctx_dev) { -#if defined(PIOS_INCLUDE_FREERTOS) +#ifdef PIOS_INCLUDE_FREERTOS bool need_yield = false; #endif /* PIOS_INCLUDE_FREERTOS */ @@ -139,7 +137,7 @@ static void PIOS_USB_RCTX_SendReport(struct pios_usb_rctx_dev * usb_rctx_dev) SetEPTxCount(usb_rctx_dev->cfg->data_tx_ep, sizeof(usb_rctx_dev->report)); SetEPTxValid(usb_rctx_dev->cfg->data_tx_ep); -#if defined(PIOS_INCLUDE_FREERTOS) +#ifdef PIOS_INCLUDE_FREERTOS if (need_yield) { vPortYieldFromISR(); } @@ -208,4 +206,4 @@ void PIOS_USB_RCTX_Update(uint32_t usbrctx_id, const uint16_t channel[], const i PIOS_USB_RCTX_SendReport(usb_rctx_dev); } -#endif /* PIOS_INCLUDE_USB_RCTX */ +#endif /* PIOS_INCLUDE_USB_RCTX */ diff --git a/flight/PiOS/STM32F10x/pios_wdg.c b/flight/PiOS/STM32F10x/pios_wdg.c index 312807e26..0f3e9d600 100644 --- a/flight/PiOS/STM32F10x/pios_wdg.c +++ b/flight/PiOS/STM32F10x/pios_wdg.c @@ -33,6 +33,9 @@ */ #include "pios.h" + +#ifdef PIOS_INCLUDE_WDG + #include "stm32f10x_iwdg.h" #include "stm32f10x_dbgmcu.h" @@ -173,3 +176,5 @@ void PIOS_WDG_Clear(void) IWDG_ReloadCounter(); #endif } + +#endif /* PIOS_INCLUDE_WDG */ From e80890e1649c230cfc94d169a8161b93ca768f9a Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Fri, 15 Mar 2013 20:42:54 +0200 Subject: [PATCH 08/68] pios: STM32F4xx PIOS #ifdef guards --- flight/PiOS/STM32F4xx/pios_adc.c | 4 +++- flight/PiOS/STM32F4xx/pios_bl_helper.c | 8 +++++--- flight/PiOS/STM32F4xx/pios_debug.c | 1 - flight/PiOS/STM32F4xx/pios_delay.c | 5 ++--- flight/PiOS/STM32F4xx/pios_dsm.c | 10 +++++----- flight/PiOS/STM32F4xx/pios_exti.c | 3 +-- flight/PiOS/STM32F4xx/pios_flash_internal.c | 4 ++-- flight/PiOS/STM32F4xx/pios_gpio.c | 5 ++--- flight/PiOS/STM32F4xx/pios_i2c.c | 7 +++---- flight/PiOS/STM32F4xx/pios_iap.c | 4 ++++ flight/PiOS/STM32F4xx/pios_irq.c | 5 ++--- flight/PiOS/STM32F4xx/pios_led.c | 5 ++--- flight/PiOS/STM32F4xx/pios_overo.c | 8 ++++++-- flight/PiOS/STM32F4xx/pios_ppm.c | 8 ++++---- flight/PiOS/STM32F4xx/pios_pwm.c | 8 ++++---- flight/PiOS/STM32F4xx/pios_rtc.c | 7 ++++--- flight/PiOS/STM32F4xx/pios_servo.c | 6 +++++- flight/PiOS/STM32F4xx/pios_spi.c | 4 ++-- flight/PiOS/STM32F4xx/pios_sys.c | 5 ++--- flight/PiOS/STM32F4xx/pios_tim.c | 5 ++++- flight/PiOS/STM32F4xx/pios_usart.c | 5 ++--- flight/PiOS/STM32F4xx/pios_usb.c | 8 ++++---- flight/PiOS/STM32F4xx/pios_usb_cdc.c | 6 ++---- flight/PiOS/STM32F4xx/pios_usb_hid.c | 6 ++---- flight/PiOS/STM32F4xx/pios_wdg.c | 5 +++++ 25 files changed, 77 insertions(+), 65 deletions(-) diff --git a/flight/PiOS/STM32F4xx/pios_adc.c b/flight/PiOS/STM32F4xx/pios_adc.c index a1320a1be..7131e440a 100644 --- a/flight/PiOS/STM32F4xx/pios_adc.c +++ b/flight/PiOS/STM32F4xx/pios_adc.c @@ -43,9 +43,11 @@ */ #include "pios.h" + +#ifdef PIOS_INCLUDE_ADC + #include -#if defined(PIOS_INCLUDE_ADC) #if !defined(PIOS_ADC_MAX_SAMPLES) #define PIOS_ADC_MAX_SAMPLES 0 diff --git a/flight/PiOS/STM32F4xx/pios_bl_helper.c b/flight/PiOS/STM32F4xx/pios_bl_helper.c index 05de4a305..afa59b3e5 100644 --- a/flight/PiOS/STM32F4xx/pios_bl_helper.c +++ b/flight/PiOS/STM32F4xx/pios_bl_helper.c @@ -28,9 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_BL_HELPER) + +#ifdef PIOS_INCLUDE_BL_HELPER + #include #include "stm32f4xx_flash.h" #include @@ -192,4 +193,5 @@ void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t * array, uint8_t size) void PIOS_BL_HELPER_CRC_Ini() { } -#endif + +#endif /* PIOS_INCLUDE_BL_HELPER */ diff --git a/flight/PiOS/STM32F4xx/pios_debug.c b/flight/PiOS/STM32F4xx/pios_debug.c index 339b9d427..0e607cf47 100644 --- a/flight/PiOS/STM32F4xx/pios_debug.c +++ b/flight/PiOS/STM32F4xx/pios_debug.c @@ -28,7 +28,6 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" // Global variables diff --git a/flight/PiOS/STM32F4xx/pios_delay.c b/flight/PiOS/STM32F4xx/pios_delay.c index 947998c3f..5faeef2c7 100644 --- a/flight/PiOS/STM32F4xx/pios_delay.c +++ b/flight/PiOS/STM32F4xx/pios_delay.c @@ -30,10 +30,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include -#if defined(PIOS_INCLUDE_DELAY) +#ifdef PIOS_INCLUDE_DELAY /* these should be defined by CMSIS, but they aren't */ #define DWT_CTRL (*(volatile uint32_t *)0xe0001000) @@ -167,7 +166,7 @@ uint32_t PIOS_DELAY_DiffuS(uint32_t raw) return diff / us_ticks; } -#endif +#endif /* PIOS_INCLUDE_DELAY */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_dsm.c b/flight/PiOS/STM32F4xx/pios_dsm.c index 7c5348560..4bcc0187f 100644 --- a/flight/PiOS/STM32F4xx/pios_dsm.c +++ b/flight/PiOS/STM32F4xx/pios_dsm.c @@ -28,13 +28,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" + +#ifdef PIOS_INCLUDE_DSM + #include "pios_dsm_priv.h" -#if defined(PIOS_INCLUDE_DSM) - -#if !defined(PIOS_INCLUDE_RTC) +#ifndef PIOS_INCLUDE_RTC #error PIOS_INCLUDE_RTC must be used to use DSM #endif @@ -401,7 +401,7 @@ static void PIOS_DSM_Supervisor(uint32_t dsm_id) } } -#endif /* PIOS_INCLUDE_DSM */ +#endif /* PIOS_INCLUDE_DSM */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_exti.c b/flight/PiOS/STM32F4xx/pios_exti.c index 45efb2ae5..3dc1e1158 100644 --- a/flight/PiOS/STM32F4xx/pios_exti.c +++ b/flight/PiOS/STM32F4xx/pios_exti.c @@ -29,10 +29,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_EXTI) +#ifdef PIOS_INCLUDE_EXTI /* Map EXTI line to full config */ #define EXTI_MAX_LINES 16 diff --git a/flight/PiOS/STM32F4xx/pios_flash_internal.c b/flight/PiOS/STM32F4xx/pios_flash_internal.c index 534b911fd..fceae8038 100644 --- a/flight/PiOS/STM32F4xx/pios_flash_internal.c +++ b/flight/PiOS/STM32F4xx/pios_flash_internal.c @@ -26,7 +26,7 @@ #include "pios.h" -#if defined(PIOS_INCLUDE_FLASH_INTERNAL) +#ifdef PIOS_INCLUDE_FLASH_INTERNAL #include "stm32f4xx_flash.h" #include "pios_flash_internal_priv.h" @@ -334,4 +334,4 @@ const struct pios_flash_driver pios_internal_flash_driver = { .read_data = PIOS_Flash_Internal_ReadData, }; -#endif /* defined(PIOS_INCLUDE_FLASH_INTERNAL) */ +#endif /* PIOS_INCLUDE_FLASH_INTERNAL */ diff --git a/flight/PiOS/STM32F4xx/pios_gpio.c b/flight/PiOS/STM32F4xx/pios_gpio.c index 88f342a74..18c083d9b 100644 --- a/flight/PiOS/STM32F4xx/pios_gpio.c +++ b/flight/PiOS/STM32F4xx/pios_gpio.c @@ -28,10 +28,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_GPIO) +#ifdef PIOS_INCLUDE_GPIO /* Private Function Prototypes */ @@ -92,7 +91,7 @@ void PIOS_GPIO_Toggle(uint8_t Pin) GPIO_ToggleBits(GPIO_PORT[Pin], GPIO_PIN[Pin]); } -#endif +#endif /* PIOS_INCLUDE_GPIO */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_i2c.c b/flight/PiOS/STM32F4xx/pios_i2c.c index bb2a1bfc1..9ceb72337 100644 --- a/flight/PiOS/STM32F4xx/pios_i2c.c +++ b/flight/PiOS/STM32F4xx/pios_i2c.c @@ -33,12 +33,11 @@ * be merged. */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_I2C) +#ifdef PIOS_INCLUDE_I2C -#if defined(PIOS_INCLUDE_FREERTOS) +#ifdef PIOS_INCLUDE_FREERTOS #define USE_FREERTOS #endif @@ -1232,7 +1231,7 @@ void PIOS_I2C_ER_IRQ_Handler(uint32_t i2c_id) } } -#endif +#endif /* PIOS_INCLUDE_I2C */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_iap.c b/flight/PiOS/STM32F4xx/pios_iap.c index ca4ef89ba..e08ccd09a 100644 --- a/flight/PiOS/STM32F4xx/pios_iap.c +++ b/flight/PiOS/STM32F4xx/pios_iap.c @@ -33,6 +33,8 @@ ****************************************************************************************/ #include +#ifdef PIOS_INCLUDE_IAP + /**************************************************************************************** * Private Definitions/Macros ****************************************************************************************/ @@ -140,3 +142,5 @@ void PIOS_IAP_WriteBootCount (uint16_t boot_count) { RTC_WriteBackupRegister ( IAP_BOOTCOUNT, boot_count ); } + +#endif /* PIOS_INCLUDE_IAP */ diff --git a/flight/PiOS/STM32F4xx/pios_irq.c b/flight/PiOS/STM32F4xx/pios_irq.c index b556931bc..d14120829 100644 --- a/flight/PiOS/STM32F4xx/pios_irq.c +++ b/flight/PiOS/STM32F4xx/pios_irq.c @@ -32,10 +32,9 @@ * @todo This should be shared with the F1xx code. */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_IRQ) +#ifdef PIOS_INCLUDE_IRQ /* Private Function Prototypes */ @@ -93,7 +92,7 @@ int32_t PIOS_IRQ_Enable(void) return 0; } -#endif +#endif /* PIOS_INCLUDE_IRQ */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_led.c b/flight/PiOS/STM32F4xx/pios_led.c index 1f7fd6365..7ff5dec42 100644 --- a/flight/PiOS/STM32F4xx/pios_led.c +++ b/flight/PiOS/STM32F4xx/pios_led.c @@ -28,10 +28,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_LED) +#ifdef PIOS_INCLUDE_LED #include @@ -166,7 +165,7 @@ void PIOS_LED_Toggle(uint32_t led_id) } } -#endif +#endif /* PIOS_INCLUDE_LED */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_overo.c b/flight/PiOS/STM32F4xx/pios_overo.c index c535d413e..2de75591a 100644 --- a/flight/PiOS/STM32F4xx/pios_overo.c +++ b/flight/PiOS/STM32F4xx/pios_overo.c @@ -31,6 +31,8 @@ #include +#ifdef PIOS_INCLUDE_OVERO + /** * Configures the SPI device to use a double buffered DMA for transferring * data. At the end of each transfer (NSS goes high) it makes sure to reset @@ -38,7 +40,7 @@ * buffer */ -#if defined(PIOS_INCLUDE_SPI) +#ifdef PIOS_INCLUDE_SPI #include @@ -368,7 +370,9 @@ static void PIOS_OVERO_RxStart(uint32_t overo_id, uint16_t rx_bytes_avail) {}; #endif /* PIOS_INCLUDE_FREERTOS */ -#endif +#endif /* PIOS_INCLUDE_SPI */ + +#endif /* PIOS_INCLUDE_OVERO */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_ppm.c b/flight/PiOS/STM32F4xx/pios_ppm.c index e17b342b7..3040287da 100644 --- a/flight/PiOS/STM32F4xx/pios_ppm.c +++ b/flight/PiOS/STM32F4xx/pios_ppm.c @@ -28,11 +28,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#include "pios_ppm_priv.h" -#if defined(PIOS_INCLUDE_PPM) +#ifdef PIOS_INCLUDE_PPM + +#include "pios_ppm_priv.h" /* Provide a RCVR driver */ static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel); @@ -349,7 +349,7 @@ static void PIOS_PPM_Supervisor(uint32_t ppm_id) { ppm_dev->Fresh = false; } -#endif +#endif /* PIOS_INCLUDE_PPM */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_pwm.c b/flight/PiOS/STM32F4xx/pios_pwm.c index 5bbec32aa..4f7f6c942 100644 --- a/flight/PiOS/STM32F4xx/pios_pwm.c +++ b/flight/PiOS/STM32F4xx/pios_pwm.c @@ -28,11 +28,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#include "pios_pwm_priv.h" -#if defined(PIOS_INCLUDE_PWM) +#ifdef PIOS_INCLUDE_PWM + +#include "pios_pwm_priv.h" /* Provide a RCVR driver */ static int32_t PIOS_PWM_Get(uint32_t rcvr_id, uint8_t channel); @@ -274,7 +274,7 @@ static void PIOS_PWM_tim_edge_cb (uint32_t tim_id, uint32_t context, uint8_t cha } -#endif +#endif /* PIOS_INCLUDE_PWM */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_rtc.c b/flight/PiOS/STM32F4xx/pios_rtc.c index cc2de2ce2..e5b2e64ab 100644 --- a/flight/PiOS/STM32F4xx/pios_rtc.c +++ b/flight/PiOS/STM32F4xx/pios_rtc.c @@ -28,10 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_RTC) +#ifdef PIOS_INCLUDE_RTC + #include #ifndef PIOS_RTC_PRESCALER @@ -130,7 +130,8 @@ void PIOS_RTC_irq_handler (void) if (EXTI_GetITStatus(EXTI_Line22) != RESET) EXTI_ClearITPendingBit(EXTI_Line22); } -#endif + +#endif /* PIOS_INCLUDE_RTC */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_servo.c b/flight/PiOS/STM32F4xx/pios_servo.c index 05188d563..5c5d6ef52 100644 --- a/flight/PiOS/STM32F4xx/pios_servo.c +++ b/flight/PiOS/STM32F4xx/pios_servo.c @@ -28,8 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" + +#ifdef PIOS_INCLUDE_SERVO + #include "pios_servo_priv.h" #include "pios_tim_priv.h" @@ -153,3 +155,5 @@ void PIOS_Servo_Set(uint8_t servo, uint16_t position) break; } } + +#endif /* PIOS_INCLUDE_SERVO */ diff --git a/flight/PiOS/STM32F4xx/pios_spi.c b/flight/PiOS/STM32F4xx/pios_spi.c index 87a8e0e9e..2bd07284a 100644 --- a/flight/PiOS/STM32F4xx/pios_spi.c +++ b/flight/PiOS/STM32F4xx/pios_spi.c @@ -38,7 +38,7 @@ */ #include -#if defined(PIOS_INCLUDE_SPI) +#ifdef PIOS_INCLUDE_SPI #include @@ -659,7 +659,7 @@ void PIOS_SPI_IRQ_Handler(uint32_t spi_id) } } -#endif +#endif /* PIOS_INCLUDE_SPI */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_sys.c b/flight/PiOS/STM32F4xx/pios_sys.c index 1bb0a090b..a25e01182 100644 --- a/flight/PiOS/STM32F4xx/pios_sys.c +++ b/flight/PiOS/STM32F4xx/pios_sys.c @@ -29,10 +29,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_SYS) +#ifdef PIOS_INCLUDE_SYS /* Private Function Prototypes */ void NVIC_Configuration(void); @@ -320,7 +319,7 @@ void assert_failed(uint8_t * file, uint32_t line) } #endif -#endif +#endif /* PIOS_INCLUDE_SYS */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_tim.c b/flight/PiOS/STM32F4xx/pios_tim.c index 129e88a86..4f3828d68 100644 --- a/flight/PiOS/STM32F4xx/pios_tim.c +++ b/flight/PiOS/STM32F4xx/pios_tim.c @@ -31,7 +31,8 @@ #include "pios.h" -#include "pios_tim.h" +#ifdef PIOS_INCLUDE_TIM + #include "pios_tim_priv.h" enum pios_tim_dev_magic { @@ -465,6 +466,8 @@ static void PIOS_TIM8_TRG_COM_TIM14_IRQHandler (void) } } +#endif /* PIOS_INCLUDE_TIM */ + /** * @} * @} diff --git a/flight/PiOS/STM32F4xx/pios_usart.c b/flight/PiOS/STM32F4xx/pios_usart.c index 2fe780e48..8080cbb69 100644 --- a/flight/PiOS/STM32F4xx/pios_usart.c +++ b/flight/PiOS/STM32F4xx/pios_usart.c @@ -32,10 +32,9 @@ * @todo This is virtually identical to the F1xx driver and should be merged. */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_USART) +#ifdef PIOS_INCLUDE_USART #include @@ -350,7 +349,7 @@ static void PIOS_USART_generic_irq_handler(uint32_t usart_id) #endif /* PIOS_INCLUDE_FREERTOS */ } -#endif +#endif /* PIOS_INCLUDE_USART */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_usb.c b/flight/PiOS/STM32F4xx/pios_usb.c index ae74d0e89..50ae0837f 100644 --- a/flight/PiOS/STM32F4xx/pios_usb.c +++ b/flight/PiOS/STM32F4xx/pios_usb.c @@ -28,14 +28,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" + +#ifdef PIOS_INCLUDE_USB + #include "usb_core.h" #include "pios_usb_board_data.h" -#include "pios_usb.h" #include "pios_usb_priv.h" -#if defined(PIOS_INCLUDE_USB) /* Rx/Tx status */ static uint8_t transfer_possible = 0; @@ -261,7 +261,7 @@ void USB_OTG_BSP_TimerIRQ (void) } -#endif /* PIOS_INCLUDE_USB */ +#endif /* PIOS_INCLUDE_USB */ /** * @} diff --git a/flight/PiOS/STM32F4xx/pios_usb_cdc.c b/flight/PiOS/STM32F4xx/pios_usb_cdc.c index c26997ccd..30151330e 100644 --- a/flight/PiOS/STM32F4xx/pios_usb_cdc.c +++ b/flight/PiOS/STM32F4xx/pios_usb_cdc.c @@ -29,12 +29,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_USB_CDC) +#ifdef PIOS_INCLUDE_USB_CDC -#include "pios_usb.h" #include "pios_usb_cdc_priv.h" #include "pios_usb_board_data.h" /* PIOS_BOARD_*_DATA_LENGTH */ @@ -398,4 +396,4 @@ static void PIOS_USB_CDC_CTRL_EP_IN_Callback(void) SetEPTxValid(usb_cdc_dev->cfg->data_tx_ep); } -#endif /* PIOS_INCLUDE_USB_CDC */ +#endif /* PIOS_INCLUDE_USB_CDC */ diff --git a/flight/PiOS/STM32F4xx/pios_usb_hid.c b/flight/PiOS/STM32F4xx/pios_usb_hid.c index 4fa50960c..88f45978b 100644 --- a/flight/PiOS/STM32F4xx/pios_usb_hid.c +++ b/flight/PiOS/STM32F4xx/pios_usb_hid.c @@ -29,12 +29,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_USB_HID) +#ifdef PIOS_INCLUDE_USB_HID -#include "pios_usb.h" #include "pios_usb_hid_priv.h" #include "pios_usb_board_data.h" /* PIOS_BOARD_*_DATA_LENGTH */ #include "pios_usbhook.h" /* PIOS_USBHOOK_* */ @@ -525,4 +523,4 @@ static bool PIOS_USB_HID_EP_OUT_Callback(uint32_t usb_hid_id, uint8_t epnum, uin return rc; } -#endif /* PIOS_INCLUDE_USB_HID */ +#endif /* PIOS_INCLUDE_USB_HID */ diff --git a/flight/PiOS/STM32F4xx/pios_wdg.c b/flight/PiOS/STM32F4xx/pios_wdg.c index 2c718ecfd..f1a5e5d10 100644 --- a/flight/PiOS/STM32F4xx/pios_wdg.c +++ b/flight/PiOS/STM32F4xx/pios_wdg.c @@ -37,6 +37,9 @@ */ #include "pios.h" + +#ifdef PIOS_INCLUDE_WDG + #include "stm32f4xx_iwdg.h" #include "stm32f4xx_dbgmcu.h" #include "stm32f4xx_rtc.h" @@ -177,3 +180,5 @@ void PIOS_WDG_Clear(void) IWDG_ReloadCounter(); #endif } + +#endif /* PIOS_INCLUDE_WDG */ From 00a0ef430dd31c0cb5bfb3b44430aa4bc6d53ca2 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 14:34:25 +0200 Subject: [PATCH 09/68] pios: fix pios_config.h (now PIOS_INCLUDE_COM_MSG requires PIOS_INCLUDE_COM) --- flight/targets/Bootloaders/CopterControl/inc/pios_config.h | 1 + flight/targets/Bootloaders/OSD/inc/pios_config.h | 1 + flight/targets/Bootloaders/PipXtreme/inc/pios_config.h | 1 + flight/targets/Bootloaders/RevoMini/inc/pios_config.h | 1 + flight/targets/Bootloaders/Revolution/inc/pios_config.h | 1 + 5 files changed, 5 insertions(+) diff --git a/flight/targets/Bootloaders/CopterControl/inc/pios_config.h b/flight/targets/Bootloaders/CopterControl/inc/pios_config.h index 3eb2c281a..f06d6257e 100644 --- a/flight/targets/Bootloaders/CopterControl/inc/pios_config.h +++ b/flight/targets/Bootloaders/CopterControl/inc/pios_config.h @@ -39,6 +39,7 @@ #define PIOS_INCLUDE_SYS #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_MSG #define PIOS_INCLUDE_GPIO #define PIOS_INCLUDE_IAP diff --git a/flight/targets/Bootloaders/OSD/inc/pios_config.h b/flight/targets/Bootloaders/OSD/inc/pios_config.h index dc71a1556..6dd5cda23 100644 --- a/flight/targets/Bootloaders/OSD/inc/pios_config.h +++ b/flight/targets/Bootloaders/OSD/inc/pios_config.h @@ -36,6 +36,7 @@ #define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_MSG #define PIOS_INCLUDE_BL_HELPER #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT diff --git a/flight/targets/Bootloaders/PipXtreme/inc/pios_config.h b/flight/targets/Bootloaders/PipXtreme/inc/pios_config.h index 1b1b9c2bc..dfa1ff2da 100644 --- a/flight/targets/Bootloaders/PipXtreme/inc/pios_config.h +++ b/flight/targets/Bootloaders/PipXtreme/inc/pios_config.h @@ -38,6 +38,7 @@ #define PIOS_INCLUDE_SYS #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_MSG #define PIOS_INCLUDE_GPIO #define PIOS_INCLUDE_IAP diff --git a/flight/targets/Bootloaders/RevoMini/inc/pios_config.h b/flight/targets/Bootloaders/RevoMini/inc/pios_config.h index cfe34aaad..88f4f6c08 100644 --- a/flight/targets/Bootloaders/RevoMini/inc/pios_config.h +++ b/flight/targets/Bootloaders/RevoMini/inc/pios_config.h @@ -36,6 +36,7 @@ #define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_MSG #define PIOS_INCLUDE_BL_HELPER #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT diff --git a/flight/targets/Bootloaders/Revolution/inc/pios_config.h b/flight/targets/Bootloaders/Revolution/inc/pios_config.h index dc71a1556..6dd5cda23 100644 --- a/flight/targets/Bootloaders/Revolution/inc/pios_config.h +++ b/flight/targets/Bootloaders/Revolution/inc/pios_config.h @@ -36,6 +36,7 @@ #define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_MSG #define PIOS_INCLUDE_BL_HELPER #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT From 23c605ffbac1de2474df4c012669539b5220006c Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 11 Mar 2013 21:54:36 +0200 Subject: [PATCH 10/68] Makefile: indents, comments, spacing, $(CMDS) variables, etc. How to invoke external command instead of shell builtin on Windows: ECHO := /bin/echo Conflicts: Makefile --- Makefile | 596 +++++++++++++++++++++++------------------- make/firmware-defs.mk | 2 +- make/tools.mk | 16 +- 3 files changed, 334 insertions(+), 280 deletions(-) diff --git a/Makefile b/Makefile index 9605e7194..85b39d25d 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,36 @@ +# +# Top level Makefile for the OpenPilot project build system. +# Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + # Set up a default goal .DEFAULT_GOAL := help # Set up some macros for common directories within the tree -ROOT_DIR=$(CURDIR) -TOOLS_DIR=$(ROOT_DIR)/tools -BUILD_DIR=$(ROOT_DIR)/build -DL_DIR=$(ROOT_DIR)/downloads +ROOT_DIR := $(CURDIR) +TOOLS_DIR := $(ROOT_DIR)/tools +BUILD_DIR := $(ROOT_DIR)/build +DL_DIR := $(ROOT_DIR)/downloads + +# Set up default build configurations (debug | release) +UAVOGEN_BUILD_CONF ?= debug +GCS_BUILD_CONF ?= debug +ANDROIDGCS_BUILD_CONF ?= debug +GOOGLE_API_VERSION ?= 14 # Function for converting an absolute path to one relative # to the top of the source tree. @@ -15,10 +40,10 @@ toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1))) # to remove the chance that they will cause problems with our build define SANITIZE_VAR $(if $(filter-out undefined,$(origin $(1))), - $(info *NOTE* Sanitized $(2) variable '$(1)' from $(origin $(1))) - MAKEOVERRIDES = $(filter-out $(1)=%,$(MAKEOVERRIDES)) - override $(1) := - unexport $(1) + $(info *NOTE* Sanitized $(2) variable '$(1)' from $(origin $(1))) + MAKEOVERRIDES = $(filter-out $(1)=%,$(MAKEOVERRIDES)) + override $(1) := + unexport $(1) ) endef @@ -31,144 +56,107 @@ $(foreach var, $(SANITIZE_GCC_VARS), $(eval $(call SANITIZE_VAR,$(var),disallowe SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER $(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated))) -# Deal with unreasonable requests -# See: http://xkcd.com/149/ -ifeq ($(MAKECMDGOALS),me a sandwich) - ifeq ($(shell whoami),root) - $(error Okay) - else - $(error What? Make it yourself) - endif -endif - # Make sure this isn't being run as root -ifeq ($(shell whoami),root) -$(error You should not be running this as root) +ifeq ($(shell whoami 2>/dev/null),root) + $(error You should not be running this as root) endif # Decide on a verbosity level based on the V= parameter export AT := @ - ifndef V -export V0 := -export V1 := $(AT) + export V0 := + export V1 := $(AT) else ifeq ($(V), 0) -export V0 := $(AT) -export V1 := $(AT) + export V0 := $(AT) + export V1 := $(AT) else ifeq ($(V), 1) endif -# Make sure we know a few things about the architecture before including +# Set up misc host tools, maybe useful on Windows +ECHO := echo +MKDIR := mkdir +RM := rm +LN := ln +SED := sed +TAR := tar +ANT := ant +JAVAC := javac +JAR := jar +GIT := git +PYTHON := python +INSTALL := install + +# Make sure we know few things about the architecture before including # the tools.mk to ensure that we download/install the right tools. UNAME := $(shell uname) -ARCH := $(shell uname -m) +ARCH := $(shell uname -m) +# Here and everywhere if not Linux or OSX then assume Windows +ifeq ($(filter Linux Darwin, $(UNAME)), ) + UNAME := Windows +endif +# The tools.mk uses wget to fetch tarballs or packages +ifeq ($(shell [ -x "$(TOOLS_DIR)/bin/wget" ] && $(ECHO) "exists"), exists) + WGET := $(TOOLS_DIR)/bin/wget +else + # not installed, hope it's in the path... + WGET ?= wget +endif + +# Include tools installers include $(ROOT_DIR)/make/tools.mk +# Set up paths to tools +ifeq ($(shell [ -d "$(QT_SDK_DIR)" ] && $(ECHO) "exists"), exists) + QMAKE := $(QT_SDK_QMAKE_PATH) +else + # not installed, hope it's in the path... + QMAKE ?= qmake +endif + +ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && $(ECHO) "exists"), exists) + ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi- +else + # not installed, hope it's in the path... + ARM_SDK_PREFIX ?= arm-none-eabi- +endif + +ifeq ($(shell [ -d "$(OPENOCD_DIR)" ] && $(ECHO) "exists"), exists) + OPENOCD := $(OPENOCD_DIR)/bin/openocd +else + # not installed, hope it's in the path... + OPENOCD ?= openocd +endif + +ifeq ($(shell [ -d "$(ANDROID_SDK_DIR)" ] && $(ECHO) "exists"), exists) + ANDROID := $(ANDROID_SDK_DIR)/tools/android + ANDROID_DX := $(ANDROID_SDK_DIR)/platform-tools/dx +else + # not installed, hope it's in the path... + ANDROID ?= android + ANDROID_DX ?= dx +endif + # We almost need to consider autoconf/automake instead of this -# I don't know if windows supports uname :-( -QT_SPEC=win32-g++ -UAVOBJGENERATOR="$(BUILD_DIR)/ground/uavobjgenerator/debug/uavobjgenerator.exe" ifeq ($(UNAME), Linux) - QT_SPEC=linux-g++ - UAVOBJGENERATOR="$(BUILD_DIR)/ground/uavobjgenerator/uavobjgenerator" -endif -ifeq ($(UNAME), Darwin) - QT_SPEC=macx-g++ - UAVOBJGENERATOR="$(BUILD_DIR)/ground/uavobjgenerator/uavobjgenerator" + QT_SPEC = linux-g++ + UAVOBJGENERATOR = "$(BUILD_DIR)/ground/uavobjgenerator/uavobjgenerator" +else ifeq ($(UNAME), Darwin) + QT_SPEC = macx-g++ + UAVOBJGENERATOR = "$(BUILD_DIR)/ground/uavobjgenerator/uavobjgenerator" +else + QT_SPEC = win32-g++ + UAVOBJGENERATOR = "$(BUILD_DIR)/ground/uavobjgenerator/$(UAVOGEN_BUILD_CONF)/uavobjgenerator.exe" endif -# OpenPilot GCS build configuration (debug | release) -GCS_BUILD_CONF ?= debug +# version-info cmd to extract some repository data +VERSION_INFO := $(PYTHON) $(ROOT_DIR)/make/scripts/version-info.py --path="$(ROOT_DIR)" -# Set up misc host tools -RM=rm - -.PHONY: help -help: - @echo - @echo " This Makefile is known to work on Linux and Mac in a standard shell environment." - @echo " It also works on Windows by following the instructions in make/winx86/README.txt." - @echo - @echo " Here is a summary of the available targets:" - @echo - @echo " [Tool Installers]" - @echo " qt_sdk_install - Install the QT v4.7.3 tools" - @echo " arm_sdk_install - Install the GNU ARM gcc toolchain" - @echo " openocd_install - Install the OpenOCD JTAG daemon" - @echo " stm32flash_install - Install the stm32flash tool for unbricking boards" - @echo " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards" - @echo " android_sdk_install - Install the Android SDK tools" - @echo - @echo " [Big Hammer]" - @echo " all - Generate UAVObjects, build openpilot firmware and gcs" - @echo " all_flight - Build all firmware, bootloaders and bootloader updaters" - @echo " all_fw - Build only firmware for all boards" - @echo " all_bl - Build only bootloaders for all boards" - @echo " all_bu - Build only bootloader updaters for all boards" - @echo - @echo " all_clean - Remove your build directory ($(BUILD_DIR))" - @echo " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters" - @echo " all_fw_clean - Remove firmware for all boards" - @echo " all_bl_clean - Remove bootlaoders for all boards" - @echo " all_bu_clean - Remove bootloader updaters for all boards" - @echo - @echo " all_ - Build all available images for " - @echo " all__clean - Remove all available images for " - @echo - @echo " all_ut - Build all unit tests" - @echo " all_ut_tap - Run all unit tests and capture all TAP output to files" - @echo " all_ut_run - Run all unit tests and dump TAP output to console" - @echo - @echo " [Firmware]" - @echo " - Build firmware for " - @echo " supported boards are ($(ALL_BOARDS))" - @echo " fw_ - Build firmware for " - @echo " supported boards are ($(FW_BOARDS))" - @echo " fw__clean - Remove firmware for " - @echo " fw__program - Use OpenOCD + JTAG to write firmware to " - @echo - @echo " [Bootloader]" - @echo " bl_ - Build bootloader for " - @echo " supported boards are ($(BL_BOARDS))" - @echo " bl__clean - Remove bootloader for " - @echo " bl__program - Use OpenOCD + JTAG to write bootloader to " - @echo - @echo " [Bootloader Updater]" - @echo " bu_ - Build bootloader updater for " - @echo " supported boards are ($(BU_BOARDS))" - @echo " bu__clean - Remove bootloader updater for " - @echo - @echo " [Unbrick a board]" - @echo " unbrick_ - Use the STM32's built in boot ROM to write a bootloader to " - @echo " supported boards are ($(BL_BOARDS))" - @echo " [Unittests]" - @echo " ut_ - Build unit test " - @echo " ut__tap - Run test and capture TAP output into a file" - @echo " ut__run - Run test and dump TAP output to console" - @echo - @echo " [Simulation]" - @echo " sim_osx - Build OpenPilot simulation firmware for OSX" - @echo " sim_osx_clean - Delete all build output for the osx simulation" - @echo " sim_win32 - Build OpenPilot simulation firmware for" - @echo " Windows using mingw and msys" - @echo " sim_win32_clean - Delete all build output for the win32 simulation" - @echo - @echo " [GCS]" - @echo " gcs - Build the Ground Control System (GCS) application" - @echo " gcs_clean - Remove the Ground Control System (GCS) application" - @echo - @echo " [UAVObjects]" - @echo " uavobjects - Generate source files from the UAVObject definition XML files" - @echo " uavobjects_test - parse xml-files - check for valid, duplicate ObjId's, ... " - @echo " uavobjects_ - Generate source files from a subset of the UAVObject definition XML files" - @echo " supported groups are ($(UAVOBJ_TARGETS))" - @echo - @echo " Hint: Add V=1 to your command line to see verbose build output." - @echo - @echo " Note: All tools will be installed into $(TOOLS_DIR)" - @echo " All build output will be placed in $(BUILD_DIR)" - @echo +############################## +# +# All targets +# +############################## .PHONY: all all: uavobjects all_ground all_flight @@ -178,49 +166,56 @@ all_clean: [ ! -d "$(BUILD_DIR)" ] || $(RM) -rf "$(BUILD_DIR)" $(DL_DIR): - mkdir -p $@ + $(MKDIR) -p $@ $(TOOLS_DIR): - mkdir -p $@ + $(MKDIR) -p $@ $(BUILD_DIR): - mkdir -p $@ + $(MKDIR) -p $@ ############################## # -# Set up paths to tools +# UAVObjects # ############################## -ifeq ($(shell [ -d "$(QT_SDK_DIR)" ] && echo "exists"), exists) - QMAKE = $(QT_SDK_QMAKE_PATH) +ifeq ($(V), 1) + UAVOGEN_SILENT := else - # not installed, hope it's in the path... - QMAKE = qmake + UAVOGEN_SILENT := silent endif -ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && echo "exists"), exists) - ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi- -else - # not installed, hope it's in the path... - ARM_SDK_PREFIX ?= arm-none-eabi- -endif +.PHONY: uavobjgenerator +uavobjgenerator: + $(V1) $(MKDIR) -p $(BUILD_DIR)/ground/$@ + $(V1) ( cd $(BUILD_DIR)/ground/$@ && \ + $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro -spec $(QT_SPEC) -r CONFIG+="$(UAVOGEN_BUILD_CONF) $(UAVOGEN_SILENT)" && \ + $(MAKE) --no-print-directory -w ; \ + ) -ifeq ($(shell [ -d "$(OPENOCD_DIR)" ] && echo "exists"), exists) - OPENOCD := $(OPENOCD_DIR)/bin/openocd -else - # not installed, hope it's in the path... - OPENOCD ?= openocd -endif +UAVOBJ_TARGETS := gcs flight python matlab java wireshark -ifeq ($(shell [ -d "$(ANDROID_SDK_DIR)" ] && echo "exists"), exists) - ANDROID := $(ANDROID_SDK_DIR)/tools/android - ANDROID_DX := $(ANDROID_SDK_DIR)/platform-tools/dx -else - # not installed, hope it's in the path... - ANDROID ?= android - ANDROID_DX ?= dx -endif +.PHONY: uavobjects +uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS)) + +UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition +UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics + +$(UAVOBJ_OUT_DIR): + $(V1) $(MKDIR) -p $@ + +uavobjects_%: $(UAVOBJ_OUT_DIR) uavobjgenerator + $(V1) ( cd $(UAVOBJ_OUT_DIR) && \ + $(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \ + ) + +uavobjects_test: $(UAVOBJ_OUT_DIR) uavobjgenerator + $(V1) $(UAVOBJGENERATOR) -v -none $(UAVOBJ_XML_DIR) $(ROOT_DIR) + +uavobjects_clean: + $(V0) @$(ECHO) " CLEAN $@" + $(V1) [ ! -d "$(UAVOBJ_OUT_DIR)" ] || $(RM) -r "$(UAVOBJ_OUT_DIR)" ############################## # @@ -237,91 +232,57 @@ gcs: openpilotgcs gcs_clean: openpilotgcs_clean ifeq ($(V), 1) -GCS_SILENT := + GCS_SILENT := else -GCS_SILENT := silent + GCS_SILENT := silent endif .PHONY: openpilotgcs -openpilotgcs: uavobjects_gcs - $(V1) mkdir -p $(BUILD_DIR)/ground/$@ +openpilotgcs: uavobjects_gcs + $(V1) $(MKDIR) -p $(BUILD_DIR)/ground/$@ $(V1) ( cd $(BUILD_DIR)/ground/$@ && \ - $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) && \ - $(MAKE) -w ; \ + $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) && \ + $(MAKE) -w ; \ ) .PHONY: openpilotgcs_clean openpilotgcs_clean: - $(V0) @echo " CLEAN $@" + $(V0) @$(ECHO) " CLEAN $@" $(V1) [ ! -d "$(BUILD_DIR)/ground/openpilotgcs" ] || $(RM) -r "$(BUILD_DIR)/ground/openpilotgcs" -ifeq ($(V), 1) -UAVOGEN_SILENT := -else -UAVOGEN_SILENT := silent -endif - -.PHONY: uavobjgenerator -uavobjgenerator: - $(V1) mkdir -p $(BUILD_DIR)/ground/$@ - $(V1) ( cd $(BUILD_DIR)/ground/$@ && \ - $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro -spec $(QT_SPEC) -r CONFIG+="debug $(UAVOGEN_SILENT)" && \ - $(MAKE) --no-print-directory -w ; \ - ) - -UAVOBJ_TARGETS := gcs flight python matlab java wireshark -.PHONY:uavobjects -uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS)) - -UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition -UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics - -$(UAVOBJ_OUT_DIR): - $(V1) mkdir -p $@ - -uavobjects_%: $(UAVOBJ_OUT_DIR) uavobjgenerator - $(V1) ( cd $(UAVOBJ_OUT_DIR) && \ - $(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \ - ) - -uavobjects_test: $(UAVOBJ_OUT_DIR) uavobjgenerator - $(V1) $(UAVOBJGENERATOR) -v -none $(UAVOBJ_XML_DIR) $(ROOT_DIR) - -uavobjects_clean: - $(V0) @echo " CLEAN $@" - $(V1) [ ! -d "$(UAVOBJ_OUT_DIR)" ] || $(RM) -r "$(UAVOBJ_OUT_DIR)" - ################################ # # Android GCS related components # ################################ -ANDROIDGCS_BUILD_CONF ?= debug - # Build the output directory for the Android GCS build ANDROIDGCS_OUT_DIR := $(BUILD_DIR)/androidgcs $(ANDROIDGCS_OUT_DIR): - $(V1) mkdir -p $@ + $(V1) $(MKDIR) -p $@ # Build the asset directory for the android assets ANDROIDGCS_ASSETS_DIR := $(ANDROIDGCS_OUT_DIR)/assets $(ANDROIDGCS_ASSETS_DIR)/uavos: - $(V1) mkdir -p $@ + $(V1) $(MKDIR) -p $@ ifeq ($(V), 1) -ANT_QUIET := -ANDROID_SILENT := + ANT_QUIET := + ANDROID_SILENT := else -ANT_QUIET := -q -ANDROID_SILENT := -s + ANT_QUIET := -q + ANDROID_SILENT := -s endif + .PHONY: androidgcs androidgcs: uavo-collections_java - $(V0) @echo " ANDROID $(call toprel, $(ANDROIDGCS_OUT_DIR))" - $(V1) mkdir -p $(ANDROIDGCS_OUT_DIR) - $(V1) $(ANDROID) $(ANDROID_SILENT) update project --target 'Google Inc.:Google APIs:14' --name androidgcs --path ./androidgcs - $(V1) ant -f ./androidgcs/build.xml \ + $(V0) @$(ECHO) " ANDROID $(call toprel, $(ANDROIDGCS_OUT_DIR))" + $(V1) $(MKDIR) -p $(ANDROIDGCS_OUT_DIR) + $(V1) $(ANDROID) $(ANDROID_SILENT) update project \ + --target "Google Inc.:Google APIs:$(GOOGLE_API_VERSION)" \ + --name androidgcs \ + --path ./androidgcs + $(V1) $(ANT) -f ./androidgcs/build.xml \ $(ANT_QUIET) \ -Dout.dir="../$(call toprel, $(ANDROIDGCS_OUT_DIR)/bin)" \ -Dgen.absolute.dir="$(ANDROIDGCS_OUT_DIR)/gen" \ @@ -329,18 +290,21 @@ androidgcs: uavo-collections_java .PHONY: androidgcs_clean androidgcs_clean: - $(V0) @echo " CLEAN $@" + $(V0) @$(ECHO) " CLEAN $@" $(V1) [ ! -d "$(ANDROIDGCS_OUT_DIR)" ] || $(RM) -r "$(ANDROIDGCS_OUT_DIR)" # We want to take snapshots of the UAVOs at each point that they change # to allow the GCS to be compatible with as many versions as possible. -# +# We always include a pseudo collection called "srctree" which represents +# the UAVOs in the source tree. So not necessary to add current tree UAVO +# hash here, it is always included. + # Find the git hashes of each commit that changes uavobjects with: # git log --format=%h -- shared/uavobjectdefinition/ | head -n 2 +# List only UAVO hashes of past releases, do not list current hash. UAVO_GIT_VERSIONS := 5e14f53 -# All versions includes a pseudo collection called "working" which represents -# the UAVOs in the source tree +# All versions includes also the current source tree UAVO hash UAVO_ALL_VERSIONS := $(UAVO_GIT_VERSIONS) srctree # This is where the UAVO collections are stored @@ -352,29 +316,29 @@ define UAVO_COLLECTION_GIT_TEMPLATE # Make the output directory that will contain all of the synthetics for the # uavo collection referenced by the git hash $(1) $$(UAVO_COLLECTION_DIR)/$(1): - $$(V1) mkdir -p $$(UAVO_COLLECTION_DIR)/$(1) + $$(V1) $(MKDIR) -p $$(UAVO_COLLECTION_DIR)/$(1) # Extract the snapshot of shared/uavobjectdefinition from git hash $(1) $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: | $$(UAVO_COLLECTION_DIR)/$(1) $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: - $$(V0) @echo " UAVOTAR $(1)" - $$(V1) git archive $(1) -o $$@ -- shared/uavobjectdefinition/ + $$(V0) @$(ECHO) " UAVOTAR $(1)" + $$(V1) $(GIT) archive $(1) -o $$@ -- shared/uavobjectdefinition/ # Extract the uavo xml files from our snapshot $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar - $$(V0) @echo " UAVOUNTAR $(1)" - $$(V1) rm -rf $$@ - $$(V1) mkdir -p $$@ - $$(V1) tar -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || rm -rf $$@ + $$(V0) @$(ECHO) " UAVOUNTAR $(1)" + $$(V1) $(RM) -rf $$@ + $$(V1) $(MKDIR) -p $$@ + $$(V1) $(TAR) -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || $(RM) -rf $$@ endef # Map the current working directory into the set of UAVO collections $(UAVO_COLLECTION_DIR)/srctree: - $(V1) mkdir -p $@ + $(V1) $(MKDIR) -p $@ $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: | $(UAVO_COLLECTION_DIR)/srctree $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: $(UAVOBJ_XML_DIR) - $(V1) ln -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml + $(V1) $(LN) -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml # $(1) git hash (or symbolic name) of a UAVO snapshot define UAVO_COLLECTION_BUILD_TEMPLATE @@ -383,18 +347,17 @@ define UAVO_COLLECTION_BUILD_TEMPLATE $$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml # Compute the sha1 hash for this UAVO collection # The sed bit truncates the UAVO hash to 16 hex digits - $$(V1) python $$(ROOT_DIR)/make/scripts/version-info.py \ - --path=$$(ROOT_DIR) \ + $$(V1) $$(VERSION_INFO) \ --uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \ --format='$$$${UAVOSHA1TXT}' | \ - sed -e 's|\(................\).*|\1|' > $$@ + $(SED) -e 's|\(................\).*|\1|' > $$@ - $$(V0) @echo " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) + $$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) # Generate the java uavobjects for this UAVO collection $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavohash - $$(V0) @echo " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) - $$(V1) mkdir -p $$@ + $$(V0) @$(ECHO) " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) + $$(V1) $(MKDIR) -p $$@ $$(V1) ( \ cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \ $$(UAVOBJGENERATOR) -java $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition $$(ROOT_DIR) ; \ @@ -403,22 +366,22 @@ $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavoh # Build a jar file for this UAVO collection $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: | $$(ANDROIDGCS_ASSETS_DIR)/uavos $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java - $$(V0) @echo " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) + $$(V0) @$(ECHO) " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) $$(V1) ( \ HASH=$$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) && \ cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \ - javac java/*.java \ - $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \ - $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \ - $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \ - -d . && \ + $(JAVAC) java/*.java \ + $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \ + $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \ + $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \ + -d . && \ find ./org/openpilot/uavtalk/uavobjects -type f -name '*.class' > classlist.txt && \ - jar cf tmp_uavobjects.jar @classlist.txt && \ + $(JAR) cf tmp_uavobjects.jar @classlist.txt && \ $$(ANDROID_DX) \ --dex \ --output $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar \ tmp_uavobjects.jar && \ - ln -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \ + $(LN) -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \ ) endef @@ -437,7 +400,7 @@ uavo-collections: uavo-collections_java .PHONY: uavo-collections_clean uavo-collections_clean: - $(V0) @echo " CLEAN $(UAVO_COLLECTION_DIR)" + $(V0) @$(ECHO) " CLEAN $(UAVO_COLLECTION_DIR)" $(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR) ############################## @@ -466,7 +429,7 @@ $(1): fw_$(1)_opfw fw_$(1): fw_$(1)_opfw fw_$(1)_%: uavobjects_flight - $(V1) mkdir -p $(BUILD_DIR)/fw_$(1)/dep + $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep $(V1) cd $(ROOT_DIR)/flight/targets/$(2) && \ $$(MAKE) -r --no-print-directory \ BOARD_NAME=$(1) \ @@ -492,7 +455,7 @@ fw_$(1)_%: uavobjects_flight .PHONY: $(1)_clean $(1)_clean: fw_$(1)_clean fw_$(1)_clean: - $(V0) @echo " CLEAN $$@" + $(V0) @$(ECHO) " CLEAN $$@" $(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1) endef @@ -504,7 +467,7 @@ bl_$(1): bl_$(1)_bin bl_$(1)_bino: bl_$(1)_bin bl_$(1)_%: - $(V1) mkdir -p $(BUILD_DIR)/bl_$(1)/dep + $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep $(V1) cd $(ROOT_DIR)/flight/targets/Bootloaders/$(2) && \ $$(MAKE) -r --no-print-directory \ BOARD_NAME=$(1) \ @@ -530,20 +493,20 @@ bl_$(1)_%: .PHONY: unbrick_$(1) unbrick_$(1): bl_$(1)_hex $(if $(filter-out undefined,$(origin UNBRICK_TTY)), - $(V0) @echo " UNBRICK $(1) via $$(UNBRICK_TTY)" + $(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)" $(V1) $(STM32FLASH_DIR)/stm32flash \ -w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \ -g 0x0 \ $$(UNBRICK_TTY) , - $(V0) @echo - $(V0) @echo "ERROR: You must specify UNBRICK_TTY= to use for unbricking." - $(V0) @echo " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0" + $(V0) @$(ECHO) + $(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY= to use for unbricking." + $(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0" ) .PHONY: bl_$(1)_clean bl_$(1)_clean: - $(V0) @echo " CLEAN $$@" + $(V0) @$(ECHO) " CLEAN $$@" $(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1) endef @@ -553,7 +516,7 @@ define BU_TEMPLATE bu_$(1): bu_$(1)_opfw bu_$(1)_%: bl_$(1)_bino - $(V1) mkdir -p $(BUILD_DIR)/bu_$(1)/dep + $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep $(V1) cd $(ROOT_DIR)/flight/targets/Bootloaders/BootloaderUpdater && \ $$(MAKE) -r --no-print-directory \ BOARD_NAME=$(1) \ @@ -578,7 +541,7 @@ bu_$(1)_%: bl_$(1)_bino .PHONY: bu_$(1)_clean bu_$(1)_clean: - $(V0) @echo " CLEAN $$@" + $(V0) @$(ECHO) " CLEAN $$@" $(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1) endef @@ -588,7 +551,7 @@ define EF_TEMPLATE ef_$(1): ef_$(1)_bin ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw - $(V1) mkdir -p $(BUILD_DIR)/ef_$(1)/dep + $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)/dep $(V1) cd $(ROOT_DIR)/flight/targets/EntireFlash && \ $$(MAKE) -r --no-print-directory \ BOARD_NAME=$(1) \ @@ -604,7 +567,7 @@ ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw .PHONY: ef_$(1)_clean ef_$(1)_clean: - $(V0) @echo " CLEAN $$@" + $(V0) @$(ECHO) " CLEAN $$@" $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1) endef @@ -612,13 +575,13 @@ endef # additional details on each line of output to describe which build and target # that each line applies to. ifneq ($(strip $(filter all_%,$(MAKECMDGOALS))),) -export ENABLE_MSG_EXTRA := yes + export ENABLE_MSG_EXTRA := yes endif # When building more than one goal in a single make invocation, also # enable the extra context for each output line ifneq ($(word 2,$(MAKECMDGOALS)),) -export ENABLE_MSG_EXTRA := yes + export ENABLE_MSG_EXTRA := yes endif # $(1) = Canonical board name all in lower case (e.g. coptercontrol) @@ -636,14 +599,14 @@ all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS))) all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS))) endef -ALL_BOARDS := coptercontrol pipxtreme revolution revomini simposix osd +ALL_BOARDS := coptercontrol pipxtreme simposix revolution revomini osd ALL_BOARDS_BU := coptercontrol pipxtreme simposix # SimPosix only builds on Linux so drop it from the list for # all other platforms. ifneq ($(UNAME), Linux) -ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS)) -ALL_BOARDS_BU := $(filter-out simposix, $(ALL_BOARDS_BU)) + ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS)) + ALL_BOARDS_BU := $(filter-out simposix, $(ALL_BOARDS_BU)) endif # Friendly names of each board (used to find source tree) @@ -668,10 +631,6 @@ BL_BOARDS := $(ALL_BOARDS) BU_BOARDS := $(ALL_BOARDS_BU) EF_BOARDS := $(ALL_BOARDS) -# FIXME: The BU image doesn't work for F4 boards so we need to -# filter them out to prevent errors. -BU_BOARDS := $(filter-out revolution osd, $(BU_BOARDS)) - # SimPosix doesn't have a BL, BU or EF target so we need to # filter them out to prevent errors on the all_flight target. BL_BOARDS := $(filter-out simposix, $(BL_BOARDS)) @@ -723,7 +682,7 @@ $(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_fr sim_win32: sim_win32_exe sim_win32_%: uavobjects_flight - $(V1) mkdir -p $(BUILD_DIR)/sitl_win32 + $(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32 $(V1) $(MAKE) --no-print-directory \ -C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $* @@ -731,11 +690,10 @@ sim_win32_%: uavobjects_flight sim_osx: sim_osx_elf sim_osx_%: uavobjects_flight - $(V1) mkdir -p $(BUILD_DIR)/sim_osx + $(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx $(V1) $(MAKE) --no-print-directory \ -C $(ROOT_DIR)/flight/targets/Revolution --file=$(ROOT_DIR)/flight/targets/Revolution/Makefile.osx $* - ############################## # # Unit Tests @@ -744,10 +702,10 @@ sim_osx_%: uavobjects_flight ALL_UNITTESTS := logfs +# Build the directory for the unit tests UT_OUT_DIR := $(BUILD_DIR)/unit_tests - $(UT_OUT_DIR): - $(V1) mkdir -p $@ + $(V1) $(MKDIR) -p $@ .PHONY: all_ut all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS))) @@ -760,7 +718,7 @@ all_ut_run: $(addsuffix _run, $(addprefix ut_, $(ALL_UNITTESTS))) .PHONY: all_ut_clean all_ut_clean: - $(V0) @echo " CLEAN $@" + $(V0) @$(ECHO) " CLEAN $@" $(V1) [ ! -d "$(UT_OUT_DIR)" ] || $(RM) -r "$(UT_OUT_DIR)" # $(1) = Unit test name @@ -769,7 +727,7 @@ define UT_TEMPLATE ut_$(1): ut_$(1)_run ut_$(1)_%: $$(UT_OUT_DIR) - $(V1) mkdir -p $(UT_OUT_DIR)/$(1) + $(V1) $(MKDIR) -p $(UT_OUT_DIR)/$(1) $(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \ $$(MAKE) -r --no-print-directory \ BUILD_TYPE=ut \ @@ -791,9 +749,8 @@ ut_$(1)_%: $$(UT_OUT_DIR) .PHONY: ut_$(1)_clean ut_$(1)_clean: - $(V0) @echo " CLEAN $(1)" + $(V0) @$(ECHO) " CLEAN $(1)" $(V1) [ ! -d "$(UT_OUT_DIR)/$(1)" ] || $(RM) -r "$(UT_OUT_DIR)/$(1)" - endef # Expand the unittest rules @@ -803,7 +760,7 @@ $(foreach ut, $(ALL_UNITTESTS), $(eval $(call UT_TEMPLATE,$(ut)))) # output is interleaved with the rest of the make output. ifneq ($(strip $(filter all_ut_run,$(MAKECMDGOALS))),) .NOTPARALLEL: -$(info *NOTE* Parallel make disabled by all_ut_run target so we have sane console output) + $(info *NOTE* Parallel make disabled by all_ut_run target so we have sane console output) endif ############################## @@ -820,11 +777,108 @@ package: package_resources: $(V1) cd package && $(MAKE) --no-print-directory opfw_resource +############################## +# +# Build info +# +############################## + .PHONY: build-info build-info: - $(V1) mkdir -p $(BUILD_DIR) - $(V1) python $(ROOT_DIR)/make/scripts/version-info.py \ - --path=$(ROOT_DIR) \ + $(V1) $(MKDIR) -p $(BUILD_DIR) + $(V1) $(VERSION_INFO) \ --uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \ --template="make/templates/$@.txt" \ --outfile="$(BUILD_DIR)/$@.txt" + +############################## +# +# Help message, the default Makefile goal +# +############################## + +.PHONY: help +help: + @$(ECHO) + @$(ECHO) " This Makefile is known to work on Linux and Mac in a standard shell environment." + @$(ECHO) " It also works on Windows by following the instructions in make/winx86/README.txt." + @$(ECHO) + @$(ECHO) " Here is a summary of the available targets:" + @$(ECHO) + @$(ECHO) " [Tool Installers]" + @$(ECHO) " qt_sdk_install - Install the QT v4.7.3 tools" + @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain" + @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon" + @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking boards" + @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards" + @$(ECHO) " android_sdk_install - Install the Android SDK tools" + @$(ECHO) + @$(ECHO) " [Big Hammer]" + @$(ECHO) " all - Generate UAVObjects, build openpilot firmware and gcs" + @$(ECHO) " all_flight - Build all firmware, bootloaders and bootloader updaters" + @$(ECHO) " all_fw - Build only firmware for all boards" + @$(ECHO) " all_bl - Build only bootloaders for all boards" + @$(ECHO) " all_bu - Build only bootloader updaters for all boards" + @$(ECHO) + @$(ECHO) " all_clean - Remove your build directory ($(BUILD_DIR))" + @$(ECHO) " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters" + @$(ECHO) " all_fw_clean - Remove firmware for all boards" + @$(ECHO) " all_bl_clean - Remove bootlaoders for all boards" + @$(ECHO) " all_bu_clean - Remove bootloader updaters for all boards" + @$(ECHO) + @$(ECHO) " all_ - Build all available images for " + @$(ECHO) " all__clean - Remove all available images for " + @$(ECHO) + @$(ECHO) " all_ut - Build all unit tests" + @$(ECHO) " all_ut_tap - Run all unit tests and capture all TAP output to files" + @$(ECHO) " all_ut_run - Run all unit tests and dump TAP output to console" + @$(ECHO) + @$(ECHO) " [Firmware]" + @$(ECHO) " - Build firmware for " + @$(ECHO) " supported boards are ($(ALL_BOARDS))" + @$(ECHO) " fw_ - Build firmware for " + @$(ECHO) " supported boards are ($(FW_BOARDS))" + @$(ECHO) " fw__clean - Remove firmware for " + @$(ECHO) " fw__program - Use OpenOCD + JTAG to write firmware to " + @$(ECHO) + @$(ECHO) " [Bootloader]" + @$(ECHO) " bl_ - Build bootloader for " + @$(ECHO) " supported boards are ($(BL_BOARDS))" + @$(ECHO) " bl__clean - Remove bootloader for " + @$(ECHO) " bl__program - Use OpenOCD + JTAG to write bootloader to " + @$(ECHO) + @$(ECHO) " [Bootloader Updater]" + @$(ECHO) " bu_ - Build bootloader updater for " + @$(ECHO) " supported boards are ($(BU_BOARDS))" + @$(ECHO) " bu__clean - Remove bootloader updater for " + @$(ECHO) + @$(ECHO) " [Unbrick a board]" + @$(ECHO) " unbrick_ - Use the STM32's built in boot ROM to write a bootloader to " + @$(ECHO) " supported boards are ($(BL_BOARDS))" + @$(ECHO) " [Unittests]" + @$(ECHO) " ut_ - Build unit test " + @$(ECHO) " ut__tap - Run test and capture TAP output into a file" + @$(ECHO) " ut__run - Run test and dump TAP output to console" + @$(ECHO) + @$(ECHO) " [Simulation]" + @$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX" + @$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation" + @$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for" + @$(ECHO) " Windows using mingw and msys" + @$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation" + @$(ECHO) + @$(ECHO) " [GCS]" + @$(ECHO) " gcs - Build the Ground Control System (GCS) application" + @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application" + @$(ECHO) + @$(ECHO) " [UAVObjects]" + @$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files" + @$(ECHO) " uavobjects_test - parse xml-files - check for valid, duplicate ObjId's, ... " + @$(ECHO) " uavobjects_ - Generate source files from a subset of the UAVObject definition XML files" + @$(ECHO) " supported groups are ($(UAVOBJ_TARGETS))" + @$(ECHO) + @$(ECHO) " Hint: Add V=1 to your command line to see verbose build output." + @$(ECHO) + @$(ECHO) " Note: All tools will be installed into $(TOOLS_DIR)" + @$(ECHO) " All build output will be placed in $(BUILD_DIR)" + @$(ECHO) diff --git a/make/firmware-defs.mk b/make/firmware-defs.mk index 62eee394a..6e36af602 100644 --- a/make/firmware-defs.mk +++ b/make/firmware-defs.mk @@ -64,7 +64,7 @@ toprel = $(subst $(realpath $(TOP))/,,$(abspath $(1))) # Display compiler version information. .PHONY: gccversion -gccversion : +gccversion: @$(CC) --version # Create final output file (.hex) from ELF output file. diff --git a/make/tools.mk b/make/tools.mk index 5dec32f58..6ec2b4d20 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -27,7 +27,7 @@ endif qt_sdk_install : | $(DL_DIR) $(TOOLS_DIR) qt_sdk_install: qt_sdk_clean # download the source only if it's newer than what we already have - $(V1) wget -N --content-disposition -P "$(DL_DIR)" "$(QT_SDK_URL)" + $(V1) $(WGET) -N --content-disposition -P "$(DL_DIR)" "$(QT_SDK_URL)" # tell the user exactly which path they should select in the GUI $(V1) echo "*** NOTE NOTE NOTE ***" $(V1) echo "*" @@ -54,7 +54,7 @@ arm_sdk_install: ARM_SDK_FILE := $(notdir $(ARM_SDK_URL)) arm_sdk_install: | $(DL_DIR) $(TOOLS_DIR) arm_sdk_install: arm_sdk_clean # download the source only if it's newer than what we already have - $(V1) wget --no-check-certificate -N -P "$(DL_DIR)" "$(ARM_SDK_URL)" + $(V1) $(WGET) --no-check-certificate -N -P "$(DL_DIR)" "$(ARM_SDK_URL)" # binary only release so just extract it $(V1) tar -C $(TOOLS_DIR) -xjf "$(DL_DIR)/$(ARM_SDK_FILE)" @@ -74,7 +74,7 @@ openocd_install: OPENOCD_URL := http://sourceforge.net/projects/openocd/files/o openocd_install: OPENOCD_FILE := openocd-0.6.1.tar.bz2 openocd_install: openocd_clean # download the source only if it's newer than what we already have - $(V1) wget -N -P "$(DL_DIR)" --trust-server-name "$(OPENOCD_URL)" + $(V1) $(WGET) -N -P "$(DL_DIR)" --trust-server-name "$(OPENOCD_URL)" # extract the source $(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -r "$(OPENOCD_BUILD_DIR)" @@ -111,7 +111,7 @@ ftd2xx_install: FTD2XX_FILE := CDM20817.zip ftd2xx_install: ftd2xx_clean # download the file only if it's newer than what we already have $(V0) @echo " DOWNLOAD $(FTD2XX_URL)" - $(V1) wget -q -N -P "$(DL_DIR)" "$(FTD2XX_URL)" + $(V1) $(WGET) -q -N -P "$(DL_DIR)" "$(FTD2XX_URL)" # extract the source $(V0) @echo " EXTRACT $(FTD2XX_FILE) -> $(FTD2XX_DIR)" @@ -133,7 +133,7 @@ libusb_win_install: LIBUSB_WIN_FILE := libusb-win32-bin-1.2.6.0.zip libusb_win_install: libusb_win_clean # download the file only if it's newer than what we already have $(V0) @echo " DOWNLOAD $(LIBUSB_WIN_URL)" - $(V1) wget -q -N -P "$(DL_DIR)" --trust-server-name "$(LIBUSB_WIN_URL)" + $(V1) $(WGET) -q -N -P "$(DL_DIR)" --trust-server-name "$(LIBUSB_WIN_URL)" # extract the source $(V0) @echo " EXTRACT $(LIBUSB_WIN_FILE) -> $(LIBUSB_WIN_DIR)" @@ -269,7 +269,7 @@ dfuutil_install: | $(DL_DIR) $(TOOLS_DIR) dfuutil_install: dfuutil_clean # download the source $(V0) @echo " DOWNLOAD $(DFUUTIL_URL)" - $(V1) wget -N -P "$(DL_DIR)" "$(DFUUTIL_URL)" + $(V1) $(WGET) -N -P "$(DL_DIR)" "$(DFUUTIL_URL)" # extract the source $(V0) @echo " EXTRACT $(DFUUTIL_FILE)" @@ -302,7 +302,7 @@ android_sdk_install: | $(DL_DIR) $(TOOLS_DIR) android_sdk_install: android_sdk_clean # download the source only if it's newer than what we already have $(V0) @echo " DOWNLOAD $(ANDROID_SDK_URL)" - $(V1) wget --no-check-certificate -N -P "$(DL_DIR)" "$(ANDROID_SDK_URL)" + $(V1) $(WGET) --no-check-certificate -N -P "$(DL_DIR)" "$(ANDROID_SDK_URL)" # binary only release so just extract it $(V0) @echo " EXTRACT $(ANDROID_SDK_FILE)" @@ -329,7 +329,7 @@ gtest_install: gtest_clean # download the file unconditionally since google code gives back 404 # for HTTP HEAD requests which are used when using the wget -N option $(V1) [ ! -f "$(DL_DIR)/$(GTEST_FILE)" ] || $(RM) -f "$(DL_DIR)/$(GTEST_FILE)" - $(V1) wget -P "$(DL_DIR)" --trust-server-name "$(GTEST_URL)" + $(V1) $(WGET) -P "$(DL_DIR)" --trust-server-name "$(GTEST_URL)" # extract the source $(V1) [ ! -d "$(GTEST_DIR)" ] || $(RM) -rf "$(GTEST_DIR)" From 60a7d7e4548580a357e6ed27c010aab5cf6066ec Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 11 Mar 2013 23:36:26 +0200 Subject: [PATCH 11/68] Makefile: export important make variables from the top Makefile --- Makefile | 84 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 85b39d25d..8626776ca 100644 --- a/Makefile +++ b/Makefile @@ -17,14 +17,21 @@ # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# This top level Makefile passes down some variables to sub-makes through +# the environment. They are explicitly exported using the export keyword. +# Lower level makefiles assume that these variables are defined. To ensure +# that a special magic variable is exported here. It must be checked for +# existance by each sub-make. +export OPENPILOT_IS_COOL := Fuck Yeah! + # Set up a default goal .DEFAULT_GOAL := help # Set up some macros for common directories within the tree -ROOT_DIR := $(CURDIR) -TOOLS_DIR := $(ROOT_DIR)/tools -BUILD_DIR := $(ROOT_DIR)/build -DL_DIR := $(ROOT_DIR)/downloads +export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) +export TOOLS_DIR := $(ROOT_DIR)/tools +export BUILD_DIR := $(ROOT_DIR)/build +export DL_DIR := $(ROOT_DIR)/downloads # Set up default build configurations (debug | release) UAVOGEN_BUILD_CONF ?= debug @@ -56,7 +63,7 @@ $(foreach var, $(SANITIZE_GCC_VARS), $(eval $(call SANITIZE_VAR,$(var),disallowe SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER $(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated))) -# Make sure this isn't being run as root +# Make sure this isn't being run as root (no whoami on Windows, but that is ok here) ifeq ($(shell whoami 2>/dev/null),root) $(error You should not be running this as root) endif @@ -72,20 +79,6 @@ else ifeq ($(V), 0) else ifeq ($(V), 1) endif -# Set up misc host tools, maybe useful on Windows -ECHO := echo -MKDIR := mkdir -RM := rm -LN := ln -SED := sed -TAR := tar -ANT := ant -JAVAC := javac -JAR := jar -GIT := git -PYTHON := python -INSTALL := install - # Make sure we know few things about the architecture before including # the tools.mk to ensure that we download/install the right tools. UNAME := $(shell uname) @@ -95,6 +88,32 @@ ifeq ($(filter Linux Darwin, $(UNAME)), ) UNAME := Windows endif +# Set up misc host tools +export ECHO := echo +export MKDIR := mkdir +export RM := rm +export LN := ln +export CAT := cat +export SED := sed +export TAR := tar +export ANT := ant +export JAVAC := javac +export JAR := jar +export GIT := git +export PYTHON := python +export INSTALL := install + +# version-info cmd to extract some repository data +export VERSION_INFO := $(PYTHON) "$(ROOT_DIR)/make/scripts/version-info.py" --path="$(ROOT_DIR)" + +# Test if quotes are needed for the echo-command +ifeq (${shell $(ECHO) "test"}, test) + export QUOTE := ' +# This line is just to clear out the single quote above ' +else + export QUOTE := +endif + # The tools.mk uses wget to fetch tarballs or packages ifeq ($(shell [ -x "$(TOOLS_DIR)/bin/wget" ] && $(ECHO) "exists"), exists) WGET := $(TOOLS_DIR)/bin/wget @@ -115,17 +134,17 @@ else endif ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && $(ECHO) "exists"), exists) - ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi- + export ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi- else # not installed, hope it's in the path... - ARM_SDK_PREFIX ?= arm-none-eabi- + export ARM_SDK_PREFIX ?= arm-none-eabi- endif ifeq ($(shell [ -d "$(OPENOCD_DIR)" ] && $(ECHO) "exists"), exists) - OPENOCD := $(OPENOCD_DIR)/bin/openocd + export OPENOCD := $(OPENOCD_DIR)/bin/openocd else # not installed, hope it's in the path... - OPENOCD ?= openocd + export OPENOCD ?= openocd endif ifeq ($(shell [ -d "$(ANDROID_SDK_DIR)" ] && $(ECHO) "exists"), exists) @@ -149,9 +168,6 @@ else UAVOBJGENERATOR = "$(BUILD_DIR)/ground/uavobjgenerator/$(UAVOGEN_BUILD_CONF)/uavobjgenerator.exe" endif -# version-info cmd to extract some repository data -VERSION_INFO := $(PYTHON) $(ROOT_DIR)/make/scripts/version-info.py --path="$(ROOT_DIR)" - ############################## # # All targets @@ -411,14 +427,14 @@ uavo-collections_clean: # Define some pointers to the various important pieces of the flight code # to prevent these being repeated in every sub makefile -PIOS := $(ROOT_DIR)/flight/PiOS -FLIGHTLIB := $(ROOT_DIR)/flight/Libraries -OPMODULEDIR := $(ROOT_DIR)/flight/Modules -OPUAVOBJ := $(ROOT_DIR)/flight/targets/UAVObjects -OPUAVTALK := $(ROOT_DIR)/flight/targets/UAVTalk -HWDEFS := $(ROOT_DIR)/flight/targets/board_hw_defs -DOXYGENDIR := $(ROOT_DIR)/flight/Doc/Doxygen -OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight +export PIOS := $(ROOT_DIR)/flight/PiOS +export FLIGHTLIB := $(ROOT_DIR)/flight/Libraries +export OPMODULEDIR := $(ROOT_DIR)/flight/Modules +export OPUAVOBJ := $(ROOT_DIR)/flight/targets/UAVObjects +export OPUAVTALK := $(ROOT_DIR)/flight/targets/UAVTalk +export HWDEFS := $(ROOT_DIR)/flight/targets/board_hw_defs +export DOXYGENDIR := $(ROOT_DIR)/flight/Doc/Doxygen +export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight # $(1) = Canonical board name all in lower case (e.g. coptercontrol) # $(2) = Name of board used in source tree (e.g. CopterControl) From 8a98920f3dc1f6baa3bfd1ed4291971b05d1ba53 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 11 Mar 2013 23:39:28 +0200 Subject: [PATCH 12/68] Makefile: use exported variables in firmware-defs.mk Note that $(QUOTE) variable is uppercased. Windows make does not export lowercased variables with export keyword (even if must do). Conflicts: make/firmware-defs.mk --- flight/targets/RevoMini/Makefile.osx | 8 -- flight/targets/Revolution/Makefile.osx | 8 -- flight/targets/SimPosix/Makefile | 8 -- make/firmware-defs.mk | 178 +++++++++++++------------ 4 files changed, 92 insertions(+), 110 deletions(-) diff --git a/flight/targets/RevoMini/Makefile.osx b/flight/targets/RevoMini/Makefile.osx index 7241ceeb7..130871e7b 100644 --- a/flight/targets/RevoMini/Makefile.osx +++ b/flight/targets/RevoMini/Makefile.osx @@ -438,14 +438,6 @@ endif endif endif -# Test if quotes are needed for the echo-command -result = ${shell echo "test"} -ifeq (${result}, test) - quote = ' -else - quote = -endif - # Generate intermediate code gencode: ${OUTDIR}/InitMods.c ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h diff --git a/flight/targets/Revolution/Makefile.osx b/flight/targets/Revolution/Makefile.osx index 06cb0a506..df14dbf0d 100644 --- a/flight/targets/Revolution/Makefile.osx +++ b/flight/targets/Revolution/Makefile.osx @@ -450,14 +450,6 @@ endif endif endif -# Test if quotes are needed for the echo-command -result = ${shell echo "test"} -ifeq (${result}, test) - quote = ' -else - quote = -endif - # Generate intermediate code gencode: ${OUTDIR}/InitMods.c ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h diff --git a/flight/targets/SimPosix/Makefile b/flight/targets/SimPosix/Makefile index 80ba93a58..449f62ea7 100644 --- a/flight/targets/SimPosix/Makefile +++ b/flight/targets/SimPosix/Makefile @@ -483,14 +483,6 @@ endif #create compile-time module auto-initialisation MODNAMES = ${notdir $(subst /revolution,,$(MODULES))} -# Test if quotes are needed for the echo-command -result = ${shell echo "test"} -ifeq (${result}, test) - quote = ' -else - quote = -endif - # Generate intermediate code gencode: ${OUTDIR}/InitMods.c ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h diff --git a/make/firmware-defs.mk b/make/firmware-defs.mk index 6e36af602..2330a6ef0 100644 --- a/make/firmware-defs.mk +++ b/make/firmware-defs.mk @@ -1,66 +1,77 @@ -# Toolchain prefix (i.e arm-elf- -> arm-elf-gcc.exe) -TCHAIN_PREFIX ?= arm-none-eabi- +# +# Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) +endif # Define toolchain component names. -CC = $(TCHAIN_PREFIX)gcc -CXX = $(TCHAIN_PREFIX)g++ -AR = $(TCHAIN_PREFIX)ar -OBJCOPY = $(TCHAIN_PREFIX)objcopy -OBJDUMP = $(TCHAIN_PREFIX)objdump -SIZE = $(TCHAIN_PREFIX)size -NM = $(TCHAIN_PREFIX)nm -STRIP = $(TCHAIN_PREFIX)strip -INSTALL = install +CC = $(ARM_SDK_PREFIX)gcc +CXX = $(ARM_SDK_PREFIX)g++ +AR = $(ARM_SDK_PREFIX)ar +OBJCOPY = $(ARM_SDK_PREFIX)objcopy +OBJDUMP = $(ARM_SDK_PREFIX)objdump +SIZE = $(ARM_SDK_PREFIX)size +NM = $(ARM_SDK_PREFIX)nm +STRIP = $(ARM_SDK_PREFIX)strip THUMB = -mthumb -# Test if quotes are needed for the echo-command -result = ${shell echo "test"} -ifeq (${result}, test) - quote = ' -# This line is just to clear out the single quote above ' -else - quote = -endif - # Add a board designator to the terse message text ifeq ($(ENABLE_MSG_EXTRA),yes) - MSG_EXTRA := [$(BUILD_TYPE)|$(BOARD_SHORT_NAME)] + MSG_EXTRA := [$(BUILD_TYPE)|$(BOARD_SHORT_NAME)] else - MSG_BOARD := + MSG_EXTRA := endif # Define Messages # English -MSG_FORMATERROR = ${quote} Can not handle output-format${quote} -MSG_MODINIT = ${quote} MODINIT $(MSG_EXTRA) ${quote} -MSG_SIZE = ${quote} SIZE $(MSG_EXTRA) ${quote} -MSG_LOAD_FILE = ${quote} BIN/HEX $(MSG_EXTRA) ${quote} -MSG_BIN_OBJ = ${quote} BINO $(MSG_EXTRA) ${quote} -MSG_STRIP_FILE = ${quote} STRIP $(MSG_EXTRA) ${quote} -MSG_EXTENDED_LISTING = ${quote} LIS $(MSG_EXTRA) ${quote} -MSG_SYMBOL_TABLE = ${quote} NM $(MSG_EXTRA) ${quote} -MSG_ARCHIVING = ${quote} AR $(MSG_EXTRA) ${quote} -MSG_LINKING = ${quote} LD $(MSG_EXTRA) ${quote} -MSG_COMPILING = ${quote} CC ${MSG_EXTRA} ${quote} -MSG_COMPILING_ARM = ${quote} CC-ARM $(MSG_EXTRA) ${quote} -MSG_COMPILINGCXX = ${quote} CXX $(MSG_EXTRA) ${quote} -MSG_COMPILINGCXX_ARM = ${quote} CXX-ARM $(MSG_EXTRA) ${quote} -MSG_ASSEMBLING = ${quote} AS $(MSG_EXTRA) ${quote} -MSG_ASSEMBLING_ARM = ${quote} AS-ARM $(MSG_EXTRA) ${quote} -MSG_CLEANING = ${quote} CLEAN $(MSG_EXTRA) ${quote} -MSG_ASMFROMC = ${quote} AS(C) $(MSG_EXTRA) ${quote} -MSG_ASMFROMC_ARM = ${quote} AS(C)-ARM $(MSG_EXTRA) ${quote} -MSG_PYMITEINIT = ${quote} PY $(MSG_EXTRA) ${quote} -MSG_INSTALLING = ${quote} INSTALL $(MSG_EXTRA) ${quote} -MSG_OPFIRMWARE = ${quote} OPFW $(MSG_EXTRA) ${quote} -MSG_FWINFO = ${quote} FWINFO $(MSG_EXTRA) ${quote} -MSG_JTAG_PROGRAM = ${quote} JTAG-PGM $(MSG_EXTRA) ${quote} -MSG_JTAG_WIPE = ${quote} JTAG-WIPE $(MSG_EXTRA) ${quote} -MSG_PADDING = ${quote} PADDING $(MSG_EXTRA) ${quote} -MSG_FLASH_IMG = ${quote} FLASH_IMG $(MSG_EXTRA) ${quote} +MSG_FORMATERROR = ${QUOTE} Can not handle output-format${QUOTE} +MSG_MODINIT = ${QUOTE} MODINIT $(MSG_EXTRA) ${QUOTE} +MSG_SIZE = ${QUOTE} SIZE $(MSG_EXTRA) ${QUOTE} +MSG_LOAD_FILE = ${QUOTE} BIN/HEX $(MSG_EXTRA) ${QUOTE} +MSG_BIN_OBJ = ${QUOTE} BINO $(MSG_EXTRA) ${QUOTE} +MSG_STRIP_FILE = ${QUOTE} STRIP $(MSG_EXTRA) ${QUOTE} +MSG_EXTENDED_LISTING = ${QUOTE} LIS $(MSG_EXTRA) ${QUOTE} +MSG_SYMBOL_TABLE = ${QUOTE} NM $(MSG_EXTRA) ${QUOTE} +MSG_ARCHIVING = ${QUOTE} AR $(MSG_EXTRA) ${QUOTE} +MSG_LINKING = ${QUOTE} LD $(MSG_EXTRA) ${QUOTE} +MSG_COMPILING = ${QUOTE} CC $(MSG_EXTRA) ${QUOTE} +MSG_COMPILING_ARM = ${QUOTE} CC-ARM $(MSG_EXTRA) ${QUOTE} +MSG_COMPILINGCXX = ${QUOTE} CXX $(MSG_EXTRA) ${QUOTE} +MSG_COMPILINGCXX_ARM = ${QUOTE} CXX-ARM $(MSG_EXTRA) ${QUOTE} +MSG_ASSEMBLING = ${QUOTE} AS $(MSG_EXTRA) ${QUOTE} +MSG_ASSEMBLING_ARM = ${QUOTE} AS-ARM $(MSG_EXTRA) ${QUOTE} +MSG_CLEANING = ${QUOTE} CLEAN $(MSG_EXTRA) ${QUOTE} +MSG_ASMFROMC = ${QUOTE} AS(C) $(MSG_EXTRA) ${QUOTE} +MSG_ASMFROMC_ARM = ${QUOTE} AS(C)-ARM $(MSG_EXTRA) ${QUOTE} +MSG_PYMITEINIT = ${QUOTE} PY $(MSG_EXTRA) ${QUOTE} +MSG_INSTALLING = ${QUOTE} INSTALL $(MSG_EXTRA) ${QUOTE} +MSG_OPFIRMWARE = ${QUOTE} OPFW $(MSG_EXTRA) ${QUOTE} +MSG_FWINFO = ${QUOTE} FWINFO $(MSG_EXTRA) ${QUOTE} +MSG_JTAG_PROGRAM = ${QUOTE} JTAG-PGM $(MSG_EXTRA) ${QUOTE} +MSG_JTAG_WIPE = ${QUOTE} JTAG-WIPE $(MSG_EXTRA) ${QUOTE} +MSG_PADDING = ${QUOTE} PADDING $(MSG_EXTRA) ${QUOTE} +MSG_FLASH_IMG = ${QUOTE} FLASH_IMG $(MSG_EXTRA) ${QUOTE} -toprel = $(subst $(realpath $(TOP))/,,$(abspath $(1))) +# Function for converting an absolute path to one relative +# to the top of the source tree. +toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1))) # Display compiler version information. .PHONY: gccversion @@ -69,25 +80,25 @@ gccversion: # Create final output file (.hex) from ELF output file. %.hex: %.elf - @echo $(MSG_LOAD_FILE) $(call toprel, $@) + @$(ECHO) $(MSG_LOAD_FILE) $(call toprel, $@) $(V1) $(OBJCOPY) -O ihex $< $@ # Create stripped output file (.elf.stripped) from ELF output file. %.elf.stripped: %.elf - @echo $(MSG_STRIP_FILE) $(call toprel, $@) + @$(ECHO) $(MSG_STRIP_FILE) $(call toprel, $@) $(V1) $(STRIP) --strip-unneeded $< -o $@ # Create final output file (.bin) from ELF output file. %.bin: %.elf - @echo $(MSG_LOAD_FILE) $(call toprel, $@) + @$(ECHO) $(MSG_LOAD_FILE) $(call toprel, $@) $(V1) $(OBJCOPY) -O binary $< $@ %.bin: %.o - @echo $(MSG_LOAD_FILE) $(call toprel, $@) + @$(ECHO) $(MSG_LOAD_FILE) $(call toprel, $@) $(V1) $(OBJCOPY) -O binary $< $@ %.bin.o: %.bin - @echo $(MSG_BIN_OBJ) $(call toprel, $@) + @$(ECHO) $(MSG_BIN_OBJ) $(call toprel, $@) $(V1) $(OBJCOPY) -I binary -O elf32-littlearm --binary-architecture arm \ --rename-section .data=.rodata,alloc,load,readonly,data,contents \ --wildcard \ @@ -99,12 +110,12 @@ gccversion: # Create extended listing file/disassambly from ELF output file. # using objdump testing: option -C %.lss: %.elf - @echo $(MSG_EXTENDED_LISTING) $(call toprel, $@) + @$(ECHO) $(MSG_EXTENDED_LISTING) $(call toprel, $@) $(V1) $(OBJDUMP) -h -S -C -r $< > $@ # Create a symbol table from ELF output file. %.sym: %.elf - @echo $(MSG_SYMBOL_TABLE) $(call toprel, $@) + @$(ECHO) $(MSG_SYMBOL_TABLE) $(call toprel, $@) $(V1) $(NM) -n $< > $@ define SIZE_TEMPLATE @@ -113,7 +124,7 @@ size: $(1)_size .PHONY: $(1)_size $(1)_size: $(1) - @echo $(MSG_SIZE) $$(call toprel, $$<) + @$(ECHO) $(MSG_SIZE) $$(call toprel, $$<) $(V1) $(SIZE) -A $$< endef @@ -124,63 +135,62 @@ endef define OPFW_TEMPLATE FORCE: -$(1).firmwareinfo.c: $(1) $(TOP)/make/templates/firmwareinfotemplate.c FORCE - @echo $(MSG_FWINFO) $$(call toprel, $$@) - $(V1) python $(TOP)/make/scripts/version-info.py \ - --path=$(TOP) \ - --template=$(TOP)/make/templates/firmwareinfotemplate.c \ +$(1).firmwareinfo.c: $(1) $(ROOT_DIR)/make/templates/firmwareinfotemplate.c FORCE + @$(ECHO) $(MSG_FWINFO) $$(call toprel, $$@) + $(V1) $(VERSION_INFO) \ + --template=$(ROOT_DIR)/make/templates/firmwareinfotemplate.c \ --outfile=$$@ \ --image=$(1) \ --type=$(2) \ --revision=$(3) \ - --uavodir=$(TOP)/shared/uavobjectdefinition + --uavodir=$(ROOT_DIR)/shared/uavobjectdefinition $(eval $(call COMPILE_C_TEMPLATE, $(1).firmwareinfo.c)) $(OUTDIR)/$(notdir $(basename $(1))).opfw : $(1) $(1).firmwareinfo.bin - @echo $(MSG_OPFIRMWARE) $$(call toprel, $$@) - $(V1) cat $(1) $(1).firmwareinfo.bin > $$@ + @$(ECHO) $(MSG_OPFIRMWARE) $$(call toprel, $$@) + $(V1) $(CAT) $(1) $(1).firmwareinfo.bin > $$@ endef # Assemble: create object files from assembler source files. define ASSEMBLE_TEMPLATE $(OUTDIR)/$(notdir $(basename $(1))).o : $(1) - @echo $(MSG_ASSEMBLING) $$(call toprel, $$<) + @$(ECHO) $(MSG_ASSEMBLING) $$(call toprel, $$<) $(V1) $(CC) -c $(THUMB) $$(ASFLAGS) $$< -o $$@ endef # Assemble: create object files from assembler source files. ARM-only define ASSEMBLE_ARM_TEMPLATE $(OUTDIR)/$(notdir $(basename $(1))).o : $(1) - @echo $(MSG_ASSEMBLING_ARM) $$(call toprel, $$<) + @$(ECHO) $(MSG_ASSEMBLING_ARM) $$(call toprel, $$<) $(V1) $(CC) -c $$(ASFLAGS) $$< -o $$@ endef # Compile: create object files from C source files. define COMPILE_C_TEMPLATE $(OUTDIR)/$(notdir $(basename $(1))).o : $(1) - @echo $(MSG_COMPILING) $$(call toprel, $$<) + @$(ECHO) $(MSG_COMPILING) $$(call toprel, $$<) $(V1) $(CC) -c $(THUMB) $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@ endef # Compile: create object files from C source files. ARM-only define COMPILE_C_ARM_TEMPLATE $(OUTDIR)/$(notdir $(basename $(1))).o : $(1) - @echo $(MSG_COMPILING_ARM) $$(call toprel, $$<) + @$(ECHO) $(MSG_COMPILING_ARM) $$(call toprel, $$<) $(V1) $(CC) -c $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@ endef # Compile: create object files from C++ source files. define COMPILE_CXX_TEMPLATE $(OUTDIR)/$(notdir $(basename $(1))).o : $(1) - @echo $(MSG_COMPILINGCXX) $$(call toprel, $$<) + @$(ECHO) $(MSG_COMPILINGCXX) $$(call toprel, $$<) $(V1) $(CXX) -c $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $$(CXXFLAGS) $$< -o $$@ endef # Compile: create object files from C++ source files. ARM-only define COMPILE_CXX_ARM_TEMPLATE $(OUTDIR)/$(notdir $(basename $(1))).o : $(1) - @echo $(MSG_COMPILINGCXX_ARM) $$(call toprel, $$<) + @$(ECHO) $(MSG_COMPILINGCXX_ARM) $$(call toprel, $$<) $(V1) $(CPP) -c $$(CFLAGS) $$(CPPFLAGS) $$(CXXFLAGS) $$< -o $$@ endef @@ -192,7 +202,7 @@ define ARCHIVE_TEMPLATE .SECONDARY : $(1) .PRECIOUS : $(2) $(1): $(2) - @echo $(MSG_ARCHIVING) $$(call toprel, $$@) + @$(ECHO) $(MSG_ARCHIVING) $$(call toprel, $$@) ifeq ($(3),) $(V1) $(AR) rcs $$@ $(2) else @@ -215,7 +225,7 @@ define LINK_TEMPLATE .SECONDARY : $(1) .PRECIOUS : $(2) $(3) $(1): $(2) $(3) - @echo $(MSG_LINKING) $$(call toprel, $$@) + @$(ECHO) $(MSG_LINKING) $$(call toprel, $$@) $(V1) $(CC) $(THUMB) $$(CFLAGS) $(2) $(3) --output $$@ $$(LDFLAGS) endef @@ -226,21 +236,21 @@ define LINK_CXX_TEMPLATE .SECONDARY : $(1) .PRECIOUS : $(2) $(1): $(2) - @echo $(MSG_LINKING) $$(call toprel, $$@) + @$(ECHO) $(MSG_LINKING) $$(call toprel, $$@) $(V1) $(CXX) $(THUMB) $$(CFLAGS) $(2) --output $$@ $$(LDFLAGS) endef # Compile: create assembler files from C source files. ARM/Thumb define PARTIAL_COMPILE_TEMPLATE $($(1):.c=.s) : %.s : %.c - @echo $(MSG_ASMFROMC) $$(call toprel, $$<) + @$(ECHO) $(MSG_ASMFROMC) $$(call toprel, $$<) $(V1) $(CC) $(THUMB) -S $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@ endef # Compile: create assembler files from C source files. ARM only define PARTIAL_COMPILE_ARM_TEMPLATE $($(1):.c=.s) : %.s : %.c - @echo $(MSG_ASMFROMC_ARM) $$(call toprel, $$<) + @$(ECHO) $(MSG_ASMFROMC_ARM) $$(call toprel, $$<) $(V1) $(CC) -S $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@ endef @@ -254,13 +264,10 @@ define JTAG_TEMPLATE # Options for OpenOCD flash-programming # see openocd.pdf/openocd.texi for further information -# if OpenOCD is in the $PATH just set OPENOCDEXE=openocd -OOCD_EXE ?= openocd - # debug level OOCD_JTAG_SETUP = -d0 # interface and board/target settings (using the OOCD target-library here) -OOCD_JTAG_SETUP += -s $(TOP)/flight/Project/OpenOCD +OOCD_JTAG_SETUP += -s $(ROOT_DIR)/flight/Project/OpenOCD OOCD_JTAG_SETUP += -f $(4) -f $(5) # initialize @@ -272,8 +279,8 @@ OOCD_BOARD_RESET += -c "reset halt" .PHONY: program program: $(1) - @echo $(MSG_JTAG_PROGRAM) $$(call toprel, $$<) - $(V1) $(OOCD_EXE) \ + @$(ECHO) $(MSG_JTAG_PROGRAM) $$(call toprel, $$<) + $(V1) $(OPENOCD) \ $$(OOCD_JTAG_SETUP) \ $$(OOCD_BOARD_RESET) \ -c "flash write_image erase $$< $(2) bin" \ @@ -283,12 +290,11 @@ program: $(1) .PHONY: wipe wipe: - @echo $(MSG_JTAG_WIPE) wiping $(3) bytes starting from $(2) - $(V1) $(OOCD_EXE) \ + @$(ECHO) $(MSG_JTAG_WIPE) wiping $(3) bytes starting from $(2) + $(V1) $(OPENOCD) \ $$(OOCD_JTAG_SETUP) \ $$(OOCD_BOARD_RESET) \ -c "flash erase_address pad $(2) $(3)" \ -c "reset run" \ -c "shutdown" endef - From 75ef685c6e5feefe4a65f3a72988c86b71e2327b Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Thu, 14 Mar 2013 09:45:21 +0200 Subject: [PATCH 13/68] Makefile: bootloader makefiles cleanup Conflicts: flight/targets/Bootloaders/CopterControl/Makefile flight/targets/Bootloaders/OSD/Makefile flight/targets/Bootloaders/PipXtreme/Makefile flight/targets/Bootloaders/RevoMini/Makefile flight/targets/Bootloaders/Revolution/Makefile --- Makefile | 16 +- .../Bootloaders/CopterControl/Makefile | 486 +----------------- flight/targets/Bootloaders/OSD/Makefile | 391 +------------- flight/targets/Bootloaders/PipXtreme/Makefile | 486 +----------------- flight/targets/Bootloaders/RevoMini/Makefile | 391 +------------- .../targets/Bootloaders/Revolution/Makefile | 391 +------------- make/boot-defs.mk | 459 +++++++++++++++++ 7 files changed, 569 insertions(+), 2051 deletions(-) create mode 100644 make/boot-defs.mk diff --git a/Makefile b/Makefile index 8626776ca..0a84cce75 100644 --- a/Makefile +++ b/Makefile @@ -489,21 +489,9 @@ bl_$(1)_%: BOARD_NAME=$(1) \ BOARD_SHORT_NAME=$(3) \ BUILD_TYPE=bl \ - TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \ - REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \ - \ - TARGET=bl_$(1) \ - OUTDIR=$(BUILD_DIR)/bl_$(1) \ - \ - PIOS=$(PIOS) \ - FLIGHTLIB=$(FLIGHTLIB) \ - OPMODULEDIR=$(OPMODULEDIR) \ - OPUAVOBJ=$(OPUAVOBJ) \ - OPUAVTALK=$(OPUAVTALK) \ HWDEFSINC=$(HWDEFS)/$(1) \ - OPUAVSYNTHDIR=$(OPUAVSYNTHDIR) \ - DOXYGENDIR=$(DOXYGENDIR) \ - \ + OUTDIR=$(BUILD_DIR)/bl_$(1) \ + TARGET=bl_$(1) \ $$* .PHONY: unbrick_$(1) diff --git a/flight/targets/Bootloaders/CopterControl/Makefile b/flight/targets/Bootloaders/CopterControl/Makefile index 92f400fc5..ed1d8f3e8 100644 --- a/flight/targets/Bootloaders/CopterControl/Makefile +++ b/flight/targets/Bootloaders/CopterControl/Makefile @@ -1,468 +1,28 @@ - ##### - # Project: OpenPilot - # - # - # Makefile for OpenPilot project build PiOS and the AP. - # - # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. - # - # - # 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, write to the Free Software Foundation, Inc., - # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - ##### - -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES to compile for debugging -DEBUG ?= NO - -# Set to YES to use the Servo output pins for debugging via scope or logic analyser -ENABLE_DEBUG_PINS ?= NO - -# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs -ENABLE_AUX_UART ?= NO - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -# Remove command is different for Code Sourcery on Windows -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm -endif - -FLASH_TOOL = OPENOCD - -# Paths -OPSYSTEM = . -OPSYSTEMINC = $(OPSYSTEM)/inc -FLIGHTLIBINC = $(FLIGHTLIB)/inc -PIOSINC = $(PIOS)/inc -PIOSSTM32F10X = $(PIOS)/STM32F10x -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -APPLIBDIR = $(PIOSSTM32F10X)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver -STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc -STMUSBSRCDIR = $(STMUSBDIR)/src -STMUSBINCDIR = $(STMUSBDIR)/inc -CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 -DOSFSDIR = $(APPLIBDIR)/dosfs -MSDDIR = $(APPLIBDIR)/msd -RTOSDIR = $(APPLIBDIR)/FreeRTOS -RTOSSRCDIR = $(RTOSDIR)/Source -RTOSINCDIR = $(RTOSSRCDIR)/include - -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files - -## COPTERCONTROL_BL CORE: -SRC += $(OPSYSTEM)/main.c -SRC += $(OPSYSTEM)/pios_board.c -SRC += $(OPSYSTEM)/op_dfu.c - -## PIOS Hardware (STM32F10x) -include $(PIOS)/STM32F10x/library.mk -SRC += $(PIOSSTM32F10X)/pios_sys.c -SRC += $(PIOSSTM32F10X)/pios_led.c -SRC += $(PIOSSTM32F10X)/pios_delay.c -SRC += $(PIOSSTM32F10X)/pios_usart.c -SRC += $(PIOSSTM32F10X)/pios_irq.c -SRC += $(PIOSSTM32F10X)/pios_debug.c -SRC += $(PIOSSTM32F10X)/pios_gpio.c -SRC += $(PIOSSTM32F10X)/pios_iap.c -SRC += $(PIOSSTM32F10X)/pios_bl_helper.c - -# PIOS USB related files (seperated to make code maintenance more easy) -SRC += $(PIOSSTM32F10X)/pios_usb.c -SRC += $(PIOSSTM32F10X)/pios_usbhook.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c -SRC += $(OPSYSTEM)/pios_usb_board_data.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c -SRC += $(PIOSCOMMON)/pios_usb_util.c - -## PIOS Hardware (Common) -SRC += $(PIOSCOMMON)/pios_board_info.c -SRC += $(PIOSCOMMON)/pios_com_msg.c -SRC += $(PIOSCOMMON)/printf-stdarg.c - -## Libraries for flight calculations -SRC += $(FLIGHTLIB)/fifo_buffer.c - -## CMSIS for STM32 -SRC += $(CMSISDIR)/core_cm3.c -SRC += $(CMSISDIR)/system_stm32f10x.c - -## Used parts of the STM-Library -SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c -SRC += $(STMSPDSRCDIR)/stm32f10x_crc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c -SRC += $(STMSPDSRCDIR)/stm32f10x_exti.c -SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c -SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c -SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c -SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c -SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c -SRC += $(STMSPDSRCDIR)/stm32f10x_dbgmcu.c -SRC += $(STMSPDSRCDIR)/misc.c - -## STM32 USB Library -SRC += $(STMUSBSRCDIR)/usb_core.c -SRC += $(STMUSBSRCDIR)/usb_init.c -SRC += $(STMUSBSRCDIR)/usb_int.c -SRC += $(STMUSBSRCDIR)/usb_mem.c -SRC += $(STMUSBSRCDIR)/usb_regs.c -SRC += $(STMUSBSRCDIR)/usb_sil.c - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S - -# List Assembler source files here which must be assembled in ARM-Mode.. -ASRCARM = - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -EXTRAINCDIRS += $(OPSYSTEM) -EXTRAINCDIRS += $(OPSYSTEMINC) -EXTRAINCDIRS += $(OPUAVTALK) -EXTRAINCDIRS += $(OPUAVTALKINC) -EXTRAINCDIRS += $(OPUAVOBJ) -EXTRAINCDIRS += $(OPUAVOBJINC) -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(PIOSSTM32F10X) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(STMUSBINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(DOSFSDIR) -EXTRAINCDIRS += $(MSDDIR) -EXTRAINCDIRS += $(RTOSINCDIR) -EXTRAINCDIRS += $(APPLIBDIR) -EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3 -EXTRAINCDIRS += $(HWDEFSINC) - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32F10X) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -OPT = 0 -else -OPT = s -endif - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DSTM32F10X_$(MODEL) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) -ifeq ($(ENABLE_DEBUG_PINS), YES) -CDEFS += -DPIOS_ENABLE_DEBUG_PINS -endif -ifeq ($(ENABLE_AUX_UART), YES) -CDEFS += -DPIOS_ENABLE_AUX_UART -endif - -# Provide (only) the bootloader with board-specific defines -BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) -BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) -BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) -BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION) -BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) -BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) -BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) - -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing # -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# -ifeq ($(DEBUG),YES) -CFLAGS += -DDEBUG +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -CFLAGS += -g$(DEBUGF) -CFLAGS += -O$(OPT) -ifeq ($(DEBUG),NO) -CFLAGS += -ffunction-sections -endif +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk +include $(ROOT_DIR)/make/boot-defs.mk -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(BLONLY_CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. - -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif - -CFLAGS += -Wall -CFLAGS += -Werror -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -ifeq ($(DEBUG),NO) -LDFLAGS += -Wl,-static -endif -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -# Set linker-script name depending on selected submodel name -LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld -LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex sym -else -ifeq ($(LOADFORMAT),binary) -build: elf bin sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif -endif - -${OUTDIR}/InitMods.c: Makefile - @echo $(MSG_MODINIT) $(call toprel, $@) - @echo ${quote}// Autogenerated file${quote} > ${OUTDIR}/InitMods.c - @echo ${quote}${foreach MOD, ${MODNAMES}, extern unsigned int ${MOD}Initialize(void);}${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}void InitModules() {${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).bin -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin -else - $(error INSTALL_DIR must be specified for $@) -endif - -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list install +$(info Making bootloader for CopterControl, board revision $(BOARD_REVISION)) +$(info Use BOARD_REVISION=1 for CC, BOARD_REVISION=2 for CC3D (default)) diff --git a/flight/targets/Bootloaders/OSD/Makefile b/flight/targets/Bootloaders/OSD/Makefile index 2eec92430..aad1047d2 100644 --- a/flight/targets/Bootloaders/OSD/Makefile +++ b/flight/targets/Bootloaders/OSD/Makefile @@ -1,374 +1,25 @@ - ##### - # Project: OpenPilot INS_BOOTLOADER - # - # - # Makefile for OpenPilot INS project - # - # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. - # - # - # 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, write to the Free Software Foundation, Inc., - # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - ##### - -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES for debugging -DEBUG ?= NO - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm -endif - -# Paths -OSD_BL = $(WHEREAMI) -OSD_BLINC = $(OSD_BL)/inc -PIOSINC = $(PIOS)/inc -FLIGHTLIBINC = $(FLIGHTLIB)/inc -PIOSSTM32F4XX = $(PIOS)/STM32F4xx -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -APPLIBDIR = $(PIOSSTM32F4XX)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F4xx_StdPeriph_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc - -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files - -## BOOTLOADER: -SRC += main.c -SRC += pios_board.c -SRC += pios_usb_board_data.c -SRC += op_dfu.c - -## PIOS Hardware (STM32F4xx) -include $(PIOS)/STM32F4xx/library.mk - -# PIOS Hardware (Common) -SRC += $(PIOSCOMMON)/pios_board_info.c -SRC += $(PIOSCOMMON)/pios_com_msg.c -SRC += $(PIOSCOMMON)/printf-stdarg.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c -SRC += $(PIOSCOMMON)/pios_usb_util.c - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(PIOSSTM34FXX) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(OSD_BLINC) -EXTRAINCDIRS += $(HWDEFSINC) - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32FXX) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -OPT = 0 -else -OPT = s -endif - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DSTM32F4XX -CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) -CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) - -# Provide (only) the bootloader with board-specific defines -BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) -BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) -BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) -BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION) -BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) -BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) -BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) - -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing # -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# -ifeq ($(DEBUG),YES) -CFLAGS = +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -# This is not the best place for these. Really should abstract out -# to the board file or something -CFLAGS += -DSTM32F4XX -CFLAGS += -DMEM_SIZE=1024000000 - -CFLAGS += -g$(DEBUGF) -CFLAGS += -O$(OPT) -ifeq ($(DEBUG),NO) -CFLAGS += -fdata-sections -ffunction-sections -endif -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(BLONLY_CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. - -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif - -CFLAGS += -Wall -#CFLAGS += -Werror -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -ifeq ($(DEBUG),NO) -LDFLAGS += -Wl,-static -endif -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -#Linker scripts -LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_BL)) - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex sym -else -ifeq ($(LOADFORMAT),binary) -build: elf bin sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif -endif - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).bin -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin -else - $(error INSTALL_DIR must be specified for $@) -endif - -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list install +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk +include $(ROOT_DIR)/make/boot-defs.mk diff --git a/flight/targets/Bootloaders/PipXtreme/Makefile b/flight/targets/Bootloaders/PipXtreme/Makefile index 818e0df1e..55df4a8a3 100644 --- a/flight/targets/Bootloaders/PipXtreme/Makefile +++ b/flight/targets/Bootloaders/PipXtreme/Makefile @@ -1,470 +1,28 @@ - ##### - # Project: OpenPilot - # - # - # Makefile for OpenPilot project build PiOS and the AP. - # - # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. - # - # - # 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, write to the Free Software Foundation, Inc., - # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - ##### +# +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES to compile for debugging -DEBUG ?= NO - -# Set to YES to use the Servo output pins for debugging via scope or logic analyser -ENABLE_DEBUG_PINS ?= NO - -# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs -ENABLE_AUX_UART ?= NO - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -# Remove command is different for Code Sourcery on Windows -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -FLASH_TOOL = OPENOCD +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk +include $(ROOT_DIR)/make/boot-defs.mk -# Paths -OPSYSTEM = . -OPSYSTEMINC = $(OPSYSTEM)/inc -FLIGHTLIBINC = $(FLIGHTLIB)/inc -PIOSINC = $(PIOS)/inc -PIOSSTM32F10X = $(PIOS)/STM32F10x -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -APPLIBDIR = $(PIOSSTM32F10X)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver -STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc -STMUSBSRCDIR = $(STMUSBDIR)/src -STMUSBINCDIR = $(STMUSBDIR)/inc -CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 -DOSFSDIR = $(APPLIBDIR)/dosfs -MSDDIR = $(APPLIBDIR)/msd -RTOSDIR = $(APPLIBDIR)/FreeRTOS -RTOSSRCDIR = $(RTOSDIR)/Source -RTOSINCDIR = $(RTOSSRCDIR)/include - -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files - -## OPENPILOT_BL CORE: -SRC += $(OPSYSTEM)/main.c -SRC += $(OPSYSTEM)/pios_board.c -SRC += $(OPSYSTEM)/op_dfu.c - -## PIOS Hardware (STM32F10x) -include $(PIOS)/STM32F10x/library.mk -SRC += $(PIOSSTM32F10X)/pios_sys.c -SRC += $(PIOSSTM32F10X)/pios_led.c -SRC += $(PIOSSTM32F10X)/pios_delay.c -SRC += $(PIOSSTM32F10X)/pios_usart.c -SRC += $(PIOSSTM32F10X)/pios_irq.c -SRC += $(PIOSSTM32F10X)/pios_debug.c -SRC += $(PIOSSTM32F10X)/pios_gpio.c -SRC += $(PIOSSTM32F10X)/pios_iap.c -SRC += $(PIOSSTM32F10X)/pios_bl_helper.c - -# PIOS USB related files (seperated to make code maintenance more easy) -SRC += $(PIOSSTM32F10X)/pios_usb.c -SRC += $(PIOSSTM32F10X)/pios_usbhook.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c -SRC += $(OPSYSTEM)/pios_usb_board_data.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c -SRC += $(PIOSCOMMON)/pios_usb_util.c - -## PIOS Hardware (Common) -SRC += $(PIOSCOMMON)/pios_board_info.c -SRC += $(PIOSCOMMON)/pios_com_msg.c -SRC += $(PIOSCOMMON)/printf-stdarg.c - -## Libraries for flight calculations -SRC += $(FLIGHTLIB)/fifo_buffer.c - -## CMSIS for STM32 -SRC += $(CMSISDIR)/core_cm3.c -SRC += $(CMSISDIR)/system_stm32f10x.c - -## Used parts of the STM-Library -SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c -SRC += $(STMSPDSRCDIR)/stm32f10x_crc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c -SRC += $(STMSPDSRCDIR)/stm32f10x_exti.c -SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c -SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c -SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c -SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c -SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c -SRC += $(STMSPDSRCDIR)/stm32f10x_dbgmcu.c -SRC += $(STMSPDSRCDIR)/misc.c - -## STM32 USB Library -SRC += $(STMUSBSRCDIR)/usb_core.c -SRC += $(STMUSBSRCDIR)/usb_init.c -SRC += $(STMUSBSRCDIR)/usb_int.c -SRC += $(STMUSBSRCDIR)/usb_mem.c -SRC += $(STMUSBSRCDIR)/usb_regs.c -SRC += $(STMUSBSRCDIR)/usb_sil.c - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S - -# List Assembler source files here which must be assembled in ARM-Mode.. -ASRCARM = - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -EXTRAINCDIRS += $(OPSYSTEM) -EXTRAINCDIRS += $(OPSYSTEMINC) -EXTRAINCDIRS += $(OPUAVTALK) -EXTRAINCDIRS += $(OPUAVTALKINC) -EXTRAINCDIRS += $(OPUAVOBJ) -EXTRAINCDIRS += $(OPUAVOBJINC) -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(PIOSSTM32F10X) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(STMUSBINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(DOSFSDIR) -EXTRAINCDIRS += $(MSDDIR) -EXTRAINCDIRS += $(RTOSINCDIR) -EXTRAINCDIRS += $(APPLIBDIR) -EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3 -EXTRAINCDIRS += $(HWDEFSINC) - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32F10X) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -OPT = 0 -else -OPT = s -endif - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DSTM32F10X_$(MODEL) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) -ifeq ($(ENABLE_DEBUG_PINS), YES) -CDEFS += -DPIOS_ENABLE_DEBUG_PINS -endif -ifeq ($(ENABLE_AUX_UART), YES) -CDEFS += -DPIOS_ENABLE_AUX_UART -endif - -# Provide (only) the bootloader with board-specific defines -BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) -BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) -BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) -BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION) -BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) -BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) -BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) BLONLY_CDEFS += -DEE_BANK_BASE=$(EE_BANK_BASE) BLONLY_CDEFS += -DEE_BANK_SIZE=$(EE_BANK_SIZE) - -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -# -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) - -ifeq ($(DEBUG),YES) -CFLAGS += -DDEBUG -endif - -CFLAGS += -g$(DEBUGF) -CFLAGS += -O$(OPT) -ifeq ($(DEBUG),NO) -CFLAGS += -ffunction-sections -endif - -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(BLONLY_CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. - -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif - -CFLAGS += -Wall -CFLAGS += -Werror -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -ifeq ($(DEBUG),NO) -LDFLAGS += -Wl,-static -endif -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -# Set linker-script name depending on selected submodel name -LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld -LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex sym -else -ifeq ($(LOADFORMAT),binary) -build: elf bin sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif -endif - -${OUTDIR}/InitMods.c: Makefile - @echo $(MSG_MODINIT) $(call toprel, $@) - @echo ${quote}// Autogenerated file${quote} > ${OUTDIR}/InitMods.c - @echo ${quote}${foreach MOD, ${MODNAMES}, extern unsigned int ${MOD}Initialize(void);}${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}void InitModules() {${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).bin -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin -else - $(error INSTALL_DIR must be specified for $@) -endif - -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list install diff --git a/flight/targets/Bootloaders/RevoMini/Makefile b/flight/targets/Bootloaders/RevoMini/Makefile index 24c1f308e..aad1047d2 100644 --- a/flight/targets/Bootloaders/RevoMini/Makefile +++ b/flight/targets/Bootloaders/RevoMini/Makefile @@ -1,374 +1,25 @@ - ##### - # Project: OpenPilot INS_BOOTLOADER - # - # - # Makefile for OpenPilot INS project - # - # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. - # - # - # 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, write to the Free Software Foundation, Inc., - # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - ##### - -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES for debugging -DEBUG ?= NO - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm -endif - -# Paths -REVO_BL = $(WHEREAMI) -REVO_BLINC = $(REVO_BL)/inc -PIOSINC = $(PIOS)/inc -FLIGHTLIBINC = $(FLIGHTLIB)/inc -PIOSSTM32F4XX = $(PIOS)/STM32F4xx -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -APPLIBDIR = $(PIOSSTM32F4XX)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F4xx_StdPeriph_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc - -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files - -## BOOTLOADER: -SRC += main.c -SRC += pios_board.c -SRC += pios_usb_board_data.c -SRC += op_dfu.c - -## PIOS Hardware (STM32F4xx) -include $(PIOS)/STM32F4xx/library.mk - -# PIOS Hardware (Common) -SRC += $(PIOSCOMMON)/pios_board_info.c -SRC += $(PIOSCOMMON)/pios_com_msg.c -SRC += $(PIOSCOMMON)/printf-stdarg.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c -SRC += $(PIOSCOMMON)/pios_usb_util.c - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(PIOSSTM34FXX) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(REVO_BLINC) -EXTRAINCDIRS += $(HWDEFSINC) - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32FXX) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -OPT = 0 -else -OPT = s -endif - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DSTM32F4XX -CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) -CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) - -# Provide (only) the bootloader with board-specific defines -BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) -BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) -BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) -BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION) -BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) -BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) -BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) - -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing # -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# -ifeq ($(DEBUG),YES) -CFLAGS = +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -# This is not the best place for these. Really should abstract out -# to the board file or something -CFLAGS += -DSTM32F4XX -CFLAGS += -DMEM_SIZE=1024000000 - -CFLAGS += -g$(DEBUGF) -CFLAGS += -O$(OPT) -ifeq ($(DEBUG),NO) -CFLAGS += -fdata-sections -ffunction-sections -endif -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(BLONLY_CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. - -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif - -CFLAGS += -Wall -#CFLAGS += -Werror -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -ifeq ($(DEBUG),NO) -LDFLAGS += -Wl,-static -endif -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -#Linker scripts -LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_BL)) - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex sym -else -ifeq ($(LOADFORMAT),binary) -build: elf bin sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif -endif - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).bin -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin -else - $(error INSTALL_DIR must be specified for $@) -endif - -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list install +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk +include $(ROOT_DIR)/make/boot-defs.mk diff --git a/flight/targets/Bootloaders/Revolution/Makefile b/flight/targets/Bootloaders/Revolution/Makefile index 24c1f308e..aad1047d2 100644 --- a/flight/targets/Bootloaders/Revolution/Makefile +++ b/flight/targets/Bootloaders/Revolution/Makefile @@ -1,374 +1,25 @@ - ##### - # Project: OpenPilot INS_BOOTLOADER - # - # - # Makefile for OpenPilot INS project - # - # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. - # - # - # 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, write to the Free Software Foundation, Inc., - # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - ##### - -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES for debugging -DEBUG ?= NO - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm -endif - -# Paths -REVO_BL = $(WHEREAMI) -REVO_BLINC = $(REVO_BL)/inc -PIOSINC = $(PIOS)/inc -FLIGHTLIBINC = $(FLIGHTLIB)/inc -PIOSSTM32F4XX = $(PIOS)/STM32F4xx -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -APPLIBDIR = $(PIOSSTM32F4XX)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F4xx_StdPeriph_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc - -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files - -## BOOTLOADER: -SRC += main.c -SRC += pios_board.c -SRC += pios_usb_board_data.c -SRC += op_dfu.c - -## PIOS Hardware (STM32F4xx) -include $(PIOS)/STM32F4xx/library.mk - -# PIOS Hardware (Common) -SRC += $(PIOSCOMMON)/pios_board_info.c -SRC += $(PIOSCOMMON)/pios_com_msg.c -SRC += $(PIOSCOMMON)/printf-stdarg.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c -SRC += $(PIOSCOMMON)/pios_usb_util.c - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(PIOSSTM34FXX) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(REVO_BLINC) -EXTRAINCDIRS += $(HWDEFSINC) - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32FXX) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -OPT = 0 -else -OPT = s -endif - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DSTM32F4XX -CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) -CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) - -# Provide (only) the bootloader with board-specific defines -BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) -BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) -BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) -BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION) -BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) -BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) -BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) - -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing # -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# -ifeq ($(DEBUG),YES) -CFLAGS = +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -# This is not the best place for these. Really should abstract out -# to the board file or something -CFLAGS += -DSTM32F4XX -CFLAGS += -DMEM_SIZE=1024000000 - -CFLAGS += -g$(DEBUGF) -CFLAGS += -O$(OPT) -ifeq ($(DEBUG),NO) -CFLAGS += -fdata-sections -ffunction-sections -endif -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(BLONLY_CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. - -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif - -CFLAGS += -Wall -#CFLAGS += -Werror -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -ifeq ($(DEBUG),NO) -LDFLAGS += -Wl,-static -endif -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -#Linker scripts -LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_BL)) - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex sym -else -ifeq ($(LOADFORMAT),binary) -build: elf bin sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif -endif - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).bin -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin -else - $(error INSTALL_DIR must be specified for $@) -endif - -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list install +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk +include $(ROOT_DIR)/make/boot-defs.mk diff --git a/make/boot-defs.mk b/make/boot-defs.mk new file mode 100644 index 000000000..b5dd43510 --- /dev/null +++ b/make/boot-defs.mk @@ -0,0 +1,459 @@ +# +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) +endif + +# Set developer code and compile options. +# Set to YES to compile for debugging +DEBUG ?= NO + +# Set to YES to use the Servo output pins for debugging via scope or logic analyser +ENABLE_DEBUG_PINS ?= NO + +# Set to YES to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs +ENABLE_AUX_UART ?= NO + +# Paths +TOPDIR = . +OPSYSTEM = $(TOPDIR) +OPSYSTEMINC = $(OPSYSTEM)/inc +PIOSINC = $(PIOS)/inc +PIOSCOMMON = $(PIOS)/Common +PIOSBOARDS = $(PIOS)/Boards +FLIGHTLIBINC = $(FLIGHTLIB)/inc +STMSPDSRCDIR = $(STMSPDDIR)/src +STMSPDINCDIR = $(STMSPDDIR)/inc + +ifeq ($(MCU),cortex-m3) + PIOSSTM32F10X = $(PIOS)/STM32F10x + APPLIBDIR = $(PIOSSTM32F10X)/Libraries + STMLIBDIR = $(APPLIBDIR) + STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver + STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver + STMUSBSRCDIR = $(STMUSBDIR)/src + STMUSBINCDIR = $(STMUSBDIR)/inc + CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 + DOSFSDIR = $(APPLIBDIR)/dosfs + MSDDIR = $(APPLIBDIR)/msd + RTOSDIR = $(APPLIBDIR)/FreeRTOS + RTOSSRCDIR = $(RTOSDIR)/Source + RTOSINCDIR = $(RTOSSRCDIR)/include +else ifeq ($(MCU),cortex-m4) + PIOSSTM32F4XX = $(PIOS)/STM32F4xx + APPLIBDIR = $(PIOSSTM32F4XX)/Libraries + STMLIBDIR = $(APPLIBDIR) + STMSPDDIR = $(STMLIBDIR)/STM32F4xx_StdPeriph_Driver + PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries +else + $(error Unsupported MCU: $(MCU)) +endif + +# List C source files here (C dependencies are automatically generated). +# Use file-extension c for "c-only"-files + +## Bootloader Core +SRC += $(OPSYSTEM)/main.c +SRC += $(OPSYSTEM)/pios_board.c +SRC += $(OPSYSTEM)/pios_usb_board_data.c +SRC += $(OPSYSTEM)/op_dfu.c + +## PIOS Hardware +ifeq ($(MCU),cortex-m3) + ## PIOS Hardware (STM32F10x) + SRC += $(PIOSSTM32F10X)/pios_sys.c + SRC += $(PIOSSTM32F10X)/pios_led.c + SRC += $(PIOSSTM32F10X)/pios_delay.c + SRC += $(PIOSSTM32F10X)/pios_usart.c + SRC += $(PIOSSTM32F10X)/pios_irq.c + SRC += $(PIOSSTM32F10X)/pios_debug.c + SRC += $(PIOSSTM32F10X)/pios_gpio.c + SRC += $(PIOSSTM32F10X)/pios_iap.c + SRC += $(PIOSSTM32F10X)/pios_bl_helper.c + SRC += $(PIOSSTM32F10X)/pios_usb.c + SRC += $(PIOSSTM32F10X)/pios_usbhook.c + SRC += $(PIOSSTM32F10X)/pios_usb_hid.c + SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c + SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c + + ## Libraries for flight calculations + SRC += $(FLIGHTLIB)/fifo_buffer.c + + ## CMSIS for STM32 + SRC += $(CMSISDIR)/core_cm3.c + SRC += $(CMSISDIR)/system_stm32f10x.c + + ## Used parts of the STM-Library + SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c + SRC += $(STMSPDSRCDIR)/stm32f10x_crc.c + SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c + SRC += $(STMSPDSRCDIR)/stm32f10x_exti.c + SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c + SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c + SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c + SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c + SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c + SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c + SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c + SRC += $(STMSPDSRCDIR)/stm32f10x_dbgmcu.c + SRC += $(STMSPDSRCDIR)/misc.c + + ## STM32 USB Library + SRC += $(STMUSBSRCDIR)/usb_core.c + SRC += $(STMUSBSRCDIR)/usb_init.c + SRC += $(STMUSBSRCDIR)/usb_int.c + SRC += $(STMUSBSRCDIR)/usb_mem.c + SRC += $(STMUSBSRCDIR)/usb_regs.c + SRC += $(STMUSBSRCDIR)/usb_sil.c +else ifeq ($(MCU),cortex-m4) + ## PIOS Hardware (STM32F4xx) + include $(PIOS)/STM32F4xx/library.mk +endif + +## PIOS Hardware (Common) +SRC += $(PIOSCOMMON)/pios_board_info.c +SRC += $(PIOSCOMMON)/pios_com_msg.c +SRC += $(PIOSCOMMON)/printf-stdarg.c +SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c +SRC += $(PIOSCOMMON)/pios_usb_util.c + +# List C source files here which must be compiled in ARM-Mode (no -mthumb). +# Use file-extension c for "c-only"-files +SRCARM = + +# List C++ source files here. +# Use file-extension .cpp for C++-files (not .C) +CPPSRC = + +# List C++ source files here which must be compiled in ARM-Mode. +# Use file-extension .cpp for C++-files (not .C) +CPPSRCARM = + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ifeq ($(MCU),cortex-m3) + ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S +else + ASRC = +endif + +# List Assembler source files here which must be assembled in ARM-Mode. +ASRCARM = + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS += $(PIOS) +EXTRAINCDIRS += $(PIOSINC) +EXTRAINCDIRS += $(FLIGHTLIBINC) +EXTRAINCDIRS += $(PIOSCOMMON) +EXTRAINCDIRS += $(PIOSBOARDS) +EXTRAINCDIRS += $(STMSPDINCDIR) +EXTRAINCDIRS += $(CMSISDIR) +EXTRAINCDIRS += $(HWDEFSINC) +EXTRAINCDIRS += $(OPSYSTEMINC) + +ifeq ($(MCU),cortex-m3) + EXTRAINCDIRS += $(PIOSSTM32F10X) + EXTRAINCDIRS += $(OPUAVTALK) + EXTRAINCDIRS += $(OPUAVTALKINC) + EXTRAINCDIRS += $(OPUAVOBJ) + EXTRAINCDIRS += $(OPUAVOBJINC) + EXTRAINCDIRS += $(DOSFSDIR) + EXTRAINCDIRS += $(MSDDIR) + EXTRAINCDIRS += $(RTOSINCDIR) + EXTRAINCDIRS += $(STMUSBINCDIR) + EXTRAINCDIRS += $(APPLIBDIR) + EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3 +else ifeq ($(MCU),cortex-m4) + EXTRAINCDIRS += $(PIOSSTM34FXX) +endif + +# List any extra directories to look for library files here. +# Also add directories where the linker should search for +# includes from linker-script to the list +# Each directory must be seperated by a space. +EXTRA_LIBDIRS = + +# Extra Libraries +# Each library-name must be seperated by a space. +# i.e. to link with libxyz.a, libabc.a and libefsl.a: +# EXTRA_LIBS = xyz abc efsl +# for newlib-lpc (file: libnewlibc-lpc.a): +# EXTRA_LIBS = newlib-lpc +EXTRA_LIBS = + +# Path to linker scripts +ifeq ($(MCU),cortex-m3) + LINKERSCRIPTPATH = $(PIOSSTM32F10X) +else ifeq ($(MCU),cortex-m4) + LINKERSCRIPTPATH = $(PIOSSTM32FXX) +endif + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# Note: 3 is not always the best optimization level. +ifeq ($(DEBUG), YES) + OPT = 0 +else + OPT = s +endif + +# Output format (can be ihex or binary or both). +# binary to create a load-image in raw-binary format i.e. for SAM-BA, +# ihex to create a load-image in Intel hex format +#LOADFORMAT = ihex +#LOADFORMAT = binary +LOADFORMAT = both + +# Debugging format. +DEBUGF = dwarf-2 + +# Place project-specific -D (define) and/or -U options for C here. +ifeq ($(MCU),cortex-m3) + CDEFS = -DSTM32F10X_$(MODEL) +else ifeq ($(MCU),cortex-m4) + CDEFS += -DSTM32F4XX + CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) + CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) +endif + +CDEFS += -DUSE_$(BOARD) +CDEFS += -DUSE_STDPERIPH_DRIVER + +ifeq ($(ENABLE_DEBUG_PINS), YES) + CDEFS += -DPIOS_ENABLE_DEBUG_PINS +endif +ifeq ($(ENABLE_AUX_UART), YES) + CDEFS += -DPIOS_ENABLE_AUX_UART +endif + +# Provide (only) the bootloader with board-specific defines +BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) +BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) +BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) +BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION) +BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) +BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) +BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) + +# Place project-specific -D and/or -U options for Assembler with preprocessor here. +#ADEFS = -DUSE_IRQ_ASM_WRAPPER +ADEFS = -D__ASSEMBLY__ + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Compiler flags. +# +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing + +# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) +ifeq ($(MCU),cortex-m4) + # This is not the best place for these. Really should abstract out + # to the board file or something + CFLAGS += -DSTM32F4XX + CFLAGS += -DMEM_SIZE=1024000000 +endif + +CFLAGS += -mcpu=$(MCU) +CFLAGS += $(CDEFS) +CFLAGS += $(BLONLY_CDEFS) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. +CFLAGS += -mapcs-frame +CFLAGS += -fomit-frame-pointer +CFLAGS += -O$(OPT) +CFLAGS += -g$(DEBUGF) + +ifeq ($(DEBUG), YES) + CFLAGS += -DDEBUG +else + CFLAGS += -fdata-sections -ffunction-sections +endif + +CFLAGS += -Wall +# FIXME: STM32F4xx library raises strict aliasing and const qualifier warnings +ifneq ($(MCU),cortex-m4) + CFLAGS += -Werror +endif +CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) + +# Compiler flags to generate dependency files +CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d + +# Flags only for C +#CONLYFLAGS += -Wnested-externs +CONLYFLAGS += $(CSTANDARD) + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlns: create listing +ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp +ASFLAGS += $(ADEFS) +ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) +ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) + +MATH_LIB = -lm + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS += -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections +LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) +LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) +LDFLAGS += -lc -lgcc $(MATH_LIB) + +ifneq ($(DEBUG), YES) + LDFLAGS += -Wl,-static +endif + +# Set linker-script name depending on selected submodel name +ifeq ($(MCU),cortex-m3) + LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld + LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld +else ifeq ($(MCU),cortex-m4) + LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_BL)) +endif + +# List of all source files. +ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) +# List of all source files without directory and file-extension. +ALLSRCBASE = $(notdir $(basename $(ALLSRC))) + +# Define all object files. +ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) + +# Define all listing files (used for make clean). +LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) +# Define all depedency-files (used for make clean). +DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) + +# Default target. +all: build + +ifeq ($(LOADFORMAT),ihex) +build: elf hex sym +else ifeq ($(LOADFORMAT),binary) +build: elf bin sym +else ifeq ($(LOADFORMAT),both) +build: elf hex bin sym +else + $(error "$(MSG_FORMATERROR) $(FORMAT)") +endif + +# Link: create ELF output file from object files. +$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) + +# Assemble: create object files from assembler source files. +$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) + +# Assemble: create object files from assembler source files. ARM-only +$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) + +# Compile: create object files from C source files. +$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) + +# Compile: create object files from C source files. ARM-only +$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) + +# Compile: create object files from C++ source files. +$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) + +# Compile: create object files from C++ source files. ARM-only +$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) + +# Compile: create assembler files from C source files. ARM/Thumb +$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) + +# Compile: create assembler files from C source files. ARM only +$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) + +$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin + +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) + +.PHONY: elf lss sym hex bin bino +elf: $(OUTDIR)/$(TARGET).elf +lss: $(OUTDIR)/$(TARGET).lss +sym: $(OUTDIR)/$(TARGET).sym +hex: $(OUTDIR)/$(TARGET).hex +bin: $(OUTDIR)/$(TARGET).bin +bino: $(OUTDIR)/$(TARGET).bin.o + +# Display sizes of sections. +$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) + +# Generate Doxygen documents +docs: + doxygen $(DOXYGENDIR)/doxygen.cfg + +# Install: install binary file with prefix/suffix into install directory +install: $(OUTDIR)/$(TARGET).bin +ifneq ($(INSTALL_DIR),) + @$(ECHO) $(MSG_INSTALLING) $(call toprel, $<) + $(V1) $(MKDIR) -p $(INSTALL_DIR) + $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin +else + $(error INSTALL_DIR must be specified for $@) +endif + +# Target: clean project. +clean: clean_list + +clean_list : + @echo $(MSG_CLEANING) + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).map + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).elf + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).hex + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).sym + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).lss + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin.o + $(V1) $(RM) -f $(ALLOBJ) + $(V1) $(RM) -f $(LSTFILES) + $(V1) $(RM) -f $(DEPFILES) + $(V1) $(RM) -f $(SRC:.c=.s) + $(V1) $(RM) -f $(SRCARM:.c=.s) + $(V1) $(RM) -f $(CPPSRC:.cpp=.s) + $(V1) $(RM) -f $(CPPSRCARM:.cpp=.s) + +# Create output files directory +# all known MS Windows OS define the ComSpec environment variable +$(shell $(MKDIR) -p $(OUTDIR) 2>/dev/null) + +# Include the dependency files. +-include $(shell $(MKDIR) -p $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) + +# Listing of phony targets. +.PHONY : all build clean clean_list install From f7bdcdb782e34692364257ad0900cfe9c9b347e9 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Fri, 15 Mar 2013 21:33:25 +0200 Subject: [PATCH 14/68] Makefile: firmware makefiles cleanup (CC) Conflicts: flight/targets/CopterControl/Makefile --- Makefile | 16 +- flight/targets/CopterControl/Makefile | 777 ++++---------------------- make/apps-defs.mk | 552 ++++++++++++++++++ make/boot-defs.mk | 2 +- 4 files changed, 664 insertions(+), 683 deletions(-) create mode 100644 make/apps-defs.mk diff --git a/Makefile b/Makefile index 0a84cce75..dfa7872d4 100644 --- a/Makefile +++ b/Makefile @@ -451,21 +451,9 @@ fw_$(1)_%: uavobjects_flight BOARD_NAME=$(1) \ BOARD_SHORT_NAME=$(3) \ BUILD_TYPE=fw \ - TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \ - REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \ - \ - TARGET=fw_$(1) \ - OUTDIR=$(BUILD_DIR)/fw_$(1) \ - \ - PIOS=$(PIOS) \ - FLIGHTLIB=$(FLIGHTLIB) \ - OPMODULEDIR=$(OPMODULEDIR) \ - OPUAVOBJ=$(OPUAVOBJ) \ - OPUAVTALK=$(OPUAVTALK) \ HWDEFSINC=$(HWDEFS)/$(1) \ - DOXYGENDIR=$(DOXYGENDIR) \ - OPUAVSYNTHDIR=$(OPUAVSYNTHDIR) \ - \ + OUTDIR=$(BUILD_DIR)/fw_$(1) \ + TARGET=fw_$(1) \ $$* .PHONY: $(1)_clean diff --git a/flight/targets/CopterControl/Makefile b/flight/targets/CopterControl/Makefile index e2a603587..a36b60190 100644 --- a/flight/targets/CopterControl/Makefile +++ b/flight/targets/CopterControl/Makefile @@ -1,13 +1,6 @@ -############################################################################### -# @file Makefile -# @author The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. -# @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012 -# @addtogroup -# @{ -# @addtogroup -# @{ -# @brief Makefile to build firmware for the CopterControl board. -############################################################################### +# +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# Copyright (c) 2012, PhoenixPilot, http://github.com/PhoenixPilot # # 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 @@ -24,699 +17,147 @@ # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES to compile for debugging -DEBUG ?= NO - -# Include objects that are just nice information to show -STACK_DIAGNOSTICS ?= NO -MIXERSTATUS_DIAGNOSTICS ?= NO -RATEDESIRED_DIAGNOSTICS ?= NO -I2C_WDG_STATS_DIAGNOSTICS ?= NO -DIAG_TASKS ?= NO - -#Or just turn on all the above diagnostics. WARNING: This consumes massive amounts of memory. -ALL_DIGNOSTICS ?=NO - -# Set to YES to build a FW version that will erase all flash memory -ERASE_FLASH ?= NO -# Set to YES to use the Servo output pins for debugging via scope or logic analyser -ENABLE_DEBUG_PINS ?= NO - -# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs -ENABLE_AUX_UART ?= NO - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -# Remove command is different for Code Sourcery on Windows -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -FLASH_TOOL = OPENOCD +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk + +# ARM DSP library +USE_DSP_LIB ?= NO # Optional module and driver defaults -USE_CAMERASTAB ?= YES +USE_CAMERASTAB ?= YES USE_COMUSBBRIDGE ?= YES -USE_GPS ?= YES -USE_TXPID ?= YES -USE_I2C ?= NO -USE_ALTITUDE ?= NO -USE_AUTOTUNE ?= YES -TEST_FAULTS ?= NO +USE_GPS ?= YES +USE_TXPID ?= YES +USE_I2C ?= NO +USE_ALTITUDE ?= NO +USE_AUTOTUNE ?= NO +TEST_FAULTS ?= NO # Camera gimbal options -USE_INPUT_LPF ?= YES -USE_GIMBAL_LPF ?= YES -USE_GIMBAL_FF ?= YES +USE_INPUT_LPF ?= YES +USE_GIMBAL_LPF ?= YES +USE_GIMBAL_FF ?= YES + +# Set to YES to build a FW version that will erase data flash memory +ERASE_FLASH ?= NO + +# List of mandatory modules to include +MODULES = Attitude Stabilization Actuator ManualControl FirmwareIAP + +# Telemetry must be last to grab the optional modules (why?) +MODULES += Telemetry # List of optional modules to include OPTMODULES = ifeq ($(USE_CAMERASTAB), YES) -OPTMODULES += CameraStab + OPTMODULES += CameraStab endif ifeq ($(USE_COMUSBBRIDGE), YES) -OPTMODULES += ComUsbBridge + OPTMODULES += ComUsbBridge endif ifeq ($(USE_GPS), YES) -OPTMODULES += GPS + OPTMODULES += GPS + CDEFS += -DUSE_GPS endif ifeq ($(USE_TXPID), YES) -OPTMODULES += TxPID + OPTMODULES += TxPID endif ifeq ($(USE_ALTITUDE), YES) -ifeq ($(USE_I2C), YES) -OPTMODULES += Altitude -else -$(error "Altitude module (USE_ALTITUDE=YES) requires i2c (USE_I2C=YES)") -endif -endif -ifeq ($(TEST_FAULTS), YES) -OPTMODULES += Fault + ifeq ($(USE_I2C), YES) + OPTMODULES += Altitude + CDEFS += -DUSE_I2C + else + $(error Altitude module (USE_ALTITUDE=YES) requires i2c (USE_I2C=YES)) + endif endif ifeq ($(USE_AUTOTUNE), YES) -OPTMODULES += Autotune + OPTMODULES += Autotune +endif +ifeq ($(TEST_FAULTS), YES) + OPTMODULES += Fault endif -# List of mandatory modules to include -MODULES = Attitude Stabilization Actuator ManualControl FirmwareIAP -# Telemetry must be last to grab the optional modules (why?) -MODULES += Telemetry - -# Enable ARM DSP library -USE_DSP_LIB = NO - -# Paths -OPSYSTEM = ./System -OPSYSTEMINC = $(OPSYSTEM)/inc -OPUAVTALKINC = $(OPUAVTALK)/inc -OPUAVOBJINC = $(OPUAVOBJ)/inc -OPTESTS = ./Tests -FLIGHTLIBINC = $(FLIGHTLIB)/inc -MATHLIB = $(FLIGHTLIB)/math -MATHLIBINC = $(FLIGHTLIB)/math -PIOSINC = $(PIOS)/inc -PIOSSTM32F10X = $(PIOS)/STM32F10x -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -APPLIBDIR = $(PIOSSTM32F10X)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver -STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc -STMUSBSRCDIR = $(STMUSBDIR)/src -STMUSBINCDIR = $(STMUSBDIR)/inc -CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 -DOSFSDIR = $(APPLIBDIR)/dosfs -MSDDIR = $(APPLIBDIR)/msd -RTOSDIR = $(PIOSCOMMON)/Libraries/FreeRTOS -RTOSSRCDIR = $(RTOSDIR)/Source -RTOSINCDIR = $(RTOSSRCDIR)/include -RTOSPORTDIR = $(APPLIBDIR)/FreeRTOS/Source -DOXYGENDIR = ../Doc/Doxygen -PYMITE = $(FLIGHTLIB)/PyMite -PYMITELIB = $(PYMITE)/lib -PYMITEPLAT = $(PYMITE)/platform/openpilot -PYMITETOOLS = $(PYMITE)/tools -PYMITEVM = $(PYMITE)/vm -PYMITEINC = $(PYMITEVM) -PYMITEINC += $(PYMITEPLAT) -PYMITEINC += $(OUTDIR) -FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib -FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans - -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files - -ifndef TESTAPP -## MODULES -SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -## OPENPILOT CORE: -SRC += ${OPMODULEDIR}/System/systemmod.c -SRC += $(OPSYSTEM)/coptercontrol.c -SRC += $(OPSYSTEM)/pios_board.c -SRC += $(OPSYSTEM)/alarms.c -SRC += $(OPUAVTALK)/uavtalk.c -SRC += $(OPUAVOBJ)/uavobjectmanager.c -SRC += $(OPUAVOBJ)/eventdispatcher.c -else -## TESTCODE -SRC += $(OPTESTS)/test_common.c -SRC += $(OPTESTS)/$(TESTAPP).c -endif - - - -## UAVOBJECTS -ifndef TESTAPP -SRC += $(OPUAVSYNTHDIR)/accessorydesired.c -SRC += $(OPUAVSYNTHDIR)/objectpersistence.c -SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c -SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c -SRC += $(OPUAVSYNTHDIR)/faultsettings.c -SRC += $(OPUAVSYNTHDIR)/flightstatus.c -SRC += $(OPUAVSYNTHDIR)/systemstats.c -SRC += $(OPUAVSYNTHDIR)/systemalarms.c -SRC += $(OPUAVSYNTHDIR)/systemsettings.c -SRC += $(OPUAVSYNTHDIR)/stabilizationdesired.c -SRC += $(OPUAVSYNTHDIR)/stabilizationsettings.c -SRC += $(OPUAVSYNTHDIR)/actuatorcommand.c -SRC += $(OPUAVSYNTHDIR)/actuatordesired.c -SRC += $(OPUAVSYNTHDIR)/actuatorsettings.c -SRC += $(OPUAVSYNTHDIR)/accels.c -SRC += $(OPUAVSYNTHDIR)/gyros.c -SRC += $(OPUAVSYNTHDIR)/attitudeactual.c -SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c -SRC += $(OPUAVSYNTHDIR)/i2cstats.c -SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c -SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c -SRC += $(OPUAVSYNTHDIR)/mixersettings.c -SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c -SRC += $(OPUAVSYNTHDIR)/attitudesettings.c -SRC += $(OPUAVSYNTHDIR)/camerastabsettings.c -SRC += $(OPUAVSYNTHDIR)/cameradesired.c -SRC += $(OPUAVSYNTHDIR)/gpsposition.c -SRC += $(OPUAVSYNTHDIR)/gpsvelocity.c -SRC += $(OPUAVSYNTHDIR)/hwsettings.c -SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c -SRC += $(OPUAVSYNTHDIR)/receiveractivity.c -SRC += $(OPUAVSYNTHDIR)/relaytuningsettings.c -SRC += $(OPUAVSYNTHDIR)/relaytuning.c -SRC += $(OPUAVSYNTHDIR)/taskinfo.c -SRC += $(OPUAVSYNTHDIR)/mixerstatus.c -SRC += $(OPUAVSYNTHDIR)/ratedesired.c -SRC += $(OPUAVSYNTHDIR)/baroaltitude.c -SRC += $(OPUAVSYNTHDIR)/txpidsettings.c -SRC += $(OPUAVSYNTHDIR)/airspeedactual.c -SRC += $(OPUAVSYNTHDIR)/mpu6000settings.c - -endif - -## PIOS Hardware (STM32F10x) -include $(PIOS)/STM32F10x/library.mk -SRC += $(PIOSSTM32F10X)/pios_sys.c -SRC += $(PIOSSTM32F10X)/pios_led.c -SRC += $(PIOSSTM32F10X)/pios_delay.c -SRC += $(PIOSSTM32F10X)/pios_usart.c -SRC += $(PIOSSTM32F10X)/pios_irq.c -SRC += $(PIOSSTM32F10X)/pios_adc.c -SRC += $(PIOSSTM32F10X)/pios_servo.c -SRC += $(PIOSSTM32F10X)/pios_i2c.c -SRC += $(PIOSSTM32F10X)/pios_spi.c -SRC += $(PIOSSTM32F10X)/pios_ppm.c -SRC += $(PIOSSTM32F10X)/pios_pwm.c -SRC += $(PIOSSTM32F10X)/pios_dsm.c -SRC += $(PIOSSTM32F10X)/pios_debug.c -SRC += $(PIOSSTM32F10X)/pios_gpio.c -SRC += $(PIOSSTM32F10X)/pios_exti.c -SRC += $(PIOSSTM32F10X)/pios_rtc.c -SRC += $(PIOSSTM32F10X)/pios_wdg.c -SRC += $(PIOSSTM32F10X)/pios_iap.c -SRC += $(PIOSSTM32F10X)/pios_tim.c -SRC += $(PIOSSTM32F10X)/pios_bl_helper.c - -# PIOS USB related files (separated to make code maintenance more easy) -SRC += $(PIOSSTM32F10X)/pios_usb.c -SRC += $(PIOSSTM32F10X)/pios_usbhook.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid.c -SRC += $(PIOSSTM32F10X)/pios_usb_rctx.c -SRC += $(PIOSSTM32F10X)/pios_usb_cdc.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c -SRC += $(OPSYSTEM)/pios_usb_board_data.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c -SRC += $(PIOSCOMMON)/pios_usb_util.c - -## PIOS Hardware (Common) -SRC += $(PIOSCOMMON)/pios_crc.c -SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c -SRC += $(PIOSCOMMON)/pios_flash_jedec.c -SRC += $(PIOSCOMMON)/pios_adxl345.c -SRC += $(PIOSCOMMON)/pios_mpu6000.c -SRC += $(PIOSCOMMON)/pios_com.c -SRC += $(PIOSCOMMON)/pios_sbus.c -#SRC += $(PIOSCOMMON)/pios_i2c_esc.c -#SRC += $(PIOSCOMMON)/pios_bmp085.c -SRC += $(PIOSCOMMON)/pios_rcvr.c -SRC += $(PIOSCOMMON)/pios_gcsrcvr.c -SRC += $(PIOSCOMMON)/printf-stdarg.c -## Libraries for flight calculations -SRC += $(FLIGHTLIB)/fifo_buffer.c -SRC += $(FLIGHTLIB)/CoordinateConversions.c -SRC += $(FLIGHTLIB)/taskmonitor.c -SRC += $(FLIGHTLIB)/sanitycheck.c -SRC += $(MATHLIB)/sin_lookup.c -SRC += $(MATHLIB)/pid.c - -## CMSIS for STM32 -SRC += $(CMSISDIR)/core_cm3.c -SRC += $(CMSISDIR)/system_stm32f10x.c - -## Used parts of the STM-Library -SRC += $(STMSPDSRCDIR)/stm32f10x_adc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c -SRC += $(STMSPDSRCDIR)/stm32f10x_crc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_dac.c -SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c -SRC += $(STMSPDSRCDIR)/stm32f10x_exti.c -SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c -SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c -SRC += $(STMSPDSRCDIR)/stm32f10x_i2c.c -SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c -SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c -SRC += $(STMSPDSRCDIR)/stm32f10x_tim.c -SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c -SRC += $(STMSPDSRCDIR)/stm32f10x_iwdg.c -SRC += $(STMSPDSRCDIR)/stm32f10x_dbgmcu.c -SRC += $(STMSPDSRCDIR)/misc.c - -## STM32 USB Library -SRC += $(STMUSBSRCDIR)/usb_core.c -SRC += $(STMUSBSRCDIR)/usb_init.c -SRC += $(STMUSBSRCDIR)/usb_int.c -SRC += $(STMUSBSRCDIR)/usb_mem.c -SRC += $(STMUSBSRCDIR)/usb_regs.c -SRC += $(STMUSBSRCDIR)/usb_sil.c - -## RTOS -SRC += $(RTOSSRCDIR)/list.c -SRC += $(RTOSSRCDIR)/queue.c -SRC += $(RTOSSRCDIR)/tasks.c - -## RTOS Portable -SRC += $(RTOSPORTDIR)/portable/GCC/ARM_CM3/port.c -SRC += $(RTOSPORTDIR)/portable/MemMang/heap_1.c - -## Dosfs file system -#SRC += $(DOSFSDIR)/dosfs.c -#SRC += $(DOSFSDIR)/dfs_sdcard.c - -## PyMite files -#SRC += $(wildcard ${PYMITEVM}/*.c) -#SRC += $(wildcard ${PYMITEPLAT}/*.c) -#SRC += $(OUTDIR)/pmlib_img.c -#SRC += $(OUTDIR)/pmlib_nat.c -#SRC += $(OUTDIR)/pmlibusr_img.c -#SRC += $(OUTDIR)/pmlibusr_nat.c - -## Mass Storage Device -#SRC += $(MSDDIR)/msd.c -#SRC += $(MSDDIR)/msd_bot.c -#SRC += $(MSDDIR)/msd_desc.c -#SRC += $(MSDDIR)/msd_memory.c -#SRC += $(MSDDIR)/msd_scsi.c -#SRC += $(MSDDIR)/msd_scsi_data.c - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S - -# List Assembler source files here which must be assembled in ARM-Mode.. -ASRCARM = - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -EXTRAINCDIRS += $(OPSYSTEM) -EXTRAINCDIRS += $(OPSYSTEMINC) -EXTRAINCDIRS += $(OPUAVTALK) -EXTRAINCDIRS += $(OPUAVTALKINC) -EXTRAINCDIRS += $(OPUAVOBJ) -EXTRAINCDIRS += $(OPUAVOBJINC) -EXTRAINCDIRS += $(OPUAVSYNTHDIR) -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(MATHLIBINC) -EXTRAINCDIRS += $(PIOSSTM32F10X) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(STMUSBINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(DOSFSDIR) -EXTRAINCDIRS += $(MSDDIR) -EXTRAINCDIRS += $(RTOSINCDIR) -EXTRAINCDIRS += $(APPLIBDIR) -EXTRAINCDIRS += $(RTOSPORTDIR)/portable/GCC/ARM_CM3 -EXTRAINCDIRS += $(AHRSBOOTLOADERINC) -EXTRAINCDIRS += $(PYMITEINC) -EXTRAINCDIRS += $(HWDEFSINC) - -EXTRAINCDIRS += ${foreach MOD, ${OPTMODULES} ${MODULES}, ${OPMODULEDIR}/${MOD}/inc} ${OPMODULEDIR}/System/inc - - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32F10X) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -OPT = 1 -else -OPT = s -endif - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DSTM32F10X_$(MODEL) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) -ifeq ($(ENABLE_DEBUG_PINS), YES) -CDEFS += -DPIOS_ENABLE_DEBUG_PINS -endif -ifeq ($(ENABLE_DEBUG_CONSOLE), YES) -CDEFS += -DPIOS_INCLUDE_DEBUG_CONSOLE -endif +# Misc defines ifeq ($(ERASE_FLASH), YES) -CDEFS += -DERASE_FLASH + CDEFS += -DERASE_FLASH endif - -ifneq ($(USE_GPS), NO) -CDEFS += -DUSE_GPS -endif - -ifeq ($(USE_I2C), YES) -CDEFS += -DUSE_I2C -endif - ifeq ($(USE_INPUT_LPF), YES) -CDEFS += -DUSE_INPUT_LPF + CDEFS += -DUSE_INPUT_LPF endif - ifeq ($(USE_GIMBAL_LPF), YES) -CDEFS += -DUSE_GIMBAL_LPF + CDEFS += -DUSE_GIMBAL_LPF endif - ifeq ($(USE_GIMBAL_FF), YES) -CDEFS += -DUSE_GIMBAL_FF + CDEFS += -DUSE_GIMBAL_FF endif -# Declare all non-optional modules as built-in to force inclusion -CDEFS += ${foreach MOD, ${MODULES}, -DMODULE_$(MOD)_BUILTIN } +# List C source files here (C dependencies are automatically generated). +# Use file-extension c for "c-only"-files +ifndef TESTAPP + ## Modules + SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} + SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -# -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) - -ifeq ($(DEBUG),YES) -CFLAGS += -DDEBUG -endif - -#The following Makefile command, ifneq (, $(filter) $(A), $(B) $(C)) is equivalent -# to the pseudocode `if(A== B || A==C)` -ifneq (,$(filter YES,$(STACK_DIAGNOSTICS) $(ALL_DIGNOSTICS))) -CFLAGS += -DSTACK_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(MIXERSTATUS_DIAGNOSTICS) $(ALL_DIGNOSTICS))) -CFLAGS += -DMIXERSTATUS_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(RATEDESIRED_DIAGNOSTICS) $(ALL_DIGNOSTICS))) -CFLAGS += -DRATEDESIRED_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(I2C_WDG_STATS_DIAGNOSTICS) $(ALL_DIGNOSTICS))) -CFLAGS += -DI2C_WDG_STATS_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(DIAG_TASKS) $(ALL_DIGNOSTICS))) -CFLAGS += -DDIAG_TASKS -endif - -CFLAGS += -g$(DEBUGF) -CFLAGS += -O$(OPT) -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. - -#CFLAGS += -fno-cprop-registers -fno-defer-pop -fno-guess-branch-probability -fno-section-anchors -#CFLAGS += -fno-if-conversion -fno-if-conversion2 -fno-ipa-pure-const -fno-ipa-reference -fno-merge-constants -#CFLAGS += -fno-split-wide-types -fno-tree-ccp -fno-tree-ch -fno-tree-copy-prop -fno-tree-copyrename -#CFLAGS += -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-tree-fre -fno-tree-sink -fno-tree-sra -#CFLAGS += -fno-tree-ter -#CFLAGS += -g$(DEBUGF) -DDEBUG - -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif - -CFLAGS += -Wall -CFLAGS += -Werror -CFLAGS += -ffunction-sections -fdata-sections -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -# Set linker-script name depending on selected submodel name -LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld -LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f -PYTHON = python - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex lss sym + ## Application Core + SRC += ${OPMODULEDIR}/System/systemmod.c + SRC += $(OPSYSTEM)/coptercontrol.c + SRC += $(OPSYSTEM)/pios_board.c + SRC += $(OPSYSTEM)/alarms.c + SRC += $(OPUAVTALK)/uavtalk.c + SRC += $(OPUAVOBJ)/uavobjectmanager.c + SRC += $(OPUAVOBJ)/eventdispatcher.c else -ifeq ($(LOADFORMAT),binary) -build: elf bin lss sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin lss sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif + ## Test Code + SRC += $(OPTESTS)/test_common.c + SRC += $(OPTESTS)/$(TESTAPP).c endif -# Generate code for PyMite -#$(OUTDIR)/pmlib_img.c $(OUTDIR)/pmlib_nat.c $(OUTDIR)/pmlibusr_img.c $(OUTDIR)/pmlibusr_nat.c $(OUTDIR)/pmfeatures.h: $(wildcard $(PYMITELIB)/*.py) $(wildcard $(PYMITEPLAT)/*.py) $(wildcard $(FLIGHTPLANLIB)/*.py) $(wildcard $(FLIGHTPLANS)/*.py) -# @echo $(MSG_PYMITEINIT) $(call toprel, $@) -# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py) -# @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h -# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino opfw -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o -opfw: $(OUTDIR)/$(TARGET).opfw - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).opfw -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw -else - $(error INSTALL_DIR must be specified for $@) +## UAVObjects +ifndef TESTAPP + SRC += $(OPUAVSYNTHDIR)/accessorydesired.c + SRC += $(OPUAVSYNTHDIR)/objectpersistence.c + SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c + SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c + SRC += $(OPUAVSYNTHDIR)/faultsettings.c + SRC += $(OPUAVSYNTHDIR)/flightstatus.c + SRC += $(OPUAVSYNTHDIR)/systemstats.c + SRC += $(OPUAVSYNTHDIR)/systemalarms.c + SRC += $(OPUAVSYNTHDIR)/systemsettings.c + SRC += $(OPUAVSYNTHDIR)/stabilizationdesired.c + SRC += $(OPUAVSYNTHDIR)/stabilizationsettings.c + SRC += $(OPUAVSYNTHDIR)/actuatorcommand.c + SRC += $(OPUAVSYNTHDIR)/actuatordesired.c + SRC += $(OPUAVSYNTHDIR)/actuatorsettings.c + SRC += $(OPUAVSYNTHDIR)/accels.c + SRC += $(OPUAVSYNTHDIR)/gyros.c + SRC += $(OPUAVSYNTHDIR)/attitudeactual.c + SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c + SRC += $(OPUAVSYNTHDIR)/i2cstats.c + SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c + SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c + SRC += $(OPUAVSYNTHDIR)/mixersettings.c + SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c + SRC += $(OPUAVSYNTHDIR)/attitudesettings.c + SRC += $(OPUAVSYNTHDIR)/camerastabsettings.c + SRC += $(OPUAVSYNTHDIR)/cameradesired.c + SRC += $(OPUAVSYNTHDIR)/gpsposition.c + SRC += $(OPUAVSYNTHDIR)/gpsvelocity.c + SRC += $(OPUAVSYNTHDIR)/hwsettings.c + SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c + SRC += $(OPUAVSYNTHDIR)/receiveractivity.c + SRC += $(OPUAVSYNTHDIR)/relaytuningsettings.c + SRC += $(OPUAVSYNTHDIR)/relaytuning.c + SRC += $(OPUAVSYNTHDIR)/taskinfo.c + SRC += $(OPUAVSYNTHDIR)/mixerstatus.c + SRC += $(OPUAVSYNTHDIR)/ratedesired.c + SRC += $(OPUAVSYNTHDIR)/baroaltitude.c + SRC += $(OPUAVSYNTHDIR)/txpidsettings.c + SRC += $(OPUAVSYNTHDIR)/airspeedactual.c + SRC += $(OPUAVSYNTHDIR)/mpu6000settings.c endif -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(wildcard $(OUTDIR)/*.c) - $(V1) $(REMOVE) $(wildcard $(OUTDIR)/*.h) - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list install +include $(ROOT_DIR)/make/apps-defs.mk diff --git a/make/apps-defs.mk b/make/apps-defs.mk new file mode 100644 index 000000000..07bef1bf1 --- /dev/null +++ b/make/apps-defs.mk @@ -0,0 +1,552 @@ +# +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) +endif + +# Set developer code and compile options. +# Set to YES to compile for debugging +DEBUG ?= NO + +# Set to YES to use the Servo output pins for debugging via scope or logic analyser +ENABLE_DEBUG_PINS ?= NO + +# Include objects that are just nice information to show +STACK_DIAGNOSTICS ?= NO +MIXERSTATUS_DIAGNOSTICS ?= NO +RATEDESIRED_DIAGNOSTICS ?= NO +I2C_WDG_STATS_DIAGNOSTICS ?= NO +DIAG_TASKS ?= NO + +# Or just turn on all the above diagnostics. WARNING: this consumes massive amounts of memory. +ALL_DIGNOSTICS ?= NO + +# Paths +TOPDIR = . +OPSYSTEM = $(TOPDIR)/System +OPSYSTEMINC = $(OPSYSTEM)/inc +PIOSINC = $(PIOS)/inc +PIOSCOMMON = $(PIOS)/Common +PIOSBOARDS = $(PIOS)/Boards +FLIGHTLIBINC = $(FLIGHTLIB)/inc +MATHLIB = $(FLIGHTLIB)/math +MATHLIBINC = $(FLIGHTLIB)/math +STMSPDSRCDIR = $(STMSPDDIR)/src +STMSPDINCDIR = $(STMSPDDIR)/inc +OPUAVTALKINC = $(OPUAVTALK)/inc +OPUAVOBJINC = $(OPUAVOBJ)/inc +DOXYGENDIR = $(TOPDIR)/../Doc/Doxygen +OPTESTS = $(TOPDIR)/Tests + +PYMITE = $(FLIGHTLIB)/PyMite +PYMITELIB = $(PYMITE)/lib +PYMITEPLAT = $(PYMITE)/platform/openpilot +PYMITETOOLS = $(PYMITE)/tools +PYMITEVM = $(PYMITE)/vm +PYMITEINC = $(PYMITEVM) +PYMITEINC += $(PYMITEPLAT) +PYMITEINC += $(OUTDIR) + +FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib +FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans + +ifeq ($(MCU),cortex-m3) + PIOSSTM32F10X = $(PIOS)/STM32F10x + APPLIBDIR = $(PIOSSTM32F10X)/Libraries + STMLIBDIR = $(APPLIBDIR) + STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver + STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver + STMUSBSRCDIR = $(STMUSBDIR)/src + STMUSBINCDIR = $(STMUSBDIR)/inc + CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 + DOSFSDIR = $(APPLIBDIR)/dosfs + MSDDIR = $(APPLIBDIR)/msd + RTOSDIR = $(PIOSCOMMON)/Libraries/FreeRTOS + RTOSSRCDIR = $(RTOSDIR)/Source + RTOSINCDIR = $(RTOSSRCDIR)/include + RTOSPORTDIR = $(APPLIBDIR)/FreeRTOS/Source +else ifeq ($(MCU),cortex-m4) + +else + $(error Unsupported MCU: $(MCU)) +endif + +# List C source files here (C dependencies are automatically generated). +# Use file-extension c for "c-only"-files + +## PIOS Hardware +ifeq ($(MCU),cortex-m3) + ## PIOS Hardware (STM32F10x) + SRC += $(PIOSSTM32F10X)/pios_sys.c + SRC += $(PIOSSTM32F10X)/pios_led.c + SRC += $(PIOSSTM32F10X)/pios_delay.c + SRC += $(PIOSSTM32F10X)/pios_usart.c + SRC += $(PIOSSTM32F10X)/pios_irq.c + SRC += $(PIOSSTM32F10X)/pios_adc.c + SRC += $(PIOSSTM32F10X)/pios_servo.c + SRC += $(PIOSSTM32F10X)/pios_i2c.c + SRC += $(PIOSSTM32F10X)/pios_spi.c + SRC += $(PIOSSTM32F10X)/pios_ppm.c + SRC += $(PIOSSTM32F10X)/pios_pwm.c + SRC += $(PIOSSTM32F10X)/pios_dsm.c + SRC += $(PIOSSTM32F10X)/pios_debug.c + SRC += $(PIOSSTM32F10X)/pios_gpio.c + SRC += $(PIOSSTM32F10X)/pios_exti.c + SRC += $(PIOSSTM32F10X)/pios_rtc.c + SRC += $(PIOSSTM32F10X)/pios_wdg.c + SRC += $(PIOSSTM32F10X)/pios_iap.c + SRC += $(PIOSSTM32F10X)/pios_tim.c + SRC += $(PIOSSTM32F10X)/pios_bl_helper.c + + # PIOS USB related files + SRC += $(OPSYSTEM)/pios_usb_board_data.c + SRC += $(PIOSSTM32F10X)/pios_usb.c + SRC += $(PIOSSTM32F10X)/pios_usbhook.c + SRC += $(PIOSSTM32F10X)/pios_usb_hid.c + SRC += $(PIOSSTM32F10X)/pios_usb_rctx.c + SRC += $(PIOSSTM32F10X)/pios_usb_cdc.c + SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c + SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c + SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c + SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c + SRC += $(PIOSCOMMON)/pios_usb_util.c + + ## PIOS Hardware (Common) + SRC += $(PIOSCOMMON)/pios_crc.c + SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c + SRC += $(PIOSCOMMON)/pios_flash_jedec.c + SRC += $(PIOSCOMMON)/pios_adxl345.c + SRC += $(PIOSCOMMON)/pios_mpu6000.c + SRC += $(PIOSCOMMON)/pios_com.c + SRC += $(PIOSCOMMON)/pios_sbus.c + SRC += $(PIOSCOMMON)/pios_rcvr.c + SRC += $(PIOSCOMMON)/pios_gcsrcvr.c + SRC += $(PIOSCOMMON)/printf-stdarg.c +# SRC += $(PIOSCOMMON)/pios_i2c_esc.c +# SRC += $(PIOSCOMMON)/pios_bmp085.c + + ## Libraries for flight calculations + SRC += $(FLIGHTLIB)/fifo_buffer.c + SRC += $(FLIGHTLIB)/CoordinateConversions.c + SRC += $(FLIGHTLIB)/taskmonitor.c + SRC += $(FLIGHTLIB)/sanitycheck.c + SRC += $(MATHLIB)/sin_lookup.c + SRC += $(MATHLIB)/pid.c + + ## CMSIS for STM32 + SRC += $(CMSISDIR)/core_cm3.c + SRC += $(CMSISDIR)/system_stm32f10x.c + + ## Used parts of the STM-Library + SRC += $(STMSPDSRCDIR)/stm32f10x_adc.c + SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c + SRC += $(STMSPDSRCDIR)/stm32f10x_crc.c + SRC += $(STMSPDSRCDIR)/stm32f10x_dac.c + SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c + SRC += $(STMSPDSRCDIR)/stm32f10x_exti.c + SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c + SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c + SRC += $(STMSPDSRCDIR)/stm32f10x_i2c.c + SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c + SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c + SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c + SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c + SRC += $(STMSPDSRCDIR)/stm32f10x_tim.c + SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c + SRC += $(STMSPDSRCDIR)/stm32f10x_iwdg.c + SRC += $(STMSPDSRCDIR)/stm32f10x_dbgmcu.c + SRC += $(STMSPDSRCDIR)/misc.c + + ## STM32 USB Library + SRC += $(STMUSBSRCDIR)/usb_core.c + SRC += $(STMUSBSRCDIR)/usb_init.c + SRC += $(STMUSBSRCDIR)/usb_int.c + SRC += $(STMUSBSRCDIR)/usb_mem.c + SRC += $(STMUSBSRCDIR)/usb_regs.c + SRC += $(STMUSBSRCDIR)/usb_sil.c + + ## RTOS + SRC += $(RTOSSRCDIR)/list.c + SRC += $(RTOSSRCDIR)/queue.c + SRC += $(RTOSSRCDIR)/tasks.c + + ## RTOS Portable + SRC += $(RTOSPORTDIR)/portable/GCC/ARM_CM3/port.c + SRC += $(RTOSPORTDIR)/portable/MemMang/heap_1.c +else ifeq ($(MCU),cortex-m4) + ## PIOS Hardware (STM32F4xx) + include $(PIOS)/STM32F4xx/library.mk +endif + +# List C source files here which must be compiled in ARM-Mode (no -mthumb). +# Use file-extension c for "c-only"-files +SRCARM = + +# List C++ source files here. +# Use file-extension .cpp for C++-files (not .C) +CPPSRC = + +# List C++ source files here which must be compiled in ARM-Mode. +# Use file-extension .cpp for C++-files (not .C) +CPPSRCARM = + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ifeq ($(MCU),cortex-m3) + ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S +else + ASRC = +endif + +# List Assembler source files here which must be assembled in ARM-Mode. +ASRCARM = + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS += $(PIOS) +EXTRAINCDIRS += $(PIOSINC) +EXTRAINCDIRS += $(FLIGHTLIBINC) +EXTRAINCDIRS += $(PIOSCOMMON) +EXTRAINCDIRS += $(PIOSBOARDS) +EXTRAINCDIRS += $(STMSPDINCDIR) +EXTRAINCDIRS += $(CMSISDIR) +EXTRAINCDIRS += $(HWDEFSINC) +EXTRAINCDIRS += $(OPSYSTEMINC) +EXTRAINCDIRS += $(OPUAVSYNTHDIR) +EXTRAINCDIRS += $(MATHLIBINC) +EXTRAINCDIRS += $(PYMITEINC) + +ifeq ($(MCU),cortex-m3) + EXTRAINCDIRS += $(PIOSSTM32F10X) + EXTRAINCDIRS += $(OPUAVTALK) + EXTRAINCDIRS += $(OPUAVTALKINC) + EXTRAINCDIRS += $(OPUAVOBJ) + EXTRAINCDIRS += $(OPUAVOBJINC) + EXTRAINCDIRS += $(DOSFSDIR) + EXTRAINCDIRS += $(MSDDIR) + EXTRAINCDIRS += $(RTOSINCDIR) + EXTRAINCDIRS += $(STMUSBINCDIR) + EXTRAINCDIRS += $(APPLIBDIR) + EXTRAINCDIRS += $(RTOSPORTDIR)/portable/GCC/ARM_CM3 +else ifeq ($(MCU),cortex-m4) + EXTRAINCDIRS += $(PIOSSTM34FXX) +endif + +# Modules +EXTRAINCDIRS += $(foreach mod, $(OPTMODULES) $(MODULES), $(OPMODULEDIR)/$(mod)/inc) $(OPMODULEDIR)/System/inc + +# List any extra directories to look for library files here. +# Also add directories where the linker should search for +# includes from linker-script to the list +# Each directory must be seperated by a space. +EXTRA_LIBDIRS = + +# Extra Libraries +# Each library-name must be seperated by a space. +# i.e. to link with libxyz.a, libabc.a and libefsl.a: +# EXTRA_LIBS = xyz abc efsl +# for newlib-lpc (file: libnewlibc-lpc.a): +# EXTRA_LIBS = newlib-lpc +EXTRA_LIBS = + +# Path to linker scripts +ifeq ($(MCU),cortex-m3) + LINKERSCRIPTPATH = $(PIOSSTM32F10X) +else ifeq ($(MCU),cortex-m4) + LINKERSCRIPTPATH = $(PIOSSTM32FXX) +endif + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# Note: 3 is not always the best optimization level. +ifeq ($(DEBUG), YES) + OPT = 1 +else + OPT = s +endif + +# Output format (can be ihex or binary or both). +# binary to create a load-image in raw-binary format i.e. for SAM-BA, +# ihex to create a load-image in Intel hex format +#LOADFORMAT = ihex +#LOADFORMAT = binary +LOADFORMAT = both + +# Debugging format. +DEBUGF = dwarf-2 + +# Place project-specific -D (define) and/or -U options for C here. +ifeq ($(MCU),cortex-m3) + CDEFS = -DSTM32F10X_$(MODEL) +else ifeq ($(MCU),cortex-m4) + CDEFS += -DSTM32F4XX + CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) + CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) +endif + +CDEFS += -DUSE_$(BOARD) +CDEFS += -DUSE_STDPERIPH_DRIVER + +ifeq ($(ENABLE_DEBUG_PINS), YES) + CDEFS += -DPIOS_ENABLE_DEBUG_PINS +endif + +# Declare all non-optional modules as built-in to force inclusion +CDEFS += $(foreach mod, $(MODULES), -DMODULE_$(mod)_BUILTIN) + +# Place project-specific -D and/or -U options for Assembler with preprocessor here. +#ADEFS = -DUSE_IRQ_ASM_WRAPPER +ADEFS = -D__ASSEMBLY__ + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Compiler flags. +# +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing + +# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) +ifeq ($(MCU),cortex-m4) + # This is not the best place for these. Really should abstract out + # to the board file or something + CFLAGS += -DSTM32F4XX + CFLAGS += -DMEM_SIZE=1024000000 +endif + +# The following Makefile command, ifneq (,$(filter) $(A), $(B) $(C)) +# is equivalent to the pseudocode `if (A == B || A == C)` +ifneq (,$(filter YES,$(STACK_DIAGNOSTICS) $(ALL_DIGNOSTICS))) + CFLAGS += -DSTACK_DIAGNOSTICS +endif + +ifneq (,$(filter YES,$(MIXERSTATUS_DIAGNOSTICS) $(ALL_DIGNOSTICS))) + CFLAGS += -DMIXERSTATUS_DIAGNOSTICS +endif + +ifneq (,$(filter YES,$(RATEDESIRED_DIAGNOSTICS) $(ALL_DIGNOSTICS))) + CFLAGS += -DRATEDESIRED_DIAGNOSTICS +endif + +ifneq (,$(filter YES,$(I2C_WDG_STATS_DIAGNOSTICS) $(ALL_DIGNOSTICS))) + CFLAGS += -DI2C_WDG_STATS_DIAGNOSTICS +endif + +ifneq (,$(filter YES,$(DIAG_TASKS) $(ALL_DIGNOSTICS))) + CFLAGS += -DDIAG_TASKS +endif + +CFLAGS += -mcpu=$(MCU) +CFLAGS += $(CDEFS) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. +CFLAGS += -mapcs-frame +CFLAGS += -fomit-frame-pointer +CFLAGS += -O$(OPT) +CFLAGS += -g$(DEBUGF) + +ifeq ($(DEBUG), YES) + CFLAGS += -DDEBUG +else + CFLAGS += -fdata-sections -ffunction-sections +endif + +CFLAGS += -Wall +# FIXME: STM32F4xx library raises strict aliasing and const qualifier warnings +ifneq ($(MCU),cortex-m4) + CFLAGS += -Werror +endif +CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) + +# Compiler flags to generate dependency files +CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d + +# Flags only for C +#CONLYFLAGS += -Wnested-externs +CONLYFLAGS += $(CSTANDARD) + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlns: create listing +ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp +ASFLAGS += $(ADEFS) +ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) +ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) + +MATH_LIB = -lm + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS += -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections +LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) +LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) +LDFLAGS += -lc -lgcc $(MATH_LIB) + +ifneq ($(DEBUG), YES) + LDFLAGS += -Wl,-static +endif + +# Set linker-script name depending on selected submodel name +ifeq ($(MCU),cortex-m3) + LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld + LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld +else ifeq ($(MCU),cortex-m4) + LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP)) +endif + +# List of all source files. +ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) +# List of all source files without directory and file-extension. +ALLSRCBASE = $(notdir $(basename $(ALLSRC))) + +# Define all object files. +ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) + +# Define all listing files (used for make clean). +LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) +# Define all depedency-files (used for make clean). +DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) + +# Default target. +all: build + +ifeq ($(LOADFORMAT),ihex) +build: elf hex sym +else ifeq ($(LOADFORMAT),binary) +build: elf bin sym +else ifeq ($(LOADFORMAT),both) +build: elf hex bin sym +else + $(error "$(MSG_FORMATERROR) $(FORMAT)") +endif + +# Generate code for PyMite +# $(OUTDIR)/pmlib_img.c $(OUTDIR)/pmlib_nat.c $(OUTDIR)/pmlibusr_img.c $(OUTDIR)/pmlibusr_nat.c $(OUTDIR)/pmfeatures.h: $(wildcard $(PYMITELIB)/*.py) $(wildcard $(PYMITEPLAT)/*.py) $(wildcard $(FLIGHTPLANLIB)/*.py) $(wildcard $(FLIGHTPLANS)/*.py) +# @echo $(MSG_PYMITEINIT) $(call toprel, $@) +# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py) +# @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h +# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py + +# Link: create ELF output file from object files. +$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) + +# Assemble: create object files from assembler source files. +$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) + +# Assemble: create object files from assembler source files. ARM-only +$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) + +# Compile: create object files from C source files. +$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) + +# Compile: create object files from C source files. ARM-only +$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) + +# Compile: create object files from C++ source files. +$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) + +# Compile: create object files from C++ source files. ARM-only +$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) + +# Compile: create assembler files from C source files. ARM/Thumb +$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) + +# Compile: create assembler files from C source files. ARM only +$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) + +$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin + +# Add opfw target +$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) + +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) + +.PHONY: elf lss sym hex bin bino opfw +elf: $(OUTDIR)/$(TARGET).elf +lss: $(OUTDIR)/$(TARGET).lss +sym: $(OUTDIR)/$(TARGET).sym +hex: $(OUTDIR)/$(TARGET).hex +bin: $(OUTDIR)/$(TARGET).bin +bino: $(OUTDIR)/$(TARGET).bin.o +opfw: $(OUTDIR)/$(TARGET).opfw + +# Display sizes of sections. +$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) + +# Generate Doxygen documents +docs: + doxygen $(DOXYGENDIR)/doxygen.cfg + +# Install: install binary file with prefix/suffix into install directory +install: $(OUTDIR)/$(TARGET).opfw +ifneq ($(INSTALL_DIR),) + @$(ECHO) $(MSG_INSTALLING) $(call toprel, $<) + $(V1) $(MKDIR) -p $(INSTALL_DIR) + $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw +else + $(error INSTALL_DIR must be specified for $@) +endif + +# Target: clean project. +clean: clean_list + +clean_list : + @echo $(MSG_CLEANING) + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).map + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).elf + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).hex + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).sym + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).lss + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin.o + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).opfw + $(V1) $(RM) -f $(wildcard $(OUTDIR)/*.c) + $(V1) $(RM) -f $(wildcard $(OUTDIR)/*.h) + $(V1) $(RM) -f $(ALLOBJ) + $(V1) $(RM) -f $(LSTFILES) + $(V1) $(RM) -f $(DEPFILES) + $(V1) $(RM) -f $(SRC:.c=.s) + $(V1) $(RM) -f $(SRCARM:.c=.s) + $(V1) $(RM) -f $(CPPSRC:.cpp=.s) + $(V1) $(RM) -f $(CPPSRCARM:.cpp=.s) + +# Create output files directory +# all known MS Windows OS define the ComSpec environment variable +$(shell $(MKDIR) -p $(OUTDIR) 2>/dev/null) + +# Include the dependency files. +-include $(shell $(MKDIR) -p $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) + +# Listing of phony targets. +.PHONY : all build clean clean_list install diff --git a/make/boot-defs.mk b/make/boot-defs.mk index b5dd43510..92117317e 100644 --- a/make/boot-defs.mk +++ b/make/boot-defs.mk @@ -372,7 +372,7 @@ else endif # Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) +$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) # Assemble: create object files from assembler source files. $(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) From a1e17eccf3cb1cfc8de11229696775c1f0f69c7e Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 11:39:01 +0200 Subject: [PATCH 15/68] pios: fix packet handler #ifdef guards and Makefile Conflicts: flight/Libraries/packet_handler.c flight/targets/CopterControl/System/inc/pios_config.h --- .../CopterControl/System/inc/pios_config.h | 248 +++++++++--------- make/apps-defs.mk | 1 + 2 files changed, 132 insertions(+), 117 deletions(-) diff --git a/flight/targets/CopterControl/System/inc/pios_config.h b/flight/targets/CopterControl/System/inc/pios_config.h index 09423ea45..2cfac0fbc 100644 --- a/flight/targets/CopterControl/System/inc/pios_config.h +++ b/flight/targets/CopterControl/System/inc/pios_config.h @@ -1,117 +1,131 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotCore OpenPilot Core - * @{ - * - * @file pios_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief PiOS configuration header. - * Central compile time config for the project. - * In particular, pios_config.h is where you define which PiOS libraries - * and features are included in the firmware. - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PIOS_CONFIG_H -#define PIOS_CONFIG_H - -/* Enable/Disable PiOS Modules */ -#define PIOS_INCLUDE_ADC -#define PIOS_INCLUDE_DELAY -//#if defined(USE_I2C) -//#define PIOS_INCLUDE_I2C -//#define PIOS_INCLUDE_I2C_ESC -//#endif -#define PIOS_INCLUDE_IRQ -#define PIOS_INCLUDE_LED -#define PIOS_INCLUDE_IAP -#define PIOS_INCLUDE_TIM - -#define PIOS_INCLUDE_RCVR - -/* Supported receiver interfaces */ -#define PIOS_INCLUDE_DSM -#define PIOS_INCLUDE_SBUS -#define PIOS_INCLUDE_PPM -#define PIOS_INCLUDE_PPM_FLEXI -#define PIOS_INCLUDE_PWM -#define PIOS_INCLUDE_GCSRCVR - -/* Supported USART-based PIOS modules */ -#define PIOS_INCLUDE_TELEMETRY_RF -#define PIOS_INCLUDE_GPS -#define PIOS_GPS_MINIMAL -#define PIOS_INCLUDE_GPS_NMEA_PARSER /* Include the NMEA protocol parser */ -#define PIOS_INCLUDE_GPS_UBX_PARSER /* Include the UBX protocol parser */ -#define PIOS_INCLUDE_SERVO -#define PIOS_INCLUDE_SPI -#define PIOS_INCLUDE_SYS -#define PIOS_INCLUDE_USART -#define PIOS_INCLUDE_USB -#define PIOS_INCLUDE_USB_HID -#define PIOS_INCLUDE_USB_RCTX -#define PIOS_INCLUDE_USB_CDC -#define PIOS_INCLUDE_COM -#define PIOS_INCLUDE_SETTINGS -#define PIOS_INCLUDE_FREERTOS -#define PIOS_INCLUDE_GPIO -#define PIOS_INCLUDE_EXTI -#define PIOS_INCLUDE_RTC -#define PIOS_INCLUDE_WDG -#define PIOS_INCLUDE_BL_HELPER - -#define PIOS_INCLUDE_ADXL345 -#define PIOS_INCLUDE_FLASH -#define PIOS_INCLUDE_MPU6000 -#define PIOS_MPU6000_ACCEL - -/* A really shitty setting saving implementation */ -#define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS - -/* Alarm Thresholds */ -#define HEAP_LIMIT_WARNING 220 -#define HEAP_LIMIT_CRITICAL 40 -#define IRQSTACK_LIMIT_WARNING 100 -#define IRQSTACK_LIMIT_CRITICAL 60 -#define CPULOAD_LIMIT_WARNING 85 -#define CPULOAD_LIMIT_CRITICAL 95 - -/* Task stack sizes */ -#define PIOS_ACTUATOR_STACK_SIZE 1020 -#define PIOS_MANUAL_STACK_SIZE 800 -#define PIOS_SYSTEM_STACK_SIZE 660 -#define PIOS_STABILIZATION_STACK_SIZE 524 -#define PIOS_TELEM_STACK_SIZE 500 -#define PIOS_EVENTDISPATCHER_STACK_SIZE 130 -#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 -//#define PIOS_QUATERNION_STABILIZATION - -// This can't be too high to stop eventdispatcher thread overflowing -#define PIOS_EVENTDISAPTCHER_QUEUE 10 - -/* PIOS Initcall infrastructure */ -#define PIOS_INCLUDE_INITCALL - -#endif /* PIOS_CONFIG_H */ -/** - * @} - * @} - */ +/** + ****************************************************************************** + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotCore OpenPilot Core + * @{ + * @file pios_config.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2013. + * @brief PiOS configuration header, the compile time config file for the PIOS. + * Defines which PiOS libraries and features are included in the firmware. + * @see The GNU Public License (GPL) Version 3 + *****************************************************************************/ +/* + * 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PIOS_CONFIG_H +#define PIOS_CONFIG_H + +/* + * Below is a complete list of PIOS configurable options. + * Please do not remove or rearrange them. Only comment out + * unused options in the list. See main pios.h header for more + * details. + */ + +#define PIOS_INCLUDE_FREERTOS +#define PIOS_INCLUDE_DELAY +#define PIOS_INCLUDE_INITCALL +#define PIOS_INCLUDE_SYS + +#define PIOS_INCLUDE_IRQ +#define PIOS_INCLUDE_RTC +#define PIOS_INCLUDE_TIM +#define PIOS_INCLUDE_USART +#define PIOS_INCLUDE_ADC +/* #define PIOS_INCLUDE_I2C */ +#define PIOS_INCLUDE_SPI +#define PIOS_INCLUDE_GPIO +#define PIOS_INCLUDE_EXTI +#define PIOS_INCLUDE_WDG +#define PIOS_INCLUDE_USB +#define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_USB_CDC +#define PIOS_INCLUDE_USB_RCTX + +#define PIOS_INCLUDE_ADXL345 +/* #define PIOS_INCLUDE_BMA180 */ +/* #define PIOS_INCLUDE_L3GD20 */ +#define PIOS_INCLUDE_MPU6000 +#define PIOS_MPU6000_ACCEL +/* #define PIOS_INCLUDE_HMC5843 */ +/* #define PIOS_INCLUDE_HMC5883 */ +/* #define PIOS_INCLUDE_BMP085 */ +/* #define PIOS_INCLUDE_MS5611 */ +/* #define PIOS_INCLUDE_MPXV */ +/* #define PIOS_INCLUDE_ETASV3 */ +/* #define PIOS_INCLUDE_HCSR04 */ + +#define PIOS_INCLUDE_PWM +#define PIOS_INCLUDE_PPM +#define PIOS_INCLUDE_DSM +#define PIOS_INCLUDE_SBUS +#define PIOS_INCLUDE_GCSRCVR + +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP +#define PIOS_INCLUDE_SERVO +/* #define PIOS_INCLUDE_I2C_ESC */ +/* #define PIOS_INCLUDE_OVERO */ +/* #define PIOS_INCLUDE_SDCARD */ +#define PIOS_INCLUDE_FLASH +#define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS +/* #define PIOS_INCLUDE_FLASH_EEPROM */ +/* #define PIOS_INCLUDE_RFM22B */ +/* #define PIOS_INCLUDE_PACKET_HANDLER */ +/* #define PIOS_INCLUDE_VIDEO */ +/* #define PIOS_INCLUDE_WAVE */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +/* #define PIOS_INCLUDE_UDP */ + +#define PIOS_INCLUDE_RCVR +#define PIOS_INCLUDE_COM +/* #define PIOS_INCLUDE_COM_MSG */ +#define PIOS_INCLUDE_TELEMETRY_RF +#define PIOS_INCLUDE_GPS +#define PIOS_GPS_MINIMAL +#define PIOS_INCLUDE_GPS_NMEA_PARSER +#define PIOS_INCLUDE_GPS_UBX_PARSER + +/* Alarm Thresholds */ +#define HEAP_LIMIT_WARNING 220 +#define HEAP_LIMIT_CRITICAL 40 +#define IRQSTACK_LIMIT_WARNING 100 +#define IRQSTACK_LIMIT_CRITICAL 60 +#define CPULOAD_LIMIT_WARNING 85 +#define CPULOAD_LIMIT_CRITICAL 95 + +/* Task stack sizes */ +#define PIOS_ACTUATOR_STACK_SIZE 1020 +#define PIOS_MANUAL_STACK_SIZE 800 +#define PIOS_SYSTEM_STACK_SIZE 660 +#define PIOS_STABILIZATION_STACK_SIZE 524 +#define PIOS_TELEM_STACK_SIZE 500 +#define PIOS_EVENTDISPATCHER_STACK_SIZE 130 +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 + +/* Stabilization options */ +/* #define PIOS_QUATERNION_STABILIZATION */ + +/* This can't be too high to stop eventdispatcher thread overflowing */ +#define PIOS_EVENTDISAPTCHER_QUEUE 10 + +#endif /* PIOS_CONFIG_H */ +/** + * @} + * @} + */ diff --git a/make/apps-defs.mk b/make/apps-defs.mk index 07bef1bf1..3ec1ff840 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -144,6 +144,7 @@ ifeq ($(MCU),cortex-m3) ## Libraries for flight calculations SRC += $(FLIGHTLIB)/fifo_buffer.c SRC += $(FLIGHTLIB)/CoordinateConversions.c + SRC += $(FLIGHTLIB)/packet_handler.c SRC += $(FLIGHTLIB)/taskmonitor.c SRC += $(FLIGHTLIB)/sanitycheck.c SRC += $(MATHLIB)/sin_lookup.c From 8b4a547d690041d6998bd723e8352f67ca5d2c4d Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 11:45:20 +0200 Subject: [PATCH 16/68] rscode: add a library make config file, library.mk --- flight/Libraries/rscode/library.mk | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 flight/Libraries/rscode/library.mk diff --git a/flight/Libraries/rscode/library.mk b/flight/Libraries/rscode/library.mk new file mode 100644 index 000000000..99f227d5c --- /dev/null +++ b/flight/Libraries/rscode/library.mk @@ -0,0 +1,9 @@ +# +# Rules to add RSCODE to a PiOS target +# + +RSCODE_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +RSCODE_SRC := berlekamp.c crcgen.c galois.c rs.c + +SRC += $(addprefix $(RSCODE_DIR)/,$(RSCODE_SRC)) +EXTRAINCDIRS += $(RSCODE_DIR) From 7e4596ff35335f2482a98dfaed32fbb6f41ce19c Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 11:42:12 +0200 Subject: [PATCH 17/68] Makefile: fix some MODULE_Name_BUILTIN checks and Makefile These names are automatically generated by make using the list of mandatory (always started) modules. Wrong names mean they can be disabled, fixed now. Conflicts: flight/Modules/Radio/radio.c --- flight/Modules/Airspeed/revolution/airspeed.c | 2 +- flight/Modules/Autotune/autotune.c | 2 +- flight/Modules/Battery/battery.c | 2 +- flight/Modules/OveroSync/overosync.c | 2 +- make/apps-defs.mk | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flight/Modules/Airspeed/revolution/airspeed.c b/flight/Modules/Airspeed/revolution/airspeed.c index fd1479d0f..ab817232a 100644 --- a/flight/Modules/Airspeed/revolution/airspeed.c +++ b/flight/Modules/Airspeed/revolution/airspeed.c @@ -89,7 +89,7 @@ int32_t AirspeedStart() */ int32_t AirspeedInitialize() { -#ifdef MODULE_AIRSPEED_BUILTIN +#ifdef MODULE_Airspeed_BUILTIN airspeedEnabled = true; #else diff --git a/flight/Modules/Autotune/autotune.c b/flight/Modules/Autotune/autotune.c index 260f70750..366ac190f 100644 --- a/flight/Modules/Autotune/autotune.c +++ b/flight/Modules/Autotune/autotune.c @@ -82,7 +82,7 @@ static void update_stabilization_settings(); int32_t AutotuneInitialize(void) { // Create a queue, connect to manual control command and flightstatus -#ifdef MODULE_AUTOTUNE_BUILTIN +#ifdef MODULE_Autotune_BUILTIN autotuneEnabled = true; #else HwSettingsInitialize(); diff --git a/flight/Modules/Battery/battery.c b/flight/Modules/Battery/battery.c index ac9dcace3..83c0002cd 100644 --- a/flight/Modules/Battery/battery.c +++ b/flight/Modules/Battery/battery.c @@ -78,7 +78,7 @@ int32_t BatteryInitialize(void) { -#ifdef MODULE_BATTERY_BUILTIN +#ifdef MODULE_Battery_BUILTIN batteryEnabled = true; #else uint8_t optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM]; diff --git a/flight/Modules/OveroSync/overosync.c b/flight/Modules/OveroSync/overosync.c index 1fb4d1920..eaa2cb6fb 100644 --- a/flight/Modules/OveroSync/overosync.c +++ b/flight/Modules/OveroSync/overosync.c @@ -75,7 +75,7 @@ struct overosync *overosync; int32_t OveroSyncInitialize(void) { -#ifdef MODULE_OVERO_BUILTIN +#ifdef MODULE_OveroSync_BUILTIN overoEnabled = true; #else diff --git a/make/apps-defs.mk b/make/apps-defs.mk index 3ec1ff840..218694cb6 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -314,7 +314,7 @@ ifeq ($(ENABLE_DEBUG_PINS), YES) endif # Declare all non-optional modules as built-in to force inclusion -CDEFS += $(foreach mod, $(MODULES), -DMODULE_$(mod)_BUILTIN) +CDEFS += $(foreach mod, $(notdir $(MODULES)), -DMODULE_$(mod)_BUILTIN) # Place project-specific -D and/or -U options for Assembler with preprocessor here. #ADEFS = -DUSE_IRQ_ASM_WRAPPER From 30128517b5397dd9f5ea3a1309c5375b4b908b4b Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 11:44:22 +0200 Subject: [PATCH 18/68] Makefile: remove unused USE_I2C option from makefiles --- flight/targets/CopterControl/Makefile | 9 +-------- flight/targets/OSD/Makefile | 9 --------- flight/targets/Revolution/Makefile | 5 ----- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/flight/targets/CopterControl/Makefile b/flight/targets/CopterControl/Makefile index a36b60190..1defe2ace 100644 --- a/flight/targets/CopterControl/Makefile +++ b/flight/targets/CopterControl/Makefile @@ -32,7 +32,6 @@ USE_CAMERASTAB ?= YES USE_COMUSBBRIDGE ?= YES USE_GPS ?= YES USE_TXPID ?= YES -USE_I2C ?= NO USE_ALTITUDE ?= NO USE_AUTOTUNE ?= NO TEST_FAULTS ?= NO @@ -61,18 +60,12 @@ ifeq ($(USE_COMUSBBRIDGE), YES) endif ifeq ($(USE_GPS), YES) OPTMODULES += GPS - CDEFS += -DUSE_GPS endif ifeq ($(USE_TXPID), YES) OPTMODULES += TxPID endif ifeq ($(USE_ALTITUDE), YES) - ifeq ($(USE_I2C), YES) - OPTMODULES += Altitude - CDEFS += -DUSE_I2C - else - $(error Altitude module (USE_ALTITUDE=YES) requires i2c (USE_I2C=YES)) - endif + OPTMODULES += Altitude endif ifeq ($(USE_AUTOTUNE), YES) OPTMODULES += Autotune diff --git a/flight/targets/OSD/Makefile b/flight/targets/OSD/Makefile index fd3d4f189..926276984 100644 --- a/flight/targets/OSD/Makefile +++ b/flight/targets/OSD/Makefile @@ -47,7 +47,6 @@ USE_CAMERASTAB ?= NO USE_COMUSBBRIDGE ?= NO USE_GPS ?= NO USE_TXPID ?= NO -USE_I2C ?= NO USE_ALTITUDE ?= NO TEST_FAULTS ?= NO USE_MAGBARO ?= NO @@ -67,21 +66,13 @@ ifeq ($(USE_TXPID), YES) OPTMODULES += TxPID endif ifeq ($(USE_ALTITUDE), YES) -ifeq ($(USE_I2C), YES) OPTMODULES += Altitude -else -$(error "Altitude module (USE_ALTITUDE=YES) requires i2c (USE_I2C=YES)") -endif endif ifeq ($(TEST_FAULTS), YES) OPTMODULES += Fault endif ifeq ($(USE_MAGBARO), YES) -ifeq ($(USE_I2C), YES) OPTMODULES += Extensions/MagBaro -else -$(error "MagBaro module (USE_MAGBARO=YES) requires i2c (USE_I2C=YES)") -endif endif # List of mandatory modules to include diff --git a/flight/targets/Revolution/Makefile b/flight/targets/Revolution/Makefile index 5e85dc504..2d120a6c7 100644 --- a/flight/targets/Revolution/Makefile +++ b/flight/targets/Revolution/Makefile @@ -45,7 +45,6 @@ FLASH_TOOL = OPENOCD # Optional module and driver defaults USE_COMUSBBRIDGE ?= NO USE_TXPID ?= NO -USE_I2C ?= NO USE_ALTITUDE ?= NO TEST_FAULTS ?= NO USE_MAGBARO ?= NO @@ -62,11 +61,7 @@ ifeq ($(TEST_FAULTS), YES) OPTMODULES += Fault endif ifeq ($(USE_MAGBARO), YES) -ifeq ($(USE_I2C), YES) OPTMODULES += Extensions/MagBaro -else -$(error "MagBaro module (USE_MAGBARO=YES) requires i2c (USE_I2C=YES)") -endif endif # List of modules to include From 27822d0cd4115f077bf636e9fb07170bc0ee2ddd Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 11:48:03 +0200 Subject: [PATCH 19/68] Makefile and pios_config.h cleanup for PipXtreme Now PipXtreme uses the same apps-defs.mk file as CopterControl. Next steps are F4 boards. Conflicts: flight/targets/PipXtreme/Makefile flight/targets/PipXtreme/System/inc/pios_config.h --- flight/PiOS/Common/pios_rfm22b_com.c | 5 +- flight/PiOS/Common/pios_rfm22b_rcvr.c | 5 +- flight/PiOS/STM32F10x/pios_ppm_out.c | 8 +- flight/targets/PipXtreme/Makefile | 614 ++---------------- .../PipXtreme/System/inc/pios_config.h | 245 +++---- make/apps-defs.mk | 10 +- 6 files changed, 199 insertions(+), 688 deletions(-) diff --git a/flight/PiOS/Common/pios_rfm22b_com.c b/flight/PiOS/Common/pios_rfm22b_com.c index e8fb4a6db..868671653 100644 --- a/flight/PiOS/Common/pios_rfm22b_com.c +++ b/flight/PiOS/Common/pios_rfm22b_com.c @@ -28,9 +28,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include +#ifdef PIOS_INCLUDE_RFM22B_COM + #include /* Provide a COM driver */ @@ -128,3 +129,5 @@ static bool PIOS_RFM22B_COM_Available(uint32_t rfm22b_id) { return PIOS_RFM22B_LinkStatus(rfm22b_id); } + +#endif /* PIOS_INCLUDE_RFM22B_COM */ diff --git a/flight/PiOS/Common/pios_rfm22b_rcvr.c b/flight/PiOS/Common/pios_rfm22b_rcvr.c index 0878da0f1..889615cb4 100644 --- a/flight/PiOS/Common/pios_rfm22b_rcvr.c +++ b/flight/PiOS/Common/pios_rfm22b_rcvr.c @@ -28,10 +28,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#if defined(PIOS_INCLUDE_RFM22B_RCVR) +#ifdef PIOS_INCLUDE_RFM22B_RCVR #include "pios_rfm22b_priv.h" @@ -91,7 +90,7 @@ static void PIOS_RFM22B_RCVR_Supervisor(uint32_t rcvr_id) { rfm22b_dev->ppm_fresh = false; } -#endif /* PIOS_INCLUDE_GCSRCVR */ +#endif /* PIOS_INCLUDE_RFM22B_RCVR */ /** * @} diff --git a/flight/PiOS/STM32F10x/pios_ppm_out.c b/flight/PiOS/STM32F10x/pios_ppm_out.c index 3b6834e4d..6dd8c7915 100644 --- a/flight/PiOS/STM32F10x/pios_ppm_out.c +++ b/flight/PiOS/STM32F10x/pios_ppm_out.c @@ -28,11 +28,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Project Includes */ #include "pios.h" -#include "pios_ppm_out_priv.h" -#if defined(PIOS_INCLUDE_PPM_OUT) +#ifdef PIOS_INCLUDE_PPM_OUT + +#include "pios_ppm_out_priv.h" #define PIOS_PPM_OUT_MAX_DEVS 1 #define PIOS_PPM_OUT_MAX_CHANNELS 8 @@ -228,4 +228,4 @@ static void PIOS_PPM_OUT_tim_edge_cb (uint32_t tim_id, uint32_t context, uint8_t return; } -#endif // PIOS_PPM_OUT +#endif /* PIOS_INCLUDE_PPM_OUT */ diff --git a/flight/targets/PipXtreme/Makefile b/flight/targets/PipXtreme/Makefile index 3c9988b04..5f8f3135f 100644 --- a/flight/targets/PipXtreme/Makefile +++ b/flight/targets/PipXtreme/Makefile @@ -1,581 +1,63 @@ - ##### - # Project: OpenPilot - # - # - # Makefile for OpenPilot project build PiOS and the AP. - # - # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. - # - # - # 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, write to the Free Software Foundation, Inc., - # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - ##### +# +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES to compile for debugging -DEBUG ?= NO - -# Include objects that are just nice information to show -STACK_DIAGNOSTICS ?= NO -MIXERSTATUS_DIAGNOSTICS ?= NO -RATEDESIRED_DIAGNOSTICS ?= NO -I2C_WDG_STATS_DIAGNOSTICS ?= NO -DIAG_TASKS ?= NO - -#Or just turn on all the above diagnostics. WARNING: This consumes massive amounts of memory. -ALL_DIGNOSTICS ?=NO - -# Set to YES to build a FW version that will erase all flash memory -ERASE_FLASH ?= NO -# Set to YES to use the Servo output pins for debugging via scope or logic analyser -ENABLE_DEBUG_PINS ?= NO - -# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs -ENABLE_AUX_UART ?= NO - -USE_GPS ?= NO - -USE_I2C ?= YES - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -# Remove command is different for Code Sourcery on Windows -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -FLASH_TOOL = OPENOCD +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk -# List of modules to include -OPTMODULES = +# List of mandatory modules to include MODULES = RadioComBridge -# Paths -OPSYSTEM = ./System -OPSYSTEMINC = $(OPSYSTEM)/inc -OPUAVTALKINC = $(OPUAVTALK)/inc -OPUAVOBJINC = $(OPUAVOBJ)/inc -OPTESTS = ./Tests -FLIGHTLIBINC = $(FLIGHTLIB)/inc -RSCODEINC = $(FLIGHTLIB)/rscode -PIOSINC = $(PIOS)/inc -PIOSSTM32F10X = $(PIOS)/STM32F10x -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -APPLIBDIR = $(PIOSSTM32F10X)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver -STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc -STMUSBSRCDIR = $(STMUSBDIR)/src -STMUSBINCDIR = $(STMUSBDIR)/inc -CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 -DOSFSDIR = $(APPLIBDIR)/dosfs -MSDDIR = $(APPLIBDIR)/msd -RTOSDIR = $(PIOSCOMMON)/Libraries/FreeRTOS -RTOSSRCDIR = $(RTOSDIR)/Source -RTOSINCDIR = $(RTOSSRCDIR)/include -RTOSPORTDIR = $(APPLIBDIR)/FreeRTOS/Source -PYMITE = $(FLIGHTLIB)/PyMite -PYMITELIB = $(PYMITE)/lib -PYMITEPLAT = $(PYMITE)/platform/openpilot -PYMITETOOLS = $(PYMITE)/tools -PYMITEVM = $(PYMITE)/vm -PYMITEINC = $(PYMITEVM) -PYMITEINC += $(PYMITEPLAT) -PYMITEINC += $(OUTDIR) -FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib -FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans - -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files +# List of optional modules to include +OPTMODULES = +# List C source files here (C dependencies are automatically generated). +# Use file-extension c for "c-only"-files ifndef TESTAPP -## MODULES -SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -## OPENPILOT CORE: -SRC += ${OPMODULEDIR}/PipXtreme/pipxtrememod.c -SRC += $(OPSYSTEM)/pipxtreme.c -SRC += $(OPSYSTEM)/pios_board.c -SRC += $(OPUAVTALK)/uavtalk.c -SRC += $(OPUAVOBJ)/uavobjectmanager.c -SRC += $(OPUAVOBJ)/eventdispatcher.c + ## Modules + SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} + SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} + + ## Application Core + SRC += ${OPMODULEDIR}/PipXtreme/pipxtrememod.c + SRC += $(OPSYSTEM)/pipxtreme.c + SRC += $(OPSYSTEM)/pios_board.c + SRC += $(OPUAVTALK)/uavtalk.c + SRC += $(OPUAVOBJ)/uavobjectmanager.c + SRC += $(OPUAVOBJ)/eventdispatcher.c else -## TESTCODE -SRC += $(OPTESTS)/test_common.c -SRC += $(OPTESTS)/$(TESTAPP).c + ## Test Code + SRC += $(OPTESTS)/test_common.c + SRC += $(OPTESTS)/$(TESTAPP).c endif -## UAVOBJECTS +## UAVObjects ifndef TESTAPP -SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c -SRC += $(OPUAVSYNTHDIR)/oplinkstatus.c -SRC += $(OPUAVSYNTHDIR)/oplinksettings.c -SRC += $(OPUAVSYNTHDIR)/objectpersistence.c - + SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c + SRC += $(OPUAVSYNTHDIR)/oplinkstatus.c + SRC += $(OPUAVSYNTHDIR)/oplinksettings.c + SRC += $(OPUAVSYNTHDIR)/objectpersistence.c endif -## PIOS Hardware (STM32F10x) -include $(PIOS)/STM32F10x/library.mk -SRC += $(PIOSSTM32F10X)/pios_sys.c -SRC += $(PIOSSTM32F10X)/pios_led.c -SRC += $(PIOSSTM32F10X)/pios_delay.c -SRC += $(PIOSSTM32F10X)/pios_usart.c -SRC += $(PIOSSTM32F10X)/pios_irq.c -SRC += $(PIOSSTM32F10X)/pios_spi.c -SRC += $(PIOSSTM32F10X)/pios_ppm.c -SRC += $(PIOSSTM32F10X)/pios_ppm_out.c -SRC += $(PIOSSTM32F10X)/pios_debug.c -SRC += $(PIOSSTM32F10X)/pios_gpio.c -SRC += $(PIOSSTM32F10X)/pios_exti.c -SRC += $(PIOSSTM32F10X)/pios_rtc.c -SRC += $(PIOSSTM32F10X)/pios_wdg.c -SRC += $(PIOSSTM32F10X)/pios_tim.c -SRC += $(PIOSSTM32F10X)/pios_pwm.c -SRC += $(PIOSSTM32F10X)/pios_eeprom.c -SRC += $(PIOSSTM32F10X)/pios_bl_helper.c +# Optional component libraries +include $(FLIGHTLIB)/rscode/library.mk -# PIOS USB related files (seperated to make code maintenance more easy) -SRC += $(PIOSSTM32F10X)/pios_usb.c -SRC += $(PIOSSTM32F10X)/pios_usbhook.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid.c -SRC += $(PIOSSTM32F10X)/pios_usb_cdc.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c -SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c -SRC += $(OPSYSTEM)/pios_usb_board_data.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c -SRC += $(PIOSCOMMON)/pios_usb_util.c - -## PIOS Hardware (Common) -SRC += $(PIOSCOMMON)/pios_crc.c -SRC += $(PIOSCOMMON)/pios_com.c -SRC += $(PIOSCOMMON)/pios_i2c_esc.c -SRC += $(PIOSCOMMON)/pios_rcvr.c -SRC += $(PIOSCOMMON)/printf-stdarg.c -SRC += $(PIOSCOMMON)/pios_rfm22b.c -SRC += $(PIOSCOMMON)/pios_rfm22b_com.c -## Libraries for flight calculations -SRC += $(FLIGHTLIB)/fifo_buffer.c -SRC += $(FLIGHTLIB)/CoordinateConversions.c -SRC += $(FLIGHTLIB)/taskmonitor.c -SRC += $(FLIGHTLIB)/aes.c -## The Reed-Solomon FEC library -SRC += $(FLIGHTLIB)/rscode/rs.c -SRC += $(FLIGHTLIB)/rscode/berlekamp.c -SRC += $(FLIGHTLIB)/rscode/galois.c - -## CMSIS for STM32 -SRC += $(CMSISDIR)/core_cm3.c -SRC += $(CMSISDIR)/system_stm32f10x.c - -## Used parts of the STM-Library -SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c -SRC += $(STMSPDSRCDIR)/stm32f10x_crc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_dac.c -SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c -SRC += $(STMSPDSRCDIR)/stm32f10x_exti.c -SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c -SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c -SRC += $(STMSPDSRCDIR)/stm32f10x_i2c.c -SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c -SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c -SRC += $(STMSPDSRCDIR)/stm32f10x_tim.c -SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c -SRC += $(STMSPDSRCDIR)/stm32f10x_iwdg.c -SRC += $(STMSPDSRCDIR)/stm32f10x_dbgmcu.c -SRC += $(STMSPDSRCDIR)/misc.c - -## STM32 USB Library -SRC += $(STMUSBSRCDIR)/usb_core.c -SRC += $(STMUSBSRCDIR)/usb_init.c -SRC += $(STMUSBSRCDIR)/usb_int.c -SRC += $(STMUSBSRCDIR)/usb_mem.c -SRC += $(STMUSBSRCDIR)/usb_regs.c -SRC += $(STMUSBSRCDIR)/usb_sil.c - -## RTOS -SRC += $(RTOSSRCDIR)/list.c -SRC += $(RTOSSRCDIR)/queue.c -SRC += $(RTOSSRCDIR)/tasks.c - -## RTOS Portable -SRC += $(RTOSPORTDIR)/portable/GCC/ARM_CM3/port.c -SRC += $(RTOSPORTDIR)/portable/MemMang/heap_1.c - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S - -# List Assembler source files here which must be assembled in ARM-Mode.. -ASRCARM = - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -EXTRAINCDIRS += $(OPSYSTEM) -EXTRAINCDIRS += $(OPSYSTEMINC) -EXTRAINCDIRS += $(OPUAVTALK) -EXTRAINCDIRS += $(OPUAVTALKINC) -EXTRAINCDIRS += $(OPUAVOBJ) -EXTRAINCDIRS += $(OPUAVOBJINC) -EXTRAINCDIRS += $(OPUAVSYNTHDIR) -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(RSCODEINC) -EXTRAINCDIRS += $(PIOSSTM32F10X) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(STMUSBINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(DOSFSDIR) -EXTRAINCDIRS += $(MSDDIR) -EXTRAINCDIRS += $(RTOSINCDIR) -EXTRAINCDIRS += $(APPLIBDIR) -EXTRAINCDIRS += $(RTOSPORTDIR)/portable/GCC/ARM_CM3 -EXTRAINCDIRS += $(PYMITEINC) -EXTRAINCDIRS += $(HWDEFSINC) - -EXTRAINCDIRS += ${foreach MOD, ${OPTMODULES} ${MODULES}, ${OPMODULEDIR}/${MOD}/inc} ${OPMODULEDIR}/System/inc - - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32F10X) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -OPT = 1 -else -OPT = s -endif - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DSTM32F10X_$(MODEL) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) -ifeq ($(ENABLE_DEBUG_PINS), YES) -CDEFS += -DPIOS_ENABLE_DEBUG_PINS -endif -ifeq ($(ENABLE_AUX_UART), YES) -CDEFS += -DPIOS_ENABLE_AUX_UART -endif -ifeq ($(ERASE_FLASH), YES) -CDEFS += -DERASE_FLASH -endif - -ifneq ($(USE_GPS), NO) -CDEFS += -DUSE_GPS -endif - -ifeq ($(USE_I2C), YES) -CDEFS += -DUSE_I2C -endif - -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -# -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) - -ifeq ($(DEBUG),YES) -CFLAGS = -DDEBUG -endif - -ifneq (,$(filter YES,$(STACK_DIAGNOSTICS) $(ALL_DIGNOSTICS))) -CFLAGS += -DSTACK_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(MIXERSTATUS_DIAGNOSTICS) $(ALL_DIGNOSTICS))) -CFLAGS += -DMIXERSTATUS_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(RATEDESIRED_DIAGNOSTICS) $(ALL_DIGNOSTICS))) -CFLAGS += -DRATEDESIRED_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(I2C_WDG_STATS_DIAGNOSTICS) $(ALL_DIGNOSTICS))) -CFLAGS += -DI2C_WDG_STATS_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(DIAG_TASKS) $(ALL_DIGNOSTICS))) -CFLAGS += -DDIAG_TASKS -endif - -CFLAGS += -g$(DEBUGF) -CFLAGS += -O$(OPT) -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. - -#CFLAGS += -fno-cprop-registers -fno-defer-pop -fno-guess-branch-probability -fno-section-anchors -#CFLAGS += -fno-if-conversion -fno-if-conversion2 -fno-ipa-pure-const -fno-ipa-reference -fno-merge-constants -#CFLAGS += -fno-split-wide-types -fno-tree-ccp -fno-tree-ch -fno-tree-copy-prop -fno-tree-copyrename -#CFLAGS += -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-tree-fre -fno-tree-sink -fno-tree-sra -#CFLAGS += -fno-tree-ter -#CFLAGS += -g$(DEBUGF) -DDEBUG - -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif - -CFLAGS += -Wall -CFLAGS += -Werror -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -# Set linker-script name depending on selected submodel name -LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld -LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f -PYTHON = python - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex lss sym -else -ifeq ($(LOADFORMAT),binary) -build: elf bin lss sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin lss sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif -endif - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino opfw -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o -opfw: $(OUTDIR)/$(TARGET).opfw - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).opfw -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw -else - $(error INSTALL_DIR must be specified for $@) -endif - -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(wildcard $(OUTDIR)/*.c) - $(V1) $(REMOVE) $(wildcard $(OUTDIR)/*.h) - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list install +include $(ROOT_DIR)/make/apps-defs.mk diff --git a/flight/targets/PipXtreme/System/inc/pios_config.h b/flight/targets/PipXtreme/System/inc/pios_config.h index 94893c54b..21c0dc12a 100755 --- a/flight/targets/PipXtreme/System/inc/pios_config.h +++ b/flight/targets/PipXtreme/System/inc/pios_config.h @@ -1,110 +1,135 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotCore OpenPilot Core - * @{ - * - * @file pios_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief PiOS configuration header. - * Central compile time config for the project. - * In particular, pios_config.h is where you define which PiOS libraries - * and features are included in the firmware. - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PIOS_CONFIG_H -#define PIOS_CONFIG_H - -/* Enable/Disable PiOS Modules */ -#define PIOS_INCLUDE_DELAY -#define PIOS_INCLUDE_IRQ -#define PIOS_INCLUDE_LED -#define PIOS_INCLUDE_IAP -#define PIOS_INCLUDE_RFM22B -#define PIOS_INCLUDE_RFM22B_COM -#define PIOS_INCLUDE_RCVR -#define PIOS_INCLUDE_TIM - -/* Supported receiver interfaces */ -#define PIOS_INCLUDE_PPM - -/* Supported USART-based PIOS modules */ -#define PIOS_INCLUDE_SPI -#define PIOS_INCLUDE_SYS -#define PIOS_INCLUDE_USART -#define PIOS_INCLUDE_USB -#define PIOS_INCLUDE_USB_HID -#define PIOS_INCLUDE_USB_CDC -#define PIOS_INCLUDE_COM -#define PIOS_INCLUDE_SETTINGS -#define PIOS_INCLUDE_FREERTOS -#define PIOS_INCLUDE_GPIO -#define PIOS_INCLUDE_EXTI -#define PIOS_INCLUDE_RTC -#define PIOS_INCLUDE_WDG -#define PIOS_INCLUDE_BL_HELPER -#define PIOS_INCLUDE_FLASH_EEPROM -#define PIOS_INCLUDE_RFM22B -#define PIOS_INCLUDE_PACKET_HANDLER -#define PIOS_INCLUDE_PPM_OUT - -/* Defaults for Logging */ -#define LOG_FILENAME "PIOS.LOG" -#define STARTUP_LOG_ENABLED 1 - -/* COM Module */ -#define GPS_BAUDRATE 19200 -#define TELEM_BAUDRATE 19200 -#define AUXUART_ENABLED 0 -#define AUXUART_BAUDRATE 19200 - -/* Alarm Thresholds */ -#define HEAP_LIMIT_WARNING 220 -#define HEAP_LIMIT_CRITICAL 40 -#define IRQSTACK_LIMIT_WARNING 100 -#define IRQSTACK_LIMIT_CRITICAL 60 -#define CPULOAD_LIMIT_WARNING 85 -#define CPULOAD_LIMIT_CRITICAL 95 - -/* Task stack sizes */ -#define PIOS_ACTUATOR_STACK_SIZE 1020 -#define PIOS_MANUAL_STACK_SIZE 724 -#define PIOS_SYSTEM_STACK_SIZE 460 -#define PIOS_STABILIZATION_STACK_SIZE 524 -#define PIOS_TELEM_STACK_SIZE 500 -#define PIOS_EVENTDISPATCHER_STACK_SIZE 130 -#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 -//#define PIOS_QUATERNION_STABILIZATION - -// This can't be too high to stop eventdispatcher thread overflowing -#define PIOS_EVENTDISAPTCHER_QUEUE 10 - -/* PIOS Initcall infrastructure */ -#define PIOS_INCLUDE_INITCALL - -/* Turn on debugging signals on the telemetry port */ -//#define PIOS_RFM22B_DEBUG_ON_TELEM - -#endif /* PIOS_CONFIG_H */ -/** - * @} - * @} - */ +/** + ****************************************************************************** + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotCore OpenPilot Core + * @{ + * @file pios_config.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2013. + * @brief PiOS configuration header, the compile time config file for the PIOS. + * Defines which PiOS libraries and features are included in the firmware. + * @see The GNU Public License (GPL) Version 3 + *****************************************************************************/ +/* + * 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PIOS_CONFIG_H +#define PIOS_CONFIG_H + +/* + * Below is a complete list of PIOS configurable options. + * Please do not remove or rearrange them. Only comment out + * unused options in the list. See main pios.h header for more + * details. + */ + +#define PIOS_INCLUDE_FREERTOS +#define PIOS_INCLUDE_DELAY +#define PIOS_INCLUDE_INITCALL +#define PIOS_INCLUDE_SYS + +#define PIOS_INCLUDE_IRQ +#define PIOS_INCLUDE_RTC +#define PIOS_INCLUDE_TIM +#define PIOS_INCLUDE_USART +/* #define PIOS_INCLUDE_ADC */ +/* #define PIOS_INCLUDE_I2C */ +#define PIOS_INCLUDE_SPI +#define PIOS_INCLUDE_GPIO +#define PIOS_INCLUDE_EXTI +#define PIOS_INCLUDE_WDG +#define PIOS_INCLUDE_USB +#define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_USB_CDC +/* #define PIOS_INCLUDE_USB_RCTX */ + +/* #define PIOS_INCLUDE_ADXL345 */ +/* #define PIOS_INCLUDE_BMA180 */ +/* #define PIOS_INCLUDE_L3GD20 */ +/* #define PIOS_INCLUDE_MPU6000 */ +/* #define PIOS_MPU6000_ACCEL */ +/* #define PIOS_INCLUDE_HMC5843 */ +/* #define PIOS_INCLUDE_HMC5883 */ +/* #define PIOS_INCLUDE_BMP085 */ +/* #define PIOS_INCLUDE_MS5611 */ +/* #define PIOS_INCLUDE_MPXV */ +/* #define PIOS_INCLUDE_ETASV3 */ +/* #define PIOS_INCLUDE_HCSR04 */ + +/* #define PIOS_INCLUDE_PWM */ +#define PIOS_INCLUDE_PPM +/* #define PIOS_INCLUDE_DSM */ +/* #define PIOS_INCLUDE_SBUS */ +/* #define PIOS_INCLUDE_GCSRCVR */ + +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP +/* #define PIOS_INCLUDE_SERVO */ +/* #define PIOS_INCLUDE_I2C_ESC */ +/* #define PIOS_INCLUDE_OVERO */ +/* #define PIOS_INCLUDE_SDCARD */ +/* #define PIOS_INCLUDE_FLASH */ +/* #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS */ +#define PIOS_INCLUDE_FLASH_EEPROM +#define PIOS_INCLUDE_RFM22B +#define PIOS_INCLUDE_PACKET_HANDLER +#define PIOS_INCLUDE_PPM_OUT +/* Turn on debugging signals on the telemetry port */ +/* #define PIOS_RFM22B_DEBUG_ON_TELEM */ + +/* #define PIOS_INCLUDE_VIDEO */ +/* #define PIOS_INCLUDE_WAVE */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +/* #define PIOS_INCLUDE_UDP */ + +#define PIOS_INCLUDE_RCVR +#define PIOS_INCLUDE_COM +/* #define PIOS_INCLUDE_COM_MSG */ +/* #define PIOS_INCLUDE_TELEMETRY_RF */ +/* #define PIOS_INCLUDE_GPS */ +/* #define PIOS_GPS_MINIMAL */ +/* #define PIOS_INCLUDE_GPS_NMEA_PARSER */ +/* #define PIOS_INCLUDE_GPS_UBX_PARSER */ + +/* Alarm Thresholds */ +#define HEAP_LIMIT_WARNING 220 +#define HEAP_LIMIT_CRITICAL 40 +#define IRQSTACK_LIMIT_WARNING 100 +#define IRQSTACK_LIMIT_CRITICAL 60 +#define CPULOAD_LIMIT_WARNING 85 +#define CPULOAD_LIMIT_CRITICAL 95 + +/* Task stack sizes */ +#define PIOS_ACTUATOR_STACK_SIZE 1020 +#define PIOS_MANUAL_STACK_SIZE 724 +#define PIOS_SYSTEM_STACK_SIZE 460 +#define PIOS_STABILIZATION_STACK_SIZE 524 +#define PIOS_TELEM_STACK_SIZE 500 +#define PIOS_EVENTDISPATCHER_STACK_SIZE 130 +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 + +/* Stabilization options */ +/* #define PIOS_QUATERNION_STABILIZATION */ + +/* This can't be too high to stop eventdispatcher thread overflowing */ +#define PIOS_EVENTDISAPTCHER_QUEUE 10 + +#endif /* PIOS_CONFIG_H */ +/** + * @} + * @} + */ diff --git a/make/apps-defs.mk b/make/apps-defs.mk index 218694cb6..13fb1deaa 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -82,7 +82,7 @@ ifeq ($(MCU),cortex-m3) RTOSINCDIR = $(RTOSSRCDIR)/include RTOSPORTDIR = $(APPLIBDIR)/FreeRTOS/Source else ifeq ($(MCU),cortex-m4) - + $(error This makefile is not yet converted for F4, work in progress) else $(error Unsupported MCU: $(MCU)) endif @@ -113,6 +113,8 @@ ifeq ($(MCU),cortex-m3) SRC += $(PIOSSTM32F10X)/pios_iap.c SRC += $(PIOSSTM32F10X)/pios_tim.c SRC += $(PIOSSTM32F10X)/pios_bl_helper.c + SRC += $(PIOSSTM32F10X)/pios_eeprom.c + SRC += $(PIOSSTM32F10X)/pios_ppm_out.c # PIOS USB related files SRC += $(OPSYSTEM)/pios_usb_board_data.c @@ -137,14 +139,14 @@ ifeq ($(MCU),cortex-m3) SRC += $(PIOSCOMMON)/pios_sbus.c SRC += $(PIOSCOMMON)/pios_rcvr.c SRC += $(PIOSCOMMON)/pios_gcsrcvr.c + SRC += $(PIOSCOMMON)/pios_rfm22b.c + SRC += $(PIOSCOMMON)/pios_rfm22b_com.c SRC += $(PIOSCOMMON)/printf-stdarg.c -# SRC += $(PIOSCOMMON)/pios_i2c_esc.c -# SRC += $(PIOSCOMMON)/pios_bmp085.c + SRC += $(PIOSCOMMON)/pios_i2c_esc.c ## Libraries for flight calculations SRC += $(FLIGHTLIB)/fifo_buffer.c SRC += $(FLIGHTLIB)/CoordinateConversions.c - SRC += $(FLIGHTLIB)/packet_handler.c SRC += $(FLIGHTLIB)/taskmonitor.c SRC += $(FLIGHTLIB)/sanitycheck.c SRC += $(MATHLIB)/sin_lookup.c From 67d7db88f1124b4f84659282c57f45248954938c Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 13:40:30 +0200 Subject: [PATCH 20/68] Makefile: pass TOPDIR to sub-make to overcome Windows filename problem Makefile uses toprel function to display nice short relative paths when building. But different ways of getting current path (using . or pwd or MAKEFILE_LIST, etc) give different cases for Windows drive letters. As result, some paths are not translated by toprel function and look not nice. Passing known TOPDIR value to sub-make fixes this: ... CC flight/Modules/FirmwareIAP/firmwareiap.c CC flight/Modules/Telemetry/telemetry.c CC flight/Modules/System/systemmod.c CC d:/Work/OpenPilot/toolchains/flight/targets/CopterControl/System/coptercontrol.c CC d:/Work/OpenPilot/toolchains/flight/targets/CopterControl/System/pios_board.c ... Instead of ... CC flight/Modules/FirmwareIAP/firmwareiap.c CC flight/Modules/Telemetry/telemetry.c CC flight/Modules/System/systemmod.c CC flight/targets/CopterControl/System/coptercontrol.c CC flight/targets/CopterControl/System/pios_board.c ... --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index dfa7872d4..e1a8df8b0 100644 --- a/Makefile +++ b/Makefile @@ -452,6 +452,7 @@ fw_$(1)_%: uavobjects_flight BOARD_SHORT_NAME=$(3) \ BUILD_TYPE=fw \ HWDEFSINC=$(HWDEFS)/$(1) \ + TOPDIR=$(ROOT_DIR)/flight/targets/$(2) \ OUTDIR=$(BUILD_DIR)/fw_$(1) \ TARGET=fw_$(1) \ $$* @@ -478,6 +479,7 @@ bl_$(1)_%: BOARD_SHORT_NAME=$(3) \ BUILD_TYPE=bl \ HWDEFSINC=$(HWDEFS)/$(1) \ + TOPDIR=$(ROOT_DIR)/flight/targets/Bootloaders/$(2) \ OUTDIR=$(BUILD_DIR)/bl_$(1) \ TARGET=bl_$(1) \ $$* From 448a07fe57cede6980295965860b7aa9a46567ca Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Fri, 15 Mar 2013 12:34:38 +0200 Subject: [PATCH 21/68] pios_config.h: remove non-existent option PIOS_NO_GPS --- flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h | 1 - 1 file changed, 1 deletion(-) diff --git a/flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h b/flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h index f31de6673..af394cef1 100644 --- a/flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h +++ b/flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h @@ -35,7 +35,6 @@ #define PIOS_INCLUDE_LED #define PIOS_INCLUDE_SYS #define PIOS_INCLUDE_GPIO -#define PIOS_NO_GPS //#define DEBUG_SSP #define PIOS_INCLUDE_IRQ From db0cdc6a0c9e53b46cdb983ded2cea890aa7202b Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 15:20:08 +0200 Subject: [PATCH 22/68] Remove (almost) exact copy of dosfs from F1-specific directory The difference was in dfs_sdcard.c, line 107: -if((status = PIOS_SDCARD_SectorRead(sector, buffer)) < 0) { +if((status = PIOS_SDCARD_SectorRead(sector, buffer)) != 0) { Currenly unused, kept as is. --- .../PiOS/STM32F10x/Libraries/dosfs/README.txt | 368 ----- .../STM32F10x/Libraries/dosfs/README_1st.txt | 42 - .../STM32F10x/Libraries/dosfs/dfs_sdcard.c | 143 -- flight/PiOS/STM32F10x/Libraries/dosfs/dosfs.c | 1336 ----------------- flight/PiOS/STM32F10x/Libraries/dosfs/dosfs.h | 405 ----- make/apps-defs.mk | 2 +- 6 files changed, 1 insertion(+), 2295 deletions(-) delete mode 100644 flight/PiOS/STM32F10x/Libraries/dosfs/README.txt delete mode 100644 flight/PiOS/STM32F10x/Libraries/dosfs/README_1st.txt delete mode 100644 flight/PiOS/STM32F10x/Libraries/dosfs/dfs_sdcard.c delete mode 100644 flight/PiOS/STM32F10x/Libraries/dosfs/dosfs.c delete mode 100644 flight/PiOS/STM32F10x/Libraries/dosfs/dosfs.h diff --git a/flight/PiOS/STM32F10x/Libraries/dosfs/README.txt b/flight/PiOS/STM32F10x/Libraries/dosfs/README.txt deleted file mode 100644 index 0c08b3cde..000000000 --- a/flight/PiOS/STM32F10x/Libraries/dosfs/README.txt +++ /dev/null @@ -1,368 +0,0 @@ -README.TXT (C) Copyright 2006 -DOSFS Level 1 Version 1.02 Lewin A.R.W. Edwards (sysadm@zws.com) -===================================================================== - -Abstract -======== -DOSFS is a FAT-compatible filesystem intended for fairly low-end -embedded applications. It is not the leanest possible implementation -(the leanest FAT implementations operate in << 512 bytes of RAM, with -heavy restrictions). This code strikes a good balance between size -and functionality, with an emphasis on RAM footprint. - -Intended target systems would be in the ballpark of 1K RAM, 4K ROM -or more. - -Features: -* Supports FAT12, FAT16 and FAT32 volumes -* Supports storage devices up to 2048Gbytes in size (LBA32) -* Supports devices with or without MBRs (hard disks vs. floppy disks - or ZIP drives formatted as "big floppies") -* Supports multiple partitions on disks with MBRs -* Supports subdirectories -* Can be operated with a single global 512-byte sector buffer -* Fully reentrant code (assuming the underlying physical device driver - is reentrant and global sector buffers are not used). There are no - global variables in the filesystem -* Does not perform any memory allocation -* Partial support for random-access files - -Applications: -* Firmware upgrades -* Failsafe IPL -* Media playback -* Data logging -* Configuration storage - -There is no technical support for this free product; however, if you -have questions or suggestions, you are encouraged to email Lewin -Edwards at sysadm@zws.com. If you need custom additions to the code, -or if you have other projects for which you need engineering -assistance, please feel free to email or call (646) 549-3715. - -License -======= -The license for DOSFS is very simple but verbose to state. - -1. DOSFS is (C) Copyright 2006 by Lewin A.R.W. Edwards ("Author"). - All rights not explicitly granted herein are reserved. The DOSFS - code is the permanent property of the Author and no transfer of - ownership is implied by this license. - -2. DOSFS is an educational project, provided as-is. No guarantee of - performance or suitability for any application is stated or - implied. You use this product entirely at your own risk. Use of - this product in any manner automatically waives any right to seek - compensation or damages of any sort from the Author. Since the - products you might make are entirely out of the Author's control, - use of this product also constitutes an agreement by you to take - full responsibility for and indemnify the Author against any - action for any loss or damage (including economic loss of any - type, and specifically including patent litigation) that arises - from a product made by you that incorporates any portion of - the DOSFS code. - -3. If you live under the jurisdiction of any legislation that would - prohibit or limit any condition in this license, you cannot be - licensed to use this product. - -4. If you do not fall into the excluded category in point 3, you are - hereby licensed to use the DOSFS code in any application that you - see fit. You are not required to pay any fee or notify the Author - that you are using DOSFS. Any modifications made by you to the - DOSFS code are your property and you may distribute the modified - version in any manner that you wish. You are not required to - disclose sourcecode to such modifications, either to the Author or - to any third party. Any such disclosure made to the Author will - irrevocably become the property of the Author in the absence of a - formal agreement to the contrary, established prior to such - disclosure being made. - -To summarize the intent of the above: DOSFS is free. You can do what -you want with it. Anything that happens as a result is entirely your -responsibility. You can't take ownership of my code and stop me from -doing whatever I want with it. If you do something nifty with DOSFS -and send me the sourcecode, I may include your changes in the next -distribution and it will be released to the world as free software. -If someone sues you because your DOSFS-containing product causes -any sort of legal, financial or other problem, it's your lawsuit, -not mine, and you'll exclude me from the proceedings. - -User-Supplied Functions -======================= -You must provide functions to read sectors into memory and write -them back to the target media. The demo suite includes an emulation -module that reads/writes a disk image file (#define HOSTVER pulls -in hostemu.h which wraps the prototypes for these functions). -There are various tools for UNIX, DOS, Windows et al, to create -images from storage media; my preferred utility is dd. - -The functions you must supply in your embedded app are: - -DFS_ReadSector(unit,buffer,sector,count) -DFS_WriteSector(unit,buffer,sector,count) - -These two functions read and write, respectively, "count" sectors of -size SECTOR_SIZE (512 bytes; see below) from/to physical sector -#"sector" of device "unit", to/from the scratch buffer "buffer". They -should return 0 for success or nonzero for failure. In the current -implementation of DOSFS, count will always be 1. - -The "unit" argument is designed to permit implementation of multiple -storage devices, for example multiple media slots on a single device, -or to differentiate between master and slave devices on an ATAPI bus. - -This code is designed for 512-byte sectors. Although the sector size -is a #define, you should not tinker with it because the vast majority -of FAT filesystems use 512-byte sectors, and the DOSFS code doesn't -support runtime determination of sector size. This will not affect the -vast majority of users. - -Example Code -============ -Refer to the tests in main.c to see how to call DOSFS functions. -(These tests are all commented out). Note that the only two files -you need to add to your project are dosfs.c and dosfs.h. - - -Mounting Volumes -================ ---If the device has a partition table (practically all removable flash - media are formatted this way), call DFS_GetPtnStart to get the - starting sector# of the desired partition. You can optionally also - retrieve the active state, partition type byte and partition size - in this step. The reason this step is broken out separately is so - you can support devices that are formatted like a floppy disk, i.e. - the volume starts directly at physical sector 0 of the media. - ---Call DFS_GetVolInfo to read filesystem info into a VOLINFO structure. - DFS_GetVolInfo needs to know the unit number and partition starting - sector (as returned by DFS_GetPtnStart, or 0 if this is a "floppy- - format" volume without an MBR). - -From this point on, the VOLINFO structure is all you'll need - you can -forget the unit and partition start sector numbers. - -Enumerating Directory Contents -============================== ---Call DFS_Opendir and supply a path, populated VOLINFO and a - DIRINFO structure to receive the results. Note - you must PREPOPULATE - the DIRINFO.scratch field with a pointer to a sector scratch buffer. - This buffer must remain unmolested while you have the directory open - for searching. ---Call DFS_GetNext to receive the DIRENT contents for the next directory - item. This function returns DFS_OK for no error, and DFS_EOF if there - are no more entries in the directory being searched. - Before using the DIRENT, check the first character of the name. If it - is NULL, then this is an unusable entry - call DFS_GetNext again to - keep searching. LFN directory entries are automatically tagged this way - so your application will not be pestered by them. - - Note: A designed side-effect of this code is that when you locate the - file of interest, the DIRINFO.currentcluster, DIRINFO.currentsector - and DIRINFO.currententry-1 fields will identify the directory entry of - interest. - -Reading a File -============== ---Call DFS_OpenFile with mode = DFS_READ and supply a path and the relevant - VOLINFO structure. DFS_OpenFile will populate a FILEINFO that can be used - to refer to the file. ---Optionally call DFS_Seek to set the file pointer. If you attempt to set - the file pointer past the end of file, the file will NOT be extended. Check - the FILEINFO.pointer value after DFS_Seek to verify that the pointer is - where you expect it to be. ---Observe that functionality similar to the "whence" parameter of fseek() can - be obtained by using simple arithmetic on the FILEINFO.pointer and - FILEINFO.filelen members. ---Call DFS_ReadFile with the FILEINFO you obtained from OpenFile, and a - pointer to a buffer plus the desired number of bytes to read, and a - pointer to a sector-sized scratch buffer. The reason a scratch sector is - required is because the underlying sector read function doesn't know - about partial reads. ---Note that a file opened for reading cannot be written. If you need r/w - access, open with mode = DFS_WRITE (see below). - -Writing a file -============== ---Call DFS_OpenFile with mode = DFS_WRITE and supply a path and the relevant - VOLINFO structure. DFS_OpenFile will populate a FILEINFO that can be used to - refer to the file. ---Optionally call DFS_Seek to set the file pointer. Refer to the notes on - this topic in the section on reading files, above. ---Call DFS_WriteFile with the FILEINFO you obtained from OpenFile, and a - pointer to the source buffer, and a pointer to a sector-sized scratch - buffer. ---Note that a file open for writing can also be read. ---Files are created automatically if they do not exist. Subdirectories are - NOT automatically created. ---If you open an existing file for writing, the file pointer will start at - the beginning of the data; if you want to append, seek to the end before - writing new data. ---If you perform random-access writes to a file, the length will NOT change - unless you exceed the file's original length. There is currently no - function to truncate a file at the current pointer position. ---On-disk consistency is guaranteed when DFS_WriteFile exits, unless your - physical layer has a writeback cache in it. - -Deleting a file -=============== ---Call DFS_UnlinkFile ---WARNING: This call will delete a subdirectory (correctly) but will NOT - first recurse the directory to delete the contents - so you will end up - with lost clusters. - -Notes -===== -Some platforms may require explicit pragmas or attributes to the structures -and unions. For example, arm-gcc will require __attribute__ ((__packed__)) -otherwise it will try to be "smart" and place the uint8_t members on 4-byte -boundaries. There is no truly elegant compiler-independent method to get -around this sort of problem. - -The code assumes either a von Neumann architecture, or a compiler that -is smart enough to understand where your pointers are aimed and emit -the right kind of memory read and write instructions. The implications -of this statement depend on your target processor and the compiler you -are using. Be very careful not to straddle bank boundaries on bank- -switched memory systems. - -Physical 32-bit sector numbers are used throughout. Therefore, the -CHS geometry (if any) of the storage media is not known to DOSFS. Your -sector r/w functions may need to query the CHS geometry and perform -mapping. - -File timestamps set by DOSFS are always 1:01:00am on Jan 1, 2006. If -your system has a concept of real time, you can enhance this. - -FILEINFO structures contain a pointer to the corresponding VOLINFO -used to open the file, mainly in order to avoid mixups but also to -obviate the need for an extra parameter to every file read/write. DOSFS -assumes that the VOLINFO won't move around. If you need to move or -destroy VOLINFOs pertaining to open files, you'll have to fix up the -pointer in the FILEINFO structure yourself. - -The subdirectory delimiter is a forward slash ( '/' ) by default. The -reason for this is to avoid the common programming error of forgetting -that backslash is an escape character in C strings; i.e. "\MYDIR\FILE" -is NOT what you want; "\\MYDIR\\FILE" is what you wanted to type. If you -are porting DOS code into an embedded environment, feel free to change -this #define. - -DOSFS does not have a concept of "current directory". A current directory -is owned by a process, and a process is an operating system concept. -DOSFS is a filesystem library, not an operating system. Therefore, any -path you provide to a DOSFS call is assumed to be relative to the root of -the volume. - -There is no call to close a file or directory that is open for reading or -writing. You can simply destroy or reuse the data structures allocated for -that operation; there is no internal state in DOSFS so no cleanup is -necessary. Similarly, there is no call to close a file that is open for -writing. (Observe that dosfs.c has no global variables. All state information -is stored in data structures provided by the caller). - -MAX_PATH is defined as 64. MS-type DOS filesystems support 128 characters -or more in paths. You can increase this define, but it may GREATLY -increase memory requirements. - -VFAT long filenames are not supported. There is a certain amount of -patent controversy about them, but more importantly they don't really -belong in the scope of a "minimalist embedded filesystem". - -Improving Performance -===================== -Read performance is fairly good, but can be improved by implementing read -caching on the FAT (see below) and, depending on your hardware platform, -possibly by implementing multi-sector reads. - -Write performance may benefit ENORMOUSLY from platform-specific -optimization, especially if you are working with a flash media type that -has a large erase block size. While it is not possible to offer detailed -platform-independent advice, my general advice is to implement writeback -caching on the FAT area. One method for doing this would be to have a -cache system that lives in the DFS_ReadSector/WriteSector functions (on -top of the physical sector r/w functions) and is initially switched off. -Once you have called DFS_GetVolInfo, you then extract the VOLINFO.fat1 -and VOLINFO.rootdir parameters and pass them to your caching layer. -Sectors >= fat1 and < rootdir should be cached. The cache strategy is -determined by the physical storage medium underlying the filesystem. - -CACHING HINT: -Observe that there will be numerous read-modify-write operations in the -region from VOLINFO.fat1 through VOLINFO.fat1+VOLINFO.secperfat-1, but -in the region from VOLINFO.fat1+VOLINFO.secperfat through VOLINFO.rootdir -there will ONLY be write operations. - -Platform Compatibility -====================== -DOSFS was derived from code originally written for ARM7TDMI but -designed to be portable. It has been tested on AVR (using avrgcc), -MSP430 (using Rowley's CrossWorks) and PPC603e (using gcc); the host -test suite has also been validated on x86 using gcc under both Cygwin -and 32-bit Fedora Core 4 Linux. - -TODO list -========= -* Add function to create subdirectory -* Make DFS_UnlinkFile recognize non-empty subdirectories -* Support "fast write" files where the FAT is not updated, for - logging applications where latency is important. - -Test cases for V1.02 -==================== -Version 1.02 has NOT been through full regression testing. However the -bugs fixed in this version are important, and people have been asking -about them. - -Test cases for V1.01 -==================== -See below. - -Test cases for V1.00 -==================== -These are the test cases that were used to validate the correct -functionality of the DOSFS suite. Each test was performed on FAT12, -FAT16 and FAT32 volumes. P=Pass, F=Fail. - -Case F12 F16 F32 ---------------------------------------------------------------------- -Get volume information P P P -Open root directory P P P -List contents of root directory (fully populated) P P P -Open subdirectory P P P -List contents of subdirectory (<= 1 cluster) P P P -List contents of large subdirectory (> 1 cluster) P P P -Open 5-level nested subdirectory P P P -Open existing file for reading P P P -Open nonexistent file for reading P P P -Seek past EOF, file open for reading P P P -Seek to cluster boundary P P P -Seek past cluster boundary P P P -Seek backwards to nonzero offset, pointer > cluster size P P P -Block-read entire file >1 cluster in size, odd size P P P -Seek to odd location in file P P P -Perform <1 sector reads from random file locations P P P -Open nonexistent file for writing in root dir P P P -Open nonexistent file for writing in subdir P P P -Repeat prev. 2 tests on volume with 0 free clusters P P P -Seek past EOF, file open for writing P P P -Open existing file for writing in root dir P P P -Write random-length records to file, 20 clusters total P P P -MS-DOS 6.0 SCANDISK cross-check P P P - -Revision History -================ -Jan-06-2005 larwe Initial release (1.0) -Jan-29-2006 larwe Bugfix release (1.01) - - Fixed error in FAT12 FAT read on boundary of sector - - Improved compilability under avrgcc -Sep-16-2006 larwe Bugfix release (1.02) - - DFS_Seek would not correctly rewind to start of file - - DFS_Seek would not correctly seek to a position not on a cluster - boundary - - DFS_OpenFile fencepost error caused memory access at [start of - string-1] with a local variable - - DFS_OpenFile could not open a file in the root directory - - \ No newline at end of file diff --git a/flight/PiOS/STM32F10x/Libraries/dosfs/README_1st.txt b/flight/PiOS/STM32F10x/Libraries/dosfs/README_1st.txt deleted file mode 100644 index a44df8f80..000000000 --- a/flight/PiOS/STM32F10x/Libraries/dosfs/README_1st.txt +++ /dev/null @@ -1,42 +0,0 @@ -DOSFS has been developed by Lewin Edwards, and is provided as freeware. - -See README.txt for details. - -This package has been downloaded from: - http://www.larwe.com/zws/products/dosfs/ - -Version 1.03 from 9/30/06 is used. - - -dfs_sdcard has been added as access layer between DFS functions and PIOS_SDCARD functions - -The original usage examples can be found under unused/main.c - -Addendum: - -TK 2008-12-18: -DFS_Seek was running endless, applied a patch which has been posted at -http://reza.net/wordpress/?p=110 - -TK 2008-12-18: -patched the patch: endcluster wasn't calculated correctly - -TK 2008-12-18: -added 'DFS_CachingEnabledSet(uint8_t enable)' function to enable a simple -caching mechanism. This feature has to be explicitely enabled, as it isn't -reentrant and requires to use the same buffer pointer whenever reading a file! - -TK 2008-18-12 -added missing pendant to DFS_CanonicalToDir; -char *DFS_DirToCanonical(char *dest, char *src) -expects a 13 byte buffer in *dest - -TK 2009-02-12 -added dummy "DFS_Close" function -It has no effect if writing to SD Card, it's only used by the DosFS wrapper -in emulation - -TK 2009-07-04 -fixed bug in DFS_GetNext() in conjunction with the DFS_GetFreeDirEnt() function -New files where not added correctly to subdirectories - diff --git a/flight/PiOS/STM32F10x/Libraries/dosfs/dfs_sdcard.c b/flight/PiOS/STM32F10x/Libraries/dosfs/dfs_sdcard.c deleted file mode 100644 index ff5040c72..000000000 --- a/flight/PiOS/STM32F10x/Libraries/dosfs/dfs_sdcard.c +++ /dev/null @@ -1,143 +0,0 @@ -/** - ****************************************************************************** - * - * @file pios.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * Parts by Thorsten Klose (tk@midibox.org) (tk@midibox.org) - * @brief Access layer between DOSFS and PIOS - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* Include files */ - -#include - -#include "dosfs.h" - - -/* Local variables */ - -/* For caching - this feature has to be explicitly enabled, as it isn't reentrant */ -/* and requires to use the same buffer pointer whenever reading a file. */ -static uint32_t last_sector; -static uint8_t caching_enabled = 0; - -void DFS_CachingEnabledSet(uint8_t enable) -{ - caching_enabled = enable; - last_sector = 0xffffffff; -} - - -/** -* Converts directory name to canonical name -* (missing pendant to DFS_anonicalToDir) -* dest must point to a 13-byte buffer -*/ -char *DFS_DirToCanonical(char *dest, char *src) -{ - uint8_t pos = 0; - - while( pos < 8 && src[pos] != ' ' ) { - *dest++ = src[pos++]; - } - - if( src[8] != ' ' ) { - *dest++ = '.'; - - pos = 8; - while( pos < 11 && src[pos] != ' ' ) { - *dest++ = src[pos++]; - } - } - - /* Terminate string */ - *dest = 0; - - return dest; -} - - - -/** -* Read sector from SD Card -* Returns 0 OK, nonzero for any error -*/ -uint32_t DFS_ReadSector(uint8_t unit, uint8_t *buffer, uint32_t sector, uint32_t count) -{ - /* Only allow access to single unit */ - if(unit != 0) { - return 1; - } - - /* According to README.txt, count is always 1 - check this! */ - if(count != 1) { - return 2; - } - - /* Cache: */ - if(caching_enabled && sector == last_sector) { - /* we assume that sector is already in *buffer */ - /* since the user has to take care that the same buffer is used for file reads, this */ - /* feature has to be explicitly enabled with DFS_CachingEnabledSet(uint8_t enable) */ - return 0; - } - - last_sector = sector; - - /* Forward to PIOS */ - int32_t status; - if((status = PIOS_SDCARD_SectorRead(sector, buffer)) < 0) { - /* Cannot access SD Card */ - return 3; - } - - /* Success */ - return 0; -} - -/** -* Write sector to SD Card -* Returns 0 OK, nonzero for any error -*/ -uint32_t DFS_WriteSector(uint8_t unit, uint8_t *buffer, uint32_t sector, uint32_t count) -{ - /* Only allow access to single unit */ - if(unit != 0) { - return 1; - } - - /* According to README.txt, count is always 1 - check this! */ - if(count != 1) { - return 2; - } - - /* Invalidate cache */ - last_sector = 0xffffffff; - - /* Forward to PIOS */ - int32_t status; - if((status = PIOS_SDCARD_SectorWrite(sector, buffer)) < 0) { - /* Cannot access SD Card */ - return 3; - } - - /* Success */ - return 0; -} diff --git a/flight/PiOS/STM32F10x/Libraries/dosfs/dosfs.c b/flight/PiOS/STM32F10x/Libraries/dosfs/dosfs.c deleted file mode 100644 index 8a75b95d0..000000000 --- a/flight/PiOS/STM32F10x/Libraries/dosfs/dosfs.c +++ /dev/null @@ -1,1336 +0,0 @@ -/* - DOSFS Embedded FAT-Compatible Filesystem - (C) 2005 Lewin A.R.W. Edwards (sysadm@zws.com) - - You are permitted to modify and/or use this code in your own projects without - payment of royalty, regardless of the license(s) you choose for those projects. - - You cannot re-copyright or restrict use of the code as released by Lewin Edwards. -*/ - -//#include "common.h" -#include -#include -//#include "fat.h" - -#define div(a,b) ldiv(a,b) - -#include "dosfs.h" - -/* - Get starting sector# of specified partition on drive #unit - NOTE: This code ASSUMES an MBR on the disk. - scratchsector should point to a SECTOR_SIZE scratch area - Returns 0xffffffff for any error. - If pactive is non-NULL, this function also returns the partition active flag. - If pptype is non-NULL, this function also returns the partition type. - If psize is non-NULL, this function also returns the partition size. -*/ -uint32_t DFS_GetPtnStart(uint8_t unit, uint8_t *scratchsector, uint8_t pnum, uint8_t *pactive, uint8_t *pptype, uint32_t *psize) -{ - uint32_t result=0; - PMBR mbr = (PMBR) scratchsector; - - // DOS ptable supports maximum 4 partitions - if (pnum > 3) - return DFS_ERRMISC; - - // Read MBR from target media - if (DFS_ReadSector(unit,scratchsector,0,1)) { - return DFS_ERRMISC; - } - - // check if jump to boot, VBR - if(mbr->bootcode[0]==0xEB || mbr->bootcode[0]==0xE9){ - // MBR is actually VBR - return 0; - } - - result = (uint32_t) mbr->ptable[pnum].start_0 | - (((uint32_t) mbr->ptable[pnum].start_1) << 8) | - (((uint32_t) mbr->ptable[pnum].start_2) << 16) | - (((uint32_t) mbr->ptable[pnum].start_3) << 24); - - if (pactive) - *pactive = mbr->ptable[pnum].active; - - if (pptype) - *pptype = mbr->ptable[pnum].type; - - if (psize) - *psize = (uint32_t) mbr->ptable[pnum].size_0 | - (((uint32_t) mbr->ptable[pnum].size_1) << 8) | - (((uint32_t) mbr->ptable[pnum].size_2) << 16) | - (((uint32_t) mbr->ptable[pnum].size_3) << 24); - - return result; -} - - -/* - Retrieve volume info from BPB and store it in a VOLINFO structure - You must provide the unit and starting sector of the filesystem, and - a pointer to a sector buffer for scratch - Attempts to read BPB and glean information about the FS from that. - Returns 0 OK, nonzero for any error. -*/ -uint32_t DFS_GetVolInfo(uint8_t unit, uint8_t *scratchsector, uint32_t startsector, PVOLINFO volinfo) -{ - PLBR lbr = (PLBR) scratchsector; - volinfo->unit = unit; - volinfo->startsector = startsector; -#ifdef DEBUG_DOSFS - printf("DFS_GetVolInfo\r\n"); -#endif - - if(DFS_ReadSector(unit,scratchsector,startsector,1)) - return DFS_ERRMISC; - -// tag: OEMID, refer dosfs.h -// strncpy(volinfo->oemid, lbr->oemid, 8); -// volinfo->oemid[8] = 0; - - volinfo->secperclus = lbr->bpb.secperclus; - volinfo->reservedsecs = (uint16_t) lbr->bpb.reserved_l | - (((uint16_t) lbr->bpb.reserved_h) << 8); - - volinfo->numsecs = (uint16_t) lbr->bpb.sectors_s_l | - (((uint16_t) lbr->bpb.sectors_s_h) << 8); - - if (!volinfo->numsecs) - volinfo->numsecs = (uint32_t) lbr->bpb.sectors_l_0 | - (((uint32_t) lbr->bpb.sectors_l_1) << 8) | - (((uint32_t) lbr->bpb.sectors_l_2) << 16) | - (((uint32_t) lbr->bpb.sectors_l_3) << 24); - - // If secperfat is 0, we must be in a FAT32 volume; get secperfat - // from the FAT32 EBPB. The volume label and system ID string are also - // in different locations for FAT12/16 vs FAT32. - volinfo->secperfat = (uint16_t) lbr->bpb.secperfat_l | - (((uint16_t) lbr->bpb.secperfat_h) << 8); - if (!volinfo->secperfat) { - volinfo->secperfat = (uint32_t) lbr->ebpb.ebpb32.fatsize_0 | - (((uint32_t) lbr->ebpb.ebpb32.fatsize_1) << 8) | - (((uint32_t) lbr->ebpb.ebpb32.fatsize_2) << 16) | - (((uint32_t) lbr->ebpb.ebpb32.fatsize_3) << 24); - - memcpy(volinfo->label, lbr->ebpb.ebpb32.label, 11); - volinfo->label[11] = 0; - -// tag: OEMID, refer dosfs.h -// memcpy(volinfo->system, lbr->ebpb.ebpb32.system, 8); -// volinfo->system[8] = 0; - } - else { - memcpy(volinfo->label, lbr->ebpb.ebpb.label, 11); - volinfo->label[11] = 0; - -// tag: OEMID, refer dosfs.h -// memcpy(volinfo->system, lbr->ebpb.ebpb.system, 8); -// volinfo->system[8] = 0; - } - - // note: if rootentries is 0, we must be in a FAT32 volume. - volinfo->rootentries = (uint16_t) lbr->bpb.rootentries_l | - (((uint16_t) lbr->bpb.rootentries_h) << 8); - - // after extracting raw info we perform some useful precalculations - volinfo->fat1 = startsector + volinfo->reservedsecs; - - // The calculation below is designed to round up the root directory size for FAT12/16 - // and to simply ignore the root directory for FAT32, since it's a normal, expandable - // file in that situation. - if (volinfo->rootentries) { - volinfo->rootdir = volinfo->fat1 + (volinfo->secperfat * 2); - volinfo->dataarea = volinfo->rootdir + (((volinfo->rootentries * 32) + (SECTOR_SIZE - 1)) / SECTOR_SIZE); - } - else { - volinfo->dataarea = volinfo->fat1 + (volinfo->secperfat * 2); - volinfo->rootdir = (uint32_t) lbr->ebpb.ebpb32.root_0 | - (((uint32_t) lbr->ebpb.ebpb32.root_1) << 8) | - (((uint32_t) lbr->ebpb.ebpb32.root_2) << 16) | - (((uint32_t) lbr->ebpb.ebpb32.root_3) << 24); - } - - // Calculate number of clusters in data area and infer FAT type from this information. - volinfo->numclusters = (volinfo->numsecs - volinfo->dataarea) / volinfo->secperclus; - if (volinfo->numclusters < 4085) - volinfo->filesystem = FAT12; - else if (volinfo->numclusters < 65525) - volinfo->filesystem = FAT16; - else - volinfo->filesystem = FAT32; - - return DFS_OK; -} - -/* - Fetch FAT entry for specified cluster number - You must provide a scratch buffer for one sector (SECTOR_SIZE) and a populated VOLINFO - Returns a FAT32 BAD_CLUSTER value for any error, otherwise the contents of the desired - FAT entry. - scratchcache should point to a UINT32. This variable caches the physical sector number - last read into the scratch buffer for performance enhancement reasons. -*/ -uint32_t DFS_GetFAT(PVOLINFO volinfo, uint8_t *scratch, uint32_t *scratchcache, uint32_t cluster) -{ - uint32_t offset=0, sector=0, result=0; - -#ifdef DEBUG_DOSFS - printf("DFS_GetFAT\r\n"); -#endif - - if (volinfo->filesystem == FAT12) { - offset = cluster + (cluster / 2); - } - else if (volinfo->filesystem == FAT16) { - offset = cluster * 2; - } - else if (volinfo->filesystem == FAT32) { - offset = cluster * 4; - } - else - return 0x0ffffff7; // FAT32 bad cluster - - // at this point, offset is the BYTE offset of the desired sector from the start - // of the FAT. Calculate the physical sector containing this FAT entry. - sector = ldiv(offset, SECTOR_SIZE).quot + volinfo->fat1; - - // If this is not the same sector we last read, then read it into RAM - if (sector != *scratchcache) { - if(DFS_ReadSector(volinfo->unit, scratch, sector, 1)) { - // avoid anyone assuming that this cache value is still valid, which - // might cause disk corruption - *scratchcache = 0; - return 0x0ffffff7; // FAT32 bad cluster - } - *scratchcache = sector; - } - - // At this point, we "merely" need to extract the relevant entry. - // This is easy for FAT16 and FAT32, but a royal PITA for FAT12 as a single entry - // may span a sector boundary. The normal way around this is always to read two - // FAT sectors, but that luxury is (by design intent) unavailable to DOSFS. - offset = ldiv(offset, SECTOR_SIZE).rem; - - if (volinfo->filesystem == FAT12) { - // Special case for sector boundary - Store last byte of current sector. - // Then read in the next sector and put the first byte of that sector into - // the high byte of result. - if (offset == SECTOR_SIZE - 1) { - result = (uint32_t) scratch[offset]; - sector++; - if(DFS_ReadSector(volinfo->unit, scratch, sector, 1)) { - // avoid anyone assuming that this cache value is still valid, which - // might cause disk corruption - *scratchcache = 0; - return 0x0ffffff7; // FAT32 bad cluster - } - *scratchcache = sector; - // Thanks to Claudio Leonel for pointing out this missing line. - result |= ((uint32_t) scratch[0]) << 8; - } - else { - result = (uint32_t) scratch[offset] | - ((uint32_t) scratch[offset+1]) << 8; - } - if (cluster & 1) - result = result >> 4; - else - result = result & 0xfff; - } - else if (volinfo->filesystem == FAT16) { - result = (uint32_t) scratch[offset] | - ((uint32_t) scratch[offset+1]) << 8; - } - else if (volinfo->filesystem == FAT32) { - result = ((uint32_t) scratch[offset] | - ((uint32_t) scratch[offset+1]) << 8 | - ((uint32_t) scratch[offset+2]) << 16 | - ((uint32_t) scratch[offset+3]) << 24) & 0x0fffffff; - } - else - result = 0x0ffffff7; // FAT32 bad cluster - return result; -} - - -/* - Set FAT entry for specified cluster number - You must provide a scratch buffer for one sector (SECTOR_SIZE) and a populated VOLINFO - Returns DFS_ERRMISC for any error, otherwise DFS_OK - scratchcache should point to a UINT32. This variable caches the physical sector number - last read into the scratch buffer for performance enhancement reasons. - - NOTE: This code is HIGHLY WRITE-INEFFICIENT, particularly for flash media. Considerable - performance gains can be realized by caching the sector. However this is difficult to - achieve on FAT12 without requiring 2 sector buffers of scratch space, and it is a design - requirement of this code to operate on a single 512-byte scratch. - - If you are operating DOSFS over flash, you are strongly advised to implement a writeback - cache in your physical I/O driver. This will speed up your code significantly and will - also conserve power and flash write life. -*/ -uint32_t DFS_SetFAT(PVOLINFO volinfo, uint8_t *scratch, uint32_t *scratchcache, uint32_t cluster, uint32_t new_contents) -{ - uint32_t offset=0, sector=0, result=0; -#ifdef DEBUG_DOSFS - printf("DFS_SetFAT (%lu->%lu)\r\n",cluster,new_contents); -#endif - - if (volinfo->filesystem == FAT12) { - offset = cluster + (cluster / 2); - new_contents &=0xfff; - } - else if (volinfo->filesystem == FAT16) { - offset = cluster * 2; - new_contents &=0xffff; - } - else if (volinfo->filesystem == FAT32) { - offset = cluster * 4; - new_contents &=0x0fffffff; // FAT32 is really "FAT28" - } - else - return DFS_ERRMISC; - - // at this point, offset is the BYTE offset of the desired sector from the start - // of the FAT. Calculate the physical sector containing this FAT entry. - sector = ldiv(offset, SECTOR_SIZE).quot + volinfo->fat1; - - // If this is not the same sector we last read, then read it into RAM - if (sector != *scratchcache) { - if(DFS_ReadSector(volinfo->unit, scratch, sector, 1)) { - // avoid anyone assuming that this cache value is still valid, which - // might cause disk corruption - *scratchcache = 0; - return DFS_ERRMISC; - } - *scratchcache = sector; - } - - // At this point, we "merely" need to extract the relevant entry. - // This is easy for FAT16 and FAT32, but a royal PITA for FAT12 as a single entry - // may span a sector boundary. The normal way around this is always to read two - // FAT sectors, but that luxury is (by design intent) unavailable to DOSFS. - offset = ldiv(offset, SECTOR_SIZE).rem; - - if (volinfo->filesystem == FAT12) { - - // If this is an odd cluster, pre-shift the desired new contents 4 bits to - // make the calculations below simpler - if (cluster & 1) - new_contents = new_contents << 4; - - // Special case for sector boundary - if (offset == SECTOR_SIZE - 1) { - - // Odd cluster: High 12 bits being set - if (cluster & 1) { - scratch[offset] = (scratch[offset] & 0x0f) | (new_contents & 0xf0); - } - // Even cluster: Low 12 bits being set - else { - scratch[offset] = new_contents & 0xff; - } - result = DFS_WriteSector(volinfo->unit, scratch, *scratchcache, 1); - // mirror the FAT into copy 2 - if (DFS_OK == result) - result = DFS_WriteSector(volinfo->unit, scratch, (*scratchcache)+volinfo->secperfat, 1); - - // If we wrote that sector OK, then read in the subsequent sector - // and poke the first byte with the remainder of this FAT entry. - if (DFS_OK == result) { - // *scratchcache++; - ++*scratchcache; // TK: to avoid warning "value computed is not used" - result = DFS_ReadSector(volinfo->unit, scratch, *scratchcache, 1); - if (DFS_OK == result) { - // Odd cluster: High 12 bits being set - if (cluster & 1) { - scratch[0] = new_contents & 0xff00; - } - // Even cluster: Low 12 bits being set - else { - scratch[0] = (scratch[0] & 0xf0) | (new_contents & 0x0f); - } - result = DFS_WriteSector(volinfo->unit, scratch, *scratchcache, 1); - // mirror the FAT into copy 2 - if (DFS_OK == result) - result = DFS_WriteSector(volinfo->unit, scratch, (*scratchcache)+volinfo->secperfat, 1); - } - else { - // avoid anyone assuming that this cache value is still valid, which - // might cause disk corruption - *scratchcache = 0; - } - } - } // if (offset == SECTOR_SIZE - 1) - - // Not a sector boundary. But we still have to worry about if it's an odd - // or even cluster number. - else { - // Odd cluster: High 12 bits being set - if (cluster & 1) { - scratch[offset] = (scratch[offset] & 0x0f) | (new_contents & 0xf0); - scratch[offset+1] = new_contents & 0xff00; - } - // Even cluster: Low 12 bits being set - else { - scratch[offset] = new_contents & 0xff; - scratch[offset+1] = (scratch[offset+1] & 0xf0) | (new_contents & 0x0f); - } - result = DFS_WriteSector(volinfo->unit, scratch, *scratchcache, 1); - // mirror the FAT into copy 2 - if (DFS_OK == result) - result = DFS_WriteSector(volinfo->unit, scratch, (*scratchcache)+volinfo->secperfat, 1); - } - } - else if (volinfo->filesystem == FAT16) { - scratch[offset] = (new_contents & 0xff); - scratch[offset+1] = (new_contents & 0xff00) >> 8; - result = DFS_WriteSector(volinfo->unit, scratch, *scratchcache, 1); - // mirror the FAT into copy 2 - XXX - if (DFS_OK == result) - result = DFS_WriteSector(volinfo->unit, scratch, (*scratchcache)+volinfo->secperfat, 1); - } - else if (volinfo->filesystem == FAT32) { - scratch[offset] = (new_contents & 0xff); - scratch[offset+1] = (new_contents & 0xff00) >> 8; - scratch[offset+2] = (new_contents & 0xff0000) >> 16; - scratch[offset+3] = (scratch[offset+3] & 0xf0) | ((new_contents & 0x0f000000) >> 24); - // Note well from the above: Per Microsoft's guidelines we preserve the upper - // 4 bits of the FAT32 cluster value. It's unclear what these bits will be used - // for; in every example I've encountered they are always zero. - result = DFS_WriteSector(volinfo->unit, scratch, *scratchcache, 1); - // mirror the FAT into copy 2 - if (DFS_OK == result) - result = DFS_WriteSector(volinfo->unit, scratch, (*scratchcache)+volinfo->secperfat, 1); - } - else - result = DFS_ERRMISC; - - return result; -} - -/* - Convert a filename element from canonical (8.3) to directory entry (11) form - src must point to the first non-separator character. - dest must point to a 12-byte buffer. -*/ -uint8_t *DFS_CanonicalToDir(uint8_t *dest, uint8_t *src) -{ - uint8_t *destptr = dest; - - memset(dest, ' ', 11); - dest[11] = 0; - - while (*src && (*src != DIR_SEPARATOR) && (destptr - dest < 11)) { - if (*src >= 'a' && *src <='z') { - *destptr++ = (*src - 'a') + 'A'; - src++; - } - else if (*src == '.') { - src++; - destptr = dest + 8; - } - else { - *destptr++ = *src++; - } - } - - return dest; -} - -/* - Find the first unused FAT entry - You must provide a scratch buffer for one sector (SECTOR_SIZE) and a populated VOLINFO - Returns a FAT32 BAD_CLUSTER value for any error, otherwise the contents of the desired - FAT entry. - Returns FAT32 bad_sector (0x0ffffff7) if there is no free cluster available -*/ -uint32_t DFS_GetFreeFAT(PVOLINFO volinfo, uint8_t *scratch) -{ - uint32_t i, result = 0xffffffff, scratchcache = 0; - - -#ifdef DEBUG_DOSFS - printf("DFS_GetFreeFAT\r\n"); -#endif - - // Search starts at cluster 2, which is the first usable cluster - // NOTE: This search can't terminate at a bad cluster, because there might - // legitimately be bad clusters on the disk. - for (i=2; i < volinfo->numclusters; i++) { - result = DFS_GetFAT(volinfo, scratch, &scratchcache, i); - if (!result) { - return i; - } - } - return 0x0ffffff7; // Can't find a free cluster -} - - -/* - Open a directory for enumeration by DFS_GetNextDirEnt - You must supply a populated VOLINFO (see DFS_GetVolInfo) - ** you must also make sure dirinfo->scratch is valid in the dirinfo you pass it** //reza - The empty string or a string containing only the directory separator are - considered to be the root directory. - Returns 0 OK, nonzero for any error. -*/ -uint32_t DFS_OpenDir(PVOLINFO volinfo, uint8_t *dirname, PDIRINFO dirinfo) -{ - // Default behavior is a regular search for existing entries - dirinfo->flags = 0; -#ifdef DEBUG_DOSFS - printf("DFS_OpenDir\r\n"); -#endif - - if (!strlen((char *) dirname) || (strlen((char *) dirname) == 1 && dirname[0] == DIR_SEPARATOR)) { - if (volinfo->filesystem == FAT32) { - dirinfo->currentcluster = volinfo->rootdir; - dirinfo->currentsector = 0; - dirinfo->currententry = 0; - - // read first sector of directory - return DFS_ReadSector(volinfo->unit, dirinfo->scratch, volinfo->dataarea + ((volinfo->rootdir - 2) * volinfo->secperclus), 1); - } - else { - dirinfo->currentcluster = 0; - dirinfo->currentsector = 0; - dirinfo->currententry = 0; - - // read first sector of directory - return DFS_ReadSector(volinfo->unit, dirinfo->scratch, volinfo->rootdir, 1); - } - } - - // This is not the root directory. We need to find the start of this subdirectory. - // We do this by devious means, using our own companion function DFS_GetNext. - else { - uint8_t tmpfn[12]; - uint8_t *ptr = dirname; - uint32_t result; - DIRENT de; - - if (volinfo->filesystem == FAT32) { - dirinfo->currentcluster = volinfo->rootdir; - dirinfo->currentsector = 0; - dirinfo->currententry = 0; - - // read first sector of directory - if (DFS_ReadSector(volinfo->unit, dirinfo->scratch, volinfo->dataarea + ((volinfo->rootdir - 2) * volinfo->secperclus), 1)) - return DFS_ERRMISC; - } - else { - dirinfo->currentcluster = 0; - dirinfo->currentsector = 0; - dirinfo->currententry = 0; - - // read first sector of directory - if (DFS_ReadSector(volinfo->unit, dirinfo->scratch, volinfo->rootdir, 1)) - return DFS_ERRMISC; - } - - // skip leading path separators - while (*ptr == DIR_SEPARATOR && *ptr) - ptr++; - - // Scan the path from left to right, finding the start cluster of each entry - // Observe that this code is inelegant, but obviates the need for recursion. - while (*ptr) { - DFS_CanonicalToDir(tmpfn, ptr); - - de.name[0] = 0; - - do { - result = DFS_GetNext(volinfo, dirinfo, &de); - } while (!result && memcmp(de.name, tmpfn, 11)); - - if (!memcmp(de.name, tmpfn, 11) && ((de.attr & ATTR_DIRECTORY) == ATTR_DIRECTORY)) { - if (volinfo->filesystem == FAT32) { - dirinfo->currentcluster = (uint32_t) de.startclus_l_l | - ((uint32_t) de.startclus_l_h) << 8 | - ((uint32_t) de.startclus_h_l) << 16 | - ((uint32_t) de.startclus_h_h) << 24; - } - else { - dirinfo->currentcluster = (uint32_t) de.startclus_l_l | - ((uint32_t) de.startclus_l_h) << 8; - } - dirinfo->currentsector = 0; - dirinfo->currententry = 0; - - if (DFS_ReadSector(volinfo->unit, dirinfo->scratch, volinfo->dataarea + ((dirinfo->currentcluster - 2) * volinfo->secperclus), 1)) - return DFS_ERRMISC; - } - else if (!memcmp(de.name, tmpfn, 11) && !(de.attr & ATTR_DIRECTORY)) - return DFS_NOTFOUND; - - // seek to next item in list - while (*ptr != DIR_SEPARATOR && *ptr) - ptr++; - if (*ptr == DIR_SEPARATOR) - ptr++; - } - - if (!dirinfo->currentcluster) - return DFS_NOTFOUND; - } - return DFS_OK; -} - -/* - Get next entry in opened directory structure. Copies fields into the dirent - structure, updates dirinfo. Note that it is the _caller's_ responsibility to - handle the '.' and '..' entries. - A deleted file will be returned as a NULL entry (first char of filename=0) - by this code. Filenames beginning with 0x05 will be translated to 0xE5 - automatically. Long file name entries will be returned as NULL. - returns DFS_EOF if there are no more entries, DFS_OK if this entry is valid, - or DFS_ERRMISC for a media error -*/ -uint32_t DFS_GetNext(PVOLINFO volinfo, PDIRINFO dirinfo, PDIRENT dirent) -{ - uint32_t tempint; // required by DFS_GetFAT - -#ifdef DEBUG_DOSFS - printf("DFS_GetNext\r\n"); -#endif - - // Do we need to read the next sector of the directory? - if (dirinfo->currententry >= SECTOR_SIZE / sizeof(DIRENT)) { - dirinfo->currententry = 0; - dirinfo->currentsector++; - - // Root directory; special case handling - // Note that currentcluster will only ever be zero if both: - // (a) this is the root directory, and - // (b) we are on a FAT12/16 volume, where the root dir can't be expanded - if (dirinfo->currentcluster == 0) { - // Trying to read past end of root directory? - if (dirinfo->currentsector * (SECTOR_SIZE / sizeof(DIRENT)) >= volinfo->rootentries) - return DFS_EOF; - - // Otherwise try to read the next sector - if (DFS_ReadSector(volinfo->unit, dirinfo->scratch, volinfo->rootdir + dirinfo->currentsector, 1)) - return DFS_ERRMISC; - } - - // Normal handling - else { - if (dirinfo->currentsector >= volinfo->secperclus) { - dirinfo->currentsector = 0; - if ((dirinfo->currentcluster >= 0xff7 && volinfo->filesystem == FAT12) || - (dirinfo->currentcluster >= 0xfff7 && volinfo->filesystem == FAT16) || - (dirinfo->currentcluster >= 0x0ffffff7 && volinfo->filesystem == FAT32)) { - - // We are at the end of the directory chain. If this is a normal - // find operation, we should indicate that there is nothing more - // to see. - if (!(dirinfo->flags & DFS_DI_BLANKENT)) - return DFS_EOF; - - // On the other hand, if this is a "find free entry" search, - // we need to tell the caller to allocate a new cluster - else - return DFS_ALLOCNEW; - } - dirinfo->currentcluster = DFS_GetFAT(volinfo, dirinfo->scratch, &tempint, dirinfo->currentcluster); - } - if (DFS_ReadSector(volinfo->unit, dirinfo->scratch, volinfo->dataarea + ((dirinfo->currentcluster - 2) * volinfo->secperclus) + dirinfo->currentsector, 1)) - return DFS_ERRMISC; - } - } - - memcpy(dirent, &(((PDIRENT) dirinfo->scratch)[dirinfo->currententry]), sizeof(DIRENT)); - - if (dirent->name[0] == 0) { // no more files in this directory - // If this is a "find blank" then we can reuse this name. -#if 0 - if (dirinfo->flags & DFS_DI_BLANKENT) - return DFS_OK; -#else - - // TK: DFS_GetFreeDirEnt() expects that currententry has been incremented by 1 - if (dirinfo->flags & DFS_DI_BLANKENT) { - dirinfo->currententry++; - return DFS_OK; - } -#endif - - else - return DFS_EOF; - } - - if (dirent->name[0] == 0xe5) // handle deleted file entries - dirent->name[0] = 0; -#if 1 - // TK: ensure that DFS_GetFreeDirEnt() doesn't return entries with long name - else if( dirinfo->flags & DFS_DI_BLANKENT ) - {} // do nothing.. -#endif - - else if ((dirent->attr & ATTR_LONG_NAME) == ATTR_LONG_NAME) - dirent->name[0] = 0; - else if (dirent->name[0] == 0x05) // handle kanji filenames beginning with 0xE5 - dirent->name[0] = 0xe5; - - dirinfo->currententry++; - - return DFS_OK; -} - -/* - INTERNAL - Find a free directory entry in the directory specified by path - This function MAY cause a disk write if it is necessary to extend the directory - size. - Note - di.scratch must be preinitialized to point to a sector scratch buffer - de is a scratch structure - Returns DFS_ERRMISC if a new entry could not be located or created - de is updated with the same return information you would expect from DFS_GetNext -*/ -uint32_t DFS_GetFreeDirEnt(PVOLINFO volinfo, uint8_t *path, PDIRINFO di, PDIRENT de) -{ - uint32_t tempclus=0,i=0; -#ifdef DEBUG_DOSFS - printf("DFS_GetFreeDirEnt\r\n"); -#endif - - if (DFS_OpenDir(volinfo, path, di)) - return DFS_NOTFOUND; - - // Set "search for empty" flag so DFS_GetNext knows what we're doing - di->flags |= DFS_DI_BLANKENT; - - // We seek through the directory looking for an empty entry - // Note we are reusing tempclus as a temporary result holder. - tempclus = 0; - do { - tempclus = DFS_GetNext(volinfo, di, de); - - // Empty entry found - if (tempclus == DFS_OK && (!de->name[0])) { - return DFS_OK; - } - - // End of root directory reached - else if (tempclus == DFS_EOF) - return DFS_ERRMISC; - - else if (tempclus == DFS_ALLOCNEW) { - tempclus = DFS_GetFreeFAT(volinfo, di->scratch); - if (tempclus == 0x0ffffff7) - return DFS_ERRMISC; - - // write out zeroed sectors to the new cluster - memset(di->scratch, 0, SECTOR_SIZE); - for (i=0;isecperclus;i++) { - if (DFS_WriteSector(volinfo->unit, di->scratch, volinfo->dataarea + ((tempclus - 2) * volinfo->secperclus) + i, 1)) - return DFS_ERRMISC; - } - // Point old end cluster to newly allocated cluster - i = 0; - DFS_SetFAT(volinfo, di->scratch, &i, di->currentcluster, tempclus); - - // Update DIRINFO so caller knows where to place the new file - di->currentcluster = tempclus; - di->currentsector = 0; - di->currententry = 1; // since the code coming after this expects to subtract 1 - - // Mark newly allocated cluster as end of chain - switch(volinfo->filesystem) { - case FAT12: tempclus = 0xff8; break; - case FAT16: tempclus = 0xfff8; break; - case FAT32: tempclus = 0x0ffffff8; break; - default: return DFS_ERRMISC; - } - DFS_SetFAT(volinfo, di->scratch, &i, di->currentcluster, tempclus); - } - } while (!tempclus); - - // We shouldn't get here - return DFS_ERRMISC; -} - -/* - Open a file for reading or writing. You supply populated VOLINFO, a path to the file, - mode (DFS_READ or DFS_WRITE) and an empty fileinfo structure. You also need to - provide a pointer to a sector-sized scratch buffer. - Returns various DFS_* error states. If the result is DFS_OK, fileinfo can be used - to access the file from this point on. -*/ -uint32_t DFS_OpenFile(PVOLINFO volinfo, uint8_t *path, uint8_t mode, uint8_t *scratch, PFILEINFO fileinfo) -{ - uint8_t tmppath[MAX_PATH]; - uint8_t filename[12]; - uint8_t *p; - DIRINFO di; - DIRENT de; - uint32_t temp; -#ifdef DEBUG_DOSFS - printf("DFS_OpenFile\r\n"); -#endif - - // larwe 2006-09-16 +1 zero out file structure - memset(fileinfo, 0, sizeof(FILEINFO)); - - // save access mode - fileinfo->mode = mode; - - // Get a local copy of the path. If it's longer than MAX_PATH, abort. - strncpy((char *) tmppath, (char *) path, MAX_PATH); - tmppath[MAX_PATH - 1] = 0; - if (strcmp((char *) path,(char *) tmppath)) { - return DFS_PATHLEN; - } - - // strip leading path separators - while (tmppath[0] == DIR_SEPARATOR) - strcpy((char *) tmppath, (char *) tmppath + 1); - - // Parse filename off the end of the supplied path - p = tmppath; - while (*(p++)); - - p--; - while (p > tmppath && *p != DIR_SEPARATOR) // larwe 9/16/06 ">=" to ">" bugfix - p--; - if (*p == DIR_SEPARATOR) - p++; - - DFS_CanonicalToDir(filename, p); - - if (p > tmppath) - p--; - if (*p == DIR_SEPARATOR || p == tmppath) // larwe 9/16/06 +"|| p == tmppath" bugfix - *p = 0; - - // At this point, if our path was MYDIR/MYDIR2/FILE.EXT, filename = "FILE EXT" and - // tmppath = "MYDIR/MYDIR2". - di.scratch = scratch; - if (DFS_OpenDir(volinfo, tmppath, &di)) - return DFS_NOTFOUND; - - while (!DFS_GetNext(volinfo, &di, &de)) { - if (!memcmp(de.name, filename, 11)) { - // You can't use this function call to open a directory. - if (de.attr & ATTR_DIRECTORY) - return DFS_NOTFOUND; - - fileinfo->volinfo = volinfo; - fileinfo->pointer = 0; - // The reason we store this extra info about the file is so that we can - // speedily update the file size, modification date, etc. on a file that is - // opened for writing. - if (di.currentcluster == 0) - fileinfo->dirsector = volinfo->rootdir + di.currentsector; - else - fileinfo->dirsector = volinfo->dataarea + ((di.currentcluster - 2) * volinfo->secperclus) + di.currentsector; - fileinfo->diroffset = di.currententry - 1; - if (volinfo->filesystem == FAT32) { - fileinfo->cluster = (uint32_t) de.startclus_l_l | - ((uint32_t) de.startclus_l_h) << 8 | - ((uint32_t) de.startclus_h_l) << 16 | - ((uint32_t) de.startclus_h_h) << 24; - } - else { - fileinfo->cluster = (uint32_t) de.startclus_l_l | - ((uint32_t) de.startclus_l_h) << 8; - } - fileinfo->firstcluster = fileinfo->cluster; - fileinfo->filelen = (uint32_t) de.filesize_0 | - ((uint32_t) de.filesize_1) << 8 | - ((uint32_t) de.filesize_2) << 16 | - ((uint32_t) de.filesize_3) << 24; - - return DFS_OK; - } - } - - // At this point, we KNOW the file does not exist. If the file was opened - // with write access, we can create it. - if (mode & DFS_WRITE) { - uint32_t cluster; - - // Locate or create a directory entry for this file - if (DFS_OK != DFS_GetFreeDirEnt(volinfo, tmppath, &di, &de)) - return DFS_ERRMISC; - - // put sane values in the directory entry - memset(&de, 0, sizeof(de)); - memcpy(de.name, filename, 11); - de.crttime_l = 0x20; // 01:01:00am, Jan 1, 2006. - de.crttime_h = 0x08; - de.crtdate_l = 0x11; - de.crtdate_h = 0x34; - de.lstaccdate_l = 0x11; - de.lstaccdate_h = 0x34; - de.wrttime_l = 0x20; - de.wrttime_h = 0x08; - de.wrtdate_l = 0x11; - de.wrtdate_h = 0x34; - - // allocate a starting cluster for the directory entry - cluster = DFS_GetFreeFAT(volinfo, scratch); - - de.startclus_l_l = cluster & 0xff; - de.startclus_l_h = (cluster & 0xff00) >> 8; - de.startclus_h_l = (cluster & 0xff0000) >> 16; - de.startclus_h_h = (cluster & 0xff000000) >> 24; - - // update FILEINFO for our caller's sake - fileinfo->volinfo = volinfo; - fileinfo->pointer = 0; - // The reason we store this extra info about the file is so that we can - // speedily update the file size, modification date, etc. on a file that is - // opened for writing. - if (di.currentcluster == 0) - fileinfo->dirsector = volinfo->rootdir + di.currentsector; - else - fileinfo->dirsector = volinfo->dataarea + ((di.currentcluster - 2) * volinfo->secperclus) + di.currentsector; - fileinfo->diroffset = di.currententry - 1; - fileinfo->cluster = cluster; - fileinfo->firstcluster = cluster; - fileinfo->filelen = 0; - - // write the directory entry - // note that we no longer have the sector containing the directory entry, - // tragically, so we have to re-read it - if (DFS_ReadSector(volinfo->unit, scratch, fileinfo->dirsector, 1)) - return DFS_ERRMISC; - memcpy(&(((PDIRENT) scratch)[di.currententry-1]), &de, sizeof(DIRENT)); - if (DFS_WriteSector(volinfo->unit, scratch, fileinfo->dirsector, 1)) - return DFS_ERRMISC; - - // Mark newly allocated cluster as end of chain - switch(volinfo->filesystem) { - case FAT12: cluster = 0xff8; break; - case FAT16: cluster = 0xfff8; break; - case FAT32: cluster = 0x0ffffff8; break; - default: return DFS_ERRMISC; - } - temp = 0; - DFS_SetFAT(volinfo, scratch, &temp, fileinfo->cluster, cluster); - - return DFS_OK; - } - - return DFS_NOTFOUND; -} - -/* - Read an open file - You must supply a prepopulated FILEINFO as provided by DFS_OpenFile, and a - pointer to a SECTOR_SIZE scratch buffer. - Note that returning DFS_EOF is not an error condition. This function updates the - successcount field with the number of bytes actually read. -*/ -uint32_t DFS_ReadFile(PFILEINFO fileinfo, uint8_t *scratch, uint8_t *buffer, uint32_t *successcount, uint32_t len) -{ - uint32_t remain=0; - uint32_t result = DFS_OK; - uint32_t sector=0; - uint32_t bytesread=0; -#ifdef DEBUG_DOSFS - printf("DFS_ReadFile\r\n"); -#endif - - // Don't try to read past EOF - if (len > fileinfo->filelen - fileinfo->pointer) - len = fileinfo->filelen - fileinfo->pointer; - - remain = len; - *successcount = 0; - - while (remain && result == DFS_OK) { - // This is a bit complicated. The sector we want to read is addressed at a cluster - // granularity by the fileinfo->cluster member. The file pointer tells us how many - // extra sectors to add to that number. - sector = fileinfo->volinfo->dataarea + - ((fileinfo->cluster - 2) * fileinfo->volinfo->secperclus) + - div(div(fileinfo->pointer,fileinfo->volinfo->secperclus * SECTOR_SIZE).rem, SECTOR_SIZE).quot; - - // Case 1 - File pointer is not on a sector boundary - if (div(fileinfo->pointer, SECTOR_SIZE).rem) { - uint16_t tempreadsize; - - // We always have to go through scratch in this case - result = DFS_ReadSector(fileinfo->volinfo->unit, scratch, sector, 1); - - // This is the number of bytes that we actually care about in the sector - // just read. - tempreadsize = SECTOR_SIZE - (div(fileinfo->pointer, SECTOR_SIZE).rem); - - // Case 1A - We want the entire remainder of the sector. After this - // point, all passes through the read loop will be aligned on a sector - // boundary, which allows us to go through the optimal path 2A below. - if (remain >= tempreadsize) { - memcpy(buffer, scratch + (SECTOR_SIZE - tempreadsize), tempreadsize); - bytesread = tempreadsize; - buffer += tempreadsize; - fileinfo->pointer += tempreadsize; - remain -= tempreadsize; - } - // Case 1B - This read concludes the file read operation - else { - memcpy(buffer, scratch + (SECTOR_SIZE - tempreadsize), remain); - - buffer += remain; - fileinfo->pointer += remain; - bytesread = remain; - remain = 0; - } - } - // Case 2 - File pointer is on sector boundary - else { - // Case 2A - We have at least one more full sector to read and don't have - // to go through the scratch buffer. You could insert optimizations here to - // read multiple sectors at a time, if you were thus inclined (note that - // the maximum multi-read you could perform is a single cluster, so it would - // be advantageous to have code similar to case 1A above that would round the - // pointer to a cluster boundary the first pass through, so all subsequent - // [large] read requests would be able to go a cluster at a time). - if (remain >= SECTOR_SIZE) { - result = DFS_ReadSector(fileinfo->volinfo->unit, buffer, sector, 1); - remain -= SECTOR_SIZE; - buffer += SECTOR_SIZE; - fileinfo->pointer += SECTOR_SIZE; - bytesread = SECTOR_SIZE; - } - // Case 2B - We are only reading a partial sector - else { - result = DFS_ReadSector(fileinfo->volinfo->unit, scratch, sector, 1); - memcpy(buffer, scratch, remain); - buffer += remain; - fileinfo->pointer += remain; - bytesread = remain; - remain = 0; - } - } - - *successcount += bytesread; - - // check to see if we stepped over a cluster boundary - if (div(fileinfo->pointer - bytesread, fileinfo->volinfo->secperclus * SECTOR_SIZE).quot != - div(fileinfo->pointer, fileinfo->volinfo->secperclus * SECTOR_SIZE).quot) { - // An act of minor evil - we use bytesread as a scratch integer, knowing that - // its value is not used after updating *successcount above - bytesread = 0; - if (((fileinfo->volinfo->filesystem == FAT12) && (fileinfo->cluster >= 0xff8)) || - ((fileinfo->volinfo->filesystem == FAT16) && (fileinfo->cluster >= 0xfff8)) || - ((fileinfo->volinfo->filesystem == FAT32) && (fileinfo->cluster >= 0x0ffffff8))) - result = DFS_EOF; - else - fileinfo->cluster = DFS_GetFAT(fileinfo->volinfo, scratch, &bytesread, fileinfo->cluster); - } - } - - return result; -} - -/* - Seek file pointer to a given position - This function does not return status - refer to the fileinfo->pointer value - to see where the pointer wound up. - Requires a SECTOR_SIZE scratch buffer -*/ -void DFS_Seek(PFILEINFO fileinfo, uint32_t offset, uint8_t *scratch) -{ - uint32_t tempint; - uint16_t endcluster=0; //canny/reza 5/7 fixed -#ifdef DEBUG_DOSFS - printf("DFS_Seek\r\n"); -#endif - - // larwe 9/16/06 bugfix split case 0a/0b and changed fallthrough handling - // Case 0a - Return immediately for degenerate case - if (offset == fileinfo->pointer) { - return; - } - - // Case 0b - Don't allow the user to seek past the end of the file - if (offset > fileinfo->filelen) { - offset = fileinfo->filelen; - // NOTE NO RETURN HERE! - } - - // Case 1 - Simple rewind to start - // Note _intentional_ fallthrough from Case 0b above - if (offset == 0) { - fileinfo->cluster = fileinfo->firstcluster; - fileinfo->pointer = 0; - return; // larwe 9/16/06 +1 bugfix - } - // Case 2 - Seeking backwards. Need to reset and seek forwards - else if (offset < fileinfo->pointer) { - fileinfo->cluster = fileinfo->firstcluster; - fileinfo->pointer = 0; - // NOTE NO RETURN HERE! - } - - // Case 3 - Seeking forwards - // Note _intentional_ fallthrough from Case 2 above - // Case 3a - Seek size does not cross cluster boundary - - // very simple case - // larwe 9/16/06 changed .rem to .quot in both div calls, bugfix - if (div(fileinfo->pointer, fileinfo->volinfo->secperclus * SECTOR_SIZE).quot == - div(fileinfo->pointer + offset, fileinfo->volinfo->secperclus * SECTOR_SIZE).quot) { - fileinfo->pointer = offset; - } - // Case 3b - Seeking across cluster boundary(ies) - else { - // round file pointer down to cluster boundary - fileinfo->pointer = div(fileinfo->pointer, fileinfo->volinfo->secperclus * SECTOR_SIZE).quot * - fileinfo->volinfo->secperclus * SECTOR_SIZE; - - // seek by clusters - // larwe 9/30/06 bugfix changed .rem to .quot in both div calls - // canny/reza 5/7 added endcluster related code - // TK 2008-12-18: fixed endcluster calculation - // old: endcluster = div(fileinfo->pointer + offset, fileinfo->volinfo->secperclus * SECTOR_SIZE).quot; - endcluster = div(offset, fileinfo->volinfo->secperclus * SECTOR_SIZE).quot; - while (div(fileinfo->pointer, fileinfo->volinfo->secperclus * SECTOR_SIZE).quot !=endcluster) { - fileinfo->cluster = DFS_GetFAT(fileinfo->volinfo, scratch, &tempint, fileinfo->cluster); - // Abort if there was an error - if (fileinfo->cluster == 0x0ffffff7) { - fileinfo->pointer = 0; - fileinfo->cluster = fileinfo->firstcluster; - return; - } - fileinfo->pointer += SECTOR_SIZE * fileinfo->volinfo->secperclus; - } - - // since we know the cluster is right, we have no more work to do - fileinfo->pointer = offset; - } -} - -/* - Delete a file - scratch must point to a sector-sized buffer -*/ -uint32_t DFS_UnlinkFile(PVOLINFO volinfo, uint8_t *path, uint8_t *scratch) -{ - // PDIRENT de = (PDIRENT) scratch; - FILEINFO fi; - uint32_t cache = 0; - uint32_t tempclus = 0; - -#ifdef DEBUG_DOSFS - printf("DFS_UnlinkFile\r\n"); -#endif - - // DFS_OpenFile gives us all the information we need to delete it - if (DFS_OK != DFS_OpenFile(volinfo, path, DFS_READ, scratch, &fi)) - return DFS_NOTFOUND; - - // First, read the directory sector and delete that entry - if (DFS_ReadSector(volinfo->unit, scratch, fi.dirsector, 1)) - return DFS_ERRMISC; - ((PDIRENT) scratch)[fi.diroffset].name[0] = 0xe5; - if (DFS_WriteSector(volinfo->unit, scratch, fi.dirsector, 1)) - return DFS_ERRMISC; - - // Now follow the cluster chain to free the file space - while (!((volinfo->filesystem == FAT12 && fi.firstcluster >= 0x0ff7) || - (volinfo->filesystem == FAT16 && fi.firstcluster >= 0xfff7) || - (volinfo->filesystem == FAT32 && fi.firstcluster >= 0x0ffffff7))) { - tempclus = fi.firstcluster; - - fi.firstcluster = DFS_GetFAT(volinfo, scratch, &cache, fi.firstcluster); - DFS_SetFAT(volinfo, scratch, &cache, tempclus, 0); - - } - return DFS_OK; -} - - -/* - Write an open file - You must supply a prepopulated FILEINFO as provided by DFS_OpenFile, and a - pointer to a SECTOR_SIZE scratch buffer. - This function updates the successcount field with the number of bytes actually written. -*/ -uint32_t DFS_WriteFile(PFILEINFO fileinfo, uint8_t *scratch, uint8_t *buffer, uint32_t *successcount, uint32_t len) -{ - uint32_t remain=0; - uint32_t result = DFS_OK; - uint32_t sector=0; - uint32_t byteswritten=0; -#ifdef DEBUG_DOSFS - printf("DFS_WriteFile\r\n"); -#endif - - - // Don't allow writes to a file that's open as readonly - if (!(fileinfo->mode & DFS_WRITE)) - return DFS_ERRMISC; - - remain = len; - *successcount = 0; - - while (remain && result == DFS_OK) { - // This is a bit complicated. The sector we want to read is addressed at a cluster - // granularity by the fileinfo->cluster member. The file pointer tells us how many - // extra sectors to add to that number. - sector = fileinfo->volinfo->dataarea + - ((fileinfo->cluster - 2) * fileinfo->volinfo->secperclus) + - div(div(fileinfo->pointer,fileinfo->volinfo->secperclus * SECTOR_SIZE).rem, SECTOR_SIZE).quot; - - // Case 1 - File pointer is not on a sector boundary - if (div(fileinfo->pointer, SECTOR_SIZE).rem) { - uint16_t tempsize; - - // We always have to go through scratch in this case - result = DFS_ReadSector(fileinfo->volinfo->unit, scratch, sector, 1); - - // This is the number of bytes that we don't want to molest in the - // scratch sector just read. - tempsize = div(fileinfo->pointer, SECTOR_SIZE).rem; - - // Case 1A - We are writing the entire remainder of the sector. After - // this point, all passes through the read loop will be aligned on a - // sector boundary, which allows us to go through the optimal path - // 2A below. - if (remain >= SECTOR_SIZE - tempsize) { - memcpy(scratch + tempsize, buffer, SECTOR_SIZE - tempsize); - if (!result) - result = DFS_WriteSector(fileinfo->volinfo->unit, scratch, sector, 1); - - byteswritten = SECTOR_SIZE - tempsize; - buffer += SECTOR_SIZE - tempsize; - fileinfo->pointer += SECTOR_SIZE - tempsize; - if (fileinfo->filelen < fileinfo->pointer) { - fileinfo->filelen = fileinfo->pointer; - } - remain -= SECTOR_SIZE - tempsize; - } - // Case 1B - This concludes the file write operation - else { - memcpy(scratch + tempsize, buffer, remain); - if (!result) - result = DFS_WriteSector(fileinfo->volinfo->unit, scratch, sector, 1); - - buffer += remain; - fileinfo->pointer += remain; - if (fileinfo->filelen < fileinfo->pointer) { - fileinfo->filelen = fileinfo->pointer; - } - byteswritten = remain; - remain = 0; - } - } // case 1 - // Case 2 - File pointer is on sector boundary - else { - // Case 2A - We have at least one more full sector to write and don't have - // to go through the scratch buffer. You could insert optimizations here to - // write multiple sectors at a time, if you were thus inclined. Refer to - // similar notes in DFS_ReadFile. - if (remain >= SECTOR_SIZE) { - result = DFS_WriteSector(fileinfo->volinfo->unit, buffer, sector, 1); - remain -= SECTOR_SIZE; - buffer += SECTOR_SIZE; - fileinfo->pointer += SECTOR_SIZE; - if (fileinfo->filelen < fileinfo->pointer) { - fileinfo->filelen = fileinfo->pointer; - } - byteswritten = SECTOR_SIZE; - } - // Case 2B - We are only writing a partial sector and potentially need to - // go through the scratch buffer. - else { - // If the current file pointer is not yet at or beyond the file - // length, we are writing somewhere in the middle of the file and - // need to load the original sector to do a read-modify-write. - if (fileinfo->pointer < fileinfo->filelen) { - result = DFS_ReadSector(fileinfo->volinfo->unit, scratch, sector, 1); - if (!result) { - memcpy(scratch, buffer, remain); - result = DFS_WriteSector(fileinfo->volinfo->unit, scratch, sector, 1); - } - } - else { - result = DFS_WriteSector(fileinfo->volinfo->unit, buffer, sector, 1); - } - - buffer += remain; - fileinfo->pointer += remain; - if (fileinfo->filelen < fileinfo->pointer) { - fileinfo->filelen = fileinfo->pointer; - } - byteswritten = remain; - remain = 0; - } - } - - *successcount += byteswritten; - - // check to see if we stepped over a cluster boundary - if (div(fileinfo->pointer - byteswritten, fileinfo->volinfo->secperclus * SECTOR_SIZE).quot != - div(fileinfo->pointer, fileinfo->volinfo->secperclus * SECTOR_SIZE).quot) { - uint32_t lastcluster; - - // We've transgressed into another cluster. If we were already at EOF, - // we need to allocate a new cluster. - // An act of minor evil - we use byteswritten as a scratch integer, knowing - // that its value is not used after updating *successcount above - byteswritten = 0; - - lastcluster = fileinfo->cluster; - fileinfo->cluster = DFS_GetFAT(fileinfo->volinfo, scratch, &byteswritten, fileinfo->cluster); - - // Allocate a new cluster? - if (((fileinfo->volinfo->filesystem == FAT12) && (fileinfo->cluster >= 0xff8)) || - ((fileinfo->volinfo->filesystem == FAT16) && (fileinfo->cluster >= 0xfff8)) || - ((fileinfo->volinfo->filesystem == FAT32) && (fileinfo->cluster >= 0x0ffffff8))) { - uint32_t tempclus; - - tempclus = DFS_GetFreeFAT(fileinfo->volinfo, scratch); - byteswritten = 0; // invalidate cache - if (tempclus == 0x0ffffff7) - return DFS_ERRMISC; - - // Link new cluster onto file - DFS_SetFAT(fileinfo->volinfo, scratch, &byteswritten, lastcluster, tempclus); - fileinfo->cluster = tempclus; - - // Mark newly allocated cluster as end of chain - switch(fileinfo->volinfo->filesystem) { - case FAT12: tempclus = 0xff8; break; - case FAT16: tempclus = 0xfff8; break; - case FAT32: tempclus = 0x0ffffff8; break; - default: return DFS_ERRMISC; - } - DFS_SetFAT(fileinfo->volinfo, scratch, &byteswritten, fileinfo->cluster, tempclus); - - result = DFS_OK; - } - // No else clause is required. - } - } - - // Update directory entry - if (DFS_ReadSector(fileinfo->volinfo->unit, scratch, fileinfo->dirsector, 1)) - return DFS_ERRMISC; - ((PDIRENT) scratch)[fileinfo->diroffset].filesize_0 = fileinfo->filelen & 0xff; - ((PDIRENT) scratch)[fileinfo->diroffset].filesize_1 = (fileinfo->filelen & 0xff00) >> 8; - ((PDIRENT) scratch)[fileinfo->diroffset].filesize_2 = (fileinfo->filelen & 0xff0000) >> 16; - ((PDIRENT) scratch)[fileinfo->diroffset].filesize_3 = (fileinfo->filelen & 0xff000000) >> 24; - if (DFS_WriteSector(fileinfo->volinfo->unit, scratch, fileinfo->dirsector, 1)) - return DFS_ERRMISC; - return result; -} - - -/* -// TK: added 2009-02-12 - Close a file - No original function of DosFS driver - It has no effect if writing to SD Card, it's only used by the DosFS wrapper in emulation -*/ -uint32_t DFS_Close(PFILEINFO fileinfo) -{ - return DFS_OK; -} - diff --git a/flight/PiOS/STM32F10x/Libraries/dosfs/dosfs.h b/flight/PiOS/STM32F10x/Libraries/dosfs/dosfs.h deleted file mode 100644 index e255f8ae3..000000000 --- a/flight/PiOS/STM32F10x/Libraries/dosfs/dosfs.h +++ /dev/null @@ -1,405 +0,0 @@ -/* - DOSFS Embedded FAT-Compatible Filesystem - (C) 2005 Lewin A.R.W. Edwards (sysadm@zws.com) -*/ - -#ifndef _DOSFS_H -#define _DOSFS_H - -#include - -//=================================================================== -// User-supplied functions -uint32_t DFS_ReadSector(uint8_t unit, uint8_t *buffer, uint32_t sector, uint32_t count); -uint32_t DFS_WriteSector(uint8_t unit, uint8_t *buffer, uint32_t sector, uint32_t count); - - -//=================================================================== -// Configurable items -#define MAX_PATH 64 // Maximum path length (increasing this will - // GREATLY increase stack requirements!) -#define DIR_SEPARATOR '/' // character separating directory components - -// End of configurable items -//=================================================================== - -//=================================================================== -// 32-bit error codes -#define DFS_OK 0 // no error -#define DFS_EOF 1 // end of file (not an error) -#define DFS_WRITEPROT 2 // volume is write protected -#define DFS_NOTFOUND 3 // path or file not found -#define DFS_PATHLEN 4 // path too long -#define DFS_ALLOCNEW 5 // must allocate new directory cluster -#define DFS_ERRMISC 0xffffffff // generic error - -//=================================================================== -// File access modes -#define DFS_READ 1 // read-only -#define DFS_WRITE 2 // write-only - -//=================================================================== -// Miscellaneous constants -#define SECTOR_SIZE 512 // sector size in bytes - -//=================================================================== -// Internal subformat identifiers -#define FAT12 0 -#define FAT16 1 -#define FAT32 2 - -//=================================================================== -// DOS attribute bits -#define ATTR_READ_ONLY 0x01 -#define ATTR_HIDDEN 0x02 -#define ATTR_SYSTEM 0x04 -#define ATTR_VOLUME_ID 0x08 -#define ATTR_DIRECTORY 0x10 -#define ATTR_ARCHIVE 0x20 -#define ATTR_LONG_NAME (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID) - - -/* - Directory entry structure - note: if name[0] == 0xe5, this is a free dir entry - if name[0] == 0x00, this is a free entry and all subsequent entries are free - if name[0] == 0x05, the first character of the name is 0xe5 [a kanji nicety] - - Date format: bit 0-4 = day of month (1-31) - bit 5-8 = month, 1=Jan..12=Dec - bit 9-15 = count of years since 1980 (0-127) - Time format: bit 0-4 = 2-second count, (0-29) - bit 5-10 = minutes (0-59) - bit 11-15= hours (0-23) -*/ -typedef struct _tagDIRENT { - uint8_t name[11]; // filename - uint8_t attr; // attributes (see ATTR_* constant definitions) - uint8_t reserved; // reserved, must be 0 - uint8_t crttimetenth; // create time, 10ths of a second (0-199 are valid) - uint8_t crttime_l; // creation time low byte - uint8_t crttime_h; // creation time high byte - uint8_t crtdate_l; // creation date low byte - uint8_t crtdate_h; // creation date high byte - uint8_t lstaccdate_l; // last access date low byte - uint8_t lstaccdate_h; // last access date high byte - uint8_t startclus_h_l; // high word of first cluster, low byte (FAT32) - uint8_t startclus_h_h; // high word of first cluster, high byte (FAT32) - uint8_t wrttime_l; // last write time low byte - uint8_t wrttime_h; // last write time high byte - uint8_t wrtdate_l; // last write date low byte - uint8_t wrtdate_h; // last write date high byte - uint8_t startclus_l_l; // low word of first cluster, low byte - uint8_t startclus_l_h; // low word of first cluster, high byte - uint8_t filesize_0; // file size, low byte - uint8_t filesize_1; // - uint8_t filesize_2; // - uint8_t filesize_3; // file size, high byte -} DIRENT, *PDIRENT; - -/* - Partition table entry structure -*/ -typedef struct _tagPTINFO { - uint8_t active; // 0x80 if partition active - uint8_t start_h; // starting head - uint8_t start_cs_l; // starting cylinder and sector (low byte) - uint8_t start_cs_h; // starting cylinder and sector (high byte) - uint8_t type; // type ID byte - uint8_t end_h; // ending head - uint8_t end_cs_l; // ending cylinder and sector (low byte) - uint8_t end_cs_h; // ending cylinder and sector (high byte) - uint8_t start_0; // starting sector# (low byte) - uint8_t start_1; // - uint8_t start_2; // - uint8_t start_3; // starting sector# (high byte) - uint8_t size_0; // size of partition (low byte) - uint8_t size_1; // - uint8_t size_2; // - uint8_t size_3; // size of partition (high byte) -} PTINFO, *PPTINFO; - -/* - Master Boot Record structure -*/ -typedef struct _tagMBR { - uint8_t bootcode[0x1be]; // boot sector - PTINFO ptable[4]; // four partition table structures - uint8_t sig_55; // 0x55 signature byte - uint8_t sig_aa; // 0xaa signature byte -} MBR, *PMBR; - -/* - BIOS Parameter Block structure (FAT12/16) -*/ -typedef struct _tagBPB { - uint8_t bytepersec_l; // bytes per sector low byte (0x00) - uint8_t bytepersec_h; // bytes per sector high byte (0x02) - uint8_t secperclus; // sectors per cluster (1,2,4,8,16,32,64,128 are valid) - uint8_t reserved_l; // reserved sectors low byte - uint8_t reserved_h; // reserved sectors high byte - uint8_t numfats; // number of FAT copies (2) - uint8_t rootentries_l; // number of root dir entries low byte (0x00 normally) - uint8_t rootentries_h; // number of root dir entries high byte (0x02 normally) - uint8_t sectors_s_l; // small num sectors low byte - uint8_t sectors_s_h; // small num sectors high byte - uint8_t mediatype; // media descriptor byte - uint8_t secperfat_l; // sectors per FAT low byte - uint8_t secperfat_h; // sectors per FAT high byte - uint8_t secpertrk_l; // sectors per track low byte - uint8_t secpertrk_h; // sectors per track high byte - uint8_t heads_l; // heads low byte - uint8_t heads_h; // heads high byte - uint8_t hidden_0; // hidden sectors low byte - uint8_t hidden_1; // (note - this is the number of MEDIA sectors before - uint8_t hidden_2; // first sector of VOLUME - we rely on the MBR instead) - uint8_t hidden_3; // hidden sectors high byte - uint8_t sectors_l_0; // large num sectors low byte - uint8_t sectors_l_1; // - uint8_t sectors_l_2; // - uint8_t sectors_l_3; // large num sectors high byte -} BPB, *PBPB; - -/* - Extended BIOS Parameter Block structure (FAT12/16) -*/ -typedef struct _tagEBPB { - uint8_t unit; // int 13h drive# - uint8_t head; // archaic, used by Windows NT-class OSes for flags - uint8_t signature; // 0x28 or 0x29 - uint8_t serial_0; // serial# - uint8_t serial_1; // serial# - uint8_t serial_2; // serial# - uint8_t serial_3; // serial# - uint8_t label[11]; // volume label - uint8_t system[8]; // filesystem ID -} EBPB, *PEBPB; - -/* - Extended BIOS Parameter Block structure (FAT32) -*/ -typedef struct _tagEBPB32 { - uint8_t fatsize_0; // big FAT size in sectors low byte - uint8_t fatsize_1; // - uint8_t fatsize_2; // - uint8_t fatsize_3; // big FAT size in sectors high byte - uint8_t extflags_l; // extended flags low byte - uint8_t extflags_h; // extended flags high byte - uint8_t fsver_l; // filesystem version (0x00) low byte - uint8_t fsver_h; // filesystem version (0x00) high byte - uint8_t root_0; // cluster of root dir, low byte - uint8_t root_1; // - uint8_t root_2; // - uint8_t root_3; // cluster of root dir, high byte - uint8_t fsinfo_l; // sector pointer to FSINFO within reserved area, low byte (2) - uint8_t fsinfo_h; // sector pointer to FSINFO within reserved area, high byte (0) - uint8_t bkboot_l; // sector pointer to backup boot sector within reserved area, low byte (6) - uint8_t bkboot_h; // sector pointer to backup boot sector within reserved area, high byte (0) - uint8_t reserved[12]; // reserved, should be 0 - - uint8_t unit; // int 13h drive# - uint8_t head; // archaic, used by Windows NT-class OSes for flags - uint8_t signature; // 0x28 or 0x29 - uint8_t serial_0; // serial# - uint8_t serial_1; // serial# - uint8_t serial_2; // serial# - uint8_t serial_3; // serial# - uint8_t label[11]; // volume label - uint8_t system[8]; // filesystem ID -} EBPB32, *PEBPB32; - -/* - Logical Boot Record structure (volume boot sector) -*/ -typedef struct _tagLBR { - uint8_t jump[3]; // JMP instruction - uint8_t oemid[8]; // OEM ID, space-padded - BPB bpb; // BIOS Parameter Block - union { - EBPB ebpb; // FAT12/16 Extended BIOS Parameter Block - EBPB32 ebpb32; // FAT32 Extended BIOS Parameter Block - } ebpb; - uint8_t code[420]; // boot sector code - uint8_t sig_55; // 0x55 signature byte - uint8_t sig_aa; // 0xaa signature byte -} LBR, *PLBR; - -/* - Volume information structure (Internal to DOSFS) -*/ -typedef struct _tagVOLINFO { - uint8_t unit; // unit on which this volume resides - uint8_t filesystem; // formatted filesystem - -// These two fields aren't very useful, so support for them has been commented out to -// save memory. (Note that the "system" tag is not actually used by DOS to determine -// filesystem type - that decision is made entirely on the basis of how many clusters -// the drive contains. DOSFS works the same way). -// See tag: OEMID in dosfs.c -// uint8_t oemid[9]; // OEM ID ASCIIZ -// uint8_t system[9]; // system ID ASCIIZ - uint8_t label[12]; // volume label ASCIIZ - uint32_t startsector; // starting sector of filesystem - uint8_t secperclus; // sectors per cluster - uint16_t reservedsecs; // reserved sectors - uint32_t numsecs; // number of sectors in volume - uint32_t secperfat; // sectors per FAT - uint16_t rootentries; // number of root dir entries - - uint32_t numclusters; // number of clusters on drive - - // The fields below are PHYSICAL SECTOR NUMBERS. - uint32_t fat1; // starting sector# of FAT copy 1 - uint32_t rootdir; // starting sector# of root directory (FAT12/FAT16) or cluster (FAT32) - uint32_t dataarea; // starting sector# of data area (cluster #2) -} VOLINFO, *PVOLINFO; - -/* - Flags in DIRINFO.flags -*/ -#define DFS_DI_BLANKENT 0x01 // Searching for blank entry - -/* - Directory search structure (Internal to DOSFS) -*/ -typedef struct _tagDIRINFO { - uint32_t currentcluster; // current cluster in dir - uint8_t currentsector; // current sector in cluster - uint8_t currententry; // current dir entry in sector - uint8_t *scratch; // ptr to user-supplied scratch buffer (one sector) - uint8_t flags; // internal DOSFS flags -} DIRINFO, *PDIRINFO; - -/* - File handle structure (Internal to DOSFS) -*/ -typedef struct _tagFILEINFO { - PVOLINFO volinfo; // VOLINFO used to open this file - uint32_t dirsector; // physical sector containing dir entry of this file - uint8_t diroffset; // # of this entry within the dir sector - uint8_t mode; // mode in which this file was opened - uint32_t firstcluster; // first cluster of file - uint32_t filelen; // byte length of file - - uint32_t cluster; // current cluster - uint32_t pointer; // current (BYTE) pointer -} FILEINFO, *PFILEINFO; - -/* - Get starting sector# of specified partition on drive #unit - NOTE: This code ASSUMES an MBR on the disk. - scratchsector should point to a SECTOR_SIZE scratch area - Returns 0xffffffff for any error. - If pactive is non-NULL, this function also returns the partition active flag. - If pptype is non-NULL, this function also returns the partition type. - If psize is non-NULL, this function also returns the partition size. -*/ -uint32_t DFS_GetPtnStart(uint8_t unit, uint8_t *scratchsector, uint8_t pnum, uint8_t *pactive, uint8_t *pptype, uint32_t *psize); - -/* - Retrieve volume info from BPB and store it in a VOLINFO structure - You must provide the unit and starting sector of the filesystem, and - a pointer to a sector buffer for scratch - Attempts to read BPB and glean information about the FS from that. - Returns 0 OK, nonzero for any error. -*/ -uint32_t DFS_GetVolInfo(uint8_t unit, uint8_t *scratchsector, uint32_t startsector, PVOLINFO volinfo); - -/* - Open a directory for enumeration by DFS_GetNextDirEnt - You must supply a populated VOLINFO (see DFS_GetVolInfo) - The empty string or a string containing only the directory separator are - considered to be the root directory. - Returns 0 OK, nonzero for any error. -*/ -uint32_t DFS_OpenDir(PVOLINFO volinfo, uint8_t *dirname, PDIRINFO dirinfo); - -/* - Get next entry in opened directory structure. Copies fields into the dirent - structure, updates dirinfo. Note that it is the _caller's_ responsibility to - handle the '.' and '..' entries. - A deleted file will be returned as a NULL entry (first char of filename=0) - by this code. Filenames beginning with 0x05 will be translated to 0xE5 - automatically. Long file name entries will be returned as NULL. - returns DFS_EOF if there are no more entries, DFS_OK if this entry is valid, - or DFS_ERRMISC for a media error -*/ -uint32_t DFS_GetNext(PVOLINFO volinfo, PDIRINFO dirinfo, PDIRENT dirent); - -/* - Open a file for reading or writing. You supply populated VOLINFO, a path to the file, - mode (DFS_READ or DFS_WRITE) and an empty fileinfo structure. You also need to - provide a pointer to a sector-sized scratch buffer. - Returns various DFS_* error states. If the result is DFS_OK, fileinfo can be used - to access the file from this point on. -*/ -uint32_t DFS_OpenFile(PVOLINFO volinfo, uint8_t *path, uint8_t mode, uint8_t *scratch, PFILEINFO fileinfo); - -/* - Read an open file - You must supply a prepopulated FILEINFO as provided by DFS_OpenFile, and a - pointer to a SECTOR_SIZE scratch buffer. - Note that returning DFS_EOF is not an error condition. This function updates the - successcount field with the number of bytes actually read. -*/ -uint32_t DFS_ReadFile(PFILEINFO fileinfo, uint8_t *scratch, uint8_t *buffer, uint32_t *successcount, uint32_t len); - -/* - Write an open file - You must supply a prepopulated FILEINFO as provided by DFS_OpenFile, and a - pointer to a SECTOR_SIZE scratch buffer. - This function updates the successcount field with the number of bytes actually written. -*/ -uint32_t DFS_WriteFile(PFILEINFO fileinfo, uint8_t *scratch, uint8_t *buffer, uint32_t *successcount, uint32_t len); - -/* - Seek file pointer to a given position - This function does not return status - refer to the fileinfo->pointer value - to see where the pointer wound up. - Requires a SECTOR_SIZE scratch buffer -*/ -void DFS_Seek(PFILEINFO fileinfo, uint32_t offset, uint8_t *scratch); - -/* - Delete a file - scratch must point to a sector-sized buffer -*/ -uint32_t DFS_UnlinkFile(PVOLINFO volinfo, uint8_t *path, uint8_t *scratch); - -/* - Fetch FAT entry for specified cluster number - You must provide a scratch buffer for one sector (SECTOR_SIZE) and a populated VOLINFO - Returns a FAT32 BAD_CLUSTER value for any error, otherwise the contents of the desired - FAT entry. - scratchcache should point to a UINT32. This variable caches the physical sector number - last read into the scratch buffer for performance enhancement reasons. -*/ -uint32_t DFS_GetFAT(PVOLINFO volinfo, uint8_t *scratch, uint32_t *scratchcache, uint32_t cluster); - -/* -// TK: added 2009-02-12 - Close a file - No original function of DosFS driver - It has no effect if writing to SD Card, it's only used by the DosFS wrapper in emulation -*/ -uint32_t DFS_Close(PFILEINFO fileinfo); - - - -// TK: added 2008-18-12 -// for caching - this feature has to be explicitely enabled, as it isn't reentrant -// and requires to use the same buffer pointer whenever reading a file -void DFS_CachingEnabledSet(uint8_t enable); - -// TK: added 2008-18-12 -// missing pendant to DFS_CanonicalToDir -char *DFS_DirToCanonical(char *dest, char *src); - - -// If we are building a host-emulation version, include host support -#ifdef HOSTVER -#include "hostemu.h" -#endif - - -#endif // _DOSFS_H diff --git a/make/apps-defs.mk b/make/apps-defs.mk index 13fb1deaa..b65882722 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -75,8 +75,8 @@ ifeq ($(MCU),cortex-m3) STMUSBSRCDIR = $(STMUSBDIR)/src STMUSBINCDIR = $(STMUSBDIR)/inc CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 - DOSFSDIR = $(APPLIBDIR)/dosfs MSDDIR = $(APPLIBDIR)/msd + DOSFSDIR = $(PIOSCOMMON)/Libraries/dosfs RTOSDIR = $(PIOSCOMMON)/Libraries/FreeRTOS RTOSSRCDIR = $(RTOSDIR)/Source RTOSINCDIR = $(RTOSSRCDIR)/include From 238692c3da51668a46a77c7f91f38c89757eff55 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 15:21:00 +0200 Subject: [PATCH 23/68] STM32F4xx/library.mk cleanup (formatting only) Conflicts: flight/PiOS/STM32F4xx/library.mk --- flight/PiOS/STM32F4xx/library.mk | 72 ++++++++++++-------------------- 1 file changed, 27 insertions(+), 45 deletions(-) diff --git a/flight/PiOS/STM32F4xx/library.mk b/flight/PiOS/STM32F4xx/library.mk index cbd65e53f..b2366ca36 100644 --- a/flight/PiOS/STM32F4xx/library.mk +++ b/flight/PiOS/STM32F4xx/library.mk @@ -2,64 +2,46 @@ # Rules to (help) build the F4xx device support. # -# # Directory containing this makefile -# -PIOS_DEVLIB := $(dir $(lastword $(MAKEFILE_LIST))) +PIOS_DEVLIB := $(dir $(lastword $(MAKEFILE_LIST))) -# # Hardcoded linker script names for now -# -LINKER_SCRIPTS_APP = $(PIOS_DEVLIB)/link_STM32F4xx_OP_memory.ld \ - $(PIOS_DEVLIB)/link_STM32F4xx_sections.ld +LINKER_SCRIPTS_APP = $(PIOS_DEVLIB)/link_STM32F4xx_OP_memory.ld \ + $(PIOS_DEVLIB)/link_STM32F4xx_sections.ld +LINKER_SCRIPTS_BL = $(PIOS_DEVLIB)/link_STM32F4xx_BL_memory.ld \ + $(PIOS_DEVLIB)/link_STM32F4xx_sections.ld -LINKER_SCRIPTS_BL = $(PIOS_DEVLIB)/link_STM32F4xx_BL_memory.ld \ - $(PIOS_DEVLIB)/link_STM32F4xx_sections.ld - -# # Compiler options implied by the F4xx -# -CDEFS += -DSTM32F4XX -CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DARM_MATH_CM4 -D__FPU_PRESENT=1 -ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard +CDEFS += -DSTM32F4XX +CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) +CDEFS += -DUSE_STDPERIPH_DRIVER +ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -# # PIOS device library source and includes -# -SRC += $(wildcard $(PIOS_DEVLIB)*.c) -EXTRAINCDIRS += $(PIOS_DEVLIB)/inc +SRC += $(wildcard $(PIOS_DEVLIB)*.c) +EXTRAINCDIRS += $(PIOS_DEVLIB)/inc -# # CMSIS for the F4 -# include $(PIOSCOMMONLIB)/CMSIS2/library.mk -CMSIS2_DEVICEDIR := $(PIOS_DEVLIB)/Libraries/CMSIS2/Device/ST/STM32F4xx -SRC += $(wildcard $(CMSIS2_DEVICEDIR)/Source/$(BOARD_NAME)/*.c) -EXTRAINCDIRS += $(CMSIS2_DEVICEDIR)/Include +CMSIS2_DEVICEDIR := $(PIOS_DEVLIB)/Libraries/CMSIS2/Device/ST/STM32F4xx +SRC += $(wildcard $(CMSIS2_DEVICEDIR)/Source/$(BOARD_NAME)/*.c) +EXTRAINCDIRS += $(CMSIS2_DEVICEDIR)/Include -# # ST Peripheral library -# -PERIPHLIB = $(PIOS_DEVLIB)/Libraries/STM32F4xx_StdPeriph_Driver -SRC += $(wildcard $(PERIPHLIB)/src/*.c) -EXTRAINCDIRS += $(PERIPHLIB)/inc +PERIPHLIB = $(PIOS_DEVLIB)/Libraries/STM32F4xx_StdPeriph_Driver +SRC += $(wildcard $(PERIPHLIB)/src/*.c) +EXTRAINCDIRS += $(PERIPHLIB)/inc -# # ST USB OTG library -# -USBOTGLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB_OTG_Driver -USBOTGLIB_SRC = usb_core.c usb_dcd.c usb_dcd_int.c -SRC += $(addprefix $(USBOTGLIB)/src/,$(USBOTGLIB_SRC)) -EXTRAINCDIRS += $(USBOTGLIB)/inc +USBOTGLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB_OTG_Driver +USBOTGLIB_SRC = usb_core.c usb_dcd.c usb_dcd_int.c +SRC += $(addprefix $(USBOTGLIB)/src/,$(USBOTGLIB_SRC)) +EXTRAINCDIRS += $(USBOTGLIB)/inc -# # ST USB Device library -# -USBDEVLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB_Device_Library -SRC += $(wildcard $(USBDEVLIB)/Core/src/*.c) -EXTRAINCDIRS += $(USBDEVLIB)/Core/inc +USBDEVLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB_Device_Library +SRC += $(wildcard $(USBDEVLIB)/Core/src/*.c) +EXTRAINCDIRS += $(USBDEVLIB)/Core/inc # # FreeRTOS @@ -68,7 +50,7 @@ EXTRAINCDIRS += $(USBDEVLIB)/Core/inc # the device-specific pieces of the code. # ifneq ($(FREERTOS_DIR),) -FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source -SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F/*.c) -EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F + FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source + SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F/*.c) + EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F endif From b7545c6f57776eb500bc63010b720e1239aae895 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 16:19:39 +0200 Subject: [PATCH 24/68] Makefile: add --warn-common and --fatal-warnings to identify name clashes This will stop builds if few same symbols are found when linking. It should not be the case, but possible and may give unpredicted results. --- make/apps-defs.mk | 2 ++ make/boot-defs.mk | 2 ++ 2 files changed, 4 insertions(+) diff --git a/make/apps-defs.mk b/make/apps-defs.mk index b65882722..6c3507b31 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -414,6 +414,8 @@ LDFLAGS += -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) LDFLAGS += -lc -lgcc $(MATH_LIB) +LDFLAGS += -Wl,--warn-common +LDFLAGS += -Wl,--fatal-warnings ifneq ($(DEBUG), YES) LDFLAGS += -Wl,-static diff --git a/make/boot-defs.mk b/make/boot-defs.mk index 92117317e..a012f7d6e 100644 --- a/make/boot-defs.mk +++ b/make/boot-defs.mk @@ -332,6 +332,8 @@ LDFLAGS += -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) LDFLAGS += -lc -lgcc $(MATH_LIB) +LDFLAGS += -Wl,--warn-common +LDFLAGS += -Wl,--fatal-warnings ifneq ($(DEBUG), YES) LDFLAGS += -Wl,-static From 0e6b2acb220bb4ed690d9185845b24eab56994ff Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 19:19:57 +0200 Subject: [PATCH 25/68] Makefile: add PiOS/STM32F10x/library.mk Conflicts: flight/PiOS/STM32F10x/library.mk --- flight/PiOS/STM32F10x/library.mk | 51 +++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/flight/PiOS/STM32F10x/library.mk b/flight/PiOS/STM32F10x/library.mk index e0af6b637..e86234dea 100644 --- a/flight/PiOS/STM32F10x/library.mk +++ b/flight/PiOS/STM32F10x/library.mk @@ -1,13 +1,50 @@ # -# Rules to (help) build the F10x device support. +# Rules to (help) build the F1xx device support. # -# -# Compiler options implied by the F1xx -# -CDEFS += -DARM_MATH_CM3 +# Directory containing this makefile +PIOS_DEVLIB := $(dir $(lastword $(MAKEFILE_LIST))) + +# Linker scripts path (contains board-specific scripts) +LINKER_SCRIPTS_PATH = $(PIOS_DEVLIB) + +# Compiler options implied by the F10x +CDEFS += -DSTM32F10X -DSTM32F10X_$(MODEL) +CDEFS += -DUSE_STDPERIPH_DRIVER +CDEFS += -DARM_MATH_CM3 + +ARCHFLAGS += -mcpu=cortex-m3 + +# Board-specific startup files +ASRC += $(PIOS_DEVLIB)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S + +# PIOS device library source and includes +SRC += $(wildcard $(PIOS_DEVLIB)*.c) -# # CMSIS for the F1 +CMSIS_DIR = $(PIOS_DEVLIB)/Libraries/CMSIS/Core/CM3 +SRC += $(CMSIS_DIR)/core_cm3.c +SRC += $(CMSIS_DIR)/system_stm32f10x.c +EXTRAINCDIRS += $(CMSIS_DIR) + +# ST Peripheral library +PERIPHLIB = $(PIOS_DEVLIB)/Libraries/STM32F10x_StdPeriph_Driver +SRC += $(wildcard $(PERIPHLIB)/src/*.c) +EXTRAINCDIRS += $(PERIPHLIB)/inc + +# ST USB Device library +USBDEVLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB-FS-Device_Driver +SRC += $(wildcard $(USBDEVLIB)/src/*.c) +EXTRAINCDIRS += $(USBDEVLIB)/inc + # -include $(PIOSCOMMONLIB)/CMSIS2/library.mk +# FreeRTOS +# +# If the application has included the generic FreeRTOS support, then add in +# the device-specific pieces of the code. +# +ifneq ($(FREERTOS_DIR),) + FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source + SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3/*.c) + EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3 +endif From f65ff0585f62cfe7407ea8a22a6f0d51f659de58 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 19:21:41 +0200 Subject: [PATCH 26/68] Makefile: add make/common-defs.mk and use it to build bootloaders (STM32F10x) Conflicts: make/boot-defs.mk --- flight/PiOS/STM32F4xx/library.mk | 3 +- .../Bootloaders/CopterControl/Makefile | 1 + flight/targets/Bootloaders/OSD/Makefile | 1 + flight/targets/Bootloaders/PipXtreme/Makefile | 1 + flight/targets/Bootloaders/RevoMini/Makefile | 1 + .../targets/Bootloaders/Revolution/Makefile | 1 + make/boot-defs.mk | 349 +----------------- make/common-defs.mk | 235 ++++++++++++ 8 files changed, 253 insertions(+), 339 deletions(-) create mode 100644 make/common-defs.mk diff --git a/flight/PiOS/STM32F4xx/library.mk b/flight/PiOS/STM32F4xx/library.mk index b2366ca36..d0e403453 100644 --- a/flight/PiOS/STM32F4xx/library.mk +++ b/flight/PiOS/STM32F4xx/library.mk @@ -13,6 +13,7 @@ LINKER_SCRIPTS_BL = $(PIOS_DEVLIB)/link_STM32F4xx_BL_memory.ld \ # Compiler options implied by the F4xx CDEFS += -DSTM32F4XX +CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) CDEFS += -DUSE_STDPERIPH_DRIVER ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard @@ -22,7 +23,7 @@ SRC += $(wildcard $(PIOS_DEVLIB)*.c) EXTRAINCDIRS += $(PIOS_DEVLIB)/inc # CMSIS for the F4 -include $(PIOSCOMMONLIB)/CMSIS2/library.mk +include $(PIOSCOMMON)/Libraries/CMSIS2/library.mk CMSIS2_DEVICEDIR := $(PIOS_DEVLIB)/Libraries/CMSIS2/Device/ST/STM32F4xx SRC += $(wildcard $(CMSIS2_DEVICEDIR)/Source/$(BOARD_NAME)/*.c) EXTRAINCDIRS += $(CMSIS2_DEVICEDIR)/Include diff --git a/flight/targets/Bootloaders/CopterControl/Makefile b/flight/targets/Bootloaders/CopterControl/Makefile index ed1d8f3e8..bdfea5986 100644 --- a/flight/targets/Bootloaders/CopterControl/Makefile +++ b/flight/targets/Bootloaders/CopterControl/Makefile @@ -23,6 +23,7 @@ endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk include $(ROOT_DIR)/make/boot-defs.mk +include $(ROOT_DIR)/make/common-defs.mk $(info Making bootloader for CopterControl, board revision $(BOARD_REVISION)) $(info Use BOARD_REVISION=1 for CC, BOARD_REVISION=2 for CC3D (default)) diff --git a/flight/targets/Bootloaders/OSD/Makefile b/flight/targets/Bootloaders/OSD/Makefile index aad1047d2..ed5d04928 100644 --- a/flight/targets/Bootloaders/OSD/Makefile +++ b/flight/targets/Bootloaders/OSD/Makefile @@ -23,3 +23,4 @@ endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk include $(ROOT_DIR)/make/boot-defs.mk +include $(ROOT_DIR)/make/common-defs.mk diff --git a/flight/targets/Bootloaders/PipXtreme/Makefile b/flight/targets/Bootloaders/PipXtreme/Makefile index 55df4a8a3..e6a37c2e4 100644 --- a/flight/targets/Bootloaders/PipXtreme/Makefile +++ b/flight/targets/Bootloaders/PipXtreme/Makefile @@ -23,6 +23,7 @@ endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk include $(ROOT_DIR)/make/boot-defs.mk +include $(ROOT_DIR)/make/common-defs.mk BLONLY_CDEFS += -DEE_BANK_BASE=$(EE_BANK_BASE) BLONLY_CDEFS += -DEE_BANK_SIZE=$(EE_BANK_SIZE) diff --git a/flight/targets/Bootloaders/RevoMini/Makefile b/flight/targets/Bootloaders/RevoMini/Makefile index aad1047d2..ed5d04928 100644 --- a/flight/targets/Bootloaders/RevoMini/Makefile +++ b/flight/targets/Bootloaders/RevoMini/Makefile @@ -23,3 +23,4 @@ endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk include $(ROOT_DIR)/make/boot-defs.mk +include $(ROOT_DIR)/make/common-defs.mk diff --git a/flight/targets/Bootloaders/Revolution/Makefile b/flight/targets/Bootloaders/Revolution/Makefile index aad1047d2..ed5d04928 100644 --- a/flight/targets/Bootloaders/Revolution/Makefile +++ b/flight/targets/Bootloaders/Revolution/Makefile @@ -23,3 +23,4 @@ endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk include $(ROOT_DIR)/make/boot-defs.mk +include $(ROOT_DIR)/make/common-defs.mk diff --git a/make/boot-defs.mk b/make/boot-defs.mk index a012f7d6e..b1e37e35f 100644 --- a/make/boot-defs.mk +++ b/make/boot-defs.mk @@ -38,29 +38,12 @@ PIOSINC = $(PIOS)/inc PIOSCOMMON = $(PIOS)/Common PIOSBOARDS = $(PIOS)/Boards FLIGHTLIBINC = $(FLIGHTLIB)/inc -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc +## PIOS Hardware ifeq ($(MCU),cortex-m3) - PIOSSTM32F10X = $(PIOS)/STM32F10x - APPLIBDIR = $(PIOSSTM32F10X)/Libraries - STMLIBDIR = $(APPLIBDIR) - STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver - STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver - STMUSBSRCDIR = $(STMUSBDIR)/src - STMUSBINCDIR = $(STMUSBDIR)/inc - CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 - DOSFSDIR = $(APPLIBDIR)/dosfs - MSDDIR = $(APPLIBDIR)/msd - RTOSDIR = $(APPLIBDIR)/FreeRTOS - RTOSSRCDIR = $(RTOSDIR)/Source - RTOSINCDIR = $(RTOSSRCDIR)/include + include $(PIOS)/STM32F10x/library.mk else ifeq ($(MCU),cortex-m4) - PIOSSTM32F4XX = $(PIOS)/STM32F4xx - APPLIBDIR = $(PIOSSTM32F4XX)/Libraries - STMLIBDIR = $(APPLIBDIR) - STMSPDDIR = $(STMLIBDIR)/STM32F4xx_StdPeriph_Driver - PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries + include $(PIOS)/STM32F4xx/library.mk else $(error Unsupported MCU: $(MCU)) endif @@ -74,58 +57,6 @@ SRC += $(OPSYSTEM)/pios_board.c SRC += $(OPSYSTEM)/pios_usb_board_data.c SRC += $(OPSYSTEM)/op_dfu.c -## PIOS Hardware -ifeq ($(MCU),cortex-m3) - ## PIOS Hardware (STM32F10x) - SRC += $(PIOSSTM32F10X)/pios_sys.c - SRC += $(PIOSSTM32F10X)/pios_led.c - SRC += $(PIOSSTM32F10X)/pios_delay.c - SRC += $(PIOSSTM32F10X)/pios_usart.c - SRC += $(PIOSSTM32F10X)/pios_irq.c - SRC += $(PIOSSTM32F10X)/pios_debug.c - SRC += $(PIOSSTM32F10X)/pios_gpio.c - SRC += $(PIOSSTM32F10X)/pios_iap.c - SRC += $(PIOSSTM32F10X)/pios_bl_helper.c - SRC += $(PIOSSTM32F10X)/pios_usb.c - SRC += $(PIOSSTM32F10X)/pios_usbhook.c - SRC += $(PIOSSTM32F10X)/pios_usb_hid.c - SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c - SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c - - ## Libraries for flight calculations - SRC += $(FLIGHTLIB)/fifo_buffer.c - - ## CMSIS for STM32 - SRC += $(CMSISDIR)/core_cm3.c - SRC += $(CMSISDIR)/system_stm32f10x.c - - ## Used parts of the STM-Library - SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c - SRC += $(STMSPDSRCDIR)/stm32f10x_crc.c - SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c - SRC += $(STMSPDSRCDIR)/stm32f10x_exti.c - SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c - SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c - SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c - SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c - SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c - SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c - SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c - SRC += $(STMSPDSRCDIR)/stm32f10x_dbgmcu.c - SRC += $(STMSPDSRCDIR)/misc.c - - ## STM32 USB Library - SRC += $(STMUSBSRCDIR)/usb_core.c - SRC += $(STMUSBSRCDIR)/usb_init.c - SRC += $(STMUSBSRCDIR)/usb_int.c - SRC += $(STMUSBSRCDIR)/usb_mem.c - SRC += $(STMUSBSRCDIR)/usb_regs.c - SRC += $(STMUSBSRCDIR)/usb_sil.c -else ifeq ($(MCU),cortex-m4) - ## PIOS Hardware (STM32F4xx) - include $(PIOS)/STM32F4xx/library.mk -endif - ## PIOS Hardware (Common) SRC += $(PIOSCOMMON)/pios_board_info.c SRC += $(PIOSCOMMON)/pios_com_msg.c @@ -135,15 +66,15 @@ SRC += $(PIOSCOMMON)/pios_usb_util.c # List C source files here which must be compiled in ARM-Mode (no -mthumb). # Use file-extension c for "c-only"-files -SRCARM = +SRCARM += # List C++ source files here. # Use file-extension .cpp for C++-files (not .C) -CPPSRC = +CPPSRC += # List C++ source files here which must be compiled in ARM-Mode. # Use file-extension .cpp for C++-files (not .C) -CPPSRCARM = +CPPSRCARM += # List Assembler source files here. # Make them always end in a capital .S. Files ending in a lowercase .s @@ -152,14 +83,10 @@ CPPSRCARM = # Even though the DOS/Win* filesystem matches both .s and .S the same, # it will preserve the spelling of the filenames, and gcc itself does # care about how the name is spelled on its command-line. -ifeq ($(MCU),cortex-m3) - ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S -else - ASRC = -endif +ASRC += # List Assembler source files here which must be assembled in ARM-Mode. -ASRCARM = +ASRCARM += # List any extra directories to look for include files here. # Each directory must be seperated by a space. @@ -169,26 +96,9 @@ EXTRAINCDIRS += $(FLIGHTLIBINC) EXTRAINCDIRS += $(PIOSCOMMON) EXTRAINCDIRS += $(PIOSBOARDS) EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(CMSISDIR) EXTRAINCDIRS += $(HWDEFSINC) EXTRAINCDIRS += $(OPSYSTEMINC) -ifeq ($(MCU),cortex-m3) - EXTRAINCDIRS += $(PIOSSTM32F10X) - EXTRAINCDIRS += $(OPUAVTALK) - EXTRAINCDIRS += $(OPUAVTALKINC) - EXTRAINCDIRS += $(OPUAVOBJ) - EXTRAINCDIRS += $(OPUAVOBJINC) - EXTRAINCDIRS += $(DOSFSDIR) - EXTRAINCDIRS += $(MSDDIR) - EXTRAINCDIRS += $(RTOSINCDIR) - EXTRAINCDIRS += $(STMUSBINCDIR) - EXTRAINCDIRS += $(APPLIBDIR) - EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3 -else ifeq ($(MCU),cortex-m4) - EXTRAINCDIRS += $(PIOSSTM34FXX) -endif - # List any extra directories to look for library files here. # Also add directories where the linker should search for # includes from linker-script to the list @@ -203,51 +113,6 @@ EXTRA_LIBDIRS = # EXTRA_LIBS = newlib-lpc EXTRA_LIBS = -# Path to linker scripts -ifeq ($(MCU),cortex-m3) - LINKERSCRIPTPATH = $(PIOSSTM32F10X) -else ifeq ($(MCU),cortex-m4) - LINKERSCRIPTPATH = $(PIOSSTM32FXX) -endif - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# Note: 3 is not always the best optimization level. -ifeq ($(DEBUG), YES) - OPT = 0 -else - OPT = s -endif - -# Output format (can be ihex or binary or both). -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -U options for C here. -ifeq ($(MCU),cortex-m3) - CDEFS = -DSTM32F10X_$(MODEL) -else ifeq ($(MCU),cortex-m4) - CDEFS += -DSTM32F4XX - CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) - CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) -endif - -CDEFS += -DUSE_$(BOARD) -CDEFS += -DUSE_STDPERIPH_DRIVER - -ifeq ($(ENABLE_DEBUG_PINS), YES) - CDEFS += -DPIOS_ENABLE_DEBUG_PINS -endif -ifeq ($(ENABLE_AUX_UART), YES) - CDEFS += -DPIOS_ENABLE_AUX_UART -endif - # Provide (only) the bootloader with board-specific defines BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) @@ -257,205 +122,13 @@ BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) -# Place project-specific -D and/or -U options for Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -# Compiler flags. -# -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing - -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) -ifeq ($(MCU),cortex-m4) - # This is not the best place for these. Really should abstract out - # to the board file or something - CFLAGS += -DSTM32F4XX - CFLAGS += -DMEM_SIZE=1024000000 -endif - -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) +# Compiler flags CFLAGS += $(BLONLY_CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -CFLAGS += -O$(OPT) -CFLAGS += -g$(DEBUGF) - -ifeq ($(DEBUG), YES) - CFLAGS += -DDEBUG -else - CFLAGS += -fdata-sections -ffunction-sections -endif - -CFLAGS += -Wall -# FIXME: STM32F4xx library raises strict aliasing and const qualifier warnings -ifneq ($(MCU),cortex-m4) - CFLAGS += -Werror -endif -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) - -# Compiler flags to generate dependency files -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# Flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS += -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += -lc -lgcc $(MATH_LIB) -LDFLAGS += -Wl,--warn-common -LDFLAGS += -Wl,--fatal-warnings - -ifneq ($(DEBUG), YES) - LDFLAGS += -Wl,-static -endif # Set linker-script name depending on selected submodel name ifeq ($(MCU),cortex-m3) - LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld - LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld + LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_memory.ld + LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_BL_sections.ld else ifeq ($(MCU),cortex-m4) LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_BL)) endif - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex sym -else ifeq ($(LOADFORMAT),binary) -build: elf bin sym -else ifeq ($(LOADFORMAT),both) -build: elf hex bin sym -else - $(error "$(MSG_FORMATERROR) $(FORMAT)") -endif - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).bin -ifneq ($(INSTALL_DIR),) - @$(ECHO) $(MSG_INSTALLING) $(call toprel, $<) - $(V1) $(MKDIR) -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin -else - $(error INSTALL_DIR must be specified for $@) -endif - -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).map - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).elf - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).hex - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).sym - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).lss - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin.o - $(V1) $(RM) -f $(ALLOBJ) - $(V1) $(RM) -f $(LSTFILES) - $(V1) $(RM) -f $(DEPFILES) - $(V1) $(RM) -f $(SRC:.c=.s) - $(V1) $(RM) -f $(SRCARM:.c=.s) - $(V1) $(RM) -f $(CPPSRC:.cpp=.s) - $(V1) $(RM) -f $(CPPSRCARM:.cpp=.s) - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -$(shell $(MKDIR) -p $(OUTDIR) 2>/dev/null) - -# Include the dependency files. --include $(shell $(MKDIR) -p $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) - -# Listing of phony targets. -.PHONY : all build clean clean_list install diff --git a/make/common-defs.mk b/make/common-defs.mk new file mode 100644 index 000000000..cf05fb68a --- /dev/null +++ b/make/common-defs.mk @@ -0,0 +1,235 @@ +# +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) +endif + +# +# Common botloader and firmware rules +# + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# Note: 3 is not always the best optimization level. +ifeq ($(DEBUG), YES) + OPT = 0 +else + OPT = s +endif + +# Output format (can be ihex or binary or both). +# binary to create a load-image in raw-binary format i.e. for SAM-BA, +# ihex to create a load-image in Intel hex format +#LOADFORMAT = ihex +#LOADFORMAT = binary +LOADFORMAT = both + +# Debugging format. +DEBUGF = dwarf-2 + +# Place project-specific -D (define) and/or -U options for C here. +CDEFS += -DUSE_$(BOARD) + +ifeq ($(ENABLE_DEBUG_PINS), YES) + CDEFS += -DPIOS_ENABLE_DEBUG_PINS +endif + +ifeq ($(ENABLE_AUX_UART), YES) + CDEFS += -DPIOS_ENABLE_AUX_UART +endif + +# Place project-specific -D and/or -U options for Assembler with preprocessor here. +#ADEFS = -DUSE_IRQ_ASM_WRAPPER +ADEFS = -D__ASSEMBLY__ + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Compiler flags. +# +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing + +# Common architecture-specific flags from the device-specific library makefile +CFLAGS += $(ARCHFLAGS) +CFLAGS += $(CDEFS) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. +CFLAGS += -mapcs-frame +CFLAGS += -fomit-frame-pointer +CFLAGS += -O$(OPT) +CFLAGS += -g$(DEBUGF) +CFLAGS += -Wall +CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) + +# FIXME: STM32F4xx library raises strict aliasing and const qualifier warnings +ifneq ($(MCU),cortex-m4) + CFLAGS += -Werror +endif + +ifeq ($(DEBUG), YES) + CFLAGS += -DDEBUG +else + CFLAGS += -fdata-sections -ffunction-sections +endif + +# Compiler flags to generate dependency files +CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d + +# Flags only for C +#CONLYFLAGS += -Wnested-externs +CONLYFLAGS += $(CSTANDARD) + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlns: create listing +ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp +ASFLAGS += $(ADEFS) +ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) +ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS += -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections +LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) +LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) +LDFLAGS += -lc -lgcc -lm +LDFLAGS += -Wl,--warn-common +LDFLAGS += -Wl,--fatal-warnings + +ifneq ($(DEBUG), YES) + LDFLAGS += -Wl,-static +endif + +# List of all source files. +ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) +# List of all source files without directory and file-extension. +ALLSRCBASE = $(notdir $(basename $(ALLSRC))) + +# Define all object files. +ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) + +# Define all listing files (used for make clean). +LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) +# Define all depedency-files (used for make clean). +DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) + +# Default target. +all: build + +ifeq ($(LOADFORMAT),ihex) +build: elf hex sym +else ifeq ($(LOADFORMAT),binary) +build: elf bin sym +else ifeq ($(LOADFORMAT),both) +build: elf hex bin sym +else + $(error "$(MSG_FORMATERROR) $(FORMAT)") +endif + +# Link: create ELF output file from object files. +$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) + +# Assemble: create object files from assembler source files. +$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) + +# Assemble: create object files from assembler source files. ARM-only +$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) + +# Compile: create object files from C source files. +$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) + +# Compile: create object files from C source files. ARM-only +$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) + +# Compile: create object files from C++ source files. +$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) + +# Compile: create object files from C++ source files. ARM-only +$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) + +# Compile: create assembler files from C source files. ARM/Thumb +$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) + +# Compile: create assembler files from C source files. ARM only +$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) + +$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin + +# Add opfw target +$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) + +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) + +.PHONY: elf lss sym hex bin bino opfw +elf: $(OUTDIR)/$(TARGET).elf +lss: $(OUTDIR)/$(TARGET).lss +sym: $(OUTDIR)/$(TARGET).sym +hex: $(OUTDIR)/$(TARGET).hex +bin: $(OUTDIR)/$(TARGET).bin +bino: $(OUTDIR)/$(TARGET).bin.o +opfw: $(OUTDIR)/$(TARGET).opfw + +# Display sizes of sections. +$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) + +# Generate Doxygen documents +docs: + doxygen $(DOXYGENDIR)/doxygen.cfg + +# Target: clean project +clean: + @echo $(MSG_CLEANING) + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).map + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).elf + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).hex + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).sym + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).lss + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin.o + $(V1) $(RM) -f $(OUTDIR)/$(TARGET).opfw + $(V1) $(RM) -f $(wildcard $(OUTDIR)/*.c) + $(V1) $(RM) -f $(wildcard $(OUTDIR)/*.h) + $(V1) $(RM) -f $(ALLOBJ) + $(V1) $(RM) -f $(LSTFILES) + $(V1) $(RM) -f $(DEPFILES) + $(V1) $(RM) -f $(SRC:.c=.s) + $(V1) $(RM) -f $(SRCARM:.c=.s) + $(V1) $(RM) -f $(CPPSRC:.cpp=.s) + $(V1) $(RM) -f $(CPPSRCARM:.cpp=.s) + +# Create output files directory +# all known MS Windows OS define the ComSpec environment variable +$(shell $(MKDIR) -p $(OUTDIR) 2>/dev/null) + +# Include the dependency files. +-include $(shell $(MKDIR) -p $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) + +# Listing of phony targets. +.PHONY : all build clean install From 243c1a28ec82fb64bbf6577e118333f0fd6601ba Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 22:16:49 +0200 Subject: [PATCH 27/68] Remove duplicated global var and defines from board definition file Was caught using just added linker options: LDFLAGS += -Wl,--warn-common LDFLAGS += -Wl,--fatal-warnings --- flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h index 88ce43312..9be8efe2c 100755 --- a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h @@ -303,18 +303,6 @@ extern uint32_t pios_packet_handler; #define RS_ECC_NPARITY 4 #endif /* PIOS_INCLUDE_PACKET_HANDLER */ -//------------------------- -// Packet Handler -//------------------------- - -#if defined(PIOS_INCLUDE_PACKET_HANDLER) -uint32_t pios_packet_handler; -#define PIOS_PACKET_HANDLER (pios_packet_handler) -#define PIOS_PH_MAX_PACKET 255 -#define PIOS_PH_WIN_SIZE 3 -#define PIOS_PH_MAX_CONNECTIONS 1 -#endif /* PIOS_INCLUDE_PACKET_HANDLER */ - //------------------------- // Reed-Solomon ECC //------------------------- From 91f14768db56663bcafdb10d1a31417cb1d0f348 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 16 Mar 2013 22:19:50 +0200 Subject: [PATCH 28/68] Makefile: fix mk files, now both CC and PipX are buildable using common defs Conflicts: make/apps-defs.mk --- flight/PiOS/STM32F10x/library.mk | 1 + flight/targets/CopterControl/Makefile | 29 +- flight/targets/PipXtreme/Makefile | 1 + make/apps-defs.mk | 481 ++++---------------------- make/boot-defs.mk | 5 +- make/common-defs.mk | 12 +- 6 files changed, 92 insertions(+), 437 deletions(-) diff --git a/flight/PiOS/STM32F10x/library.mk b/flight/PiOS/STM32F10x/library.mk index e86234dea..b2b4b7927 100644 --- a/flight/PiOS/STM32F10x/library.mk +++ b/flight/PiOS/STM32F10x/library.mk @@ -46,5 +46,6 @@ EXTRAINCDIRS += $(USBDEVLIB)/inc ifneq ($(FREERTOS_DIR),) FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3/*.c) + SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/MemMang/heap_1.c) EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3 endif diff --git a/flight/targets/CopterControl/Makefile b/flight/targets/CopterControl/Makefile index 1defe2ace..6cd6a9e9b 100644 --- a/flight/targets/CopterControl/Makefile +++ b/flight/targets/CopterControl/Makefile @@ -28,21 +28,21 @@ include $(ROOT_DIR)/make/firmware-defs.mk USE_DSP_LIB ?= NO # Optional module and driver defaults -USE_CAMERASTAB ?= YES +USE_CAMERASTAB ?= YES USE_COMUSBBRIDGE ?= YES -USE_GPS ?= YES -USE_TXPID ?= YES -USE_ALTITUDE ?= NO -USE_AUTOTUNE ?= NO -TEST_FAULTS ?= NO +USE_GPS ?= YES +USE_TXPID ?= YES +USE_ALTITUDE ?= NO +USE_AUTOTUNE ?= NO +TEST_FAULTS ?= NO # Camera gimbal options -USE_INPUT_LPF ?= YES -USE_GIMBAL_LPF ?= YES -USE_GIMBAL_FF ?= YES +USE_INPUT_LPF ?= YES +USE_GIMBAL_LPF ?= YES +USE_GIMBAL_FF ?= YES # Set to YES to build a FW version that will erase data flash memory -ERASE_FLASH ?= NO +ERASE_FLASH ?= NO # List of mandatory modules to include MODULES = Attitude Stabilization Actuator ManualControl FirmwareIAP @@ -75,9 +75,6 @@ ifeq ($(TEST_FAULTS), YES) endif # Misc defines -ifeq ($(ERASE_FLASH), YES) - CDEFS += -DERASE_FLASH -endif ifeq ($(USE_INPUT_LPF), YES) CDEFS += -DUSE_INPUT_LPF endif @@ -87,13 +84,16 @@ endif ifeq ($(USE_GIMBAL_FF), YES) CDEFS += -DUSE_GIMBAL_FF endif +ifeq ($(ERASE_FLASH), YES) + CDEFS += -DERASE_FLASH +endif # List C source files here (C dependencies are automatically generated). # Use file-extension c for "c-only"-files ifndef TESTAPP ## Modules - SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} + SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} ## Application Core SRC += ${OPMODULEDIR}/System/systemmod.c @@ -154,3 +154,4 @@ ifndef TESTAPP endif include $(ROOT_DIR)/make/apps-defs.mk +include $(ROOT_DIR)/make/common-defs.mk diff --git a/flight/targets/PipXtreme/Makefile b/flight/targets/PipXtreme/Makefile index 5f8f3135f..bdbfae8e4 100644 --- a/flight/targets/PipXtreme/Makefile +++ b/flight/targets/PipXtreme/Makefile @@ -61,3 +61,4 @@ endif include $(FLIGHTLIB)/rscode/library.mk include $(ROOT_DIR)/make/apps-defs.mk +include $(ROOT_DIR)/make/common-defs.mk diff --git a/make/apps-defs.mk b/make/apps-defs.mk index 6c3507b31..71acae877 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -45,44 +45,29 @@ PIOSINC = $(PIOS)/inc PIOSCOMMON = $(PIOS)/Common PIOSBOARDS = $(PIOS)/Boards FLIGHTLIBINC = $(FLIGHTLIB)/inc + +## UAVTalk and UAVObject manager +OPUAVOBJINC = $(OPUAVOBJ)/inc +OPUAVTALKINC = $(OPUAVTALK)/inc + +## Math MATHLIB = $(FLIGHTLIB)/math MATHLIBINC = $(FLIGHTLIB)/math -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc -OPUAVTALKINC = $(OPUAVTALK)/inc -OPUAVOBJINC = $(OPUAVOBJ)/inc -DOXYGENDIR = $(TOPDIR)/../Doc/Doxygen + +## FreeRTOS support +FREERTOS_DIR = $(PIOSCOMMON)/Libraries/FreeRTOS +FREERTOS_SRC_DIR = $(FREERTOS_DIR)/Source +FREERTOS_INC_DIR = $(FREERTOS_SRC_DIR)/include + +## Misc +DOXYGENDIR = $(ROOT_DIR)/flight/Doc/Doxygen OPTESTS = $(TOPDIR)/Tests -PYMITE = $(FLIGHTLIB)/PyMite -PYMITELIB = $(PYMITE)/lib -PYMITEPLAT = $(PYMITE)/platform/openpilot -PYMITETOOLS = $(PYMITE)/tools -PYMITEVM = $(PYMITE)/vm -PYMITEINC = $(PYMITEVM) -PYMITEINC += $(PYMITEPLAT) -PYMITEINC += $(OUTDIR) - -FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib -FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans - +## PIOS Hardware ifeq ($(MCU),cortex-m3) - PIOSSTM32F10X = $(PIOS)/STM32F10x - APPLIBDIR = $(PIOSSTM32F10X)/Libraries - STMLIBDIR = $(APPLIBDIR) - STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver - STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver - STMUSBSRCDIR = $(STMUSBDIR)/src - STMUSBINCDIR = $(STMUSBDIR)/inc - CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 - MSDDIR = $(APPLIBDIR)/msd - DOSFSDIR = $(PIOSCOMMON)/Libraries/dosfs - RTOSDIR = $(PIOSCOMMON)/Libraries/FreeRTOS - RTOSSRCDIR = $(RTOSDIR)/Source - RTOSINCDIR = $(RTOSSRCDIR)/include - RTOSPORTDIR = $(APPLIBDIR)/FreeRTOS/Source + include $(PIOS)/STM32F10x/library.mk else ifeq ($(MCU),cortex-m4) - $(error This makefile is not yet converted for F4, work in progress) + include $(PIOS)/STM32F4xx/library.mk else $(error Unsupported MCU: $(MCU)) endif @@ -90,124 +75,53 @@ endif # List C source files here (C dependencies are automatically generated). # Use file-extension c for "c-only"-files -## PIOS Hardware -ifeq ($(MCU),cortex-m3) - ## PIOS Hardware (STM32F10x) - SRC += $(PIOSSTM32F10X)/pios_sys.c - SRC += $(PIOSSTM32F10X)/pios_led.c - SRC += $(PIOSSTM32F10X)/pios_delay.c - SRC += $(PIOSSTM32F10X)/pios_usart.c - SRC += $(PIOSSTM32F10X)/pios_irq.c - SRC += $(PIOSSTM32F10X)/pios_adc.c - SRC += $(PIOSSTM32F10X)/pios_servo.c - SRC += $(PIOSSTM32F10X)/pios_i2c.c - SRC += $(PIOSSTM32F10X)/pios_spi.c - SRC += $(PIOSSTM32F10X)/pios_ppm.c - SRC += $(PIOSSTM32F10X)/pios_pwm.c - SRC += $(PIOSSTM32F10X)/pios_dsm.c - SRC += $(PIOSSTM32F10X)/pios_debug.c - SRC += $(PIOSSTM32F10X)/pios_gpio.c - SRC += $(PIOSSTM32F10X)/pios_exti.c - SRC += $(PIOSSTM32F10X)/pios_rtc.c - SRC += $(PIOSSTM32F10X)/pios_wdg.c - SRC += $(PIOSSTM32F10X)/pios_iap.c - SRC += $(PIOSSTM32F10X)/pios_tim.c - SRC += $(PIOSSTM32F10X)/pios_bl_helper.c - SRC += $(PIOSSTM32F10X)/pios_eeprom.c - SRC += $(PIOSSTM32F10X)/pios_ppm_out.c +## PIOS Hardware (Common) +SRC += $(PIOSCOMMON)/pios_crc.c +SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c +SRC += $(PIOSCOMMON)/pios_flash_jedec.c +SRC += $(PIOSCOMMON)/pios_adxl345.c +SRC += $(PIOSCOMMON)/pios_mpu6000.c +SRC += $(PIOSCOMMON)/pios_com.c +SRC += $(PIOSCOMMON)/pios_sbus.c +SRC += $(PIOSCOMMON)/pios_rcvr.c +SRC += $(PIOSCOMMON)/pios_gcsrcvr.c +SRC += $(PIOSCOMMON)/pios_rfm22b.c +SRC += $(PIOSCOMMON)/pios_rfm22b_com.c +SRC += $(PIOSCOMMON)/printf-stdarg.c +SRC += $(PIOSCOMMON)/pios_i2c_esc.c +SRC += $(PIOSSTM32F10X)/pios_ppm_out.c - # PIOS USB related files - SRC += $(OPSYSTEM)/pios_usb_board_data.c - SRC += $(PIOSSTM32F10X)/pios_usb.c - SRC += $(PIOSSTM32F10X)/pios_usbhook.c - SRC += $(PIOSSTM32F10X)/pios_usb_hid.c - SRC += $(PIOSSTM32F10X)/pios_usb_rctx.c - SRC += $(PIOSSTM32F10X)/pios_usb_cdc.c - SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c - SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c - SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c - SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c - SRC += $(PIOSCOMMON)/pios_usb_util.c +# PIOS USB related files +SRC += $(OPSYSTEM)/pios_usb_board_data.c +SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c +SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c +SRC += $(PIOSCOMMON)/pios_usb_util.c - ## PIOS Hardware (Common) - SRC += $(PIOSCOMMON)/pios_crc.c - SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c - SRC += $(PIOSCOMMON)/pios_flash_jedec.c - SRC += $(PIOSCOMMON)/pios_adxl345.c - SRC += $(PIOSCOMMON)/pios_mpu6000.c - SRC += $(PIOSCOMMON)/pios_com.c - SRC += $(PIOSCOMMON)/pios_sbus.c - SRC += $(PIOSCOMMON)/pios_rcvr.c - SRC += $(PIOSCOMMON)/pios_gcsrcvr.c - SRC += $(PIOSCOMMON)/pios_rfm22b.c - SRC += $(PIOSCOMMON)/pios_rfm22b_com.c - SRC += $(PIOSCOMMON)/printf-stdarg.c - SRC += $(PIOSCOMMON)/pios_i2c_esc.c +## Libraries for flight calculations +SRC += $(FLIGHTLIB)/fifo_buffer.c +SRC += $(FLIGHTLIB)/taskmonitor.c +SRC += $(FLIGHTLIB)/packet_handler.c +SRC += $(FLIGHTLIB)/sanitycheck.c +SRC += $(FLIGHTLIB)/CoordinateConversions.c +SRC += $(MATHLIB)/sin_lookup.c +SRC += $(MATHLIB)/pid.c - ## Libraries for flight calculations - SRC += $(FLIGHTLIB)/fifo_buffer.c - SRC += $(FLIGHTLIB)/CoordinateConversions.c - SRC += $(FLIGHTLIB)/taskmonitor.c - SRC += $(FLIGHTLIB)/sanitycheck.c - SRC += $(MATHLIB)/sin_lookup.c - SRC += $(MATHLIB)/pid.c - - ## CMSIS for STM32 - SRC += $(CMSISDIR)/core_cm3.c - SRC += $(CMSISDIR)/system_stm32f10x.c - - ## Used parts of the STM-Library - SRC += $(STMSPDSRCDIR)/stm32f10x_adc.c - SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c - SRC += $(STMSPDSRCDIR)/stm32f10x_crc.c - SRC += $(STMSPDSRCDIR)/stm32f10x_dac.c - SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c - SRC += $(STMSPDSRCDIR)/stm32f10x_exti.c - SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c - SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c - SRC += $(STMSPDSRCDIR)/stm32f10x_i2c.c - SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c - SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c - SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c - SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c - SRC += $(STMSPDSRCDIR)/stm32f10x_tim.c - SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c - SRC += $(STMSPDSRCDIR)/stm32f10x_iwdg.c - SRC += $(STMSPDSRCDIR)/stm32f10x_dbgmcu.c - SRC += $(STMSPDSRCDIR)/misc.c - - ## STM32 USB Library - SRC += $(STMUSBSRCDIR)/usb_core.c - SRC += $(STMUSBSRCDIR)/usb_init.c - SRC += $(STMUSBSRCDIR)/usb_int.c - SRC += $(STMUSBSRCDIR)/usb_mem.c - SRC += $(STMUSBSRCDIR)/usb_regs.c - SRC += $(STMUSBSRCDIR)/usb_sil.c - - ## RTOS - SRC += $(RTOSSRCDIR)/list.c - SRC += $(RTOSSRCDIR)/queue.c - SRC += $(RTOSSRCDIR)/tasks.c - - ## RTOS Portable - SRC += $(RTOSPORTDIR)/portable/GCC/ARM_CM3/port.c - SRC += $(RTOSPORTDIR)/portable/MemMang/heap_1.c -else ifeq ($(MCU),cortex-m4) - ## PIOS Hardware (STM32F4xx) - include $(PIOS)/STM32F4xx/library.mk -endif +## Common FreeRTOS files +SRC += $(FREERTOS_SRC_DIR)/list.c +SRC += $(FREERTOS_SRC_DIR)/queue.c +SRC += $(FREERTOS_SRC_DIR)/tasks.c # List C source files here which must be compiled in ARM-Mode (no -mthumb). # Use file-extension c for "c-only"-files -SRCARM = +SRCARM += # List C++ source files here. # Use file-extension .cpp for C++-files (not .C) -CPPSRC = +CPPSRC += # List C++ source files here which must be compiled in ARM-Mode. # Use file-extension .cpp for C++-files (not .C) -CPPSRCARM = +CPPSRCARM += # List Assembler source files here. # Make them always end in a capital .S. Files ending in a lowercase .s @@ -216,14 +130,10 @@ CPPSRCARM = # Even though the DOS/Win* filesystem matches both .s and .S the same, # it will preserve the spelling of the filenames, and gcc itself does # care about how the name is spelled on its command-line. -ifeq ($(MCU),cortex-m3) - ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S -else - ASRC = -endif +ASRC += # List Assembler source files here which must be assembled in ARM-Mode. -ASRCARM = +ASRCARM += # List any extra directories to look for include files here. # Each directory must be seperated by a space. @@ -232,29 +142,13 @@ EXTRAINCDIRS += $(PIOSINC) EXTRAINCDIRS += $(FLIGHTLIBINC) EXTRAINCDIRS += $(PIOSCOMMON) EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(CMSISDIR) EXTRAINCDIRS += $(HWDEFSINC) EXTRAINCDIRS += $(OPSYSTEMINC) -EXTRAINCDIRS += $(OPUAVSYNTHDIR) EXTRAINCDIRS += $(MATHLIBINC) -EXTRAINCDIRS += $(PYMITEINC) - -ifeq ($(MCU),cortex-m3) - EXTRAINCDIRS += $(PIOSSTM32F10X) - EXTRAINCDIRS += $(OPUAVTALK) - EXTRAINCDIRS += $(OPUAVTALKINC) - EXTRAINCDIRS += $(OPUAVOBJ) - EXTRAINCDIRS += $(OPUAVOBJINC) - EXTRAINCDIRS += $(DOSFSDIR) - EXTRAINCDIRS += $(MSDDIR) - EXTRAINCDIRS += $(RTOSINCDIR) - EXTRAINCDIRS += $(STMUSBINCDIR) - EXTRAINCDIRS += $(APPLIBDIR) - EXTRAINCDIRS += $(RTOSPORTDIR)/portable/GCC/ARM_CM3 -else ifeq ($(MCU),cortex-m4) - EXTRAINCDIRS += $(PIOSSTM34FXX) -endif +EXTRAINCDIRS += $(OPUAVOBJINC) +EXTRAINCDIRS += $(OPUAVTALKINC) +EXTRAINCDIRS += $(OPUAVSYNTHDIR) +EXTRAINCDIRS += $(FREERTOS_INC_DIR) # Modules EXTRAINCDIRS += $(foreach mod, $(OPTMODULES) $(MODULES), $(OPMODULEDIR)/$(mod)/inc) $(OPMODULEDIR)/System/inc @@ -263,7 +157,7 @@ EXTRAINCDIRS += $(foreach mod, $(OPTMODULES) $(MODULES), $(OPMODULEDIR)/$(mod)/i # Also add directories where the linker should search for # includes from linker-script to the list # Each directory must be seperated by a space. -EXTRA_LIBDIRS = +EXTRA_LIBDIRS += # Extra Libraries # Each library-name must be seperated by a space. @@ -271,81 +165,14 @@ EXTRA_LIBDIRS = # EXTRA_LIBS = xyz abc efsl # for newlib-lpc (file: libnewlibc-lpc.a): # EXTRA_LIBS = newlib-lpc -EXTRA_LIBS = +EXTRA_LIBS += m -# Path to linker scripts -ifeq ($(MCU),cortex-m3) - LINKERSCRIPTPATH = $(PIOSSTM32F10X) -else ifeq ($(MCU),cortex-m4) - LINKERSCRIPTPATH = $(PIOSSTM32FXX) -endif - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# Note: 3 is not always the best optimization level. -ifeq ($(DEBUG), YES) - OPT = 1 -else - OPT = s -endif - -# Output format (can be ihex or binary or both). -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -U options for C here. -ifeq ($(MCU),cortex-m3) - CDEFS = -DSTM32F10X_$(MODEL) -else ifeq ($(MCU),cortex-m4) - CDEFS += -DSTM32F4XX - CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) - CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) -endif - -CDEFS += -DUSE_$(BOARD) -CDEFS += -DUSE_STDPERIPH_DRIVER - -ifeq ($(ENABLE_DEBUG_PINS), YES) - CDEFS += -DPIOS_ENABLE_DEBUG_PINS -endif +# Compiler flags +CFLAGS += # Declare all non-optional modules as built-in to force inclusion CDEFS += $(foreach mod, $(notdir $(MODULES)), -DMODULE_$(mod)_BUILTIN) -# Place project-specific -D and/or -U options for Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -# Compiler flags. -# -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing - -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) -ifeq ($(MCU),cortex-m4) - # This is not the best place for these. Really should abstract out - # to the board file or something - CFLAGS += -DSTM32F4XX - CFLAGS += -DMEM_SIZE=1024000000 -endif - # The following Makefile command, ifneq (,$(filter) $(A), $(B) $(C)) # is equivalent to the pseudocode `if (A == B || A == C)` ifneq (,$(filter YES,$(STACK_DIAGNOSTICS) $(ALL_DIGNOSTICS))) @@ -368,190 +195,10 @@ ifneq (,$(filter YES,$(DIAG_TASKS) $(ALL_DIGNOSTICS))) CFLAGS += -DDIAG_TASKS endif -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -CFLAGS += -O$(OPT) -CFLAGS += -g$(DEBUGF) - -ifeq ($(DEBUG), YES) - CFLAGS += -DDEBUG -else - CFLAGS += -fdata-sections -ffunction-sections -endif - -CFLAGS += -Wall -# FIXME: STM32F4xx library raises strict aliasing and const qualifier warnings -ifneq ($(MCU),cortex-m4) - CFLAGS += -Werror -endif -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) - -# Compiler flags to generate dependency files -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# Flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS += -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += -lc -lgcc $(MATH_LIB) -LDFLAGS += -Wl,--warn-common -LDFLAGS += -Wl,--fatal-warnings - -ifneq ($(DEBUG), YES) - LDFLAGS += -Wl,-static -endif - # Set linker-script name depending on selected submodel name ifeq ($(MCU),cortex-m3) - LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld - LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld + LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_memory.ld + LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_sections.ld else ifeq ($(MCU),cortex-m4) LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP)) endif - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex sym -else ifeq ($(LOADFORMAT),binary) -build: elf bin sym -else ifeq ($(LOADFORMAT),both) -build: elf hex bin sym -else - $(error "$(MSG_FORMATERROR) $(FORMAT)") -endif - -# Generate code for PyMite -# $(OUTDIR)/pmlib_img.c $(OUTDIR)/pmlib_nat.c $(OUTDIR)/pmlibusr_img.c $(OUTDIR)/pmlibusr_nat.c $(OUTDIR)/pmfeatures.h: $(wildcard $(PYMITELIB)/*.py) $(wildcard $(PYMITEPLAT)/*.py) $(wildcard $(FLIGHTPLANLIB)/*.py) $(wildcard $(FLIGHTPLANS)/*.py) -# @echo $(MSG_PYMITEINIT) $(call toprel, $@) -# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py) -# @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h -# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -# Add opfw target -$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino opfw -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o -opfw: $(OUTDIR)/$(TARGET).opfw - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).opfw -ifneq ($(INSTALL_DIR),) - @$(ECHO) $(MSG_INSTALLING) $(call toprel, $<) - $(V1) $(MKDIR) -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw -else - $(error INSTALL_DIR must be specified for $@) -endif - -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).map - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).elf - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).hex - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).sym - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).lss - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).bin.o - $(V1) $(RM) -f $(OUTDIR)/$(TARGET).opfw - $(V1) $(RM) -f $(wildcard $(OUTDIR)/*.c) - $(V1) $(RM) -f $(wildcard $(OUTDIR)/*.h) - $(V1) $(RM) -f $(ALLOBJ) - $(V1) $(RM) -f $(LSTFILES) - $(V1) $(RM) -f $(DEPFILES) - $(V1) $(RM) -f $(SRC:.c=.s) - $(V1) $(RM) -f $(SRCARM:.c=.s) - $(V1) $(RM) -f $(CPPSRC:.cpp=.s) - $(V1) $(RM) -f $(CPPSRCARM:.cpp=.s) - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -$(shell $(MKDIR) -p $(OUTDIR) 2>/dev/null) - -# Include the dependency files. --include $(shell $(MKDIR) -p $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) - -# Listing of phony targets. -.PHONY : all build clean clean_list install diff --git a/make/boot-defs.mk b/make/boot-defs.mk index b1e37e35f..f7b5d43dd 100644 --- a/make/boot-defs.mk +++ b/make/boot-defs.mk @@ -95,7 +95,6 @@ EXTRAINCDIRS += $(PIOSINC) EXTRAINCDIRS += $(FLIGHTLIBINC) EXTRAINCDIRS += $(PIOSCOMMON) EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) EXTRAINCDIRS += $(HWDEFSINC) EXTRAINCDIRS += $(OPSYSTEMINC) @@ -103,7 +102,7 @@ EXTRAINCDIRS += $(OPSYSTEMINC) # Also add directories where the linker should search for # includes from linker-script to the list # Each directory must be seperated by a space. -EXTRA_LIBDIRS = +EXTRA_LIBDIRS += # Extra Libraries # Each library-name must be seperated by a space. @@ -111,7 +110,7 @@ EXTRA_LIBDIRS = # EXTRA_LIBS = xyz abc efsl # for newlib-lpc (file: libnewlibc-lpc.a): # EXTRA_LIBS = newlib-lpc -EXTRA_LIBS = +EXTRA_LIBS += # Provide (only) the bootloader with board-specific defines BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) diff --git a/make/common-defs.mk b/make/common-defs.mk index cf05fb68a..cd8b503e0 100644 --- a/make/common-defs.mk +++ b/make/common-defs.mk @@ -117,8 +117,7 @@ ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) # --cref: add cross reference to map file LDFLAGS += -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += -lc -lgcc -lm +LDFLAGS += -lc -lgcc $(patsubst %,-l%,$(EXTRA_LIBS)) LDFLAGS += -Wl,--warn-common LDFLAGS += -Wl,--fatal-warnings @@ -152,8 +151,15 @@ else $(error "$(MSG_FORMATERROR) $(FORMAT)") endif +# Generate code for PyMite +# $(OUTDIR)/pmlib_img.c $(OUTDIR)/pmlib_nat.c $(OUTDIR)/pmlibusr_img.c $(OUTDIR)/pmlibusr_nat.c $(OUTDIR)/pmfeatures.h: $(wildcard $(PYMITELIB)/*.py) $(wildcard $(PYMITEPLAT)/*.py) $(wildcard $(FLIGHTPLANLIB)/*.py) $(wildcard $(FLIGHTPLANS)/*.py) +# @$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@) +# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py) +# @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h +# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py + # Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) +$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) # Assemble: create object files from assembler source files. $(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) From ce4b2f4446d0c606380c22ca8d8256f64a68d688 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 00:35:13 +0200 Subject: [PATCH 29/68] pios_debug: use PIOS_INCLUDE_DEBUG_CONSOLE to DEBUG_PRINTF(level, ...) Inconsistent use of debug macros in board definition files resulted in BU compilation error. It was attempted to use PIOS_COM_SendFormattedStringNonBlocking() directly even if PIOS_COM was not included (like for BootloaderUpdater). So this function in pios_debug.c was replaced by DEBUG_PRINTF() macro. The macro itself is defined in pios_debug.h file. Its definitions are removed from board files. And to use it one has to define in pios_config.h: #define PIOS_INCLUDE_DEBUG_CONSOLE #define DEBUG_LEVEL in addition to PIOS_INCLUDE_COM with aux port. Conflicts: flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h flight/PiOS/Boards/STM32F4xx_RevoMini.h --- flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h | 6 ------ flight/PiOS/Boards/STM32F4xx_OSD.h | 9 +-------- flight/PiOS/Boards/STM32F4xx_RevoMini.h | 7 ------- flight/PiOS/STM32F10x/pios_debug.c | 4 ++-- flight/PiOS/STM32F4xx/pios_debug.c | 4 ++-- flight/PiOS/inc/pios_debug.h | 14 ++++++++++++++ .../targets/CopterControl/System/inc/pios_config.h | 3 +++ flight/targets/OSD/System/osd.c | 14 +++++++------- flight/targets/PipXtreme/System/inc/pios_config.h | 3 +++ .../targets/RevoMini/System/inc/pios_board_sim.h | 2 +- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h index 9be8efe2c..4a402b07a 100755 --- a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h @@ -191,12 +191,6 @@ extern uint32_t pios_ppm_out_id; #define PIOS_PPM_RECEIVER (pios_ppm_rcvr_id) #define PIOS_PPM_OUTPUT (pios_ppm_out_id) -#define DEBUG_LEVEL 2 -#if DEBUG_LEVEL > 1000 -#define DEBUG_PRINTF(level, ...) {if(level <= DEBUG_LEVEL && PIOS_COM_DEBUG > 0) { PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, __VA_ARGS__); }} -#else -#define DEBUG_PRINTF(...) -#endif #define RFM22_DEBUG 1 //------------------------- diff --git a/flight/PiOS/Boards/STM32F4xx_OSD.h b/flight/PiOS/Boards/STM32F4xx_OSD.h index 722c76d34..5628571a0 100644 --- a/flight/PiOS/Boards/STM32F4xx_OSD.h +++ b/flight/PiOS/Boards/STM32F4xx_OSD.h @@ -186,7 +186,7 @@ extern uint32_t pios_com_telem_usb_id; #define PIOS_COM_GPS (pios_com_gps_id) #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id) #define PIOS_COM_TELEM_RF (pios_com_telem_rf_id) -#define PIOS_COM_DEBUG PIOS_COM_AUX +#define PIOS_COM_DEBUG (PIOS_COM_AUX) #define PIOS_COM_OSD (pios_com_aux_id) //extern uint32_t pios_com_serial_id; @@ -202,13 +202,6 @@ extern uint32_t pios_com_telem_usb_id; #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id) #endif -#if defined(PIOS_COM_DEBUG) -// #define DEBUG_PRINTF(...) PIOS_COM_SendFormattedString(PIOS_COM_DEBUG, __VA_ARGS__) - #define DEBUG_PRINTF(...) PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, __VA_ARGS__) -#else - #define DEBUG_PRINTF(...) -#endif - // ***************************************************************** // ADC diff --git a/flight/PiOS/Boards/STM32F4xx_RevoMini.h b/flight/PiOS/Boards/STM32F4xx_RevoMini.h index 49c0d1c96..0f8fb38d3 100644 --- a/flight/PiOS/Boards/STM32F4xx_RevoMini.h +++ b/flight/PiOS/Boards/STM32F4xx_RevoMini.h @@ -31,13 +31,6 @@ #include -#if defined(PIOS_INCLUDE_DEBUG_CONSOLE) -#define DEBUG_LEVEL 0 -#define DEBUG_PRINTF(level, ...) {if(level <= DEBUG_LEVEL && pios_com_debug_id > 0) { PIOS_COM_SendFormattedStringNonBlocking(pios_com_debug_id, __VA_ARGS__); }} -#else -#define DEBUG_PRINTF(level, ...) -#endif /* PIOS_INCLUDE_DEBUG_CONSOLE */ - //------------------------ // Timers and Channels Used //------------------------ diff --git a/flight/PiOS/STM32F10x/pios_debug.c b/flight/PiOS/STM32F10x/pios_debug.c index 96cde1370..f7c9d6cf3 100644 --- a/flight/PiOS/STM32F10x/pios_debug.c +++ b/flight/PiOS/STM32F10x/pios_debug.c @@ -153,9 +153,9 @@ void PIOS_DEBUG_PinValue4BitL(uint8_t value) */ void PIOS_DEBUG_Panic(const char *msg) { -#ifdef PIOS_COM_DEBUG +#ifdef PIOS_INCLUDE_DEBUG_CONSOLE register int *lr asm("lr"); // Link-register holds the PC of the caller - PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, "\r%s @0x%x\r", msg, lr); + DEBUG_PRINTF(0, "\r%s @0x%x\r", msg, lr); #endif // Stay put diff --git a/flight/PiOS/STM32F4xx/pios_debug.c b/flight/PiOS/STM32F4xx/pios_debug.c index 0e607cf47..51efbc188 100644 --- a/flight/PiOS/STM32F4xx/pios_debug.c +++ b/flight/PiOS/STM32F4xx/pios_debug.c @@ -153,9 +153,9 @@ void PIOS_DEBUG_PinValue4BitL(uint8_t value) */ void PIOS_DEBUG_Panic(const char *msg) { -#ifdef PIOS_COM_DEBUG +#ifdef PIOS_INCLUDE_DEBUG_CONSOLE register int *lr asm("lr"); // Link-register holds the PC of the caller - PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, "\r%s @0x%x\r", msg, lr); + DEBUG_PRINTF(0, "\r%s @0x%x\r", msg, lr); #endif // Stay put diff --git a/flight/PiOS/inc/pios_debug.h b/flight/PiOS/inc/pios_debug.h index 0915ad071..4bc1e0802 100644 --- a/flight/PiOS/inc/pios_debug.h +++ b/flight/PiOS/inc/pios_debug.h @@ -31,6 +31,20 @@ #ifndef PIOS_DEBUG_H #define PIOS_DEBUG_H +#ifdef PIOS_INCLUDE_DEBUG_CONSOLE +#ifndef DEBUG_LEVEL +#define DEBUG_LEVEL 0 +#endif +#define DEBUG_PRINTF(level, ...) \ + { \ + if ((level <= DEBUG_LEVEL) && (PIOS_COM_DEBUG > 0)) { \ + PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, __VA_ARGS__); \ + } \ + } +#else +#define DEBUG_PRINTF(level, ...) +#endif /* PIOS_INCLUDE_DEBUG_CONSOLE */ + extern const char *PIOS_DEBUG_AssertMsg; #ifdef USE_SIM_POSIX diff --git a/flight/targets/CopterControl/System/inc/pios_config.h b/flight/targets/CopterControl/System/inc/pios_config.h index 2cfac0fbc..a11e44224 100644 --- a/flight/targets/CopterControl/System/inc/pios_config.h +++ b/flight/targets/CopterControl/System/inc/pios_config.h @@ -36,6 +36,9 @@ * details. */ +/* #define PIOS_INCLUDE_DEBUG_CONSOLE */ +/* #define DEBUG_LEVEL 0 */ + #define PIOS_INCLUDE_FREERTOS #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL diff --git a/flight/targets/OSD/System/osd.c b/flight/targets/OSD/System/osd.c index 5615925ca..f0d48a769 100644 --- a/flight/targets/OSD/System/osd.c +++ b/flight/targets/OSD/System/osd.c @@ -117,8 +117,8 @@ void processReset(void) if (RCC_GetFlagStatus(RCC_FLAG_IWDGRST) != RESET) { // Independant Watchdog Reset - #if defined(PIOS_COM_DEBUG) - DEBUG_PRINTF("\r\nINDEPENDANT WATCHDOG CAUSED A RESET\r\n"); + #if defined(PIOS_COM_DEBUG_CONSOLE) + DEBUG_PRINTF(0, "\r\nINDEPENDANT WATCHDOG CAUSED A RESET\r\n"); #endif // all led's ON @@ -136,7 +136,7 @@ void processReset(void) if (RCC_GetFlagStatus(RCC_FLAG_WWDGRST) != RESET) { // Window Watchdog Reset - DEBUG_PRINTF("\r\nWINDOW WATCHDOG CAUSED A REBOOT\r\n"); + DEBUG_PRINTF(0, "\r\nWINDOW WATCHDOG CAUSED A REBOOT\r\n"); // all led's ON USB_LED_ON; @@ -156,28 +156,28 @@ void processReset(void) if (RCC_GetFlagStatus(RCC_FLAG_PORRST) != RESET) { // Power-On Reset #if defined(PIOS_COM_DEBUG) - DEBUG_PRINTF("\r\nPOWER-ON-RESET\r\n"); + DEBUG_PRINTF(0, "\r\nPOWER-ON-RESET\r\n"); #endif } if (RCC_GetFlagStatus(RCC_FLAG_SFTRST) != RESET) { // Software Reset #if defined(PIOS_COM_DEBUG) - DEBUG_PRINTF("\r\nSOFTWARE RESET\r\n"); + DEBUG_PRINTF(0, "\r\nSOFTWARE RESET\r\n"); #endif } if (RCC_GetFlagStatus(RCC_FLAG_LPWRRST) != RESET) { // Low-Power Reset #if defined(PIOS_COM_DEBUG) - DEBUG_PRINTF("\r\nLOW POWER RESET\r\n"); + DEBUG_PRINTF(0, "\r\nLOW POWER RESET\r\n"); #endif } if (RCC_GetFlagStatus(RCC_FLAG_PINRST) != RESET) { // Pin Reset #if defined(PIOS_COM_DEBUG) - DEBUG_PRINTF("\r\nPIN RESET\r\n"); + DEBUG_PRINTF("0, \r\nPIN RESET\r\n"); #endif } diff --git a/flight/targets/PipXtreme/System/inc/pios_config.h b/flight/targets/PipXtreme/System/inc/pios_config.h index 21c0dc12a..29459795f 100755 --- a/flight/targets/PipXtreme/System/inc/pios_config.h +++ b/flight/targets/PipXtreme/System/inc/pios_config.h @@ -36,6 +36,9 @@ * details. */ +/* #define PIOS_INCLUDE_DEBUG_CONSOLE */ +/* #define DEBUG_LEVEL 0 */ + #define PIOS_INCLUDE_FREERTOS #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL diff --git a/flight/targets/RevoMini/System/inc/pios_board_sim.h b/flight/targets/RevoMini/System/inc/pios_board_sim.h index 30a3d3d37..8f551cab9 100644 --- a/flight/targets/RevoMini/System/inc/pios_board_sim.h +++ b/flight/targets/RevoMini/System/inc/pios_board_sim.h @@ -60,7 +60,7 @@ extern uint32_t pios_com_spectrum_id; #ifdef PIOS_ENABLE_AUX_UART #define PIOS_COM_AUX (pios_com_aux_id) -#define PIOS_COM_DEBUG (PIOS_COM_AUX +#define PIOS_COM_DEBUG (PIOS_COM_AUX) #endif #define PIOS_GCSRCVR_TIMEOUT_MS 200 From 9b3d3e62ab70bec34c3361eb9eb9fe3be930c432 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 00:38:11 +0200 Subject: [PATCH 30/68] Makefile: fix Makefile for BootloaderUpdater (STM32F10x only targets) Conflicts: flight/targets/Bootloaders/BootloaderUpdater/Makefile --- Makefile | 17 +- flight/PiOS/STM32F10x/pios_usb_hid_istr.c | 5 + flight/PiOS/STM32F10x/pios_usbhook.c | 5 + flight/PiOS/STM32F4xx/pios_usbhook.c | 4 + .../Bootloaders/BootloaderUpdater/Makefile | 474 ++---------------- make/common-defs.mk | 6 +- 6 files changed, 66 insertions(+), 445 deletions(-) diff --git a/Makefile b/Makefile index e1a8df8b0..2c0bcc027 100644 --- a/Makefile +++ b/Makefile @@ -516,21 +516,10 @@ bu_$(1)_%: bl_$(1)_bino BOARD_NAME=$(1) \ BOARD_SHORT_NAME=$(3) \ BUILD_TYPE=bu \ - TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \ - REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \ - \ - TARGET=bu_$(1) \ - OUTDIR=$(BUILD_DIR)/bu_$(1) \ - \ - PIOS=$(PIOS) \ - FLIGHTLIB=$(FLIGHTLIB) \ - OPMODULEDIR=$(OPMODULEDIR) \ - OPUAVOBJ=$(OPUAVOBJ) \ - OPUAVTALK=$(OPUAVTALK) \ HWDEFSINC=$(HWDEFS)/$(1) \ - OPUAVSYNTHDIR=$(OPUAVSYNTHDIR) \ - DOXYGENDIR=$(DOXYGENDIR) \ - \ + TOPDIR=$(ROOT_DIR)/flight/targets/Bootloaders/BootloaderUpdater \ + OUTDIR=$(BUILD_DIR)/bu_$(1) \ + TARGET=bu_$(1) \ $$* .PHONY: bu_$(1)_clean diff --git a/flight/PiOS/STM32F10x/pios_usb_hid_istr.c b/flight/PiOS/STM32F10x/pios_usb_hid_istr.c index 7426b6a9c..e26dd0b4f 100644 --- a/flight/PiOS/STM32F10x/pios_usb_hid_istr.c +++ b/flight/PiOS/STM32F10x/pios_usb_hid_istr.c @@ -15,6 +15,9 @@ /* Includes ------------------------------------------------------------------*/ #include "pios.h" + +#ifdef PIOS_INCLUDE_USB + #include "usb_lib.h" #include "pios_usb_hid_pwr.h" #include "pios_usb_hid_istr.h" @@ -330,3 +333,5 @@ u32 STM32_PCD_OTG_ISR_Handler(void) #endif /* STM32F10X_CL */ /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ + +#endif /* PIOS_INCLUDE_USB */ diff --git a/flight/PiOS/STM32F10x/pios_usbhook.c b/flight/PiOS/STM32F10x/pios_usbhook.c index a691d8447..0fd6e2e5b 100644 --- a/flight/PiOS/STM32F10x/pios_usbhook.c +++ b/flight/PiOS/STM32F10x/pios_usbhook.c @@ -29,6 +29,9 @@ */ #include "pios.h" + +#ifdef PIOS_INCLUDE_USB + #include "pios_usb.h" /* PIOS_USB_* */ #include "pios_usbhook.h" #include "pios_usb_defs.h" /* struct usb_* */ @@ -549,4 +552,6 @@ static const uint8_t *PIOS_USBHOOK_GetProtocolValue(uint16_t Length) } } +#endif /* PIOS_INCLUDE_USB */ + /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ diff --git a/flight/PiOS/STM32F4xx/pios_usbhook.c b/flight/PiOS/STM32F4xx/pios_usbhook.c index 08653a74a..fa7b8284b 100644 --- a/flight/PiOS/STM32F4xx/pios_usbhook.c +++ b/flight/PiOS/STM32F4xx/pios_usbhook.c @@ -29,6 +29,9 @@ */ #include "pios.h" + +#ifdef PIOS_INCLUDE_USB + #include "pios_usb.h" /* PIOS_USB_* */ #include "pios_usbhook.h" #include "pios_usb_defs.h" /* struct usb_* */ @@ -470,3 +473,4 @@ static USBD_Class_cb_TypeDef class_callbacks = { #endif /* USB_SUPPORT_USER_STRING_DESC */ }; +#endif /* PIOS_INCLUDE_USB */ diff --git a/flight/targets/Bootloaders/BootloaderUpdater/Makefile b/flight/targets/Bootloaders/BootloaderUpdater/Makefile index 0ddea753b..5bf59502b 100644 --- a/flight/targets/Bootloaders/BootloaderUpdater/Makefile +++ b/flight/targets/Bootloaders/BootloaderUpdater/Makefile @@ -1,442 +1,64 @@ - ##### - # Project: OpenPilot - # - # - # Makefile for OpenPilot project build PiOS and the AP. - # - # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. - # - # - # 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, write to the Free Software Foundation, Inc., - # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - ##### +# +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES to compile for debugging -DEBUG ?= NO - -# Set to YES to use the Servo output pins for debugging via scope or logic analyser -ENABLE_DEBUG_PINS ?= NO - -# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs -ENABLE_AUX_UART ?= NO - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -# Toolchain prefix (i.e arm-elf- -> arm-elf-gcc.exe) -TCHAIN_PREFIX ?= arm-none-eabi- - -# Remove command is different for Code Sourcery on Windows -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -FLASH_TOOL = OPENOCD +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk # Paths -OPSYSTEM = . -OPSYSTEMINC = $(OPSYSTEM)/inc -PIOSINC = $(PIOS)/inc -PIOSSTM32F10X = $(PIOS)/STM32F10x -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -APPLIBDIR = $(PIOSSTM32F10X)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver -STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc -STMUSBSRCDIR = $(STMUSBDIR)/src -STMUSBINCDIR = $(STMUSBDIR)/inc -CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 -DOSFSDIR = $(APPLIBDIR)/dosfs -MSDDIR = $(APPLIBDIR)/msd -RTOSDIR = $(APPLIBDIR)/FreeRTOS -RTOSSRCDIR = $(RTOSDIR)/Source -RTOSINCDIR = $(RTOSSRCDIR)/include +TOPDIR = . +OPSYSTEM = $(TOPDIR) +OPSYSTEMINC = $(OPSYSTEM)/inc +PIOSINC = $(PIOS)/inc +PIOSCOMMON = $(PIOS)/Common +PIOSBOARDS = $(PIOS)/Boards +FLIGHTLIBINC = $(FLIGHTLIB)/inc -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files - -## CORE: +# List C source files here (C dependencies are automatically generated). +# Use file-extension c for "c-only"-files SRC += $(OPSYSTEM)/main.c SRC += $(OPSYSTEM)/pios_board.c +## PIOS Hardware +ifeq ($(MCU),cortex-m3) + include $(PIOS)/STM32F10x/library.mk -## PIOS Hardware (STM32F10x) -include $(PIOS)/STM32F10x/library.mk -SRC += $(PIOSSTM32F10X)/pios_sys.c -SRC += $(PIOSSTM32F10X)/pios_led.c -SRC += $(PIOSSTM32F10X)/pios_delay.c -SRC += $(PIOSSTM32F10X)/pios_irq.c -SRC += $(PIOSSTM32F10X)/pios_gpio.c - -## CMSIS for STM32 -SRC += $(CMSISDIR)/core_cm3.c -SRC += $(CMSISDIR)/system_stm32f10x.c - -## Used parts of the STM-Library -SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c -SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c -SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c -SRC += $(STMSPDSRCDIR)/stm32f10x_tim.c -SRC += $(STMSPDSRCDIR)/misc.c - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -ASRC = $(PIOSSTM32F10X)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S - -# List Assembler source files here which must be assembled in ARM-Mode.. -ASRCARM = + # Set linker-script name depending on selected submodel name + LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_memory.ld + LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_sections.ld +else + $(error Unsupported MCU for BootloaderUpdater: $(MCU)) +endif # List any extra directories to look for include files here. # Each directory must be seperated by a space. -EXTRAINCDIRS += $(OPSYSTEM) -EXTRAINCDIRS += $(OPSYSTEMINC) -EXTRAINCDIRS += $(OPUAVTALK) -EXTRAINCDIRS += $(OPUAVTALKINC) -EXTRAINCDIRS += $(OPUAVOBJ) -EXTRAINCDIRS += $(OPUAVOBJINC) -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(PIOSSTM32F10X) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(STMUSBINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(DOSFSDIR) -EXTRAINCDIRS += $(MSDDIR) -EXTRAINCDIRS += $(RTOSINCDIR) -EXTRAINCDIRS += $(APPLIBDIR) -EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3 -EXTRAINCDIRS += $(HWDEFSINC) - - - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32F10X) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -OPT = 0 -else -OPT = s -endif - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DSTM32F10X_$(MODEL) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) -ifeq ($(ENABLE_DEBUG_PINS), YES) -CDEFS += -DPIOS_ENABLE_DEBUG_PINS -endif -ifeq ($(ENABLE_AUX_UART), YES) -CDEFS += -DPIOS_ENABLE_AUX_UART -endif - -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -# -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) - -ifeq ($(DEBUG),YES) -CFLAGS = -DDEBUG -endif - -CFLAGS += -g$(DEBUGF) -CFLAGS += -O$(OPT) -ifeq ($(DEBUG),NO) -CFLAGS += -ffunction-sections -endif - -CFLAGS += -mcpu=$(MCU) -mthumb -CFLAGS += $(CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. - -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif - -CFLAGS += -Wall -CFLAGS += -Werror -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = -mcpu=$(MCU) -mthumb -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -ifeq ($(DEBUG),NO) -LDFLAGS += -Wl,-static -endif -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -# Set linker-script name depending on selected submodel name -LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld -LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld - -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin -# Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin" -# Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin" -# reset target -OOCD_CL+=-c "reset run" -# terminate OOCD after programming -OOCD_CL+=-c shutdown -# --------------------------------------------------------------------------- - - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f -###SHELL = sh -###COPY = cp - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - - -# Default target. -all: build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex sym -else -ifeq ($(LOADFORMAT),binary) -build: elf bin sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif -endif - -# Program the device. -ifeq ($(FLASH_TOOL),OPENOCD) -# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).bin - @echo ${quote}Programming with OPENOCD${quote} - $(OOCD_EXE) $(OOCD_CL) -endif +EXTRAINCDIRS += $(PIOS) +EXTRAINCDIRS += $(PIOSINC) +EXTRAINCDIRS += $(FLIGHTLIBINC) +EXTRAINCDIRS += $(PIOSCOMMON) +EXTRAINCDIRS += $(PIOSBOARDS) +EXTRAINCDIRS += $(HWDEFSINC) +EXTRAINCDIRS += $(OPSYSTEMINC) # Link: create ELF output file from object files. -BLOBJ := $(TOP)/build/bl_$(BOARD_NAME)/bl_$(BOARD_NAME).bin.o -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ) $(BLOBJ))) +EXTRAOBJ := $(BUILD_DIR)/bl_$(BOARD_NAME)/bl_$(BOARD_NAME).bin.o -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) - -.PHONY: elf lss sym hex bin bino opfw -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o -opfw: $(OUTDIR)/$(TARGET).opfw - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) -.PHONY: size -size: $(OUTDIR)/$(TARGET).elf_size - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).opfw -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw -else - $(error INSTALL_DIR must be specified for $@) -endif - -# Target: clean project. -clean: begin clean_list finished end - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list program install +include $(ROOT_DIR)/make/common-defs.mk diff --git a/make/common-defs.mk b/make/common-defs.mk index cd8b503e0..722c67e89 100644 --- a/make/common-defs.mk +++ b/make/common-defs.mk @@ -20,10 +20,6 @@ ifndef OPENPILOT_IS_COOL $(error Top level Makefile must be used to build this target) endif -# -# Common botloader and firmware rules -# - # Optimization level, can be [0, 1, 2, 3, s]. # 0 = turn off optimization. s = optimize for size. # Note: 3 is not always the best optimization level. @@ -131,7 +127,7 @@ ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) ALLSRCBASE = $(notdir $(basename $(ALLSRC))) # Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) +ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) $(EXTRAOBJ) # Define all listing files (used for make clean). LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) From 9bcbcbeb34223d273d3b44d504b3b94119d36a14 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 00:48:10 +0200 Subject: [PATCH 31/68] Remove never used op_config.h files (all occurences were empty) --- .../CopterControl/System/inc/op_config.h | 39 ------------------- .../CopterControl/System/inc/openpilot.h | 1 - flight/targets/OSD/System/inc/op_config.h | 39 ------------------- flight/targets/OSD/System/inc/openpilot.h | 1 - .../targets/PipXtreme/System/inc/op_config.h | 39 ------------------- .../targets/PipXtreme/System/inc/openpilot.h | 1 - .../targets/RevoMini/System/inc/op_config.h | 39 ------------------- .../targets/RevoMini/System/inc/openpilot.h | 1 - .../targets/Revolution/System/inc/op_config.h | 39 ------------------- .../targets/Revolution/System/inc/openpilot.h | 1 - .../targets/SimPosix/System/inc/op_config.h | 39 ------------------- .../targets/SimPosix/System/inc/openpilot.h | 1 - 12 files changed, 240 deletions(-) delete mode 100644 flight/targets/CopterControl/System/inc/op_config.h delete mode 100644 flight/targets/OSD/System/inc/op_config.h delete mode 100755 flight/targets/PipXtreme/System/inc/op_config.h delete mode 100644 flight/targets/RevoMini/System/inc/op_config.h delete mode 100644 flight/targets/Revolution/System/inc/op_config.h delete mode 100644 flight/targets/SimPosix/System/inc/op_config.h diff --git a/flight/targets/CopterControl/System/inc/op_config.h b/flight/targets/CopterControl/System/inc/op_config.h deleted file mode 100644 index 97910f392..000000000 --- a/flight/targets/CopterControl/System/inc/op_config.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotCore OpenPilot Core - * @{ - * - * @file op_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief OpenPilot configuration header. - * Compile time config for OpenPilot Application - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef OP_CONFIG_H -#define OP_CONFIG_H - -#endif /* OP_CONFIG_H */ -/** - * @} - * @} - */ diff --git a/flight/targets/CopterControl/System/inc/openpilot.h b/flight/targets/CopterControl/System/inc/openpilot.h index 59ae76fd4..7f1ac3758 100644 --- a/flight/targets/CopterControl/System/inc/openpilot.h +++ b/flight/targets/CopterControl/System/inc/openpilot.h @@ -35,7 +35,6 @@ #include /* OpenPilot Libraries */ -#include "op_config.h" #include "utlist.h" #include "uavobjectmanager.h" #include "eventdispatcher.h" diff --git a/flight/targets/OSD/System/inc/op_config.h b/flight/targets/OSD/System/inc/op_config.h deleted file mode 100644 index 97910f392..000000000 --- a/flight/targets/OSD/System/inc/op_config.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotCore OpenPilot Core - * @{ - * - * @file op_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief OpenPilot configuration header. - * Compile time config for OpenPilot Application - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef OP_CONFIG_H -#define OP_CONFIG_H - -#endif /* OP_CONFIG_H */ -/** - * @} - * @} - */ diff --git a/flight/targets/OSD/System/inc/openpilot.h b/flight/targets/OSD/System/inc/openpilot.h index 59ae76fd4..7f1ac3758 100644 --- a/flight/targets/OSD/System/inc/openpilot.h +++ b/flight/targets/OSD/System/inc/openpilot.h @@ -35,7 +35,6 @@ #include /* OpenPilot Libraries */ -#include "op_config.h" #include "utlist.h" #include "uavobjectmanager.h" #include "eventdispatcher.h" diff --git a/flight/targets/PipXtreme/System/inc/op_config.h b/flight/targets/PipXtreme/System/inc/op_config.h deleted file mode 100755 index 97910f392..000000000 --- a/flight/targets/PipXtreme/System/inc/op_config.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotCore OpenPilot Core - * @{ - * - * @file op_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief OpenPilot configuration header. - * Compile time config for OpenPilot Application - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef OP_CONFIG_H -#define OP_CONFIG_H - -#endif /* OP_CONFIG_H */ -/** - * @} - * @} - */ diff --git a/flight/targets/PipXtreme/System/inc/openpilot.h b/flight/targets/PipXtreme/System/inc/openpilot.h index 59ae76fd4..7f1ac3758 100755 --- a/flight/targets/PipXtreme/System/inc/openpilot.h +++ b/flight/targets/PipXtreme/System/inc/openpilot.h @@ -35,7 +35,6 @@ #include /* OpenPilot Libraries */ -#include "op_config.h" #include "utlist.h" #include "uavobjectmanager.h" #include "eventdispatcher.h" diff --git a/flight/targets/RevoMini/System/inc/op_config.h b/flight/targets/RevoMini/System/inc/op_config.h deleted file mode 100644 index 97910f392..000000000 --- a/flight/targets/RevoMini/System/inc/op_config.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotCore OpenPilot Core - * @{ - * - * @file op_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief OpenPilot configuration header. - * Compile time config for OpenPilot Application - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef OP_CONFIG_H -#define OP_CONFIG_H - -#endif /* OP_CONFIG_H */ -/** - * @} - * @} - */ diff --git a/flight/targets/RevoMini/System/inc/openpilot.h b/flight/targets/RevoMini/System/inc/openpilot.h index 59ae76fd4..7f1ac3758 100644 --- a/flight/targets/RevoMini/System/inc/openpilot.h +++ b/flight/targets/RevoMini/System/inc/openpilot.h @@ -35,7 +35,6 @@ #include /* OpenPilot Libraries */ -#include "op_config.h" #include "utlist.h" #include "uavobjectmanager.h" #include "eventdispatcher.h" diff --git a/flight/targets/Revolution/System/inc/op_config.h b/flight/targets/Revolution/System/inc/op_config.h deleted file mode 100644 index 97910f392..000000000 --- a/flight/targets/Revolution/System/inc/op_config.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotCore OpenPilot Core - * @{ - * - * @file op_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief OpenPilot configuration header. - * Compile time config for OpenPilot Application - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef OP_CONFIG_H -#define OP_CONFIG_H - -#endif /* OP_CONFIG_H */ -/** - * @} - * @} - */ diff --git a/flight/targets/Revolution/System/inc/openpilot.h b/flight/targets/Revolution/System/inc/openpilot.h index 59ae76fd4..7f1ac3758 100644 --- a/flight/targets/Revolution/System/inc/openpilot.h +++ b/flight/targets/Revolution/System/inc/openpilot.h @@ -35,7 +35,6 @@ #include /* OpenPilot Libraries */ -#include "op_config.h" #include "utlist.h" #include "uavobjectmanager.h" #include "eventdispatcher.h" diff --git a/flight/targets/SimPosix/System/inc/op_config.h b/flight/targets/SimPosix/System/inc/op_config.h deleted file mode 100644 index 0fe9e2bdc..000000000 --- a/flight/targets/SimPosix/System/inc/op_config.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotCore OpenPilot Core - * @{ - * - * @file op_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief OpenPilot configuration header. - * Compile time config for OpenPilot Application - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef OP_CONFIG_H -#define OP_CONFIG_H - -#endif /* OP_CONFIG_H */ -/** - * @} - * @} - */ diff --git a/flight/targets/SimPosix/System/inc/openpilot.h b/flight/targets/SimPosix/System/inc/openpilot.h index 0bbdf971b..5cad3ec7a 100644 --- a/flight/targets/SimPosix/System/inc/openpilot.h +++ b/flight/targets/SimPosix/System/inc/openpilot.h @@ -35,7 +35,6 @@ #include /* OpenPilot Libraries */ -#include "op_config.h" #include "utlist.h" #include "uavobjectmanager.h" #include "eventdispatcher.h" From 49ed34fd7b180c0fc0a8fa484761306738fc1295 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 13:17:48 +0200 Subject: [PATCH 32/68] insgps: move definition of NavStruct variable from header to source file --- flight/Libraries/inc/insgps.h | 2 +- flight/Libraries/insgps13state.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/flight/Libraries/inc/insgps.h b/flight/Libraries/inc/insgps.h index 1ff6c4de7..562937c75 100644 --- a/flight/Libraries/inc/insgps.h +++ b/flight/Libraries/inc/insgps.h @@ -80,7 +80,7 @@ void VelBaroCorrection(float Vel[3], float BaroAlt); uint16_t ins_get_num_states(); // Nav structure containing current solution -struct NavStruct { +extern struct NavStruct { float Pos[3]; // Position in meters and relative to a local NED frame float Vel[3]; // Velocity in meters and in NED float q[4]; // unit quaternion rotation relative to NED diff --git a/flight/Libraries/insgps13state.c b/flight/Libraries/insgps13state.c index 8748ef4c9..051338572 100644 --- a/flight/Libraries/insgps13state.c +++ b/flight/Libraries/insgps13state.c @@ -66,6 +66,9 @@ float P[NUMX][NUMX], X[NUMX]; // covariance matrix and state vector float Q[NUMW], R[NUMV]; // input noise and measurement noise variances float K[NUMX][NUMV]; // feedback gain matrix +// Global variables +struct NavStruct Nav; + // ************* Exposed Functions **************** // ************************************************* From 446abf6190807f67956b1ed0bb7b2c7aa522bdf4 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 01:38:14 +0200 Subject: [PATCH 33/68] pios: add more global config options used by Revo Conflicts: flight/PiOS/pios.h flight/targets/RevoMini/System/inc/pios_config.h --- .../CopterControl/System/inc/pios_config.h | 10 +- flight/targets/OSD/System/inc/pios_config.h | 14 +- .../PipXtreme/System/inc/pios_config.h | 10 +- .../targets/RevoMini/System/inc/pios_config.h | 274 ++++++++++-------- .../Revolution/System/inc/pios_config.h | 265 +++++++++-------- 5 files changed, 317 insertions(+), 256 deletions(-) diff --git a/flight/targets/CopterControl/System/inc/pios_config.h b/flight/targets/CopterControl/System/inc/pios_config.h index a11e44224..7c53d01ea 100644 --- a/flight/targets/CopterControl/System/inc/pios_config.h +++ b/flight/targets/CopterControl/System/inc/pios_config.h @@ -66,6 +66,7 @@ #define PIOS_MPU6000_ACCEL /* #define PIOS_INCLUDE_HMC5843 */ /* #define PIOS_INCLUDE_HMC5883 */ +/* #define PIOS_HMC5883_HAS_GPIOS */ /* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MPXV */ @@ -86,6 +87,7 @@ /* #define PIOS_INCLUDE_SDCARD */ #define PIOS_INCLUDE_FLASH #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS +/* #define FLASH_FREERTOS */ /* #define PIOS_INCLUDE_FLASH_EEPROM */ /* #define PIOS_INCLUDE_RFM22B */ /* #define PIOS_INCLUDE_PACKET_HANDLER */ @@ -99,10 +101,17 @@ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ #define PIOS_INCLUDE_TELEMETRY_RF +/* #define PIOS_INCLUDE_COM_TELEM */ +/* #define PIOS_INCLUDE_COM_FLEXI */ +/* #define PIOS_TELEM_PRIORITY_QUEUE */ #define PIOS_INCLUDE_GPS #define PIOS_GPS_MINIMAL #define PIOS_INCLUDE_GPS_NMEA_PARSER #define PIOS_INCLUDE_GPS_UBX_PARSER +/* #define PIOS_GPS_SETS_HOMELOCATION */ + +/* Performance counters */ +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 /* Alarm Thresholds */ #define HEAP_LIMIT_WARNING 220 @@ -119,7 +128,6 @@ #define PIOS_STABILIZATION_STACK_SIZE 524 #define PIOS_TELEM_STACK_SIZE 500 #define PIOS_EVENTDISPATCHER_STACK_SIZE 130 -#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 /* Stabilization options */ /* #define PIOS_QUATERNION_STABILIZATION */ diff --git a/flight/targets/OSD/System/inc/pios_config.h b/flight/targets/OSD/System/inc/pios_config.h index 332c9a79b..35bd73907 100644 --- a/flight/targets/OSD/System/inc/pios_config.h +++ b/flight/targets/OSD/System/inc/pios_config.h @@ -54,11 +54,15 @@ /* Com systems to include */ #define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_TELEM +/* #define PIOS_INCLUDE_COM_TELEM */ +/* #define PIOS_INCLUDE_COM_FLEXI */ +/* #define PIOS_TELEM_PRIORITY_QUEUE */ #define PIOS_INCLUDE_COM_AUX #define PIOS_INCLUDE_GPS //#define PIOS_OVERO_SPI #define PIOS_INCLUDE_BMP085 #define PIOS_INCLUDE_HMC5883 +/* #define PIOS_HMC5883_HAS_GPIOS */ #define PIOS_INCLUDE_SDCARD //#define PIOS_INCLUDE_WAVE /* Supported receiver interfaces */ @@ -73,6 +77,11 @@ //#define PIOS_INCLUDE_FLASH /* A really shitty setting saving implementation */ //#define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS +/* #define FLASH_FREERTOS */ + +/* Performance counters */ +// This actually needs calibrating +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD (8379692) #define PIOS_INCLUDE_INITCALL /* Include init call structures */ #define PIOS_TELEM_PRIORITY_QUEUE /* Enable a priority queue in telemetry */ @@ -80,6 +89,7 @@ #define PIOS_GPS_SETS_HOMELOCATION /* GPS options */ #define PIOS_INCLUDE_GPS_NMEA_PARSER /* Include the NMEA protocol parser */ #define PIOS_INCLUDE_GPS_UBX_PARSER /* Include the UBX protocol parser */ +/* #define PIOS_GPS_SETS_HOMELOCATION */ /* Alarm Thresholds */ #define HEAP_LIMIT_WARNING 4000 @@ -89,8 +99,4 @@ #define CPULOAD_LIMIT_WARNING 80 #define CPULOAD_LIMIT_CRITICAL 95 -// This actually needs calibrating -#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD (8379692) -#define LOG_FILENAME "PIOS.LOG" - #endif /* PIOS_CONFIG_H */ diff --git a/flight/targets/PipXtreme/System/inc/pios_config.h b/flight/targets/PipXtreme/System/inc/pios_config.h index 29459795f..362de4787 100755 --- a/flight/targets/PipXtreme/System/inc/pios_config.h +++ b/flight/targets/PipXtreme/System/inc/pios_config.h @@ -66,6 +66,7 @@ /* #define PIOS_MPU6000_ACCEL */ /* #define PIOS_INCLUDE_HMC5843 */ /* #define PIOS_INCLUDE_HMC5883 */ +/* #define PIOS_HMC5883_HAS_GPIOS */ /* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MPXV */ @@ -86,6 +87,7 @@ /* #define PIOS_INCLUDE_SDCARD */ /* #define PIOS_INCLUDE_FLASH */ /* #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS */ +/* #define FLASH_FREERTOS */ #define PIOS_INCLUDE_FLASH_EEPROM #define PIOS_INCLUDE_RFM22B #define PIOS_INCLUDE_PACKET_HANDLER @@ -103,10 +105,17 @@ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ /* #define PIOS_INCLUDE_TELEMETRY_RF */ +/* #define PIOS_INCLUDE_COM_TELEM */ +/* #define PIOS_INCLUDE_COM_FLEXI */ +/* #define PIOS_TELEM_PRIORITY_QUEUE */ /* #define PIOS_INCLUDE_GPS */ /* #define PIOS_GPS_MINIMAL */ /* #define PIOS_INCLUDE_GPS_NMEA_PARSER */ /* #define PIOS_INCLUDE_GPS_UBX_PARSER */ +/* #define PIOS_GPS_SETS_HOMELOCATION */ + +/* Performance counters */ +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 /* Alarm Thresholds */ #define HEAP_LIMIT_WARNING 220 @@ -123,7 +132,6 @@ #define PIOS_STABILIZATION_STACK_SIZE 524 #define PIOS_TELEM_STACK_SIZE 500 #define PIOS_EVENTDISPATCHER_STACK_SIZE 130 -#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 /* Stabilization options */ /* #define PIOS_QUATERNION_STABILIZATION */ diff --git a/flight/targets/RevoMini/System/inc/pios_config.h b/flight/targets/RevoMini/System/inc/pios_config.h index 6ea05446c..59f26aa96 100644 --- a/flight/targets/RevoMini/System/inc/pios_config.h +++ b/flight/targets/RevoMini/System/inc/pios_config.h @@ -1,127 +1,147 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotCore OpenPilot Core - * @{ - * - * @file pios_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief PiOS configuration header. - * Central compile time config for the project. - * In particular, pios_config.h is where you define which PiOS libraries - * and features are included in the firmware. - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef PIOS_CONFIG_H -#define PIOS_CONFIG_H - -/* Major features */ -#define PIOS_INCLUDE_FREERTOS -#define PIOS_INCLUDE_BL_HELPER - -/* Enable/Disable PiOS Modules */ -#define PIOS_INCLUDE_ADC -#define PIOS_INCLUDE_DELAY -#define PIOS_INCLUDE_I2C -#define PIOS_INCLUDE_IRQ -#define PIOS_INCLUDE_LED -#define PIOS_INCLUDE_IAP -#define PIOS_INCLUDE_SERVO -#define PIOS_INCLUDE_SPI -#define PIOS_INCLUDE_SYS -#define PIOS_INCLUDE_USART -#define PIOS_INCLUDE_USB -#define PIOS_INCLUDE_USB_HID -//#define PIOS_INCLUDE_GPIO -#define PIOS_INCLUDE_EXTI -#define PIOS_INCLUDE_RTC -#define PIOS_INCLUDE_WDG - -/* Variables related to the RFM22B functionality */ -#define PIOS_INCLUDE_RFM22B -#define PIOS_INCLUDE_RFM22B_COM -#define PIOS_INCLUDE_RFM22B_RCVR - -/* Select the sensors to include */ -#define PIOS_INCLUDE_HMC5883 -#define PIOS_HMC5883_HAS_GPIOS -#define PIOS_INCLUDE_MPU6000 -#define PIOS_MPU6000_ACCEL -#define PIOS_INCLUDE_MS5611 -#define PIOS_INCLUDE_ETASV3 -#define PIOS_INCLUDE_MPXV -//#define PIOS_INCLUDE_HCSR04 -#define FLASH_FREERTOS -/* Com systems to include */ -#define PIOS_INCLUDE_COM -#define PIOS_INCLUDE_COM_TELEM -#define PIOS_INCLUDE_COM_FLEXI - -#define PIOS_INCLUDE_GPS -#define PIOS_INCLUDE_GPS_NMEA_PARSER -#define PIOS_INCLUDE_GPS_UBX_PARSER -#define PIOS_GPS_SETS_HOMELOCATION - -/* Supported receiver interfaces */ -#define PIOS_INCLUDE_RCVR -#define PIOS_INCLUDE_DSM -#define PIOS_INCLUDE_SBUS -#define PIOS_INCLUDE_PPM -#define PIOS_INCLUDE_PWM -#define PIOS_INCLUDE_GCSRCVR - -#define PIOS_INCLUDE_SETTINGS -#define PIOS_INCLUDE_FLASH -/* A really shitty setting saving implementation */ -#define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS - -//#define PIOS_INCLUDE_DEBUG_CONSOLE - -/* Other Interfaces */ -//#define PIOS_INCLUDE_I2C_ESC - -//#define PIOS_OVERO_SPI - -/* Flags that alter behaviors - mostly to lower resources for CC */ -#define PIOS_INCLUDE_INITCALL /* Include init call structures */ -#define PIOS_TELEM_PRIORITY_QUEUE /* Enable a priority queue in telemetry */ -//#define PIOS_QUATERNION_STABILIZATION /* Stabilization options */ -#define PIOS_GPS_SETS_HOMELOCATION /* GPS options */ - -/* Alarm Thresholds */ -#define HEAP_LIMIT_WARNING 1000 -#define HEAP_LIMIT_CRITICAL 500 -#define IRQSTACK_LIMIT_WARNING 150 -#define IRQSTACK_LIMIT_CRITICAL 80 -#define CPULOAD_LIMIT_WARNING 80 -#define CPULOAD_LIMIT_CRITICAL 95 - -// This actually needs calibrating -#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD (8379692) - -#define REVOLUTION - -#endif /* PIOS_CONFIG_H */ -/** - * @} - * @} - */ +/** + ****************************************************************************** + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotCore OpenPilot Core + * @{ + * @file pios_config.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2013. + * @brief PiOS configuration header, the compile time config file for the PIOS. + * Defines which PiOS libraries and features are included in the firmware. + * @see The GNU Public License (GPL) Version 3 + *****************************************************************************/ +/* + * 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PIOS_CONFIG_H +#define PIOS_CONFIG_H + +/* + * Below is a complete list of PIOS configurable options. + * Please do not remove or rearrange them. Only comment out + * unused options in the list. See main pios.h header for more + * details. + */ + +/* #define PIOS_INCLUDE_DEBUG_CONSOLE */ +/* #define DEBUG_LEVEL 0 */ + +#define PIOS_INCLUDE_FREERTOS +#define PIOS_INCLUDE_DELAY +#define PIOS_INCLUDE_INITCALL +#define PIOS_INCLUDE_SYS + +#define PIOS_INCLUDE_IRQ +#define PIOS_INCLUDE_RTC +#define PIOS_INCLUDE_TIM +#define PIOS_INCLUDE_USART +#define PIOS_INCLUDE_ADC +#define PIOS_INCLUDE_I2C +#define PIOS_INCLUDE_SPI +/* #define PIOS_INCLUDE_GPIO */ +#define PIOS_INCLUDE_EXTI +#define PIOS_INCLUDE_WDG +#define PIOS_INCLUDE_USB +#define PIOS_INCLUDE_USB_HID +/* #define PIOS_INCLUDE_USB_CDC */ +/* #define PIOS_INCLUDE_USB_RCTX */ + +/* #define PIOS_INCLUDE_ADXL345 */ +/* #define PIOS_INCLUDE_BMA180 */ +/* #define PIOS_INCLUDE_L3GD20 */ +#define PIOS_INCLUDE_MPU6000 +#define PIOS_MPU6000_ACCEL +/* #define PIOS_INCLUDE_HMC5843 */ +#define PIOS_INCLUDE_HMC5883 +#define PIOS_HMC5883_HAS_GPIOS +/* #define PIOS_INCLUDE_BMP085 */ +#define PIOS_INCLUDE_MS5611 +#define PIOS_INCLUDE_MPXV +#define PIOS_INCLUDE_ETASV3 +/* #define PIOS_INCLUDE_HCSR04 */ + +#define PIOS_INCLUDE_PWM +#define PIOS_INCLUDE_PPM +#define PIOS_INCLUDE_DSM +#define PIOS_INCLUDE_SBUS +#define PIOS_INCLUDE_GCSRCVR + +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP +#define PIOS_INCLUDE_SERVO +/* #define PIOS_INCLUDE_I2C_ESC */ +/* #define PIOS_INCLUDE_OVERO */ +/* #define PIOS_INCLUDE_SDCARD */ +#define PIOS_INCLUDE_FLASH +#define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS +#define FLASH_FREERTOS +/* #define PIOS_INCLUDE_FLASH_EEPROM */ +#define PIOS_INCLUDE_RFM22B +#define PIOS_INCLUDE_RFM22B_COM +#define PIOS_INCLUDE_RFM22B_RCVR +/* #define PIOS_INCLUDE_VIDEO */ +/* #define PIOS_INCLUDE_WAVE */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +/* #define PIOS_INCLUDE_UDP */ + +#define PIOS_INCLUDE_RCVR +#define PIOS_INCLUDE_COM +/* #define PIOS_INCLUDE_COM_MSG */ +/* #define PIOS_INCLUDE_TELEMETRY_RF */ +#define PIOS_INCLUDE_COM_TELEM +#define PIOS_INCLUDE_COM_FLEXI +#define PIOS_TELEM_PRIORITY_QUEUE +#define PIOS_INCLUDE_GPS +/* #define PIOS_GPS_MINIMAL */ +#define PIOS_INCLUDE_GPS_NMEA_PARSER +#define PIOS_INCLUDE_GPS_UBX_PARSER +#define PIOS_GPS_SETS_HOMELOCATION + +/* Alarm Thresholds */ +#define HEAP_LIMIT_WARNING 1000 +#define HEAP_LIMIT_CRITICAL 500 +#define IRQSTACK_LIMIT_WARNING 150 +#define IRQSTACK_LIMIT_CRITICAL 80 +#define CPULOAD_LIMIT_WARNING 80 +#define CPULOAD_LIMIT_CRITICAL 95 + +/* Performance counters */ +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 8379692 + +/* Task stack sizes */ +/* #define PIOS_ACTUATOR_STACK_SIZE 1020 */ +/* #define PIOS_MANUAL_STACK_SIZE 800 */ +/* #define PIOS_SYSTEM_STACK_SIZE 660 */ +/* #define PIOS_STABILIZATION_STACK_SIZE 524 */ +/* #define PIOS_TELEM_STACK_SIZE 500 */ +/* #define PIOS_EVENTDISPATCHER_STACK_SIZE 130 */ + +/* Stabilization options */ +/* #define PIOS_QUATERNION_STABILIZATION */ + +/* This can't be too high to stop eventdispatcher thread overflowing */ +#define PIOS_EVENTDISAPTCHER_QUEUE 10 + +/* Revolution series */ +#define REVOLUTION + +#endif /* PIOS_CONFIG_H */ + +/** + * @} + * @} + */ diff --git a/flight/targets/Revolution/System/inc/pios_config.h b/flight/targets/Revolution/System/inc/pios_config.h index 8ac4b2109..7c53d01ea 100644 --- a/flight/targets/Revolution/System/inc/pios_config.h +++ b/flight/targets/Revolution/System/inc/pios_config.h @@ -1,123 +1,142 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotSystem OpenPilot System - * @{ - * @addtogroup OpenPilotCore OpenPilot Core - * @{ - * - * @file pios_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief PiOS configuration header. - * Central compile time config for the project. - * In particular, pios_config.h is where you define which PiOS libraries - * and features are included in the firmware. - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * 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, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef PIOS_CONFIG_H -#define PIOS_CONFIG_H - -/* Major features */ -#define PIOS_INCLUDE_FREERTOS -#define PIOS_INCLUDE_BL_HELPER - -/* Enable/Disable PiOS Modules */ -#define PIOS_INCLUDE_ADC -#define PIOS_INCLUDE_DELAY -#define PIOS_INCLUDE_I2C -#define PIOS_INCLUDE_IRQ -#define PIOS_INCLUDE_LED -#define PIOS_INCLUDE_IAP -#define PIOS_INCLUDE_SERVO -#define PIOS_INCLUDE_SPI -#define PIOS_INCLUDE_SYS -#define PIOS_INCLUDE_USART -#define PIOS_INCLUDE_USB -#define PIOS_INCLUDE_USB_HID -//#define PIOS_INCLUDE_GPIO -#define PIOS_INCLUDE_EXTI -#define PIOS_INCLUDE_RTC -#define PIOS_INCLUDE_WDG - -/* Select the sensors to include */ -#define PIOS_INCLUDE_BMA180 -#define PIOS_INCLUDE_HMC5883 -#define PIOS_HMC5883_HAS_GPIOS -#define PIOS_INCLUDE_MPU6000 -#define PIOS_MPU6000_ACCEL -#define PIOS_INCLUDE_L3GD20 -#define PIOS_INCLUDE_MS5611 -#define PIOS_INCLUDE_ETASV3 -#define PIOS_INCLUDE_MPXV -//#define PIOS_INCLUDE_HCSR04 -#define PIOS_FLASH_ON_ACCEL /* true for second revo */ -#define FLASH_FREERTOS -/* Com systems to include */ -#define PIOS_INCLUDE_COM -#define PIOS_INCLUDE_COM_TELEM -#define PIOS_INCLUDE_COM_AUX -#define PIOS_INCLUDE_COM_AUXSBUS -#define PIOS_INCLUDE_COM_FLEXI - -#define PIOS_INCLUDE_GPS -#define PIOS_INCLUDE_GPS_NMEA_PARSER -#define PIOS_INCLUDE_GPS_UBX_PARSER -#define PIOS_GPS_SETS_HOMELOCATION - -#define PIOS_OVERO_SPI -/* Supported receiver interfaces */ -#define PIOS_INCLUDE_RCVR -#define PIOS_INCLUDE_DSM -//#define PIOS_INCLUDE_SBUS -#define PIOS_INCLUDE_PPM -#define PIOS_INCLUDE_PWM -#define PIOS_INCLUDE_GCSRCVR - -#define PIOS_INCLUDE_SETTINGS -#define PIOS_INCLUDE_FLASH -/* A really shitty setting saving implementation */ -#define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS - -/* Other Interfaces */ -//#define PIOS_INCLUDE_I2C_ESC - -/* Flags that alter behaviors - mostly to lower resources for CC */ -#define PIOS_INCLUDE_INITCALL /* Include init call structures */ -#define PIOS_TELEM_PRIORITY_QUEUE /* Enable a priority queue in telemetry */ -//#define PIOS_QUATERNION_STABILIZATION /* Stabilization options */ - -/* Alarm Thresholds */ -#define HEAP_LIMIT_WARNING 1000 -#define HEAP_LIMIT_CRITICAL 500 -#define IRQSTACK_LIMIT_WARNING 150 -#define IRQSTACK_LIMIT_CRITICAL 80 -#define CPULOAD_LIMIT_WARNING 80 -#define CPULOAD_LIMIT_CRITICAL 95 - -// This actually needs calibrating -#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD (8379692) - -#define REVOLUTION - -#endif /* PIOS_CONFIG_H */ -/** - * @} - * @} - */ +/** + ****************************************************************************** + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotCore OpenPilot Core + * @{ + * @file pios_config.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2013. + * @brief PiOS configuration header, the compile time config file for the PIOS. + * Defines which PiOS libraries and features are included in the firmware. + * @see The GNU Public License (GPL) Version 3 + *****************************************************************************/ +/* + * 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PIOS_CONFIG_H +#define PIOS_CONFIG_H + +/* + * Below is a complete list of PIOS configurable options. + * Please do not remove or rearrange them. Only comment out + * unused options in the list. See main pios.h header for more + * details. + */ + +/* #define PIOS_INCLUDE_DEBUG_CONSOLE */ +/* #define DEBUG_LEVEL 0 */ + +#define PIOS_INCLUDE_FREERTOS +#define PIOS_INCLUDE_DELAY +#define PIOS_INCLUDE_INITCALL +#define PIOS_INCLUDE_SYS + +#define PIOS_INCLUDE_IRQ +#define PIOS_INCLUDE_RTC +#define PIOS_INCLUDE_TIM +#define PIOS_INCLUDE_USART +#define PIOS_INCLUDE_ADC +/* #define PIOS_INCLUDE_I2C */ +#define PIOS_INCLUDE_SPI +#define PIOS_INCLUDE_GPIO +#define PIOS_INCLUDE_EXTI +#define PIOS_INCLUDE_WDG +#define PIOS_INCLUDE_USB +#define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_USB_CDC +#define PIOS_INCLUDE_USB_RCTX + +#define PIOS_INCLUDE_ADXL345 +/* #define PIOS_INCLUDE_BMA180 */ +/* #define PIOS_INCLUDE_L3GD20 */ +#define PIOS_INCLUDE_MPU6000 +#define PIOS_MPU6000_ACCEL +/* #define PIOS_INCLUDE_HMC5843 */ +/* #define PIOS_INCLUDE_HMC5883 */ +/* #define PIOS_HMC5883_HAS_GPIOS */ +/* #define PIOS_INCLUDE_BMP085 */ +/* #define PIOS_INCLUDE_MS5611 */ +/* #define PIOS_INCLUDE_MPXV */ +/* #define PIOS_INCLUDE_ETASV3 */ +/* #define PIOS_INCLUDE_HCSR04 */ + +#define PIOS_INCLUDE_PWM +#define PIOS_INCLUDE_PPM +#define PIOS_INCLUDE_DSM +#define PIOS_INCLUDE_SBUS +#define PIOS_INCLUDE_GCSRCVR + +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP +#define PIOS_INCLUDE_SERVO +/* #define PIOS_INCLUDE_I2C_ESC */ +/* #define PIOS_INCLUDE_OVERO */ +/* #define PIOS_INCLUDE_SDCARD */ +#define PIOS_INCLUDE_FLASH +#define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS +/* #define FLASH_FREERTOS */ +/* #define PIOS_INCLUDE_FLASH_EEPROM */ +/* #define PIOS_INCLUDE_RFM22B */ +/* #define PIOS_INCLUDE_PACKET_HANDLER */ +/* #define PIOS_INCLUDE_VIDEO */ +/* #define PIOS_INCLUDE_WAVE */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +/* #define PIOS_INCLUDE_UDP */ + +#define PIOS_INCLUDE_RCVR +#define PIOS_INCLUDE_COM +/* #define PIOS_INCLUDE_COM_MSG */ +#define PIOS_INCLUDE_TELEMETRY_RF +/* #define PIOS_INCLUDE_COM_TELEM */ +/* #define PIOS_INCLUDE_COM_FLEXI */ +/* #define PIOS_TELEM_PRIORITY_QUEUE */ +#define PIOS_INCLUDE_GPS +#define PIOS_GPS_MINIMAL +#define PIOS_INCLUDE_GPS_NMEA_PARSER +#define PIOS_INCLUDE_GPS_UBX_PARSER +/* #define PIOS_GPS_SETS_HOMELOCATION */ + +/* Performance counters */ +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 + +/* Alarm Thresholds */ +#define HEAP_LIMIT_WARNING 220 +#define HEAP_LIMIT_CRITICAL 40 +#define IRQSTACK_LIMIT_WARNING 100 +#define IRQSTACK_LIMIT_CRITICAL 60 +#define CPULOAD_LIMIT_WARNING 85 +#define CPULOAD_LIMIT_CRITICAL 95 + +/* Task stack sizes */ +#define PIOS_ACTUATOR_STACK_SIZE 1020 +#define PIOS_MANUAL_STACK_SIZE 800 +#define PIOS_SYSTEM_STACK_SIZE 660 +#define PIOS_STABILIZATION_STACK_SIZE 524 +#define PIOS_TELEM_STACK_SIZE 500 +#define PIOS_EVENTDISPATCHER_STACK_SIZE 130 + +/* Stabilization options */ +/* #define PIOS_QUATERNION_STABILIZATION */ + +/* This can't be too high to stop eventdispatcher thread overflowing */ +#define PIOS_EVENTDISAPTCHER_QUEUE 10 + +#endif /* PIOS_CONFIG_H */ +/** + * @} + * @} + */ From 3c97b5a7c6651ce015af8b5d0ff585e04563ffbb Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 13:28:12 +0200 Subject: [PATCH 34/68] Clean up pios_config.h for BL, BU, some FW (not all yet) Conflicts: flight/targets/Bootloaders/CopterControl/inc/pios_config.h --- .../BootloaderUpdater/inc/pios_config.h | 11 +++++----- .../CopterControl/inc/pios_config.h | 17 +++++++------- .../targets/Bootloaders/OSD/inc/pios_config.h | 9 ++++---- .../Bootloaders/PipXtreme/inc/pios_config.h | 20 ++++++++--------- .../Bootloaders/RevoMini/inc/pios_config.h | 9 ++++---- .../Bootloaders/Revolution/inc/pios_config.h | 9 ++++---- .../CopterControl/System/inc/pios_config.h | 16 ++++++++++++-- .../PipXtreme/System/inc/pios_config.h | 16 ++++++++++++-- .../targets/RevoMini/System/inc/pios_config.h | 22 ++++++++++++++----- 9 files changed, 81 insertions(+), 48 deletions(-) diff --git a/flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h b/flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h index af394cef1..b9a0ebb3b 100644 --- a/flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h +++ b/flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h @@ -27,18 +27,19 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef PIOS_CONFIG_H #define PIOS_CONFIG_H -#define PIOS_INCLUDE_BL_HELPER + +/* Enable/Disable PiOS modules */ #define PIOS_INCLUDE_DELAY -#define PIOS_INCLUDE_LED #define PIOS_INCLUDE_SYS -#define PIOS_INCLUDE_GPIO -//#define DEBUG_SSP #define PIOS_INCLUDE_IRQ +#define PIOS_INCLUDE_GPIO +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_BL_HELPER #endif /* PIOS_CONFIG_H */ + /** * @} * @} diff --git a/flight/targets/Bootloaders/CopterControl/inc/pios_config.h b/flight/targets/Bootloaders/CopterControl/inc/pios_config.h index f06d6257e..6661f0b18 100644 --- a/flight/targets/Bootloaders/CopterControl/inc/pios_config.h +++ b/flight/targets/Bootloaders/CopterControl/inc/pios_config.h @@ -30,22 +30,23 @@ #ifndef PIOS_CONFIG_H #define PIOS_CONFIG_H -#define PIOS_INCLUDE_BL_HELPER -#define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT -/* Enable/Disable PiOS Modules */ + +/* Enable/Disable PiOS modules */ #define PIOS_INCLUDE_DELAY -#define PIOS_INCLUDE_IRQ -#define PIOS_INCLUDE_LED #define PIOS_INCLUDE_SYS +#define PIOS_INCLUDE_IRQ +#define PIOS_INCLUDE_GPIO #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_MSG -#define PIOS_INCLUDE_GPIO -#define PIOS_INCLUDE_IAP -#define PIOS_NO_GPS +#define PIOS_INCLUDE_BL_HELPER +#define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT #endif /* PIOS_CONFIG_H */ + /** * @} * @} diff --git a/flight/targets/Bootloaders/OSD/inc/pios_config.h b/flight/targets/Bootloaders/OSD/inc/pios_config.h index 6dd5cda23..1d121c321 100644 --- a/flight/targets/Bootloaders/OSD/inc/pios_config.h +++ b/flight/targets/Bootloaders/OSD/inc/pios_config.h @@ -27,15 +27,14 @@ #ifndef PIOS_CONFIG_H #define PIOS_CONFIG_H -/* Enable/Disable PiOS Modules */ +/* Enable/Disable PiOS modules */ #define PIOS_INCLUDE_DELAY -#define PIOS_INCLUDE_IRQ -#define PIOS_INCLUDE_LED -#define PIOS_INCLUDE_SPI #define PIOS_INCLUDE_SYS -#define PIOS_INCLUDE_IAP +#define PIOS_INCLUDE_IRQ #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_MSG #define PIOS_INCLUDE_BL_HELPER diff --git a/flight/targets/Bootloaders/PipXtreme/inc/pios_config.h b/flight/targets/Bootloaders/PipXtreme/inc/pios_config.h index dfa1ff2da..f378c66b7 100644 --- a/flight/targets/Bootloaders/PipXtreme/inc/pios_config.h +++ b/flight/targets/Bootloaders/PipXtreme/inc/pios_config.h @@ -29,25 +29,23 @@ #ifndef PIOS_CONFIG_H #define PIOS_CONFIG_H -#define PIOS_INCLUDE_BL_HELPER -#define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT -/* Enable/Disable PiOS Modules */ + +/* Enable/Disable PiOS modules */ #define PIOS_INCLUDE_DELAY -#define PIOS_INCLUDE_IRQ -#define PIOS_INCLUDE_LED #define PIOS_INCLUDE_SYS +#define PIOS_INCLUDE_IRQ +#define PIOS_INCLUDE_GPIO #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_MSG -#define PIOS_INCLUDE_GPIO -#define PIOS_INCLUDE_IAP - -/* Defaults for Logging */ -#define LOG_FILENAME "PIOS.LOG" -#define STARTUP_LOG_ENABLED 1 +#define PIOS_INCLUDE_BL_HELPER +#define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT #endif /* PIOS_CONFIG_H */ + /** * @} * @} diff --git a/flight/targets/Bootloaders/RevoMini/inc/pios_config.h b/flight/targets/Bootloaders/RevoMini/inc/pios_config.h index 88f4f6c08..91c131ed3 100644 --- a/flight/targets/Bootloaders/RevoMini/inc/pios_config.h +++ b/flight/targets/Bootloaders/RevoMini/inc/pios_config.h @@ -27,15 +27,14 @@ #ifndef PIOS_CONFIG_H #define PIOS_CONFIG_H -/* Enable/Disable PiOS Modules */ + #define PIOS_INCLUDE_DELAY -#define PIOS_INCLUDE_IRQ -#define PIOS_INCLUDE_LED -#define PIOS_INCLUDE_SPI #define PIOS_INCLUDE_SYS -#define PIOS_INCLUDE_IAP +#define PIOS_INCLUDE_IRQ #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_MSG #define PIOS_INCLUDE_BL_HELPER diff --git a/flight/targets/Bootloaders/Revolution/inc/pios_config.h b/flight/targets/Bootloaders/Revolution/inc/pios_config.h index 6dd5cda23..1d121c321 100644 --- a/flight/targets/Bootloaders/Revolution/inc/pios_config.h +++ b/flight/targets/Bootloaders/Revolution/inc/pios_config.h @@ -27,15 +27,14 @@ #ifndef PIOS_CONFIG_H #define PIOS_CONFIG_H -/* Enable/Disable PiOS Modules */ +/* Enable/Disable PiOS modules */ #define PIOS_INCLUDE_DELAY -#define PIOS_INCLUDE_IRQ -#define PIOS_INCLUDE_LED -#define PIOS_INCLUDE_SPI #define PIOS_INCLUDE_SYS -#define PIOS_INCLUDE_IAP +#define PIOS_INCLUDE_IRQ #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_COM #define PIOS_INCLUDE_COM_MSG #define PIOS_INCLUDE_BL_HELPER diff --git a/flight/targets/CopterControl/System/inc/pios_config.h b/flight/targets/CopterControl/System/inc/pios_config.h index 7c53d01ea..4ea4fc968 100644 --- a/flight/targets/CopterControl/System/inc/pios_config.h +++ b/flight/targets/CopterControl/System/inc/pios_config.h @@ -39,11 +39,13 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ +/* PIOS system functions */ #define PIOS_INCLUDE_FREERTOS #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL #define PIOS_INCLUDE_SYS +/* PIOS hardware peripherals */ #define PIOS_INCLUDE_IRQ #define PIOS_INCLUDE_RTC #define PIOS_INCLUDE_TIM @@ -54,11 +56,14 @@ #define PIOS_INCLUDE_GPIO #define PIOS_INCLUDE_EXTI #define PIOS_INCLUDE_WDG + +/* PIOS USB functions */ #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID #define PIOS_INCLUDE_USB_CDC #define PIOS_INCLUDE_USB_RCTX +/* PIOS sensor interfaces */ #define PIOS_INCLUDE_ADXL345 /* #define PIOS_INCLUDE_BMA180 */ /* #define PIOS_INCLUDE_L3GD20 */ @@ -73,12 +78,14 @@ /* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_HCSR04 */ +/* PIOS receiver drivers */ #define PIOS_INCLUDE_PWM #define PIOS_INCLUDE_PPM #define PIOS_INCLUDE_DSM #define PIOS_INCLUDE_SBUS #define PIOS_INCLUDE_GCSRCVR +/* PIOS common peripherals */ #define PIOS_INCLUDE_LED #define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_SERVO @@ -93,11 +100,12 @@ /* #define PIOS_INCLUDE_PACKET_HANDLER */ /* #define PIOS_INCLUDE_VIDEO */ /* #define PIOS_INCLUDE_WAVE */ -#define PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ /* #define PIOS_INCLUDE_UDP */ +/* PIOS abstract receiver interface */ #define PIOS_INCLUDE_RCVR + +/* PIOS abstract comms interface with options */ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ #define PIOS_INCLUDE_TELEMETRY_RF @@ -110,6 +118,10 @@ #define PIOS_INCLUDE_GPS_UBX_PARSER /* #define PIOS_GPS_SETS_HOMELOCATION */ +/* PIOS bootloader helper */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ + /* Performance counters */ #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 diff --git a/flight/targets/PipXtreme/System/inc/pios_config.h b/flight/targets/PipXtreme/System/inc/pios_config.h index 362de4787..9312dab49 100755 --- a/flight/targets/PipXtreme/System/inc/pios_config.h +++ b/flight/targets/PipXtreme/System/inc/pios_config.h @@ -39,11 +39,13 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ +/* PIOS system functions */ #define PIOS_INCLUDE_FREERTOS #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL #define PIOS_INCLUDE_SYS +/* PIOS hardware peripherals */ #define PIOS_INCLUDE_IRQ #define PIOS_INCLUDE_RTC #define PIOS_INCLUDE_TIM @@ -54,11 +56,14 @@ #define PIOS_INCLUDE_GPIO #define PIOS_INCLUDE_EXTI #define PIOS_INCLUDE_WDG + +/* PIOS USB functions */ #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID #define PIOS_INCLUDE_USB_CDC /* #define PIOS_INCLUDE_USB_RCTX */ +/* PIOS sensor interfaces */ /* #define PIOS_INCLUDE_ADXL345 */ /* #define PIOS_INCLUDE_BMA180 */ /* #define PIOS_INCLUDE_L3GD20 */ @@ -73,12 +78,14 @@ /* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_HCSR04 */ +/* PIOS receiver drivers */ /* #define PIOS_INCLUDE_PWM */ #define PIOS_INCLUDE_PPM /* #define PIOS_INCLUDE_DSM */ /* #define PIOS_INCLUDE_SBUS */ /* #define PIOS_INCLUDE_GCSRCVR */ +/* PIOS common peripherals */ #define PIOS_INCLUDE_LED #define PIOS_INCLUDE_IAP /* #define PIOS_INCLUDE_SERVO */ @@ -97,11 +104,12 @@ /* #define PIOS_INCLUDE_VIDEO */ /* #define PIOS_INCLUDE_WAVE */ -#define PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ /* #define PIOS_INCLUDE_UDP */ +/* PIOS abstract receiver interface */ #define PIOS_INCLUDE_RCVR + +/* PIOS abstract comms interface with options */ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ /* #define PIOS_INCLUDE_TELEMETRY_RF */ @@ -114,6 +122,10 @@ /* #define PIOS_INCLUDE_GPS_UBX_PARSER */ /* #define PIOS_GPS_SETS_HOMELOCATION */ +/* PIOS bootloader helper */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ + /* Performance counters */ #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 diff --git a/flight/targets/RevoMini/System/inc/pios_config.h b/flight/targets/RevoMini/System/inc/pios_config.h index 59f26aa96..2f91563e7 100644 --- a/flight/targets/RevoMini/System/inc/pios_config.h +++ b/flight/targets/RevoMini/System/inc/pios_config.h @@ -39,11 +39,13 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ +/* PIOS system functions */ #define PIOS_INCLUDE_FREERTOS #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL #define PIOS_INCLUDE_SYS +/* PIOS hardware peripherals */ #define PIOS_INCLUDE_IRQ #define PIOS_INCLUDE_RTC #define PIOS_INCLUDE_TIM @@ -54,11 +56,14 @@ /* #define PIOS_INCLUDE_GPIO */ #define PIOS_INCLUDE_EXTI #define PIOS_INCLUDE_WDG + +/* PIOS USB functions */ #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID /* #define PIOS_INCLUDE_USB_CDC */ /* #define PIOS_INCLUDE_USB_RCTX */ +/* PIOS sensor interfaces */ /* #define PIOS_INCLUDE_ADXL345 */ /* #define PIOS_INCLUDE_BMA180 */ /* #define PIOS_INCLUDE_L3GD20 */ @@ -73,12 +78,14 @@ #define PIOS_INCLUDE_ETASV3 /* #define PIOS_INCLUDE_HCSR04 */ +/* PIOS receiver drivers */ #define PIOS_INCLUDE_PWM #define PIOS_INCLUDE_PPM #define PIOS_INCLUDE_DSM #define PIOS_INCLUDE_SBUS #define PIOS_INCLUDE_GCSRCVR +/* PIOS common peripherals */ #define PIOS_INCLUDE_LED #define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_SERVO @@ -94,11 +101,12 @@ #define PIOS_INCLUDE_RFM22B_RCVR /* #define PIOS_INCLUDE_VIDEO */ /* #define PIOS_INCLUDE_WAVE */ -#define PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ /* #define PIOS_INCLUDE_UDP */ +/* PIOS abstract receiver interface */ #define PIOS_INCLUDE_RCVR + +/* PIOS abstract comms interface with options */ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ /* #define PIOS_INCLUDE_TELEMETRY_RF */ @@ -111,6 +119,13 @@ #define PIOS_INCLUDE_GPS_UBX_PARSER #define PIOS_GPS_SETS_HOMELOCATION +/* PIOS bootloader helper */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ + +/* Performance counters */ +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 8379692 + /* Alarm Thresholds */ #define HEAP_LIMIT_WARNING 1000 #define HEAP_LIMIT_CRITICAL 500 @@ -119,9 +134,6 @@ #define CPULOAD_LIMIT_WARNING 80 #define CPULOAD_LIMIT_CRITICAL 95 -/* Performance counters */ -#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 8379692 - /* Task stack sizes */ /* #define PIOS_ACTUATOR_STACK_SIZE 1020 */ /* #define PIOS_MANUAL_STACK_SIZE 800 */ From 6502cea50eedbb4ab69fa788feb789164c572362 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 13:29:57 +0200 Subject: [PATCH 35/68] pios_bl_helper.h: why all these empty lines? --- flight/PiOS/inc/pios_bl_helper.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/flight/PiOS/inc/pios_bl_helper.h b/flight/PiOS/inc/pios_bl_helper.h index 668effd29..620c6c7d9 100644 --- a/flight/PiOS/inc/pios_bl_helper.h +++ b/flight/PiOS/inc/pios_bl_helper.h @@ -32,15 +32,10 @@ #define PIOS_BL_HELPER_H extern uint8_t *PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress); - extern uint8_t PIOS_BL_HELPER_FLASH_Ini(); - extern uint32_t PIOS_BL_HELPER_CRC_Memory_Calc(); - extern void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t * array, uint8_t size); - extern uint8_t PIOS_BL_HELPER_FLASH_Start(); - extern void PIOS_BL_HELPER_CRC_Ini(); #endif /* PIOS_BL_HELPER_H */ From dbe1c39c47a1bce17d5c74db89198657d0295f2b Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 13:32:48 +0200 Subject: [PATCH 36/68] pios: include memory allocator for F4 FreeRTOS targets by default This is by analogy to F1 FreeRTOS tagrgets which always use heap_1. --- flight/PiOS/STM32F4xx/library.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/flight/PiOS/STM32F4xx/library.mk b/flight/PiOS/STM32F4xx/library.mk index d0e403453..9ea3cf657 100644 --- a/flight/PiOS/STM32F4xx/library.mk +++ b/flight/PiOS/STM32F4xx/library.mk @@ -54,4 +54,5 @@ ifneq ($(FREERTOS_DIR),) FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F/*.c) EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F + include $(PIOSCOMMON)/Libraries/msheap/library.mk endif From 5c131628242ac74ade5355e89dda494ed1519288 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 13:54:06 +0200 Subject: [PATCH 37/68] Makefile: some rearrangements between apps-defs.mk and target Makefiles Conflicts: flight/targets/PipXtreme/Makefile make/apps-defs.mk --- flight/targets/CopterControl/Makefile | 5 +--- flight/targets/PipXtreme/Makefile | 7 ++--- make/apps-defs.mk | 42 +++++++++++++++++---------- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/flight/targets/CopterControl/Makefile b/flight/targets/CopterControl/Makefile index 6cd6a9e9b..4a358f724 100644 --- a/flight/targets/CopterControl/Makefile +++ b/flight/targets/CopterControl/Makefile @@ -91,14 +91,11 @@ endif # List C source files here (C dependencies are automatically generated). # Use file-extension c for "c-only"-files ifndef TESTAPP - ## Modules - SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} - SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} - ## Application Core SRC += ${OPMODULEDIR}/System/systemmod.c SRC += $(OPSYSTEM)/coptercontrol.c SRC += $(OPSYSTEM)/pios_board.c + SRC += $(OPSYSTEM)/pios_usb_board_data.c SRC += $(OPSYSTEM)/alarms.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c diff --git a/flight/targets/PipXtreme/Makefile b/flight/targets/PipXtreme/Makefile index bdbfae8e4..17577da68 100644 --- a/flight/targets/PipXtreme/Makefile +++ b/flight/targets/PipXtreme/Makefile @@ -24,7 +24,7 @@ include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk # List of mandatory modules to include -MODULES = RadioComBridge +MODULES += RadioComBridge # List of optional modules to include OPTMODULES = @@ -32,14 +32,11 @@ OPTMODULES = # List C source files here (C dependencies are automatically generated). # Use file-extension c for "c-only"-files ifndef TESTAPP - ## Modules - SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} - SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} - ## Application Core SRC += ${OPMODULEDIR}/PipXtreme/pipxtrememod.c SRC += $(OPSYSTEM)/pipxtreme.c SRC += $(OPSYSTEM)/pios_board.c + SRC += $(OPSYSTEM)/pios_usb_board_data.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/eventdispatcher.c diff --git a/make/apps-defs.mk b/make/apps-defs.mk index 71acae877..c205ea297 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -56,8 +56,7 @@ MATHLIBINC = $(FLIGHTLIB)/math ## FreeRTOS support FREERTOS_DIR = $(PIOSCOMMON)/Libraries/FreeRTOS -FREERTOS_SRC_DIR = $(FREERTOS_DIR)/Source -FREERTOS_INC_DIR = $(FREERTOS_SRC_DIR)/include +include $(FREERTOS_DIR)/library.mk ## Misc DOXYGENDIR = $(ROOT_DIR)/flight/Doc/Doxygen @@ -75,24 +74,37 @@ endif # List C source files here (C dependencies are automatically generated). # Use file-extension c for "c-only"-files +## PIOS Hardware (Common Peripherals) +SRC += $(PIOSCOMMON)/pios_adxl345.c +SRC += $(PIOSCOMMON)/pios_bma180.c +SRC += $(PIOSCOMMON)/pios_bmp085.c +SRC += $(PIOSCOMMON)/pios_etasv3.c +SRC += $(PIOSCOMMON)/pios_gcsrcvr.c +SRC += $(PIOSCOMMON)/pios_hcsr04.c +SRC += $(PIOSCOMMON)/pios_hmc5843.c +SRC += $(PIOSCOMMON)/pios_hmc5883.c +SRC += $(PIOSCOMMON)/pios_i2c_esc.c +SRC += $(PIOSCOMMON)/pios_l3gd20.c +SRC += $(PIOSCOMMON)/pios_mpu6000.c +SRC += $(PIOSCOMMON)/pios_mpxv.c +SRC += $(PIOSCOMMON)/pios_ms5611.c +SRC += $(PIOSCOMMON)/pios_video.c +SRC += $(PIOSCOMMON)/pios_wavplay.c + ## PIOS Hardware (Common) +SRC += $(PIOSCOMMON)/pios_com.c +SRC += $(PIOSCOMMON)/pios_com_msg.c SRC += $(PIOSCOMMON)/pios_crc.c SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c SRC += $(PIOSCOMMON)/pios_flash_jedec.c -SRC += $(PIOSCOMMON)/pios_adxl345.c -SRC += $(PIOSCOMMON)/pios_mpu6000.c -SRC += $(PIOSCOMMON)/pios_com.c -SRC += $(PIOSCOMMON)/pios_sbus.c SRC += $(PIOSCOMMON)/pios_rcvr.c -SRC += $(PIOSCOMMON)/pios_gcsrcvr.c SRC += $(PIOSCOMMON)/pios_rfm22b.c -SRC += $(PIOSCOMMON)/pios_rfm22b_com.c +SRC += $(PIOSCOMMON)/pios_rfm22b_com.c +SRC += $(PIOSCOMMON)/pios_sbus.c +SRC += $(PIOSCOMMON)/pios_sdcard.c SRC += $(PIOSCOMMON)/printf-stdarg.c -SRC += $(PIOSCOMMON)/pios_i2c_esc.c -SRC += $(PIOSSTM32F10X)/pios_ppm_out.c # PIOS USB related files -SRC += $(OPSYSTEM)/pios_usb_board_data.c SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c SRC += $(PIOSCOMMON)/pios_usb_util.c @@ -106,10 +118,9 @@ SRC += $(FLIGHTLIB)/CoordinateConversions.c SRC += $(MATHLIB)/sin_lookup.c SRC += $(MATHLIB)/pid.c -## Common FreeRTOS files -SRC += $(FREERTOS_SRC_DIR)/list.c -SRC += $(FREERTOS_SRC_DIR)/queue.c -SRC += $(FREERTOS_SRC_DIR)/tasks.c +## Modules +SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} +SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} # List C source files here which must be compiled in ARM-Mode (no -mthumb). # Use file-extension c for "c-only"-files @@ -148,7 +159,6 @@ EXTRAINCDIRS += $(MATHLIBINC) EXTRAINCDIRS += $(OPUAVOBJINC) EXTRAINCDIRS += $(OPUAVTALKINC) EXTRAINCDIRS += $(OPUAVSYNTHDIR) -EXTRAINCDIRS += $(FREERTOS_INC_DIR) # Modules EXTRAINCDIRS += $(foreach mod, $(OPTMODULES) $(MODULES), $(OPMODULEDIR)/$(mod)/inc) $(OPMODULEDIR)/System/inc From f3d587ad12ef4e1c00e9131faf3053109edef1c5 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 13:54:51 +0200 Subject: [PATCH 38/68] Makefile: better options sequence in common-defs.mk --- make/common-defs.mk | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/make/common-defs.mk b/make/common-defs.mk index 722c67e89..7e27350e1 100644 --- a/make/common-defs.mk +++ b/make/common-defs.mk @@ -73,12 +73,12 @@ CSTANDARD = -std=gnu99 # Common architecture-specific flags from the device-specific library makefile CFLAGS += $(ARCHFLAGS) CFLAGS += $(CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer CFLAGS += -O$(OPT) CFLAGS += -g$(DEBUGF) +CFLAGS += -mapcs-frame +CFLAGS += -fomit-frame-pointer CFLAGS += -Wall +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) # FIXME: STM32F4xx library raises strict aliasing and const qualifier warnings @@ -104,18 +104,19 @@ CONLYFLAGS += $(CSTANDARD) # -ahlns: create listing ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) # Linker flags. # -Wl,...: tell GCC to pass this to linker. # -Map: create map file # --cref: add cross reference to map file -LDFLAGS += -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections +LDFLAGS += -nostartfiles +LDFLAGS += -Wl,--warn-common,--fatal-warnings,--gc-sections +LDFLAGS += -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -lgcc $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += -Wl,--warn-common -LDFLAGS += -Wl,--fatal-warnings +LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) +LDFLAGS += -lc -lgcc ifneq ($(DEBUG), YES) LDFLAGS += -Wl,-static From c518a582158ed5be2ae7579309123524e3b5db8d Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 13:57:47 +0200 Subject: [PATCH 39/68] Makefile: remove hardly used make options from CopterControl Makefile It was reasonable to use "USE_FEATURE" on the make level when we didn't have optional modules. Now is better to add them using += make operator. Conflicts: flight/targets/CopterControl/Makefile --- flight/targets/CopterControl/Makefile | 68 +++++++-------------------- 1 file changed, 17 insertions(+), 51 deletions(-) diff --git a/flight/targets/CopterControl/Makefile b/flight/targets/CopterControl/Makefile index 4a358f724..44cf2a750 100644 --- a/flight/targets/CopterControl/Makefile +++ b/flight/targets/CopterControl/Makefile @@ -25,65 +25,31 @@ include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk # ARM DSP library -USE_DSP_LIB ?= NO - -# Optional module and driver defaults -USE_CAMERASTAB ?= YES -USE_COMUSBBRIDGE ?= YES -USE_GPS ?= YES -USE_TXPID ?= YES -USE_ALTITUDE ?= NO -USE_AUTOTUNE ?= NO -TEST_FAULTS ?= NO - -# Camera gimbal options -USE_INPUT_LPF ?= YES -USE_GIMBAL_LPF ?= YES -USE_GIMBAL_FF ?= YES +USE_DSP_LIB ?= NO # Set to YES to build a FW version that will erase data flash memory -ERASE_FLASH ?= NO +ERASE_FLASH ?= NO # List of mandatory modules to include -MODULES = Attitude Stabilization Actuator ManualControl FirmwareIAP - -# Telemetry must be last to grab the optional modules (why?) +MODULES += Attitude +MODULES += Stabilization +MODULES += Actuator +MODULES += ManualControl +MODULES += FirmwareIAP MODULES += Telemetry # List of optional modules to include -OPTMODULES = -ifeq ($(USE_CAMERASTAB), YES) - OPTMODULES += CameraStab -endif -ifeq ($(USE_COMUSBBRIDGE), YES) - OPTMODULES += ComUsbBridge -endif -ifeq ($(USE_GPS), YES) - OPTMODULES += GPS -endif -ifeq ($(USE_TXPID), YES) - OPTMODULES += TxPID -endif -ifeq ($(USE_ALTITUDE), YES) - OPTMODULES += Altitude -endif -ifeq ($(USE_AUTOTUNE), YES) - OPTMODULES += Autotune -endif -ifeq ($(TEST_FAULTS), YES) - OPTMODULES += Fault -endif +OPTMODULES += CameraStab +OPTMODULES += ComUsbBridge +OPTMODULES += GPS +OPTMODULES += TxPID +#OPTMODULES += Altitude +#OPTMODULES += Fault -# Misc defines -ifeq ($(USE_INPUT_LPF), YES) - CDEFS += -DUSE_INPUT_LPF -endif -ifeq ($(USE_GIMBAL_LPF), YES) - CDEFS += -DUSE_GIMBAL_LPF -endif -ifeq ($(USE_GIMBAL_FF), YES) - CDEFS += -DUSE_GIMBAL_FF -endif +# Include all camera options +CDEFS += -DUSE_INPUT_LPF -DUSE_GIMBAL_LPF -DUSE_GIMBAL_FF + +# Erase flash firmware should be buildable from command line ifeq ($(ERASE_FLASH), YES) CDEFS += -DERASE_FLASH endif From 886c6b87753c665cd07b29ba223640128f82fbff Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 14:00:11 +0200 Subject: [PATCH 40/68] Makefile: rework RevoMini Makefile to use new make system Conflicts: flight/targets/RevoMini/Makefile flight/targets/RevoMini/UAVObjects.inc --- flight/targets/RevoMini/Makefile | 502 +++---------------------- flight/targets/RevoMini/UAVObjects.inc | 9 +- 2 files changed, 59 insertions(+), 452 deletions(-) diff --git a/flight/targets/RevoMini/Makefile b/flight/targets/RevoMini/Makefile index 05d827f3d..b883e6a0c 100644 --- a/flight/targets/RevoMini/Makefile +++ b/flight/targets/RevoMini/Makefile @@ -1,11 +1,6 @@ -##### -# Project: OpenPilot Revolution Target -# -# -# Makefile for OpenPilot Revolution project -# -# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2013. # +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# Copyright (c) 2012, PhoenixPilot, http://github.com/PhoenixPilot # # 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 @@ -22,462 +17,79 @@ # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##### -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES for debugging -DEBUG ?= NO - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -FLASH_TOOL = OPENOCD +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk -# List of modules to include -MODULES = Sensors -MODULES += Attitude/revolution -MODULES += ManualControl Stabilization Actuator -MODULES += Battery +# List of mandatory modules to include +MODULES += Sensors +MODULES += Attitude/revolution MODULES += Altitude/revolution -MODULES += GPS FirmwareIAP MODULES += Airspeed/revolution -MODULES += AltitudeHold FixedWingPathFollower PathPlanner TxPID -#MODULES += VtolPathFollower ## OP-700: VtolPathFollower disabled because its currently unsafe - remove this line once Sambas code has been merged +MODULES += AltitudeHold +MODULES += Stabilization +MODULES += ManualControl +MODULES += Actuator +MODULES += GPS +MODULES += TxPID MODULES += CameraStab -#MODULES += OveroSync +MODULES += Battery +MODULES += FirmwareIAP +MODULES += Radio +MODULES += PathPlanner +MODULES += FixedWingPathFollower +#MODULES += VtolPathFollower ## OP-700: VtolPathFollower disabled because its currently unsafe - remove this line once Sambas code has been merged MODULES += Telemetry -PYMODULES = -#FlightPlan -# Enable ARM DSP library -USE_DSP_LIB = NO +OPTMODULES = -# Paths -OPSYSTEM = ./System -OPSYSTEMINC = $(OPSYSTEM)/inc -OPUAVTALKINC = $(OPUAVTALK)/inc -OPUAVOBJINC = $(OPUAVOBJ)/inc -PIOSINC = $(PIOS)/inc -FLIGHTLIBINC = $(FLIGHTLIB)/inc -MATHLIB = $(FLIGHTLIB)/math -MATHLIBINC = $(FLIGHTLIB)/math -RSCODE = $(FLIGHTLIB)/rscode -RSCODEINC = $(FLIGHTLIB)/rscode -PIOSSTM32F4XX = $(PIOS)/STM32F4xx -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -APPLIBDIR = $(PIOSSTM32F4XX)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F4xx_StdPeriph_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc -OPUAVOBJINC = $(OPUAVOBJ)/inc -FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib -FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans +# Include all camera options +CDEFS += -DUSE_INPUT_LPF -DUSE_GIMBAL_LPF -DUSE_GIMBAL_FF -SRC = -# optional component libraries -include $(PIOSCOMMONLIB)/FreeRTOS/library.mk -#include $(PIOSCOMMONLIB)/dosfs/library.mk -include $(PIOSCOMMONLIB)/msheap/library.mk - -## PYMite support -#include $(FLIGHTLIB)/PyMite/pymite.mk - -## MODULES -SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -## OPENPILOT CORE: -SRC += ${OPMODULEDIR}/System/systemmod.c -SRC += $(OPSYSTEM)/revolution.c -SRC += $(OPSYSTEM)/pios_board.c -SRC += $(OPSYSTEM)/pios_usb_board_data.c -SRC += $(OPSYSTEM)/alarms.c -SRC += $(OPUAVTALK)/uavtalk.c -SRC += $(OPUAVOBJ)/uavobjectmanager.c -SRC += $(OPUAVOBJ)/eventdispatcher.c - -#ifeq ($(DEBUG),YES) -SRC += $(OPSYSTEM)/dcc_stdio.c -SRC += $(OPSYSTEM)/cm3_fault_handlers.c -#endif - -SRC += $(FLIGHTLIB)/CoordinateConversions.c -SRC += $(FLIGHTLIB)/paths.c -SRC += $(FLIGHTLIB)/fifo_buffer.c -SRC += $(FLIGHTLIB)/WorldMagModel.c -SRC += $(FLIGHTLIB)/insgps13state.c -SRC += $(FLIGHTLIB)/taskmonitor.c -SRC += $(FLIGHTLIB)/sanitycheck.c - -SRC += $(MATHLIB)/sin_lookup.c -SRC += $(MATHLIB)/pid.c - -## For RFM22b -SRC += $(RSCODE)/berlekamp.c -SRC += $(RSCODE)/crcgen.c -SRC += $(RSCODE)/galois.c -SRC += $(RSCODE)/rs.c - -## PIOS Hardware (STM32F4xx) -include $(PIOS)/STM32F4xx/library.mk - -## PIOS Hardware (Common) -SRC += $(PIOSCOMMON)/pios_mpu6000.c -SRC += $(PIOSCOMMON)/pios_bma180.c -SRC += $(PIOSCOMMON)/pios_etasv3.c -SRC += $(PIOSCOMMON)/pios_mpxv.c -SRC += $(PIOSCOMMON)/pios_gcsrcvr.c -SRC += $(PIOSCOMMON)/pios_l3gd20.c -SRC += $(PIOSCOMMON)/pios_hmc5883.c -SRC += $(PIOSCOMMON)/pios_ms5611.c -SRC += $(PIOSCOMMON)/pios_crc.c -SRC += $(PIOSCOMMON)/pios_com.c -SRC += $(PIOSCOMMON)/pios_rfm22b.c -SRC += $(PIOSCOMMON)/pios_rfm22b_com.c -SRC += $(PIOSCOMMON)/pios_rfm22b_rcvr.c -SRC += $(PIOSCOMMON)/pios_rcvr.c -SRC += $(PIOSCOMMON)/pios_sbus.c -SRC += $(PIOSCOMMON)/pios_flash_jedec.c -SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c -SRC += $(PIOSCOMMON)/printf-stdarg.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c -SRC += $(PIOSCOMMON)/pios_usb_util.c - -include ./UAVObjects.inc -SRC += $(UAVOBJSRC) - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. - - -# List Assembler source files here which must be assembled in ARM-Mode.. -ASRCARM = - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(OPSYSTEMINC) -EXTRAINCDIRS += $(OPUAVTALK) -EXTRAINCDIRS += $(OPUAVTALKINC) -EXTRAINCDIRS += $(OPUAVOBJ) -EXTRAINCDIRS += $(OPUAVOBJINC) -EXTRAINCDIRS += $(OPUAVSYNTHDIR) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(MATHLIBINC) -EXTRAINCDIRS += $(RSCODEINC) -EXTRAINCDIRS += $(PIOSSTM32F4XX) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(BOOTINC) -EXTRAINCDIRS += $(HWDEFSINC) - -EXTRAINCDIRS += ${foreach MOD, ${OPTMODULES} ${MODULES} ${PYMODULES}, $(OPMODULEDIR)/${MOD}/inc} ${OPMODULEDIR}/System/inc - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32F4XX) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -CFLAGS += -O0 -CFLAGS += -DGENERAL_COV -CFLAGS += -finstrument-functions -ffixed-r10 -else -CFLAGS += -Os -endif - - - -# common architecture-specific flags from the device-specific library makefile -CFLAGS += $(ARCHFLAGS) - -CFLAGS += -DSTACK_DIAGNOSTICS -CFLAGS += -DMIXERSTATUS_DIAGNOSTICS -CFLAGS += -DRATEDESIRED_DIAGNOSTICS -CFLAGS += -DI2C_WDG_STATS_DIAGNOSTICS -CFLAGS += -DDIAGNOSTICS -CFLAGS += -DDIAG_TASKS - -# This is not the best place for these. Really should abstract out -# to the board file or something -CFLAGS += -DSTM32F4XX -CFLAGS += -DMEM_SIZE=1024000000 - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) -CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) -ifeq ($(ENABLE_DEBUG_CONSOLE), YES) -CDEFS += -DPIOS_INCLUDE_DEBUG_CONSOLE -endif - -# Declare all non-optional modules as built-in to force inclusion -CDEFS += $(foreach MOD, $(notdir $(MODULES)), -DMODULE_$(MOD)_BUILTIN) - -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -# -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) - -CFLAGS += -g$(DEBUGF) +# All diagnostics +CDEFS += -DDIAGNOSTICS -DDIAG_TASKS +# Misc options CFLAGS += -ffast-math -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. +# List C source files here (C dependencies are automatically generated). +# Use file-extension c for "c-only"-files +ifndef TESTAPP + ## Application Core + SRC += ${OPMODULEDIR}/System/systemmod.c + SRC += $(OPSYSTEM)/revolution.c + SRC += $(OPSYSTEM)/pios_board.c + SRC += $(OPSYSTEM)/pios_usb_board_data.c + SRC += $(OPSYSTEM)/alarms.c + SRC += $(OPUAVTALK)/uavtalk.c + SRC += $(OPUAVOBJ)/uavobjectmanager.c + SRC += $(OPUAVOBJ)/eventdispatcher.c -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif + #ifeq ($(DEBUG), YES) + SRC += $(OPSYSTEM)/dcc_stdio.c + SRC += $(OPSYSTEM)/cm3_fault_handlers.c + #endif -CFLAGS += -Wall -#CFLAGS += -Werror -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = $(ARCHFLAGS) -mthumb -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -#Linker scripts -LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP)) - - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f -PYTHON = python - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: gccversion build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex lss sym + SRC += $(FLIGHTLIB)/paths.c + SRC += $(FLIGHTLIB)/WorldMagModel.c + SRC += $(FLIGHTLIB)/insgps13state.c else -ifeq ($(LOADFORMAT),binary) -build: elf bin lss sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin lss sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif + ## Test Code + SRC += $(OPTESTS)/test_common.c + SRC += $(OPTESTS)/$(TESTAPP).c endif - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino opfw -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o -opfw: $(OUTDIR)/$(TARGET).opfw - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).opfw -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw -else - $(error INSTALL_DIR must be specified for $@) +## UAVObjects +ifndef TESTAPP + include ./UAVObjects.inc + SRC += $(UAVOBJSRC) endif -# Target: clean project. -clean: clean_list +# Optional component libraries +include $(FLIGHTLIB)/rscode/library.mk -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list install +include $(ROOT_DIR)/make/apps-defs.mk +include $(ROOT_DIR)/make/common-defs.mk diff --git a/flight/targets/RevoMini/UAVObjects.inc b/flight/targets/RevoMini/UAVObjects.inc index 2ed6f31b3..56f708ebe 100644 --- a/flight/targets/RevoMini/UAVObjects.inc +++ b/flight/targets/RevoMini/UAVObjects.inc @@ -1,10 +1,6 @@ -##### -# Project: OpenPilot # -# Makefile for OpenPilot UAVObject code +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org # -# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2011. -# # 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 @@ -18,11 +14,10 @@ # 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., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -##### +# # These are the UAVObjects supposed to be build as part of the OpenPilot target # (all architectures) - UAVOBJSRCFILENAMES = UAVOBJSRCFILENAMES += accessorydesired UAVOBJSRCFILENAMES += actuatorcommand From f465a04b886a2bcf80a11578f368fc1855d4d879 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 14:36:15 +0200 Subject: [PATCH 41/68] pios: add new options from Revolution to pios.h and pios_config.h --- flight/targets/CopterControl/System/inc/pios_config.h | 2 ++ flight/targets/PipXtreme/System/inc/pios_config.h | 2 ++ flight/targets/RevoMini/System/inc/pios_config.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/flight/targets/CopterControl/System/inc/pios_config.h b/flight/targets/CopterControl/System/inc/pios_config.h index 4ea4fc968..1b30f337c 100644 --- a/flight/targets/CopterControl/System/inc/pios_config.h +++ b/flight/targets/CopterControl/System/inc/pios_config.h @@ -91,6 +91,7 @@ #define PIOS_INCLUDE_SERVO /* #define PIOS_INCLUDE_I2C_ESC */ /* #define PIOS_INCLUDE_OVERO */ +/* #define PIOS_OVERO_SPI */ /* #define PIOS_INCLUDE_SDCARD */ #define PIOS_INCLUDE_FLASH #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS @@ -111,6 +112,7 @@ #define PIOS_INCLUDE_TELEMETRY_RF /* #define PIOS_INCLUDE_COM_TELEM */ /* #define PIOS_INCLUDE_COM_FLEXI */ +/* #define PIOS_INCLUDE_COM_AUX */ /* #define PIOS_TELEM_PRIORITY_QUEUE */ #define PIOS_INCLUDE_GPS #define PIOS_GPS_MINIMAL diff --git a/flight/targets/PipXtreme/System/inc/pios_config.h b/flight/targets/PipXtreme/System/inc/pios_config.h index 9312dab49..b4d7a3113 100755 --- a/flight/targets/PipXtreme/System/inc/pios_config.h +++ b/flight/targets/PipXtreme/System/inc/pios_config.h @@ -91,6 +91,7 @@ /* #define PIOS_INCLUDE_SERVO */ /* #define PIOS_INCLUDE_I2C_ESC */ /* #define PIOS_INCLUDE_OVERO */ +/* #define PIOS_OVERO_SPI */ /* #define PIOS_INCLUDE_SDCARD */ /* #define PIOS_INCLUDE_FLASH */ /* #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS */ @@ -115,6 +116,7 @@ /* #define PIOS_INCLUDE_TELEMETRY_RF */ /* #define PIOS_INCLUDE_COM_TELEM */ /* #define PIOS_INCLUDE_COM_FLEXI */ +/* #define PIOS_INCLUDE_COM_AUX */ /* #define PIOS_TELEM_PRIORITY_QUEUE */ /* #define PIOS_INCLUDE_GPS */ /* #define PIOS_GPS_MINIMAL */ diff --git a/flight/targets/RevoMini/System/inc/pios_config.h b/flight/targets/RevoMini/System/inc/pios_config.h index 2f91563e7..8bdc530ea 100644 --- a/flight/targets/RevoMini/System/inc/pios_config.h +++ b/flight/targets/RevoMini/System/inc/pios_config.h @@ -91,6 +91,7 @@ #define PIOS_INCLUDE_SERVO /* #define PIOS_INCLUDE_I2C_ESC */ /* #define PIOS_INCLUDE_OVERO */ +/* #define PIOS_OVERO_SPI */ /* #define PIOS_INCLUDE_SDCARD */ #define PIOS_INCLUDE_FLASH #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS @@ -112,6 +113,7 @@ /* #define PIOS_INCLUDE_TELEMETRY_RF */ #define PIOS_INCLUDE_COM_TELEM #define PIOS_INCLUDE_COM_FLEXI +/* #define PIOS_INCLUDE_COM_AUX */ #define PIOS_TELEM_PRIORITY_QUEUE #define PIOS_INCLUDE_GPS /* #define PIOS_GPS_MINIMAL */ From 404ba00f701b2021b95e88ba279c121e2ea6269b Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 14:36:45 +0200 Subject: [PATCH 42/68] Makefile: rework Revolution Makefile to use new make system Conflicts: flight/targets/Revolution/Makefile --- flight/targets/Revolution/Makefile | 510 ++---------------- .../Revolution/System/inc/pios_config.h | 90 ++-- 2 files changed, 112 insertions(+), 488 deletions(-) diff --git a/flight/targets/Revolution/Makefile b/flight/targets/Revolution/Makefile index 2d120a6c7..c0aae6765 100644 --- a/flight/targets/Revolution/Makefile +++ b/flight/targets/Revolution/Makefile @@ -1,11 +1,6 @@ -##### -# Project: OpenPilot Revolution Target -# -# -# Makefile for OpenPilot Revolution project -# -# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2013. # +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# Copyright (c) 2012, PhoenixPilot, http://github.com/PhoenixPilot # # 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 @@ -22,470 +17,77 @@ # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##### -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES for debugging -DEBUG ?= NO - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -FLASH_TOOL = OPENOCD +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk -# Optional module and driver defaults -USE_COMUSBBRIDGE ?= NO -USE_TXPID ?= NO -USE_ALTITUDE ?= NO -TEST_FAULTS ?= NO -USE_MAGBARO ?= NO - -# List of optional modules to include -OPTMODULES = -ifeq ($(USE_COMUSBBRIDGE), YES) -OPTMODULES += ComUsbBridge -endif -ifeq ($(USE_TXPID), YES) -OPTMODULES += TxPID -endif -ifeq ($(TEST_FAULTS), YES) -OPTMODULES += Fault -endif -ifeq ($(USE_MAGBARO), YES) -OPTMODULES += Extensions/MagBaro -endif - -# List of modules to include -MODULES = Sensors Attitude/revolution ManualControl Stabilization Actuator -MODULES += Altitude/revolution FirmwareIAP +# List of mandatory modules to include +MODULES += Sensors +MODULES += Attitude/revolution +MODULES += Altitude/revolution MODULES += Airspeed/revolution -MODULES += GPS AltitudeHold FixedWingPathFollower PathPlanner -#MODULES += VtolPathFollower ## OP-700: VtolPathFollower disabled because its currently unsafe - remove this line once Sambas code has been merged +MODULES += AltitudeHold +MODULES += Stabilization +MODULES += ManualControl +MODULES += Actuator +MODULES += GPS +#MODULES += TxPID MODULES += CameraStab +#MODULES += Battery +MODULES += FirmwareIAP +#MODULES += Radio +MODULES += PathPlanner +MODULES += FixedWingPathFollower +#MODULES += VtolPathFollower ## OP-700: VtolPathFollower disabled because its currently unsafe - remove this line once Sambas code has been merged MODULES += OveroSync MODULES += Telemetry -PYMODULES = -#FlightPlan -# Enable ARM DSP library -USE_DSP_LIB = NO +OPTMODULES = -# Paths -OPSYSTEM = ./System -OPSYSTEMINC = $(OPSYSTEM)/inc -OPUAVTALKINC = $(OPUAVTALK)/inc -OPUAVOBJINC = $(OPUAVOBJ)/inc -PIOSINC = $(PIOS)/inc -FLIGHTLIBINC = $(FLIGHTLIB)/inc -MATHLIB = $(FLIGHTLIB)/math -MATHLIBINC = $(FLIGHTLIB)/math -PIOSSTM32F4XX = $(PIOS)/STM32F4xx -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -APPLIBDIR = $(PIOSSTM32F4XX)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F4xx_StdPeriph_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc -FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib -FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans +# Include all camera options +CDEFS += -DUSE_INPUT_LPF -DUSE_GIMBAL_LPF -DUSE_GIMBAL_FF -SRC = -# optional component libraries -include $(PIOSCOMMONLIB)/FreeRTOS/library.mk -#include $(PIOSCOMMONLIB)/dosfs/library.mk -include $(PIOSCOMMONLIB)/msheap/library.mk - -## PYMite support -#include $(FLIGHTLIB)/PyMite/pymite.mk - -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files - -## MODULES -SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -## OPENPILOT CORE: -SRC += ${OPMODULEDIR}/System/systemmod.c -SRC += $(OPSYSTEM)/revolution.c -SRC += $(OPSYSTEM)/pios_board.c -SRC += $(OPSYSTEM)/pios_usb_board_data.c -SRC += $(OPSYSTEM)/alarms.c -SRC += $(OPUAVTALK)/uavtalk.c -SRC += $(OPUAVOBJ)/uavobjectmanager.c -SRC += $(OPUAVOBJ)/eventdispatcher.c - -#ifeq ($(DEBUG),YES) -SRC += $(OPSYSTEM)/dcc_stdio.c -SRC += $(OPSYSTEM)/cm3_fault_handlers.c -#endif - -SRC += $(FLIGHTLIB)/CoordinateConversions.c -SRC += $(FLIGHTLIB)/paths.c -SRC += $(FLIGHTLIB)/fifo_buffer.c -SRC += $(FLIGHTLIB)/WorldMagModel.c -SRC += $(FLIGHTLIB)/insgps13state.c -SRC += $(FLIGHTLIB)/taskmonitor.c -SRC += $(FLIGHTLIB)/sanitycheck.c - -SRC += $(MATHLIB)/sin_lookup.c -SRC += $(MATHLIB)/pid.c - -## PIOS Hardware (STM32F4xx) -include $(PIOS)/STM32F4xx/library.mk - -## PIOS Hardware (Common) -SRC += $(PIOSCOMMON)/pios_mpu6000.c -SRC += $(PIOSCOMMON)/pios_bma180.c -SRC += $(PIOSCOMMON)/pios_etasv3.c -SRC += $(PIOSCOMMON)/pios_mpxv.c -SRC += $(PIOSCOMMON)/pios_gcsrcvr.c -SRC += $(PIOSCOMMON)/pios_l3gd20.c -SRC += $(PIOSCOMMON)/pios_hmc5883.c -SRC += $(PIOSCOMMON)/pios_ms5611.c -SRC += $(PIOSCOMMON)/pios_crc.c -SRC += $(PIOSCOMMON)/pios_com.c -SRC += $(PIOSCOMMON)/pios_rcvr.c -SRC += $(PIOSCOMMON)/pios_sbus.c -SRC += $(PIOSCOMMON)/pios_flash_jedec.c -SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c -SRC += $(PIOSCOMMON)/printf-stdarg.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c -SRC += $(PIOSCOMMON)/pios_usb_util.c - -include ./UAVObjects.inc -SRC += $(UAVOBJSRC) - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. - - -# List Assembler source files here which must be assembled in ARM-Mode.. -ASRCARM = - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(OPSYSTEMINC) -EXTRAINCDIRS += $(OPUAVTALK) -EXTRAINCDIRS += $(OPUAVTALKINC) -EXTRAINCDIRS += $(OPUAVOBJ) -EXTRAINCDIRS += $(OPUAVOBJINC) -EXTRAINCDIRS += $(OPUAVSYNTHDIR) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(MATHLIBINC) -EXTRAINCDIRS += $(PIOSSTM32F4XX) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(BOOTINC) -EXTRAINCDIRS += $(HWDEFSINC) - -EXTRAINCDIRS += ${foreach MOD, ${OPTMODULES} ${MODULES} ${PYMODULES}, $(OPMODULEDIR)/${MOD}/inc} ${OPMODULEDIR}/System/inc - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32F4XX) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -CFLAGS += -O0 -CFLAGS += -DGENERAL_COV -CFLAGS += -finstrument-functions -ffixed-r10 -else -CFLAGS += -Os -endif - - - -# common architecture-specific flags from the device-specific library makefile -CFLAGS += $(ARCHFLAGS) - -CFLAGS += -DSTACK_DIAGNOSTICS -CFLAGS += -DMIXERSTATUS_DIAGNOSTICS -CFLAGS += -DRATEDESIRED_DIAGNOSTICS -CFLAGS += -DI2C_WDG_STATS_DIAGNOSTICS -CFLAGS += -DDIAG_TASKS - -# This is not the best place for these. Really should abstract out -# to the board file or something -CFLAGS += -DSTM32F4XX -CFLAGS += -DMEM_SIZE=1024000000 - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) -CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) -ifeq ($(ENABLE_DEBUG_CONSOLE), YES) -CDEFS += -DPIOS_INCLUDE_DEBUG_CONSOLE -endif - -# Declare all non-optional modules as built-in to force inclusion -CDEFS += $(foreach MOD, $(notdir $(MODULES)), -DMODULE_$(MOD)_BUILTIN) - -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -# -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) - -CFLAGS += -g$(DEBUGF) +# All diagnostics +CDEFS += -DDIAGNOSTICS -DDIAG_TASKS +# Misc options CFLAGS += -ffast-math -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. +# List C source files here (C dependencies are automatically generated). +# Use file-extension c for "c-only"-files +ifndef TESTAPP + ## Application Core + SRC += ${OPMODULEDIR}/System/systemmod.c + SRC += $(OPSYSTEM)/revolution.c + SRC += $(OPSYSTEM)/pios_board.c + SRC += $(OPSYSTEM)/pios_usb_board_data.c + SRC += $(OPSYSTEM)/alarms.c + SRC += $(OPUAVTALK)/uavtalk.c + SRC += $(OPUAVOBJ)/uavobjectmanager.c + SRC += $(OPUAVOBJ)/eventdispatcher.c -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif + #ifeq ($(DEBUG), YES) + SRC += $(OPSYSTEM)/dcc_stdio.c + SRC += $(OPSYSTEM)/cm3_fault_handlers.c + #endif -CFLAGS += -Wall -#CFLAGS += -Werror -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d - -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = $(ARCHFLAGS) -mthumb -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -#Linker scripts -LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP)) - - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f -PYTHON = python - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: gccversion build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex lss sym + SRC += $(FLIGHTLIB)/paths.c + SRC += $(FLIGHTLIB)/WorldMagModel.c + SRC += $(FLIGHTLIB)/insgps13state.c else -ifeq ($(LOADFORMAT),binary) -build: elf bin lss sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin lss sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif + ## Test Code + SRC += $(OPTESTS)/test_common.c + SRC += $(OPTESTS)/$(TESTAPP).c endif - -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino opfw -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o -opfw: $(OUTDIR)/$(TARGET).opfw - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).opfw -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw -else - $(error INSTALL_DIR must be specified for $@) +## UAVObjects +ifndef TESTAPP + include ./UAVObjects.inc + SRC += $(UAVOBJSRC) endif -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list install +include $(ROOT_DIR)/make/apps-defs.mk +include $(ROOT_DIR)/make/common-defs.mk diff --git a/flight/targets/Revolution/System/inc/pios_config.h b/flight/targets/Revolution/System/inc/pios_config.h index 7c53d01ea..2bccd78dc 100644 --- a/flight/targets/Revolution/System/inc/pios_config.h +++ b/flight/targets/Revolution/System/inc/pios_config.h @@ -39,95 +39,109 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ +/* PIOS system functions */ #define PIOS_INCLUDE_FREERTOS #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL #define PIOS_INCLUDE_SYS +/* PIOS hardware peripherals */ #define PIOS_INCLUDE_IRQ #define PIOS_INCLUDE_RTC #define PIOS_INCLUDE_TIM #define PIOS_INCLUDE_USART #define PIOS_INCLUDE_ADC -/* #define PIOS_INCLUDE_I2C */ +#define PIOS_INCLUDE_I2C #define PIOS_INCLUDE_SPI -#define PIOS_INCLUDE_GPIO +/* #define PIOS_INCLUDE_GPIO */ #define PIOS_INCLUDE_EXTI #define PIOS_INCLUDE_WDG + +/* PIOS USB functions */ #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID -#define PIOS_INCLUDE_USB_CDC -#define PIOS_INCLUDE_USB_RCTX +/* #define PIOS_INCLUDE_USB_CDC */ +/* #define PIOS_INCLUDE_USB_RCTX */ -#define PIOS_INCLUDE_ADXL345 -/* #define PIOS_INCLUDE_BMA180 */ -/* #define PIOS_INCLUDE_L3GD20 */ +/* PIOS sensor interfaces */ +/* #define PIOS_INCLUDE_ADXL345 */ +#define PIOS_INCLUDE_BMA180 +#define PIOS_INCLUDE_L3GD20 #define PIOS_INCLUDE_MPU6000 #define PIOS_MPU6000_ACCEL /* #define PIOS_INCLUDE_HMC5843 */ -/* #define PIOS_INCLUDE_HMC5883 */ -/* #define PIOS_HMC5883_HAS_GPIOS */ +#define PIOS_INCLUDE_HMC5883 +#define PIOS_HMC5883_HAS_GPIOS /* #define PIOS_INCLUDE_BMP085 */ -/* #define PIOS_INCLUDE_MS5611 */ -/* #define PIOS_INCLUDE_MPXV */ -/* #define PIOS_INCLUDE_ETASV3 */ +#define PIOS_INCLUDE_MS5611 +#define PIOS_INCLUDE_MPXV +#define PIOS_INCLUDE_ETASV3 /* #define PIOS_INCLUDE_HCSR04 */ +/* PIOS receiver drivers */ #define PIOS_INCLUDE_PWM #define PIOS_INCLUDE_PPM #define PIOS_INCLUDE_DSM #define PIOS_INCLUDE_SBUS #define PIOS_INCLUDE_GCSRCVR +/* PIOS common peripherals */ #define PIOS_INCLUDE_LED #define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_SERVO /* #define PIOS_INCLUDE_I2C_ESC */ -/* #define PIOS_INCLUDE_OVERO */ +#define PIOS_INCLUDE_OVERO +#define PIOS_OVERO_SPI /* #define PIOS_INCLUDE_SDCARD */ #define PIOS_INCLUDE_FLASH #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS -/* #define FLASH_FREERTOS */ +#define FLASH_FREERTOS /* #define PIOS_INCLUDE_FLASH_EEPROM */ /* #define PIOS_INCLUDE_RFM22B */ /* #define PIOS_INCLUDE_PACKET_HANDLER */ /* #define PIOS_INCLUDE_VIDEO */ /* #define PIOS_INCLUDE_WAVE */ -#define PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ /* #define PIOS_INCLUDE_UDP */ +/* PIOS abstract receiver interface */ #define PIOS_INCLUDE_RCVR + +/* PIOS abstract comms interface with options */ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ -#define PIOS_INCLUDE_TELEMETRY_RF -/* #define PIOS_INCLUDE_COM_TELEM */ -/* #define PIOS_INCLUDE_COM_FLEXI */ -/* #define PIOS_TELEM_PRIORITY_QUEUE */ +/* #define PIOS_INCLUDE_TELEMETRY_RF */ +#define PIOS_INCLUDE_COM_TELEM +#define PIOS_INCLUDE_COM_FLEXI +#define PIOS_INCLUDE_COM_AUX +#define PIOS_TELEM_PRIORITY_QUEUE #define PIOS_INCLUDE_GPS -#define PIOS_GPS_MINIMAL +/* #define PIOS_GPS_MINIMAL */ #define PIOS_INCLUDE_GPS_NMEA_PARSER #define PIOS_INCLUDE_GPS_UBX_PARSER -/* #define PIOS_GPS_SETS_HOMELOCATION */ +#define PIOS_GPS_SETS_HOMELOCATION + +/* PIOS bootloader helper */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ /* Performance counters */ -#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 8379692 /* Alarm Thresholds */ -#define HEAP_LIMIT_WARNING 220 -#define HEAP_LIMIT_CRITICAL 40 -#define IRQSTACK_LIMIT_WARNING 100 -#define IRQSTACK_LIMIT_CRITICAL 60 -#define CPULOAD_LIMIT_WARNING 85 +#define HEAP_LIMIT_WARNING 1000 +#define HEAP_LIMIT_CRITICAL 500 +#define IRQSTACK_LIMIT_WARNING 150 +#define IRQSTACK_LIMIT_CRITICAL 80 +#define CPULOAD_LIMIT_WARNING 80 #define CPULOAD_LIMIT_CRITICAL 95 /* Task stack sizes */ -#define PIOS_ACTUATOR_STACK_SIZE 1020 -#define PIOS_MANUAL_STACK_SIZE 800 -#define PIOS_SYSTEM_STACK_SIZE 660 -#define PIOS_STABILIZATION_STACK_SIZE 524 -#define PIOS_TELEM_STACK_SIZE 500 -#define PIOS_EVENTDISPATCHER_STACK_SIZE 130 +/* #define PIOS_ACTUATOR_STACK_SIZE 1020 */ +/* #define PIOS_MANUAL_STACK_SIZE 800 */ +/* #define PIOS_SYSTEM_STACK_SIZE 660 */ +/* #define PIOS_STABILIZATION_STACK_SIZE 524 */ +/* #define PIOS_TELEM_STACK_SIZE 500 */ +/* #define PIOS_EVENTDISPATCHER_STACK_SIZE 130 */ /* Stabilization options */ /* #define PIOS_QUATERNION_STABILIZATION */ @@ -135,7 +149,15 @@ /* This can't be too high to stop eventdispatcher thread overflowing */ #define PIOS_EVENTDISAPTCHER_QUEUE 10 +/* Revolution series */ +#define REVOLUTION + +/* OBSOLETE */ +#define PIOS_INCLUDE_COM_AUXSBUS +#define PIOS_FLASH_ON_ACCEL /* true for second revo */ + #endif /* PIOS_CONFIG_H */ + /** * @} * @} From 7e02642b013bc556c84dc499ba2304812a2ecf33 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 16:53:57 +0200 Subject: [PATCH 43/68] Move 3rd party printf formatter functions from PiOS to Libraries folder They are not a PiOS, but 3rd party libraries. They even should not be placed to the same (PiOS) library directory due to the printf symbol clashes (if all *.c from the folder are built). So they are moved, and each target can include that one which is necessary/desired. --- .../Common => Libraries}/printf-stdarg.c | 24 +++++++++---------- flight/{PiOS/Common => Libraries}/printf2.c | 0 make/apps-defs.mk | 1 - make/boot-defs.mk | 4 +++- 4 files changed, 15 insertions(+), 14 deletions(-) rename flight/{PiOS/Common => Libraries}/printf-stdarg.c (97%) rename flight/{PiOS/Common => Libraries}/printf2.c (100%) diff --git a/flight/PiOS/Common/printf-stdarg.c b/flight/Libraries/printf-stdarg.c similarity index 97% rename from flight/PiOS/Common/printf-stdarg.c rename to flight/Libraries/printf-stdarg.c index 5f057ee89..b579b9d53 100644 --- a/flight/PiOS/Common/printf-stdarg.c +++ b/flight/Libraries/printf-stdarg.c @@ -3,26 +3,26 @@ * @addtogroup PIOS PIOS Core hardware abstraction layer * @{ * - * @file printf-stdarg.c + * @file printf-stdarg.c * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * Parts by Thorsten Klose (tk@midibox.org) * @brief Formatted print functions * @see The GNU Public License (GPL) Version 3 * *****************************************************************************/ -/* - * 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 +/* + * 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 + * + * 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., + * + * 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., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ diff --git a/flight/PiOS/Common/printf2.c b/flight/Libraries/printf2.c similarity index 100% rename from flight/PiOS/Common/printf2.c rename to flight/Libraries/printf2.c diff --git a/make/apps-defs.mk b/make/apps-defs.mk index c205ea297..a73d60716 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -102,7 +102,6 @@ SRC += $(PIOSCOMMON)/pios_rfm22b.c SRC += $(PIOSCOMMON)/pios_rfm22b_com.c SRC += $(PIOSCOMMON)/pios_sbus.c SRC += $(PIOSCOMMON)/pios_sdcard.c -SRC += $(PIOSCOMMON)/printf-stdarg.c # PIOS USB related files SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c diff --git a/make/boot-defs.mk b/make/boot-defs.mk index f7b5d43dd..410a6401e 100644 --- a/make/boot-defs.mk +++ b/make/boot-defs.mk @@ -60,10 +60,12 @@ SRC += $(OPSYSTEM)/op_dfu.c ## PIOS Hardware (Common) SRC += $(PIOSCOMMON)/pios_board_info.c SRC += $(PIOSCOMMON)/pios_com_msg.c -SRC += $(PIOSCOMMON)/printf-stdarg.c SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c SRC += $(PIOSCOMMON)/pios_usb_util.c +## Misc library functions +SRC += $(FLIGHTLIB)/printf-stdarg.c + # List C source files here which must be compiled in ARM-Mode (no -mthumb). # Use file-extension c for "c-only"-files SRCARM += From 38d822d2f55339e0827b38b37c3014ba2d0e0919 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 18:14:33 +0200 Subject: [PATCH 44/68] Makefile: rework OSD Makefile and target to use new make system Conflicts: flight/targets/OSD/Makefile --- .../CopterControl/System/inc/pios_config.h | 1 + flight/targets/OSD/Makefile | 581 +++--------------- .../OSD/System/{ => inc}/font_outlined8x14.h | 0 .../OSD/System/{ => inc}/font_outlined8x8.h | 0 flight/targets/OSD/System/{ => inc}/fonts.h | 0 flight/targets/OSD/System/inc/pios_config.h | 169 +++-- .../PipXtreme/System/inc/pios_config.h | 1 + .../targets/RevoMini/System/inc/pios_config.h | 1 + .../Revolution/System/inc/pios_config.h | 1 + 9 files changed, 198 insertions(+), 556 deletions(-) rename flight/targets/OSD/System/{ => inc}/font_outlined8x14.h (100%) rename flight/targets/OSD/System/{ => inc}/font_outlined8x8.h (100%) rename flight/targets/OSD/System/{ => inc}/fonts.h (100%) diff --git a/flight/targets/CopterControl/System/inc/pios_config.h b/flight/targets/CopterControl/System/inc/pios_config.h index 1b30f337c..8b7a5cc07 100644 --- a/flight/targets/CopterControl/System/inc/pios_config.h +++ b/flight/targets/CopterControl/System/inc/pios_config.h @@ -93,6 +93,7 @@ /* #define PIOS_INCLUDE_OVERO */ /* #define PIOS_OVERO_SPI */ /* #define PIOS_INCLUDE_SDCARD */ +/* #define LOG_FILENAME "startup.log" */ #define PIOS_INCLUDE_FLASH #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS /* #define FLASH_FREERTOS */ diff --git a/flight/targets/OSD/Makefile b/flight/targets/OSD/Makefile index 926276984..a3e2d4842 100644 --- a/flight/targets/OSD/Makefile +++ b/flight/targets/OSD/Makefile @@ -1,522 +1,101 @@ - ##### - # Project: OpenPilot OSD - # - # - # Makefile for OpenPilot OSD project - # - # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. - # - # - # 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, write to the Free Software Foundation, Inc., - # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - ##### +# +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org +# +# 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, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk - -# Set developer code and compile options -# Set to YES for debugging -DEBUG ?= NO - -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) endif -FLASH_TOOL = OPENOCD - -# Optional module and driver defaults -USE_CAMERASTAB ?= NO -USE_COMUSBBRIDGE ?= NO -USE_GPS ?= NO -USE_TXPID ?= NO -USE_ALTITUDE ?= NO -TEST_FAULTS ?= NO -USE_MAGBARO ?= NO - -# List of optional modules to include -OPTMODULES = -ifeq ($(USE_CAMERASTAB), YES) -OPTMODULES += CameraStab -endif -ifeq ($(USE_COMUSBBRIDGE), YES) -OPTMODULES += ComUsbBridge -endif -ifeq ($(USE_GPS), YES) -OPTMODULES += GPS -endif -ifeq ($(USE_TXPID), YES) -OPTMODULES += TxPID -endif -ifeq ($(USE_ALTITUDE), YES) -OPTMODULES += Altitude -endif -ifeq ($(TEST_FAULTS), YES) -OPTMODULES += Fault -endif -ifeq ($(USE_MAGBARO), YES) -OPTMODULES += Extensions/MagBaro -endif +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk +include $(ROOT_DIR)/make/firmware-defs.mk # List of mandatory modules to include -MODULES = Osd/osdgen -MODULES += GPS +MODULES += Osd/osdgen MODULES += Osd/osdinput MODULES += Osd/WavPlayer +MODULES += GPS MODULES += Extensions/MagBaro -MODULES += Telemetry MODULES += FirmwareIAP +MODULES += Telemetry -# Paths -OPSYSTEM = ./System -OPSYSTEMINC = $(OPSYSTEM)/inc -OPUAVTALKINC = $(OPUAVTALK)/inc -PIOSINC = $(PIOS)/inc -FLIGHTLIBINC = $(FLIGHTLIB)/inc -PIOSSTM32F4XX = $(PIOS)/STM32F4xx -PIOSCOMMON = $(PIOS)/Common -PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -PIOS_DEVLIB = $(PIOS)/STM32F4xx -APPLIBDIR = $(PIOSSTM32F4XX)/Libraries -STMLIBDIR = $(APPLIBDIR) -STMSPDDIR = $(STMLIBDIR)/STM32F4xx_StdPeriph_Driver -STMUSBDIR = $(STMLIBDIR)/STM32_USB-FS-Device_Driver -STMSPDSRCDIR = $(STMSPDDIR)/src -STMSPDINCDIR = $(STMSPDDIR)/inc -CMSISDIR = $(STMLIBDIR)/CMSIS/Core/CM3 -RTOSDIR = $(PIOSCOMMONLIB)/FreeRTOS -RTOSSRCDIR = $(RTOSDIR)/Source -RTOSINCDIR = $(RTOSSRCDIR)/include -OPUAVOBJINC = $(OPUAVOBJ)/inc - -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files - -## MODULES -SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -## OPENPILOT CORE: -SRC += ${OPMODULEDIR}/System/systemmod.c -SRC += $(OPSYSTEM)/osd.c -SRC += $(OPSYSTEM)/pios_board.c -SRC += $(OPSYSTEM)/pios_usb_board_data.c -SRC += $(OPSYSTEM)/fonts.c -SRC += $(OPSYSTEM)/font_outlined8x14.c -SRC += $(OPSYSTEM)/font_outlined8x8.c -SRC += $(OPSYSTEM)/alarms.c -SRC += $(OPUAVTALK)/uavtalk.c -SRC += $(OPUAVOBJ)/uavobjectmanager.c -SRC += $(OPUAVOBJ)/eventdispatcher.c - -#ifeq ($(DEBUG),YES) -SRC += $(OPSYSTEM)/dcc_stdio.c -SRC += $(OPSYSTEM)/cm3_fault_handlers.c -#endif - -SRC += $(FLIGHTLIB)/fifo_buffer.c -SRC += $(FLIGHTLIB)/taskmonitor.c -SRC += $(FLIGHTLIB)/CoordinateConversions.c -SRC += $(FLIGHTLIB)/WorldMagModel.c - -## UAVOBJECTS -#SRC += $(OPUAVSYNTHDIR)/accessorydesired.c -SRC += $(OPUAVSYNTHDIR)/objectpersistence.c -SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c -SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c -SRC += $(OPUAVSYNTHDIR)/flightstatus.c -SRC += $(OPUAVSYNTHDIR)/systemstats.c -SRC += $(OPUAVSYNTHDIR)/systemalarms.c -SRC += $(OPUAVSYNTHDIR)/systemsettings.c -#SRC += $(OPUAVSYNTHDIR)/stabilizationdesired.c -#SRC += $(OPUAVSYNTHDIR)/stabilizationsettings.c -#SRC += $(OPUAVSYNTHDIR)/actuatorcommand.c -#SRC += $(OPUAVSYNTHDIR)/actuatordesired.c -#SRC += $(OPUAVSYNTHDIR)/actuatorsettings.c -#SRC += $(OPUAVSYNTHDIR)/attituderaw.c -SRC += $(OPUAVSYNTHDIR)/attitudeactual.c -#SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c -SRC += $(OPUAVSYNTHDIR)/i2cstats.c -SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c -#SRC += $(OPUAVSYNTHDIR)/telemetrysettings.c -#SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c -#SRC += $(OPUAVSYNTHDIR)/mixersettings.c -SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c -#SRC += $(OPUAVSYNTHDIR)/attitudesettings.c -#SRC += $(OPUAVSYNTHDIR)/camerastabsettings.c -#SRC += $(OPUAVSYNTHDIR)/cameradesired.c -SRC += $(OPUAVSYNTHDIR)/hwsettings.c -#SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c -#SRC += $(OPUAVSYNTHDIR)/receiveractivity.c -SRC += $(OPUAVSYNTHDIR)/taskinfo.c -SRC += $(OPUAVSYNTHDIR)/mixerstatus.c -#SRC += $(OPUAVSYNTHDIR)/ratedesired.c -SRC += $(OPUAVSYNTHDIR)/homelocation.c -SRC += $(OPUAVSYNTHDIR)/gpsposition.c -SRC += $(OPUAVSYNTHDIR)/gpssatellites.c -SRC += $(OPUAVSYNTHDIR)/gpsvelocity.c -SRC += $(OPUAVSYNTHDIR)/gpstime.c -SRC += $(OPUAVSYNTHDIR)/osdsettings.c -SRC += $(OPUAVSYNTHDIR)/baroaltitude.c -SRC += $(OPUAVSYNTHDIR)/magnetometer.c - -## PIOS Hardware (Common) -SRC += $(PIOSCOMMON)/pios_com.c -SRC += $(PIOSCOMMON)/pios_bmp085.c -SRC += $(PIOSCOMMON)/pios_hmc5883.c -#SRC += $(PIOSCOMMON)/printf-stdarg.c -SRC += $(PIOSCOMMON)/printf2.c -SRC += $(PIOSCOMMON)/pios_crc.c -SRC += $(PIOSCOMMON)/pios_video.c -SRC += $(PIOSCOMMON)/pios_wavplay.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c -SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c -SRC += $(PIOSCOMMON)/pios_usb_util.c -SRC += $(PIOSCOMMON)/pios_sdcard.c - -# optional component libraries -include $(PIOSCOMMONLIB)/FreeRTOS/library.mk -include $(PIOSCOMMONLIB)/dosfs/library.mk -include $(PIOSCOMMONLIB)/msheap/library.mk - -## PIOS Hardware (STM32F4xx) -include $(PIOS)/STM32F4xx/library.mk - - -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. -#ASRC = $(PIOSSTM32F4XX)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S - -# List Assembler source files here which must be assembled in ARM-Mode.. -ASRCARM = - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -EXTRAINCDIRS += $(OPSYSTEM) -EXTRAINCDIRS += $(OPSYSTEMINC) -EXTRAINCDIRS += $(OPUAVTALK) -EXTRAINCDIRS += $(OPUAVTALKINC) -EXTRAINCDIRS += $(OPUAVOBJ) -EXTRAINCDIRS += $(OPUAVOBJINC) -EXTRAINCDIRS += $(OPUAVSYNTHDIR) -EXTRAINCDIRS += $(PIOS) -EXTRAINCDIRS += $(PIOSINC) -EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(PIOSSTM32F4XX) -EXTRAINCDIRS += $(PIOSCOMMON) -EXTRAINCDIRS += $(PIOSBOARDS) -EXTRAINCDIRS += $(STMSPDINCDIR) -EXTRAINCDIRS += $(CMSISDIR) -EXTRAINCDIRS += $(RTOSINCDIR) -EXTRAINCDIRS += $(APPLIBDIR) -EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3 -EXTRAINCDIRS += $(OPUAVSYNTHDIR) -EXTRAINCDIRS += $(HWDEFSINC) - -EXTRAINCDIRS += ${foreach MOD, ${OPTMODULES} ${MODULES}, ${OPMODULEDIR}/${MOD}/inc} ${OPMODULEDIR}/System/inc - -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -LINKERSCRIPTPATH = $(PIOSSTM32F4XX) - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - -ifeq ($(DEBUG),YES) -CFLAGS += -O0 -CFLAGS += -DGENERAL_COV -CFLAGS += -finstrument-functions -ffixed-r10 -else -CFLAGS += -Os -endif - - - -# common architecture-specific flags from the device-specific library makefile -CFLAGS += $(ARCHFLAGS) - - -CFLAGS += -DDIAGNOSTICS -CFLAGS += -DDIAG_TASKS - -# This is not the best place for these. Really should abstract out -# to the board file or something -CFLAGS += -DSTM32F4XX -CFLAGS += -DMEM_SIZE=1024000000 - - -# Output format. (can be ihex or binary or both) -# binary to create a load-image in raw-binary format i.e. for SAM-BA, -# ihex to create a load-image in Intel hex format -#LOADFORMAT = ihex -#LOADFORMAT = binary -LOADFORMAT = both - -# Debugging format. -DEBUGF = dwarf-2 - -# Place project-specific -D (define) and/or -# -U options for C here. -CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) -CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) -CDEFS += -DUSE_STDPERIPH_DRIVER -CDEFS += -DUSE_$(BOARD) - -# Declare all non-optional modules as built-in to force inclusion -CDEFS += $(foreach MOD, $(notdir $(MODULES)), -DMODULE_$(MOD)_BUILTIN) - -# Place project-specific -D and/or -U options for -# Assembler with preprocessor here. -#ADEFS = -DUSE_IRQ_ASM_WRAPPER -ADEFS = -D__ASSEMBLY__ - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 - -#----- - -# Compiler flags. - -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -# -# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) - -CFLAGS += -g$(DEBUGF) +OPTMODULES = +# Misc options CFLAGS += -ffast-math -CFLAGS += -mcpu=$(MCU) -CFLAGS += $(CDEFS) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. +# List C source files here (C dependencies are automatically generated). +# Use file-extension c for "c-only"-files +ifndef TESTAPP + ## Application Core + SRC += ${OPMODULEDIR}/System/systemmod.c + SRC += $(OPSYSTEM)/osd.c + SRC += $(OPSYSTEM)/pios_board.c + SRC += $(OPSYSTEM)/pios_usb_board_data.c + SRC += $(OPSYSTEM)/alarms.c + SRC += $(OPUAVTALK)/uavtalk.c + SRC += $(OPUAVOBJ)/uavobjectmanager.c + SRC += $(OPUAVOBJ)/eventdispatcher.c -CFLAGS += -mapcs-frame -CFLAGS += -fomit-frame-pointer -ifeq ($(CODE_SOURCERY), YES) -CFLAGS += -fpromote-loop-indices -endif + ## OSD fonts + SRC += $(OPSYSTEM)/fonts.c + SRC += $(OPSYSTEM)/font_outlined8x14.c + SRC += $(OPSYSTEM)/font_outlined8x8.c -CFLAGS += -Wall -#CFLAGS += -Werror -CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -# Compiler flags to generate dependency files: -CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d + #ifeq ($(DEBUG), YES) + SRC += $(OPSYSTEM)/dcc_stdio.c + SRC += $(OPSYSTEM)/cm3_fault_handlers.c + #endif -# flags only for C -#CONLYFLAGS += -Wnested-externs -CONLYFLAGS += $(CSTANDARD) - -# Assembler flags. -# -Wa,...: tell GCC to pass this to the assembler. -# -ahlns: create listing -ASFLAGS = $(ARCHFLAGS) -mthumb -I. -x assembler-with-cpp -ASFLAGS += $(ADEFS) -ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) -ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) - -MATH_LIB = -lm - -# Linker flags. -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections -LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) -LDFLAGS += -lc -LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) -LDFLAGS += $(MATH_LIB) -LDFLAGS += -lc -lgcc - -#Linker scripts -LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP)) - - -# Define programs and commands. -REMOVE = $(REMOVE_CMD) -f - -# List of all source files. -ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) -# List of all source files without directory and file-extension. -ALLSRCBASE = $(notdir $(basename $(ALLSRC))) - -# Define all object files. -ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) - -# Define all listing files (used for make clean). -LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) -# Define all depedency-files (used for make clean). -DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) - -# Default target. -all: gccversion build - -ifeq ($(LOADFORMAT),ihex) -build: elf hex lss sym + SRC += $(FLIGHTLIB)/printf2.c + SRC += $(FLIGHTLIB)/WorldMagModel.c else -ifeq ($(LOADFORMAT),binary) -build: elf bin lss sym -else -ifeq ($(LOADFORMAT),both) -build: elf hex bin lss sym -else -$(error "$(MSG_FORMATERROR) $(FORMAT)") -endif -endif + ## Test Code + SRC += $(OPTESTS)/test_common.c + SRC += $(OPTESTS)/$(TESTAPP).c endif -# Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) - -# Assemble: create object files from assembler source files. -$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) - -# Assemble: create object files from assembler source files. ARM-only -$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. -$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) - -# Compile: create object files from C source files. ARM-only -$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. -$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) - -# Compile: create object files from C++ source files. ARM-only -$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) - -# Compile: create assembler files from C source files. ARM/Thumb -$(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) - -# Compile: create assembler files from C source files. ARM only -$(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) - -$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin - -$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) - -# Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) - -.PHONY: elf lss sym hex bin bino opfw -elf: $(OUTDIR)/$(TARGET).elf -lss: $(OUTDIR)/$(TARGET).lss -sym: $(OUTDIR)/$(TARGET).sym -hex: $(OUTDIR)/$(TARGET).hex -bin: $(OUTDIR)/$(TARGET).bin -bino: $(OUTDIR)/$(TARGET).bin.o -opfw: $(OUTDIR)/$(TARGET).opfw - -# Display sizes of sections. -$(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) - -# Generate Doxygen documents -docs: - doxygen $(DOXYGENDIR)/doxygen.cfg - -# Install: install binary file with prefix/suffix into install directory -install: $(OUTDIR)/$(TARGET).opfw -ifneq ($(INSTALL_DIR),) - @echo $(MSG_INSTALLING) $(call toprel, $<) - $(V1) mkdir -p $(INSTALL_DIR) - $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).opfw -else - $(error INSTALL_DIR must be specified for $@) +## UAVObjects +ifndef TESTAPP + SRC += $(OPUAVSYNTHDIR)/objectpersistence.c + SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c + SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c + SRC += $(OPUAVSYNTHDIR)/flightstatus.c + SRC += $(OPUAVSYNTHDIR)/systemstats.c + SRC += $(OPUAVSYNTHDIR)/systemalarms.c + SRC += $(OPUAVSYNTHDIR)/systemsettings.c + SRC += $(OPUAVSYNTHDIR)/attitudeactual.c + SRC += $(OPUAVSYNTHDIR)/i2cstats.c + SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c + SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c + SRC += $(OPUAVSYNTHDIR)/hwsettings.c + SRC += $(OPUAVSYNTHDIR)/taskinfo.c + SRC += $(OPUAVSYNTHDIR)/mixerstatus.c + SRC += $(OPUAVSYNTHDIR)/homelocation.c + SRC += $(OPUAVSYNTHDIR)/gpsposition.c + SRC += $(OPUAVSYNTHDIR)/gpssatellites.c + SRC += $(OPUAVSYNTHDIR)/gpsvelocity.c + SRC += $(OPUAVSYNTHDIR)/gpstime.c + SRC += $(OPUAVSYNTHDIR)/osdsettings.c + SRC += $(OPUAVSYNTHDIR)/baroaltitude.c + SRC += $(OPUAVSYNTHDIR)/magnetometer.c endif + +# Optional component libraries +include $(PIOS)/Common/Libraries/dosfs/library.mk -# Target: clean project. -clean: clean_list - -clean_list : - @echo $(MSG_CLEANING) - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).map - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).elf - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).hex - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss - $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o - $(V1) $(REMOVE) $(ALLOBJ) - $(V1) $(REMOVE) $(LSTFILES) - $(V1) $(REMOVE) $(DEPFILES) - $(V1) $(REMOVE) $(SRC:.c=.s) - $(V1) $(REMOVE) $(SRCARM:.c=.s) - $(V1) $(REMOVE) $(CPPSRC:.cpp=.s) - $(V1) $(REMOVE) $(CPPSRCARM:.cpp=.s) - -# Create output files directory -# all known MS Windows OS define the ComSpec environment variable -ifdef ComSpec -$(shell md $(subst /,\\,$(OUTDIR)) 2>NUL) -else -$(shell mkdir -p $(OUTDIR) 2>/dev/null) -endif - -# Include the dependency files. -ifdef ComSpec --include $(shell md $(subst /,\\,$(OUTDIR))\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) -else --include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) -endif - -# Listing of phony targets. -.PHONY : all build clean clean_list install \ No newline at end of file +include $(ROOT_DIR)/make/apps-defs.mk +include $(ROOT_DIR)/make/common-defs.mk diff --git a/flight/targets/OSD/System/font_outlined8x14.h b/flight/targets/OSD/System/inc/font_outlined8x14.h similarity index 100% rename from flight/targets/OSD/System/font_outlined8x14.h rename to flight/targets/OSD/System/inc/font_outlined8x14.h diff --git a/flight/targets/OSD/System/font_outlined8x8.h b/flight/targets/OSD/System/inc/font_outlined8x8.h similarity index 100% rename from flight/targets/OSD/System/font_outlined8x8.h rename to flight/targets/OSD/System/inc/font_outlined8x8.h diff --git a/flight/targets/OSD/System/fonts.h b/flight/targets/OSD/System/inc/fonts.h similarity index 100% rename from flight/targets/OSD/System/fonts.h rename to flight/targets/OSD/System/inc/fonts.h diff --git a/flight/targets/OSD/System/inc/pios_config.h b/flight/targets/OSD/System/inc/pios_config.h index 35bd73907..d81d6074a 100644 --- a/flight/targets/OSD/System/inc/pios_config.h +++ b/flight/targets/OSD/System/inc/pios_config.h @@ -1,12 +1,14 @@ /** ****************************************************************************** - * + * @addtogroup OpenPilotSystem OpenPilot System + * @{ + * @addtogroup OpenPilotCore OpenPilot Core + * @{ * @file pios_config.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief PiOS configuration header. - * - Central compile time config for the project. + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2013. + * @brief PiOS configuration header, the compile time config file for the PIOS. + * Defines which PiOS libraries and features are included in the firmware. * @see The GNU Public License (GPL) Version 3 - * *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify @@ -24,72 +26,107 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef PIOS_CONFIG_H #define PIOS_CONFIG_H -/* Major features */ -#define PIOS_INCLUDE_FREERTOS -#define PIOS_INCLUDE_BL_HELPER +/* + * Below is a complete list of PIOS configurable options. + * Please do not remove or rearrange them. Only comment out + * unused options in the list. See main pios.h header for more + * details. + */ -/* Enable/Disable PiOS Modules */ -#define PIOS_INCLUDE_ADC +/* #define PIOS_INCLUDE_DEBUG_CONSOLE */ +/* #define DEBUG_LEVEL 0 */ + +/* PIOS system functions */ +#define PIOS_INCLUDE_FREERTOS #define PIOS_INCLUDE_DELAY -#define PIOS_INCLUDE_I2C -#define PIOS_INCLUDE_IRQ -#define PIOS_INCLUDE_LED -#define PIOS_INCLUDE_IAP -//#define PIOS_INCLUDE_SERVO -#define PIOS_INCLUDE_SPI +#define PIOS_INCLUDE_INITCALL #define PIOS_INCLUDE_SYS + +/* PIOS hardware peripherals */ +#define PIOS_INCLUDE_IRQ +#define PIOS_INCLUDE_RTC +#define PIOS_INCLUDE_TIM #define PIOS_INCLUDE_USART -//#define PIOS_INCLUDE_GPIO +#define PIOS_INCLUDE_ADC +#define PIOS_INCLUDE_I2C +#define PIOS_INCLUDE_SPI +/* #define PIOS_INCLUDE_GPIO */ +#define PIOS_INCLUDE_EXTI +#define PIOS_INCLUDE_WDG + +/* PIOS USB functions */ #define PIOS_INCLUDE_USB #define PIOS_INCLUDE_USB_HID -#define PIOS_INCLUDE_EXTI -#define PIOS_INCLUDE_RTC -#define PIOS_INCLUDE_WDG -#define PIOS_INCLUDE_VIDEO +/* #define PIOS_INCLUDE_USB_CDC */ +/* #define PIOS_INCLUDE_USB_RCTX */ -/* Com systems to include */ -#define PIOS_INCLUDE_COM -#define PIOS_INCLUDE_COM_TELEM -/* #define PIOS_INCLUDE_COM_TELEM */ -/* #define PIOS_INCLUDE_COM_FLEXI */ -/* #define PIOS_TELEM_PRIORITY_QUEUE */ -#define PIOS_INCLUDE_COM_AUX -#define PIOS_INCLUDE_GPS -//#define PIOS_OVERO_SPI -#define PIOS_INCLUDE_BMP085 +/* PIOS sensor interfaces */ +/* #define PIOS_INCLUDE_ADXL345 */ +/* #define PIOS_INCLUDE_BMA180 */ +/* #define PIOS_INCLUDE_L3GD20 */ +/* #define PIOS_INCLUDE_MPU6000 */ +/* #define PIOS_MPU6000_ACCEL */ +/* #define PIOS_INCLUDE_HMC5843 */ #define PIOS_INCLUDE_HMC5883 /* #define PIOS_HMC5883_HAS_GPIOS */ -#define PIOS_INCLUDE_SDCARD -//#define PIOS_INCLUDE_WAVE -/* Supported receiver interfaces */ -//#define PIOS_INCLUDE_RCVR -//#define PIOS_INCLUDE_DSM -//#define PIOS_INCLUDE_SBUS -//#define PIOS_INCLUDE_PPM -//#define PIOS_INCLUDE_PWM -//#define PIOS_INCLUDE_GCSRCVR +#define PIOS_INCLUDE_BMP085 +/* #define PIOS_INCLUDE_MS5611 */ +/* #define PIOS_INCLUDE_MPXV */ +/* #define PIOS_INCLUDE_ETASV3 */ +/* #define PIOS_INCLUDE_HCSR04 */ -//#define PIOS_INCLUDE_SETTINGS -//#define PIOS_INCLUDE_FLASH -/* A really shitty setting saving implementation */ -//#define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS +/* PIOS receiver drivers */ +/* #define PIOS_INCLUDE_PWM */ +/* #define PIOS_INCLUDE_PPM */ +/* #define PIOS_INCLUDE_DSM */ +/* #define PIOS_INCLUDE_SBUS */ +/* #define PIOS_INCLUDE_GCSRCVR */ + +/* PIOS common peripherals */ +#define PIOS_INCLUDE_LED +#define PIOS_INCLUDE_IAP +/* #define PIOS_INCLUDE_SERVO */ +/* #define PIOS_INCLUDE_I2C_ESC */ +/* #define PIOS_INCLUDE_OVERO */ +/* #define PIOS_OVERO_SPI */ +#define PIOS_INCLUDE_SDCARD +#define LOG_FILENAME "startup.log" +/* #define PIOS_INCLUDE_FLASH */ +/* #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS */ /* #define FLASH_FREERTOS */ +/* #define PIOS_INCLUDE_FLASH_EEPROM */ +/* #define PIOS_INCLUDE_RFM22B */ +/* #define PIOS_INCLUDE_PACKET_HANDLER */ +#define PIOS_INCLUDE_VIDEO +/* #define PIOS_INCLUDE_WAVE */ +/* #define PIOS_INCLUDE_UDP */ + +/* PIOS abstract receiver interface */ +/* #define PIOS_INCLUDE_RCVR */ + +/* PIOS abstract comms interface with options */ +#define PIOS_INCLUDE_COM +/* #define PIOS_INCLUDE_COM_MSG */ +/* #define PIOS_INCLUDE_TELEMETRY_RF */ +#define PIOS_INCLUDE_COM_TELEM +/* #define PIOS_INCLUDE_COM_FLEXI */ +#define PIOS_INCLUDE_COM_AUX +#define PIOS_TELEM_PRIORITY_QUEUE +#define PIOS_INCLUDE_GPS +/* #define PIOS_GPS_MINIMAL */ +#define PIOS_INCLUDE_GPS_NMEA_PARSER +#define PIOS_INCLUDE_GPS_UBX_PARSER +#define PIOS_GPS_SETS_HOMELOCATION + +/* PIOS bootloader helper */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ /* Performance counters */ -// This actually needs calibrating -#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD (8379692) - -#define PIOS_INCLUDE_INITCALL /* Include init call structures */ -#define PIOS_TELEM_PRIORITY_QUEUE /* Enable a priority queue in telemetry */ -#define PIOS_QUATERNION_STABILIZATION /* Stabilization options */ -#define PIOS_GPS_SETS_HOMELOCATION /* GPS options */ -#define PIOS_INCLUDE_GPS_NMEA_PARSER /* Include the NMEA protocol parser */ -#define PIOS_INCLUDE_GPS_UBX_PARSER /* Include the UBX protocol parser */ -/* #define PIOS_GPS_SETS_HOMELOCATION */ +#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 8379692 /* Alarm Thresholds */ #define HEAP_LIMIT_WARNING 4000 @@ -99,4 +136,26 @@ #define CPULOAD_LIMIT_WARNING 80 #define CPULOAD_LIMIT_CRITICAL 95 +/* Task stack sizes */ +/* #define PIOS_ACTUATOR_STACK_SIZE 1020 */ +/* #define PIOS_MANUAL_STACK_SIZE 800 */ +/* #define PIOS_SYSTEM_STACK_SIZE 660 */ +/* #define PIOS_STABILIZATION_STACK_SIZE 524 */ +/* #define PIOS_TELEM_STACK_SIZE 500 */ +/* #define PIOS_EVENTDISPATCHER_STACK_SIZE 130 */ + +/* Stabilization options */ +#define PIOS_QUATERNION_STABILIZATION + +/* This can't be too high to stop eventdispatcher thread overflowing */ +/* #define PIOS_EVENTDISAPTCHER_QUEUE 10 */ + +/* Revolution series */ +/* #define REVOLUTION */ + #endif /* PIOS_CONFIG_H */ + +/** + * @} + * @} + */ diff --git a/flight/targets/PipXtreme/System/inc/pios_config.h b/flight/targets/PipXtreme/System/inc/pios_config.h index b4d7a3113..625a1b623 100755 --- a/flight/targets/PipXtreme/System/inc/pios_config.h +++ b/flight/targets/PipXtreme/System/inc/pios_config.h @@ -93,6 +93,7 @@ /* #define PIOS_INCLUDE_OVERO */ /* #define PIOS_OVERO_SPI */ /* #define PIOS_INCLUDE_SDCARD */ +/* #define LOG_FILENAME "startup.log" */ /* #define PIOS_INCLUDE_FLASH */ /* #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS */ /* #define FLASH_FREERTOS */ diff --git a/flight/targets/RevoMini/System/inc/pios_config.h b/flight/targets/RevoMini/System/inc/pios_config.h index 8bdc530ea..cefdad1a5 100644 --- a/flight/targets/RevoMini/System/inc/pios_config.h +++ b/flight/targets/RevoMini/System/inc/pios_config.h @@ -93,6 +93,7 @@ /* #define PIOS_INCLUDE_OVERO */ /* #define PIOS_OVERO_SPI */ /* #define PIOS_INCLUDE_SDCARD */ +/* #define LOG_FILENAME "startup.log" */ #define PIOS_INCLUDE_FLASH #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS #define FLASH_FREERTOS diff --git a/flight/targets/Revolution/System/inc/pios_config.h b/flight/targets/Revolution/System/inc/pios_config.h index 2bccd78dc..2e86ecb79 100644 --- a/flight/targets/Revolution/System/inc/pios_config.h +++ b/flight/targets/Revolution/System/inc/pios_config.h @@ -93,6 +93,7 @@ #define PIOS_INCLUDE_OVERO #define PIOS_OVERO_SPI /* #define PIOS_INCLUDE_SDCARD */ +/* #define LOG_FILENAME "startup.log" */ #define PIOS_INCLUDE_FLASH #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS #define FLASH_FREERTOS From 992bd696a67b2568c0fb456c56d8487e10b3e805 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 17 Mar 2013 16:59:29 +0200 Subject: [PATCH 45/68] *.mk: fix double '/' in path names ($dir always returns it as a last char) Also minor formatting of all library.mk files. Conflicts: flight/PiOS/Common/Libraries/CMSIS2/library.mk --- flight/Libraries/rscode/library.mk | 2 +- .../PiOS/Common/Libraries/CMSIS2/library.mk | 32 +++++++++---------- .../PiOS/Common/Libraries/FreeRTOS/library.mk | 7 ++-- flight/PiOS/Common/Libraries/dosfs/library.mk | 7 ++-- .../PiOS/Common/Libraries/msheap/library.mk | 7 ++-- flight/PiOS/STM32F10x/library.mk | 10 +++--- flight/PiOS/STM32F4xx/library.mk | 20 ++++++------ .../PiOS/posix/Libraries/FreeRTOS/library.mk | 7 ++-- 8 files changed, 43 insertions(+), 49 deletions(-) diff --git a/flight/Libraries/rscode/library.mk b/flight/Libraries/rscode/library.mk index 99f227d5c..8805495c4 100644 --- a/flight/Libraries/rscode/library.mk +++ b/flight/Libraries/rscode/library.mk @@ -5,5 +5,5 @@ RSCODE_DIR := $(dir $(lastword $(MAKEFILE_LIST))) RSCODE_SRC := berlekamp.c crcgen.c galois.c rs.c -SRC += $(addprefix $(RSCODE_DIR)/,$(RSCODE_SRC)) +SRC += $(addprefix $(RSCODE_DIR),$(RSCODE_SRC)) EXTRAINCDIRS += $(RSCODE_DIR) diff --git a/flight/PiOS/Common/Libraries/CMSIS2/library.mk b/flight/PiOS/Common/Libraries/CMSIS2/library.mk index d965c1b63..e6c7a1567 100644 --- a/flight/PiOS/Common/Libraries/CMSIS2/library.mk +++ b/flight/PiOS/Common/Libraries/CMSIS2/library.mk @@ -2,28 +2,26 @@ # Rules to add CMSIS2 to a PiOS target # -CMSIS2_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -EXTRAINCDIRS += $(CMSIS2_DIR)/Include +CMSIS2_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +EXTRAINCDIRS += $(CMSIS2_DIR)Include # Rules to build the ARM DSP library ifeq ($(USE_DSP_LIB), YES) + DSPLIB_NAME := dsp + CMSIS_DSPLIB := $(CMSIS2_DIR)/DSP_Lib/Source -DSPLIB_NAME := dsp -CMSIS_DSPLIB := $(CMSIS2_DIR)/DSP_Lib/Source + # Compile all files into output directory + DSPLIB_SRC := $(wildcard $(CMSIS_DSPLIB)/*/*.c) + DSPLIB_SRCBASE := $(notdir $(basename $(DSPLIB_SRC))) + $(foreach src, $(DSPLIB_SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) -# Compile all files into output directory -DSPLIB_SRC := $(wildcard $(CMSIS_DSPLIB)/*/*.c) -DSPLIB_SRCBASE := $(notdir $(basename $(DSPLIB_SRC))) -$(foreach src, $(DSPLIB_SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) + # Define the object files directory and a list of object files for the library + DSPLIB_OBJDIR = $(OUTDIR) + DSPLIB_OBJ = $(addprefix $(DSPLIB_OBJDIR)/, $(addsuffix .o, $(DSPLIB_SRCBASE))) -# Define the object files directory and a list of object files for the library -DSPLIB_OBJDIR = $(OUTDIR) -DSPLIB_OBJ = $(addprefix $(DSPLIB_OBJDIR)/, $(addsuffix .o, $(DSPLIB_SRCBASE))) - -# Create a library file -$(eval $(call ARCHIVE_TEMPLATE, $(OUTDIR)/lib$(DSPLIB_NAME).a, $(DSPLIB_OBJ), $(DSPLIB_OBJDIR))) - -# Add library to the list of linked objects -ALLLIB += $(OUTDIR)/lib$(DSPLIB_NAME).a + # Create a library file + $(eval $(call ARCHIVE_TEMPLATE, $(OUTDIR)/lib$(DSPLIB_NAME).a, $(DSPLIB_OBJ), $(DSPLIB_OBJDIR))) + # Add library to the list of linked objects + ALLLIB += $(OUTDIR)/lib$(DSPLIB_NAME).a endif diff --git a/flight/PiOS/Common/Libraries/FreeRTOS/library.mk b/flight/PiOS/Common/Libraries/FreeRTOS/library.mk index ae65aff82..9e101b273 100644 --- a/flight/PiOS/Common/Libraries/FreeRTOS/library.mk +++ b/flight/PiOS/Common/Libraries/FreeRTOS/library.mk @@ -5,7 +5,6 @@ # has been defined and add in the target-specific pieces separately. # -FREERTOS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/Source -SRC += $(wildcard $(FREERTOS_DIR)/*.c) -EXTRAINCDIRS += $(FREERTOS_DIR)/include - +FREERTOS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/Source +SRC += $(wildcard $(FREERTOS_DIR)/*.c) +EXTRAINCDIRS += $(FREERTOS_DIR)/include diff --git a/flight/PiOS/Common/Libraries/dosfs/library.mk b/flight/PiOS/Common/Libraries/dosfs/library.mk index d3bf6e16b..0e6fa982e 100644 --- a/flight/PiOS/Common/Libraries/dosfs/library.mk +++ b/flight/PiOS/Common/Libraries/dosfs/library.mk @@ -2,7 +2,6 @@ # Rules to add DOSFS to a PiOS target # -DOSFS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -SRC += $(wildcard $(DOSFS_DIR)*.c) -EXTRAINCDIRS += $(DOSFS_DIR) - +DOSFS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +SRC += $(wildcard $(DOSFS_DIR)*.c) +EXTRAINCDIRS += $(DOSFS_DIR) diff --git a/flight/PiOS/Common/Libraries/msheap/library.mk b/flight/PiOS/Common/Libraries/msheap/library.mk index de7ca06f6..84a796e62 100644 --- a/flight/PiOS/Common/Libraries/msheap/library.mk +++ b/flight/PiOS/Common/Libraries/msheap/library.mk @@ -2,7 +2,6 @@ # Rules to add the MSHeap allocator to a PiOS target # -MSHEAP_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -SRC += $(wildcard $(MSHEAP_DIR)*.c) -EXTRAINCDIRS += $(MSHEAP_DIR) - +MSHEAP_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +SRC += $(wildcard $(MSHEAP_DIR)*.c) +EXTRAINCDIRS += $(MSHEAP_DIR) diff --git a/flight/PiOS/STM32F10x/library.mk b/flight/PiOS/STM32F10x/library.mk index b2b4b7927..0f10a7fd0 100644 --- a/flight/PiOS/STM32F10x/library.mk +++ b/flight/PiOS/STM32F10x/library.mk @@ -16,24 +16,24 @@ CDEFS += -DARM_MATH_CM3 ARCHFLAGS += -mcpu=cortex-m3 # Board-specific startup files -ASRC += $(PIOS_DEVLIB)/startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S +ASRC += $(PIOS_DEVLIB)startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S # PIOS device library source and includes SRC += $(wildcard $(PIOS_DEVLIB)*.c) # CMSIS for the F1 -CMSIS_DIR = $(PIOS_DEVLIB)/Libraries/CMSIS/Core/CM3 +CMSIS_DIR = $(PIOS_DEVLIB)Libraries/CMSIS/Core/CM3 SRC += $(CMSIS_DIR)/core_cm3.c SRC += $(CMSIS_DIR)/system_stm32f10x.c EXTRAINCDIRS += $(CMSIS_DIR) # ST Peripheral library -PERIPHLIB = $(PIOS_DEVLIB)/Libraries/STM32F10x_StdPeriph_Driver +PERIPHLIB = $(PIOS_DEVLIB)Libraries/STM32F10x_StdPeriph_Driver SRC += $(wildcard $(PERIPHLIB)/src/*.c) EXTRAINCDIRS += $(PERIPHLIB)/inc # ST USB Device library -USBDEVLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB-FS-Device_Driver +USBDEVLIB = $(PIOS_DEVLIB)Libraries/STM32_USB-FS-Device_Driver SRC += $(wildcard $(USBDEVLIB)/src/*.c) EXTRAINCDIRS += $(USBDEVLIB)/inc @@ -44,7 +44,7 @@ EXTRAINCDIRS += $(USBDEVLIB)/inc # the device-specific pieces of the code. # ifneq ($(FREERTOS_DIR),) - FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source + FREERTOS_PORTDIR := $(PIOS_DEVLIB)Libraries/FreeRTOS/Source SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3/*.c) SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/MemMang/heap_1.c) EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3 diff --git a/flight/PiOS/STM32F4xx/library.mk b/flight/PiOS/STM32F4xx/library.mk index 9ea3cf657..25700e929 100644 --- a/flight/PiOS/STM32F4xx/library.mk +++ b/flight/PiOS/STM32F4xx/library.mk @@ -6,10 +6,10 @@ PIOS_DEVLIB := $(dir $(lastword $(MAKEFILE_LIST))) # Hardcoded linker script names for now -LINKER_SCRIPTS_APP = $(PIOS_DEVLIB)/link_STM32F4xx_OP_memory.ld \ - $(PIOS_DEVLIB)/link_STM32F4xx_sections.ld -LINKER_SCRIPTS_BL = $(PIOS_DEVLIB)/link_STM32F4xx_BL_memory.ld \ - $(PIOS_DEVLIB)/link_STM32F4xx_sections.ld +LINKER_SCRIPTS_APP = $(PIOS_DEVLIB)link_STM32F4xx_OP_memory.ld \ + $(PIOS_DEVLIB)link_STM32F4xx_sections.ld +LINKER_SCRIPTS_BL = $(PIOS_DEVLIB)link_STM32F4xx_BL_memory.ld \ + $(PIOS_DEVLIB)link_STM32F4xx_sections.ld # Compiler options implied by the F4xx CDEFS += -DSTM32F4XX @@ -20,27 +20,27 @@ ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard # PIOS device library source and includes SRC += $(wildcard $(PIOS_DEVLIB)*.c) -EXTRAINCDIRS += $(PIOS_DEVLIB)/inc +EXTRAINCDIRS += $(PIOS_DEVLIB)inc # CMSIS for the F4 include $(PIOSCOMMON)/Libraries/CMSIS2/library.mk -CMSIS2_DEVICEDIR := $(PIOS_DEVLIB)/Libraries/CMSIS2/Device/ST/STM32F4xx +CMSIS2_DEVICEDIR := $(PIOS_DEVLIB)Libraries/CMSIS2/Device/ST/STM32F4xx SRC += $(wildcard $(CMSIS2_DEVICEDIR)/Source/$(BOARD_NAME)/*.c) EXTRAINCDIRS += $(CMSIS2_DEVICEDIR)/Include # ST Peripheral library -PERIPHLIB = $(PIOS_DEVLIB)/Libraries/STM32F4xx_StdPeriph_Driver +PERIPHLIB = $(PIOS_DEVLIB)Libraries/STM32F4xx_StdPeriph_Driver SRC += $(wildcard $(PERIPHLIB)/src/*.c) EXTRAINCDIRS += $(PERIPHLIB)/inc # ST USB OTG library -USBOTGLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB_OTG_Driver +USBOTGLIB = $(PIOS_DEVLIB)Libraries/STM32_USB_OTG_Driver USBOTGLIB_SRC = usb_core.c usb_dcd.c usb_dcd_int.c SRC += $(addprefix $(USBOTGLIB)/src/,$(USBOTGLIB_SRC)) EXTRAINCDIRS += $(USBOTGLIB)/inc # ST USB Device library -USBDEVLIB = $(PIOS_DEVLIB)/Libraries/STM32_USB_Device_Library +USBDEVLIB = $(PIOS_DEVLIB)Libraries/STM32_USB_Device_Library SRC += $(wildcard $(USBDEVLIB)/Core/src/*.c) EXTRAINCDIRS += $(USBDEVLIB)/Core/inc @@ -51,7 +51,7 @@ EXTRAINCDIRS += $(USBDEVLIB)/Core/inc # the device-specific pieces of the code. # ifneq ($(FREERTOS_DIR),) - FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source + FREERTOS_PORTDIR := $(PIOS_DEVLIB)Libraries/FreeRTOS/Source SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F/*.c) EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F include $(PIOSCOMMON)/Libraries/msheap/library.mk diff --git a/flight/PiOS/posix/Libraries/FreeRTOS/library.mk b/flight/PiOS/posix/Libraries/FreeRTOS/library.mk index ae65aff82..c6267255f 100644 --- a/flight/PiOS/posix/Libraries/FreeRTOS/library.mk +++ b/flight/PiOS/posix/Libraries/FreeRTOS/library.mk @@ -5,7 +5,6 @@ # has been defined and add in the target-specific pieces separately. # -FREERTOS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/Source -SRC += $(wildcard $(FREERTOS_DIR)/*.c) -EXTRAINCDIRS += $(FREERTOS_DIR)/include - +FREERTOS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/Source +SRC += $(wildcard $(FREERTOS_DIR)/*.c) +EXTRAINCDIRS += $(FREERTOS_DIR)/include From 853f9bf31e02fefd7d157574e2705a8f976da57d Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 18 Mar 2013 20:24:50 +0200 Subject: [PATCH 46/68] Makefile: swap some lines for readability, no real code changes --- Makefile | 520 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 262 insertions(+), 258 deletions(-) diff --git a/Makefile b/Makefile index 2c0bcc027..9720559f3 100644 --- a/Makefile +++ b/Makefile @@ -233,6 +233,268 @@ uavobjects_clean: $(V0) @$(ECHO) " CLEAN $@" $(V1) [ ! -d "$(UAVOBJ_OUT_DIR)" ] || $(RM) -r "$(UAVOBJ_OUT_DIR)" +############################## +# +# Flight related components +# +############################## + +# Define some pointers to the various important pieces of the flight code +# to prevent these being repeated in every sub makefile +export PIOS := $(ROOT_DIR)/flight/PiOS +export FLIGHTLIB := $(ROOT_DIR)/flight/Libraries +export OPMODULEDIR := $(ROOT_DIR)/flight/Modules +export OPUAVOBJ := $(ROOT_DIR)/flight/targets/UAVObjects +export OPUAVTALK := $(ROOT_DIR)/flight/targets/UAVTalk +export HWDEFS := $(ROOT_DIR)/flight/targets/board_hw_defs +export DOXYGENDIR := $(ROOT_DIR)/flight/Doc/Doxygen +export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight + +# Define supported board lists +ALL_BOARDS := coptercontrol pipxtreme revolution revomini simposix osd +ALL_BOARDS_BU := coptercontrol pipxtreme simposix + +# Friendly names of each board (used to find source tree) +coptercontrol_friendly := CopterControl +pipxtreme_friendly := PipXtreme +revolution_friendly := Revolution +revomini_friendly := RevoMini +simposix_friendly := SimPosix +osd_friendly := OSD + +# Short names of each board (used to display board name in parallel builds) +coptercontrol_short := 'cc ' +pipxtreme_short := 'pipx' +revolution_short := 'revo' +revomini_short := 'rm ' +simposix_short := 'posx' +osd_short := 'osd ' + +# SimPosix only builds on Linux so drop it from the list for +# all other platforms. +ifneq ($(UNAME), Linux) + ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS)) + ALL_BOARDS_BU := $(filter-out simposix, $(ALL_BOARDS_BU)) +endif + +# Start out assuming that we'll build fw, bl and bu for all boards +FW_BOARDS := $(ALL_BOARDS) +BL_BOARDS := $(ALL_BOARDS) +BU_BOARDS := $(ALL_BOARDS_BU) +EF_BOARDS := $(ALL_BOARDS) + +# SimPosix doesn't have a BL, BU or EF target so we need to +# filter them out to prevent errors on the all_flight target. +BL_BOARDS := $(filter-out simposix, $(BL_BOARDS)) +BU_BOARDS := $(filter-out simposix, $(BU_BOARDS)) +EF_BOARDS := $(filter-out simposix, $(EF_BOARDS)) + +# Generate the targets for whatever boards are left in each list +FW_TARGETS := $(addprefix fw_, $(FW_BOARDS)) +BL_TARGETS := $(addprefix bl_, $(BL_BOARDS)) +BU_TARGETS := $(addprefix bu_, $(BU_BOARDS)) +EF_TARGETS := $(addprefix ef_, $(EF_BOARDS)) + +# When building any of the "all_*" targets, tell all sub makefiles to display +# additional details on each line of output to describe which build and target +# that each line applies to. +ifneq ($(strip $(filter all_%,$(MAKECMDGOALS))),) + export ENABLE_MSG_EXTRA := yes +endif + +# When building more than one goal in a single make invocation, also +# enable the extra context for each output line +ifneq ($(word 2,$(MAKECMDGOALS)),) + export ENABLE_MSG_EXTRA := yes +endif + +# TEMPLATES (used to generate build rules) + +# $(1) = Canonical board name all in lower case (e.g. coptercontrol) +# $(2) = Name of board used in source tree (e.g. CopterControl) +# $(3) = Short name for board (e.g CC) +define FW_TEMPLATE +.PHONY: $(1) fw_$(1) +$(1): fw_$(1)_opfw +fw_$(1): fw_$(1)_opfw + +fw_$(1)_%: uavobjects_flight + $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep + $(V1) cd $(ROOT_DIR)/flight/targets/$(2) && \ + $$(MAKE) -r --no-print-directory \ + BOARD_NAME=$(1) \ + BOARD_SHORT_NAME=$(3) \ + BUILD_TYPE=fw \ + HWDEFSINC=$(HWDEFS)/$(1) \ + TOPDIR=$(ROOT_DIR)/flight/targets/$(2) \ + OUTDIR=$(BUILD_DIR)/fw_$(1) \ + TARGET=fw_$(1) \ + $$* + +.PHONY: $(1)_clean +$(1)_clean: fw_$(1)_clean +fw_$(1)_clean: + $(V0) @$(ECHO) " CLEAN $$@" + $(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1) +endef + +# $(1) = Canonical board name all in lower case (e.g. coptercontrol) +# $(2) = Name of board used in source tree (e.g. CopterControl) +define BL_TEMPLATE +.PHONY: bl_$(1) +bl_$(1): bl_$(1)_bin +bl_$(1)_bino: bl_$(1)_bin + +bl_$(1)_%: + $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep + $(V1) cd $(ROOT_DIR)/flight/targets/Bootloaders/$(2) && \ + $$(MAKE) -r --no-print-directory \ + BOARD_NAME=$(1) \ + BOARD_SHORT_NAME=$(3) \ + BUILD_TYPE=bl \ + HWDEFSINC=$(HWDEFS)/$(1) \ + TOPDIR=$(ROOT_DIR)/flight/targets/Bootloaders/$(2) \ + OUTDIR=$(BUILD_DIR)/bl_$(1) \ + TARGET=bl_$(1) \ + $$* + +.PHONY: unbrick_$(1) +unbrick_$(1): bl_$(1)_hex +$(if $(filter-out undefined,$(origin UNBRICK_TTY)), + $(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)" + $(V1) $(STM32FLASH_DIR)/stm32flash \ + -w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \ + -g 0x0 \ + $$(UNBRICK_TTY) +, + $(V0) @$(ECHO) + $(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY= to use for unbricking." + $(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0" +) + +.PHONY: bl_$(1)_clean +bl_$(1)_clean: + $(V0) @$(ECHO) " CLEAN $$@" + $(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1) +endef + +# $(1) = Canonical board name all in lower case (e.g. coptercontrol) +define BU_TEMPLATE +.PHONY: bu_$(1) +bu_$(1): bu_$(1)_opfw + +bu_$(1)_%: bl_$(1)_bino + $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep + $(V1) cd $(ROOT_DIR)/flight/targets/Bootloaders/BootloaderUpdater && \ + $$(MAKE) -r --no-print-directory \ + BOARD_NAME=$(1) \ + BOARD_SHORT_NAME=$(3) \ + BUILD_TYPE=bu \ + HWDEFSINC=$(HWDEFS)/$(1) \ + TOPDIR=$(ROOT_DIR)/flight/targets/Bootloaders/BootloaderUpdater \ + OUTDIR=$(BUILD_DIR)/bu_$(1) \ + TARGET=bu_$(1) \ + $$* + +.PHONY: bu_$(1)_clean +bu_$(1)_clean: + $(V0) @$(ECHO) " CLEAN $$@" + $(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1) +endef + +# $(1) = Canonical board name all in lower case (e.g. coptercontrol) +define EF_TEMPLATE +.PHONY: ef_$(1) +ef_$(1): ef_$(1)_bin + +ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw + $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)/dep + $(V1) cd $(ROOT_DIR)/flight/targets/EntireFlash && \ + $$(MAKE) -r --no-print-directory \ + BOARD_NAME=$(1) \ + BOARD_SHORT_NAME=$(3) \ + BUILD_TYPE=ef \ + TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \ + DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \ + \ + TARGET=ef_$(1) \ + OUTDIR=$(BUILD_DIR)/ef_$(1) \ + \ + $$* + +.PHONY: ef_$(1)_clean +ef_$(1)_clean: + $(V0) @$(ECHO) " CLEAN $$@" + $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1) +endef + +# $(1) = Canonical board name all in lower case (e.g. coptercontrol) +define BOARD_PHONY_TEMPLATE +.PHONY: all_$(1) +all_$(1): $$(filter fw_$(1), $$(FW_TARGETS)) +all_$(1): $$(filter bl_$(1), $$(BL_TARGETS)) +all_$(1): $$(filter bu_$(1), $$(BU_TARGETS)) +all_$(1): $$(filter ef_$(1), $$(EF_TARGETS)) + +.PHONY: all_$(1)_clean +all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS))) +all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS))) +all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS))) +all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS))) +endef + +# Generate flight build rules +.PHONY: all_fw all_fw_clean +all_fw: $(addsuffix _opfw, $(FW_TARGETS)) +all_fw_clean: $(addsuffix _clean, $(FW_TARGETS)) + +.PHONY: all_bl all_bl_clean +all_bl: $(addsuffix _bin, $(BL_TARGETS)) +all_bl_clean: $(addsuffix _clean, $(BL_TARGETS)) + +.PHONY: all_bu all_bu_clean +all_bu: $(addsuffix _opfw, $(BU_TARGETS)) +all_bu_clean: $(addsuffix _clean, $(BU_TARGETS)) + +.PHONY: all_ef all_ef_clean +all_ef: $(EF_TARGETS) +all_ef_clean: $(addsuffix _clean, $(EF_TARGETS)) + +.PHONY: all_flight all_flight_clean +all_flight: all_fw all_bl all_bu all_ef +all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean + +# Expand the groups of targets for each board +$(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board)))) + +# Expand the firmware rules +$(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short)))) + +# Expand the bootloader rules +$(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short)))) + +# Expand the bootloader updater rules +$(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short)))) + +# Expand the entire-flash rules +$(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short)))) + +.PHONY: sim_win32 +sim_win32: sim_win32_exe + +sim_win32_%: uavobjects_flight + $(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32 + $(V1) $(MAKE) --no-print-directory \ + -C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $* + +.PHONY: sim_osx +sim_osx: sim_osx_elf + +sim_osx_%: uavobjects_flight + $(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx + $(V1) $(MAKE) --no-print-directory \ + -C $(ROOT_DIR)/flight/targets/Revolution --file=$(ROOT_DIR)/flight/targets/Revolution/Makefile.osx $* + ############################## # # GCS related components @@ -419,264 +681,6 @@ uavo-collections_clean: $(V0) @$(ECHO) " CLEAN $(UAVO_COLLECTION_DIR)" $(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR) -############################## -# -# Flight related components -# -############################## - -# Define some pointers to the various important pieces of the flight code -# to prevent these being repeated in every sub makefile -export PIOS := $(ROOT_DIR)/flight/PiOS -export FLIGHTLIB := $(ROOT_DIR)/flight/Libraries -export OPMODULEDIR := $(ROOT_DIR)/flight/Modules -export OPUAVOBJ := $(ROOT_DIR)/flight/targets/UAVObjects -export OPUAVTALK := $(ROOT_DIR)/flight/targets/UAVTalk -export HWDEFS := $(ROOT_DIR)/flight/targets/board_hw_defs -export DOXYGENDIR := $(ROOT_DIR)/flight/Doc/Doxygen -export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight - -# $(1) = Canonical board name all in lower case (e.g. coptercontrol) -# $(2) = Name of board used in source tree (e.g. CopterControl) -# $(3) = Short name for board (e.g CC) -define FW_TEMPLATE -.PHONY: $(1) fw_$(1) -$(1): fw_$(1)_opfw -fw_$(1): fw_$(1)_opfw - -fw_$(1)_%: uavobjects_flight - $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep - $(V1) cd $(ROOT_DIR)/flight/targets/$(2) && \ - $$(MAKE) -r --no-print-directory \ - BOARD_NAME=$(1) \ - BOARD_SHORT_NAME=$(3) \ - BUILD_TYPE=fw \ - HWDEFSINC=$(HWDEFS)/$(1) \ - TOPDIR=$(ROOT_DIR)/flight/targets/$(2) \ - OUTDIR=$(BUILD_DIR)/fw_$(1) \ - TARGET=fw_$(1) \ - $$* - -.PHONY: $(1)_clean -$(1)_clean: fw_$(1)_clean -fw_$(1)_clean: - $(V0) @$(ECHO) " CLEAN $$@" - $(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1) -endef - -# $(1) = Canonical board name all in lower case (e.g. coptercontrol) -# $(2) = Name of board used in source tree (e.g. CopterControl) -define BL_TEMPLATE -.PHONY: bl_$(1) -bl_$(1): bl_$(1)_bin -bl_$(1)_bino: bl_$(1)_bin - -bl_$(1)_%: - $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep - $(V1) cd $(ROOT_DIR)/flight/targets/Bootloaders/$(2) && \ - $$(MAKE) -r --no-print-directory \ - BOARD_NAME=$(1) \ - BOARD_SHORT_NAME=$(3) \ - BUILD_TYPE=bl \ - HWDEFSINC=$(HWDEFS)/$(1) \ - TOPDIR=$(ROOT_DIR)/flight/targets/Bootloaders/$(2) \ - OUTDIR=$(BUILD_DIR)/bl_$(1) \ - TARGET=bl_$(1) \ - $$* - -.PHONY: unbrick_$(1) -unbrick_$(1): bl_$(1)_hex -$(if $(filter-out undefined,$(origin UNBRICK_TTY)), - $(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)" - $(V1) $(STM32FLASH_DIR)/stm32flash \ - -w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \ - -g 0x0 \ - $$(UNBRICK_TTY) -, - $(V0) @$(ECHO) - $(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY= to use for unbricking." - $(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0" -) - -.PHONY: bl_$(1)_clean -bl_$(1)_clean: - $(V0) @$(ECHO) " CLEAN $$@" - $(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1) -endef - -# $(1) = Canonical board name all in lower case (e.g. coptercontrol) -define BU_TEMPLATE -.PHONY: bu_$(1) -bu_$(1): bu_$(1)_opfw - -bu_$(1)_%: bl_$(1)_bino - $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep - $(V1) cd $(ROOT_DIR)/flight/targets/Bootloaders/BootloaderUpdater && \ - $$(MAKE) -r --no-print-directory \ - BOARD_NAME=$(1) \ - BOARD_SHORT_NAME=$(3) \ - BUILD_TYPE=bu \ - HWDEFSINC=$(HWDEFS)/$(1) \ - TOPDIR=$(ROOT_DIR)/flight/targets/Bootloaders/BootloaderUpdater \ - OUTDIR=$(BUILD_DIR)/bu_$(1) \ - TARGET=bu_$(1) \ - $$* - -.PHONY: bu_$(1)_clean -bu_$(1)_clean: - $(V0) @$(ECHO) " CLEAN $$@" - $(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1) -endef - -# $(1) = Canonical board name all in lower case (e.g. coptercontrol) -define EF_TEMPLATE -.PHONY: ef_$(1) -ef_$(1): ef_$(1)_bin - -ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw - $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)/dep - $(V1) cd $(ROOT_DIR)/flight/targets/EntireFlash && \ - $$(MAKE) -r --no-print-directory \ - BOARD_NAME=$(1) \ - BOARD_SHORT_NAME=$(3) \ - BUILD_TYPE=ef \ - TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \ - DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \ - \ - TARGET=ef_$(1) \ - OUTDIR=$(BUILD_DIR)/ef_$(1) \ - \ - $$* - -.PHONY: ef_$(1)_clean -ef_$(1)_clean: - $(V0) @$(ECHO) " CLEAN $$@" - $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1) -endef - -# When building any of the "all_*" targets, tell all sub makefiles to display -# additional details on each line of output to describe which build and target -# that each line applies to. -ifneq ($(strip $(filter all_%,$(MAKECMDGOALS))),) - export ENABLE_MSG_EXTRA := yes -endif - -# When building more than one goal in a single make invocation, also -# enable the extra context for each output line -ifneq ($(word 2,$(MAKECMDGOALS)),) - export ENABLE_MSG_EXTRA := yes -endif - -# $(1) = Canonical board name all in lower case (e.g. coptercontrol) -define BOARD_PHONY_TEMPLATE -.PHONY: all_$(1) -all_$(1): $$(filter fw_$(1), $$(FW_TARGETS)) -all_$(1): $$(filter bl_$(1), $$(BL_TARGETS)) -all_$(1): $$(filter bu_$(1), $$(BU_TARGETS)) -all_$(1): $$(filter ef_$(1), $$(EF_TARGETS)) - -.PHONY: all_$(1)_clean -all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS))) -all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS))) -all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS))) -all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS))) -endef - -ALL_BOARDS := coptercontrol pipxtreme simposix revolution revomini osd -ALL_BOARDS_BU := coptercontrol pipxtreme simposix - -# SimPosix only builds on Linux so drop it from the list for -# all other platforms. -ifneq ($(UNAME), Linux) - ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS)) - ALL_BOARDS_BU := $(filter-out simposix, $(ALL_BOARDS_BU)) -endif - -# Friendly names of each board (used to find source tree) -coptercontrol_friendly := CopterControl -pipxtreme_friendly := PipXtreme -revolution_friendly := Revolution -revomini_friendly := RevoMini -simposix_friendly := SimPosix -osd_friendly := OSD - -# Short names of each board (used to display board name in parallel builds) -coptercontrol_short := 'cc ' -pipxtreme_short := 'pipx' -revolution_short := 'revo' -revomini_short := 'rm ' -simposix_short := 'posx' -osd_short := 'osd ' - -# Start out assuming that we'll build fw, bl and bu for all boards -FW_BOARDS := $(ALL_BOARDS) -BL_BOARDS := $(ALL_BOARDS) -BU_BOARDS := $(ALL_BOARDS_BU) -EF_BOARDS := $(ALL_BOARDS) - -# SimPosix doesn't have a BL, BU or EF target so we need to -# filter them out to prevent errors on the all_flight target. -BL_BOARDS := $(filter-out simposix, $(BL_BOARDS)) -BU_BOARDS := $(filter-out simposix, $(BU_BOARDS)) -EF_BOARDS := $(filter-out simposix, $(EF_BOARDS)) - -# Generate the targets for whatever boards are left in each list -FW_TARGETS := $(addprefix fw_, $(FW_BOARDS)) -BL_TARGETS := $(addprefix bl_, $(BL_BOARDS)) -BU_TARGETS := $(addprefix bu_, $(BU_BOARDS)) -EF_TARGETS := $(addprefix ef_, $(EF_BOARDS)) - -.PHONY: all_fw all_fw_clean -all_fw: $(addsuffix _opfw, $(FW_TARGETS)) -all_fw_clean: $(addsuffix _clean, $(FW_TARGETS)) - -.PHONY: all_bl all_bl_clean -all_bl: $(addsuffix _bin, $(BL_TARGETS)) -all_bl_clean: $(addsuffix _clean, $(BL_TARGETS)) - -.PHONY: all_bu all_bu_clean -all_bu: $(addsuffix _opfw, $(BU_TARGETS)) -all_bu_clean: $(addsuffix _clean, $(BU_TARGETS)) - -.PHONY: all_ef all_ef_clean -all_ef: $(EF_TARGETS) -all_ef_clean: $(addsuffix _clean, $(EF_TARGETS)) - -.PHONY: all_flight all_flight_clean -all_flight: all_fw all_bl all_bu all_ef -all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean - -# Expand the groups of targets for each board -$(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board)))) - -# Expand the bootloader updater rules -$(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short)))) - -# Expand the firmware rules -$(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short)))) - -# Expand the bootloader rules -$(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short)))) - -# Expand the entire-flash rules -$(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short)))) - -.PHONY: sim_win32 -sim_win32: sim_win32_exe - -sim_win32_%: uavobjects_flight - $(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32 - $(V1) $(MAKE) --no-print-directory \ - -C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $* - -.PHONY: sim_osx -sim_osx: sim_osx_elf - -sim_osx_%: uavobjects_flight - $(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx - $(V1) $(MAKE) --no-print-directory \ - -C $(ROOT_DIR)/flight/targets/Revolution --file=$(ROOT_DIR)/flight/targets/Revolution/Makefile.osx $* - ############################## # # Unit Tests From 4082b1498a631c7c80fb48ef126fcf9ddde4fa15 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Tue, 19 Mar 2013 17:52:24 +0200 Subject: [PATCH 47/68] Makefile: move opfw_resource rules from packaging to top Makefile opfw_resource make target now depends on built firmware images. They are referenced directly from Qt resource file generated. No extra copies are now necessary. --- Makefile | 25 +++++++++++++++++-- .../plugins/uploader/uploadergadgetwidget.cpp | 23 +++++++++++------ package/Makefile | 22 +++------------- 3 files changed, 42 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 9720559f3..417308389 100644 --- a/Makefile +++ b/Makefile @@ -297,8 +297,8 @@ EF_TARGETS := $(addprefix ef_, $(EF_BOARDS)) # When building any of the "all_*" targets, tell all sub makefiles to display # additional details on each line of output to describe which build and target -# that each line applies to. -ifneq ($(strip $(filter all_%,$(MAKECMDGOALS))),) +# that each line applies to. The same applies also to opfw_resource target. +ifneq ($(strip $(filter all_% opfw_resource,$(MAKECMDGOALS))),) export ENABLE_MSG_EXTRA := yes endif @@ -756,6 +756,27 @@ endif # ############################## +# Rules to generate GCS resources used to embed firmware binaries into the GCS. +# They are used later by the vehicle setup wizard to update board firmware. +# To open a firmware image use ":/firmware/fw_coptercontrol.opfw" +OPFW_RESOURCE := $(BUILD_DIR)/ground/opfw_resource/opfw_resource.qrc +OPFW_RESOURCE_PREFIX := ../../../ +OPFW_FILES := $(foreach fw_targ, $(FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw)) +OPFW_CONTENTS := \ + \ + \ + $(foreach fw_file, $(OPFW_FILES), $(OPFW_RESOURCE_PREFIX)$(fw_file)) \ + \ + + +.PHONY: opfw_resource +opfw_resource: $(OPFW_RESOURCE) + +$(OPFW_RESOURCE): $(FW_TARGETS) + @$(ECHO) Generating OPFW resource file $(call toprel, $@) + $(V1) $(MKDIR) -p $(dir $@) + $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@ + .PHONY: package package: $(V1) cd $@ && $(MAKE) --no-print-directory $@ diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp index 1b6ae9f6b..2dd5ce8ea 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp @@ -491,7 +491,7 @@ void UploaderGadgetWidget::commonSystemBoot(bool safeboot) bool UploaderGadgetWidget::autoUpdateCapable() { - return QDir(":/build").exists(); + return QDir(":/firmware").exists(); } bool UploaderGadgetWidget::autoUpdate() @@ -560,20 +560,29 @@ bool UploaderGadgetWidget::autoUpdate() } QString filename; emit autoUpdateSignal(LOADING_FW,QVariant()); - switch (dfu->devices[0].ID) - { - case 0x401: - filename="fw_coptercontrol"; + switch (dfu->devices[0].ID) { + case 0x301: + filename = "fw_pipxtreme"; break; + case 0x401: case 0x402: - filename="fw_coptercontrol"; + filename = "fw_coptercontrol"; + break; + case 0x501: + filename = "fw_osd"; + break; + case 0x902: + filename = "fw_revolution"; + break; + case 0x903: + filename = "fw_revomini"; break; default: emit autoUpdateSignal(FAILURE,QVariant()); return false; break; } - filename=":/build/"+filename+"/"+filename+".opfw"; + filename = ":/firmware/" + filename + ".opfw"; QByteArray firmware; if(!QFile::exists(filename)) { diff --git a/package/Makefile b/package/Makefile index 2a661d5b6..efa451680 100644 --- a/package/Makefile +++ b/package/Makefile @@ -110,7 +110,9 @@ package: | package_flight package_ground # and it depends on flight firmware images ground_package: | opfw_resource -opfw_resource: | all_fw +.PHONY: opfw_resource +opfw_resource: all_fw + $(V1) $(MAKE) -C $(ROOT_DIR) $@ # Decide on a verbosity level based on the V= parameter export AT := @ @@ -138,22 +140,4 @@ ifeq ($(UNAME), Darwin) PLATFORM := osx endif -toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1))) -OPFW_FILES := $(foreach fw_targ, $(FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw)) -OPFW_CONTENTS := \ - \ - \ - $(foreach fw_file, $(OPFW_FILES), $(fw_file)) \ - \ - - -.PHONY: opfw_resource -opfw_resource: - @echo Generating OPFW resource file $(call toprel, $(BUILD_DIR)/ground/$@) - $(V1) mkdir -p $(BUILD_DIR)/ground/$@ - $(V1) mkdir -p $(BUILD_DIR)/ground/$@/build - $(V1) echo '$(OPFW_CONTENTS)' > $(BUILD_DIR)/ground/$@/opfw_resource.qrc - $(V1) $(foreach fw_targ, $(FW_TARGETS), mkdir -p $(BUILD_DIR)/ground/$@/build/$(fw_targ);) - $(V1)$(foreach fw_targ, $(FW_TARGETS), cp $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw $(BUILD_DIR)/ground/$@/build/$(fw_targ)/;) - include $(WHEREAMI)/Makefile.$(PLATFORM) From 1407d4ce61d53abec654868069214390e198f627 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Tue, 19 Mar 2013 18:20:09 +0200 Subject: [PATCH 48/68] Makefile: update help output --- Makefile | 26 ++++++++++++++++++++++---- package/Makefile | 18 +----------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 417308389..f564698dc 100644 --- a/Makefile +++ b/Makefile @@ -814,10 +814,10 @@ help: @$(ECHO) " Here is a summary of the available targets:" @$(ECHO) @$(ECHO) " [Tool Installers]" - @$(ECHO) " qt_sdk_install - Install the QT v4.7.3 tools" + @$(ECHO) " qt_sdk_install - Install the QT development tools" @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain" @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon" - @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking boards" + @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards" @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards" @$(ECHO) " android_sdk_install - Install the Android SDK tools" @$(ECHO) @@ -855,6 +855,12 @@ help: @$(ECHO) " bl__clean - Remove bootloader for " @$(ECHO) " bl__program - Use OpenOCD + JTAG to write bootloader to " @$(ECHO) + @$(ECHO) " [Entire Flash]" + @$(ECHO) " ef_ - Build entire flash image for " + @$(ECHO) " supported boards are ($(EF_BOARDS))" + @$(ECHO) " ef__clean - Remove entire flash image for " + @$(ECHO) " ef__program - Use OpenOCD + JTAG to write entire flash image to " + @$(ECHO) @$(ECHO) " [Bootloader Updater]" @$(ECHO) " bu_ - Build bootloader updater for " @$(ECHO) " supported boards are ($(BU_BOARDS))" @@ -865,8 +871,8 @@ help: @$(ECHO) " supported boards are ($(BL_BOARDS))" @$(ECHO) " [Unittests]" @$(ECHO) " ut_ - Build unit test " - @$(ECHO) " ut__tap - Run test and capture TAP output into a file" - @$(ECHO) " ut__run - Run test and dump TAP output to console" + @$(ECHO) " ut__xml - Run test and capture XML output into a file" + @$(ECHO) " ut__run - Run test and dump output to console" @$(ECHO) @$(ECHO) " [Simulation]" @$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX" @@ -877,16 +883,28 @@ help: @$(ECHO) @$(ECHO) " [GCS]" @$(ECHO) " gcs - Build the Ground Control System (GCS) application" + @$(ECHO) " with optional GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))" @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application" @$(ECHO) + @$(ECHO) " [AndroidGCS]" + @$(ECHO) " androidgcs - Build the Android Ground Control System (GCS) application" + @$(ECHO) " androidgcs_install - Use ADB to install the Android GCS application" + @$(ECHO) " androidgcs_run - Run the Android GCS application" + @$(ECHO) " androidgcs_clean - Remove the Android GCS application" + @$(ECHO) @$(ECHO) " [UAVObjects]" @$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files" @$(ECHO) " uavobjects_test - parse xml-files - check for valid, duplicate ObjId's, ... " @$(ECHO) " uavobjects_ - Generate source files from a subset of the UAVObject definition XML files" @$(ECHO) " supported groups are ($(UAVOBJ_TARGETS))" @$(ECHO) + @$(ECHO) " [Packaging]" + @$(ECHO) " package - Build and package the OpenPilot platform-dependent package" + @$(ECHO) " with optional CLEAN_BUILD=YES|NO (default is YES)" + @$(ECHO) @$(ECHO) " Hint: Add V=1 to your command line to see verbose build output." @$(ECHO) @$(ECHO) " Note: All tools will be installed into $(TOOLS_DIR)" @$(ECHO) " All build output will be placed in $(BUILD_DIR)" + @$(ECHO) " Package will be placed into $(BUILD_DIR)" @$(ECHO) diff --git a/package/Makefile b/package/Makefile index efa451680..87aa5b203 100644 --- a/package/Makefile +++ b/package/Makefile @@ -40,23 +40,7 @@ BL_TARGETS := $(addprefix bl_, $(ALL_BOARDS)) BU_TARGETS := $(addprefix bu_, $(ALL_BOARDS_BU)) help: - @echo - @echo " This Makefile is known to work on Linux and Mac in a standard shell environment." - @echo " It also works on Windows by following the instructions in ../make/winx86/README.txt." - @echo - @echo " Here is a summary of the available targets:" - @echo - @echo " [Packaging]" - @echo " package - Build and package the OpenPilot distributable" - @echo " package_flight - Build and package the OpenPilot flight firmware only" - @echo - @echo " Notes:" - @echo " - package will be placed in $(PACKAGE_DIR)" - @echo - @echo " - the build directory will be removed first on every run unless" - @echo " CLEAN_BUILD=NO is defined. It means no clean before build." - @echo " This usually is safe." - @echo + $(V1) $(MAKE) -C $(ROOT_DIR) $@ # Clean and build uavobjects since all parts depend on them uavobjects: all_clean From 0957bbb498d27c89d395a21d6410a345cfcb99a1 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Wed, 20 Mar 2013 00:48:02 +0200 Subject: [PATCH 49/68] Makefile: split GCS build directory into debug and release Now by default GCS is built for release. AeroSimRC also is placed under misc (as it is installed on Windows). --- Makefile | 27 ++++++++++++------- .../openpilotgcs/src/app/gcsversioninfo.pri | 2 +- .../src/plugins/hitl/aerosimrc/src/plugin.pro | 2 +- .../uavobjects/uavobjects_dependencies.pri | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index f564698dc..6df94b8f6 100644 --- a/Makefile +++ b/Makefile @@ -34,10 +34,10 @@ export BUILD_DIR := $(ROOT_DIR)/build export DL_DIR := $(ROOT_DIR)/downloads # Set up default build configurations (debug | release) -UAVOGEN_BUILD_CONF ?= debug -GCS_BUILD_CONF ?= debug -ANDROIDGCS_BUILD_CONF ?= debug -GOOGLE_API_VERSION ?= 14 +GCS_BUILD_CONF := release +UAVOGEN_BUILD_CONF := debug +ANDROIDGCS_BUILD_CONF := debug +GOOGLE_API_VERSION := 14 # Function for converting an absolute path to one relative # to the top of the source tree. @@ -505,9 +505,10 @@ sim_osx_%: uavobjects_flight all_ground: openpilotgcs # Convenience target for the GCS -.PHONY: gcs gcs_clean +.PHONY: gcs gcs_clean gcs_all_clean gcs: openpilotgcs gcs_clean: openpilotgcs_clean +gcs_all_clean: openpilotgcs_all_clean ifeq ($(V), 1) GCS_SILENT := @@ -517,14 +518,19 @@ endif .PHONY: openpilotgcs openpilotgcs: uavobjects_gcs - $(V1) $(MKDIR) -p $(BUILD_DIR)/ground/$@ - $(V1) ( cd $(BUILD_DIR)/ground/$@ && \ + $(V1) $(MKDIR) -p $(BUILD_DIR)/ground/$@/$(GCS_BUILD_CONF) + $(V1) ( cd $(BUILD_DIR)/ground/$@/$(GCS_BUILD_CONF) && \ $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) && \ $(MAKE) -w ; \ ) .PHONY: openpilotgcs_clean openpilotgcs_clean: + $(V0) @$(ECHO) " CLEAN $@" + $(V1) [ ! -d "$(BUILD_DIR)/ground/openpilotgcs/$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/ground/openpilotgcs/$(GCS_BUILD_CONF)" + +.PHONY: openpilotgcs_all_clean +openpilotgcs_all_clean: $(V0) @$(ECHO) " CLEAN $@" $(V1) [ ! -d "$(BUILD_DIR)/ground/openpilotgcs" ] || $(RM) -r "$(BUILD_DIR)/ground/openpilotgcs" @@ -882,9 +888,10 @@ help: @$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation" @$(ECHO) @$(ECHO) " [GCS]" - @$(ECHO) " gcs - Build the Ground Control System (GCS) application" - @$(ECHO) " with optional GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))" - @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application" + @$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)" + @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)" + @$(ECHO) " supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))" + @$(ECHO) " gcs_all_clean - Remove the Ground Control System (GCS) application (all build confgurations)" @$(ECHO) @$(ECHO) " [AndroidGCS]" @$(ECHO) " androidgcs - Build the Android Ground Control System (GCS) application" diff --git a/ground/openpilotgcs/src/app/gcsversioninfo.pri b/ground/openpilotgcs/src/app/gcsversioninfo.pri index 70bb8e475..c052a0d31 100644 --- a/ground/openpilotgcs/src/app/gcsversioninfo.pri +++ b/ground/openpilotgcs/src/app/gcsversioninfo.pri @@ -8,7 +8,7 @@ # Since debug_and_release option is set, we need this !debug_and_release|build_pass { ROOT_DIR = $$GCS_SOURCE_TREE/../.. - VERSION_INFO_HEADER = $$GCS_BUILD_TREE/gcsversioninfo.h + VERSION_INFO_HEADER = $$GCS_BUILD_TREE/../gcsversioninfo.h VERSION_INFO_SCRIPT = $$ROOT_DIR/make/scripts/version-info.py VERSION_INFO_TEMPLATE = $$ROOT_DIR/make/templates/gcsversioninfotemplate.h VERSION_INFO_COMMAND = python \"$$VERSION_INFO_SCRIPT\" diff --git a/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.pro b/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.pro index 2037bf0d5..27684421b 100644 --- a/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.pro +++ b/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.pro @@ -11,7 +11,7 @@ TEMPLATE = lib TARGET = plugin_AeroSIMRC RES_DIR = $${PWD}/resources -SIM_DIR = $$GCS_BUILD_TREE/../AeroSIM-RC +SIM_DIR = $$GCS_BUILD_TREE/misc/AeroSIM-RC PLUGIN_DIR = $$SIM_DIR/Plugin/CopterControl DLLDESTDIR = $$PLUGIN_DIR diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects_dependencies.pri b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects_dependencies.pri index 6dc1ed1a8..c6a079a29 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects_dependencies.pri +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects_dependencies.pri @@ -2,7 +2,7 @@ include(../../plugins/coreplugin/coreplugin.pri) include(../../libs/utils/utils.pri) # Provide the path to the auto-generated uavobject source files for the GCS. -UAVOBJECT_SYNTHETICS=$${GCS_BUILD_TREE}/../../uavobject-synthetics/gcs +UAVOBJECT_SYNTHETICS=$${GCS_BUILD_TREE}/../../../uavobject-synthetics/gcs #message(UAVOBJECT_SYNTHETICS is $$UAVOBJECT_SYNTHETICS) # Add the include path to the auto-generated uavobject include files. From 8ea19c396c2c30805f54fde05574914be9525dbe Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Wed, 20 Mar 2013 00:52:29 +0200 Subject: [PATCH 50/68] Makefile: now 'make all' also shows extra context --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6df94b8f6..d5f90b08e 100644 --- a/Makefile +++ b/Makefile @@ -297,8 +297,9 @@ EF_TARGETS := $(addprefix ef_, $(EF_BOARDS)) # When building any of the "all_*" targets, tell all sub makefiles to display # additional details on each line of output to describe which build and target -# that each line applies to. The same applies also to opfw_resource target. -ifneq ($(strip $(filter all_% opfw_resource,$(MAKECMDGOALS))),) +# that each line applies to. The same applies also to opfw_resource and all +# targets +ifneq ($(strip $(filter all_% all opfw_resource,$(MAKECMDGOALS))),) export ENABLE_MSG_EXTRA := yes endif From 8dae0ef65a76cd18ca3c9aadd7203a168b0d9282 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Tue, 19 Mar 2013 18:02:06 +0200 Subject: [PATCH 51/68] Minor cleanup of .gitignore file --- .gitignore | 104 ++++++++++++++++++----------------------------------- 1 file changed, 35 insertions(+), 69 deletions(-) diff --git a/.gitignore b/.gitignore index 5f12c3dfd..06eca8f32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,88 +1,54 @@ -# Exclude temporary and system files -.DS_Store +# Ignore artifacts of top-level Makefile +/downloads +/tools +/build -# /flight/ +# Exclude temporary and system files +Thumbs.db +.DS_Store +GPATH +GRTAGS +GSYMS +GTAGS + +# flight /flight/*.pnproj /flight/*.pnps /flight/.cproject /flight/.metadata /flight/.project /flight/.settings -/flight/Build - -# /flight/AHRS/ -/flight/AHRS/Build - -# /flight/Bootloaders/OpenPilot.old/ -/flight/Bootloaders/OpenPilot.old/Build - -# /flight/OpenPilot/ -/flight/OpenPilot/Build -/flight/OpenPilot/Build.win32 - -#flight/Project/OpenPilotOSX -flight/Project/OpenPilotOSX/build - -# /flight/PipBee/ -/flight/PipBee/Build - -# /flight/Project/OpenPilotOSX/ -/flight/Project/OpenPilotOSX/build/ - -# /ground/ -/ground/Build - -/ground/openpilotgcs/share/openpilotgcs/models/Easystar/Thumbs.db - -/ground/openpilotgcs/share/openpilotgcs/sounds/normalize.exe - -/ground/openpilotgcs/share/openpilotgcs/sounds/default/normalize.exe - -/ground/openpilotgcs/share/openpilotgcs/translations/extract-mimetypes.xq - -/ground/openpilotgcs/src/experimental/OPMapWidget/core/header.h - -/ground/openpilotgcs/src/experimental/tools/DocumentationHelper/ui_mainwindow.h - -/ground/openpilotgcs/src/libs/qextserialport/.hg -/ground/openpilotgcs/src/libs/qextserialport/.hgtags - -/ground/openpilotgcs/src/libs/qwt/qwt.prf -/ground/openpilotgcs/src/libs/qwt/designer - -/ground/openpilotgcs/src/plugins/ipconnection/ui_ipconnectionoptionspage.h - -# Ignore artifacts of top-level Makefile -/downloads -/tools -/build +/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.mode1v3 +/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.pbxuser +# ground openpilotgcs-build-desktop -flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.mode1v3 -flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.pbxuser # Ignore some of the .pro.user files -ground/openpilotgcs/openpilotgcs.pro.user -ground/uavobjgenerator/uavobjgenerator.pro.user -ground/uavobjects/uavobjects.pro.user -ground/ground.pro.user +/ground/openpilotgcs/openpilotgcs.pro.user +/ground/uavobjgenerator/uavobjgenerator.pro.user +/ground/uavobjects/uavobjects.pro.user +/ground/ground.pro.user -GPATH -GRTAGS -GSYMS -GTAGS - -plane -quad +# Misc artifacts +/ground/openpilotgcs/share/openpilotgcs/sounds/normalize.exe +/ground/openpilotgcs/share/openpilotgcs/sounds/default/normalize.exe +/ground/openpilotgcs/share/openpilotgcs/translations/extract-mimetypes.xq +/ground/openpilotgcs/src/experimental/tools/DocumentationHelper/ui_mainwindow.h +/ground/openpilotgcs/src/libs/qextserialport/.hg +/ground/openpilotgcs/src/libs/qextserialport/.hgtags +/ground/openpilotgcs/src/libs/qwt/qwt.prf +/ground/openpilotgcs/src/libs/qwt/designer +/ground/openpilotgcs/src/plugins/ipconnection/ui_ipconnectionoptionspage.h # Ignore intermediate files generated by command-line android builds # Couldn't figure out how to force these files into the ./build directory -androidgcs/build.xml -androidgcs/local.properties -androidgcs/proguard-project.txt +/androidgcs/build.xml +/androidgcs/local.properties +/androidgcs/proguard-project.txt # Ignore build output from Eclipse android builds -androidgcs/bin/ -androidgcs/gen/ +/androidgcs/bin/ +/androidgcs/gen/ /.cproject /.project From 80db2ff79c9860eba54fbfb71d92ce95a45b6a8c Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Wed, 20 Mar 2013 00:48:51 +0200 Subject: [PATCH 52/68] Packaging: define package directory --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d5f90b08e..e6dc075fe 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ export OPENPILOT_IS_COOL := Fuck Yeah! export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) export TOOLS_DIR := $(ROOT_DIR)/tools export BUILD_DIR := $(ROOT_DIR)/build +export PKG_DIR := $(ROOT_DIR)/build/package export DL_DIR := $(ROOT_DIR)/downloads # Set up default build configurations (debug | release) @@ -914,5 +915,5 @@ help: @$(ECHO) @$(ECHO) " Note: All tools will be installed into $(TOOLS_DIR)" @$(ECHO) " All build output will be placed in $(BUILD_DIR)" - @$(ECHO) " Package will be placed into $(BUILD_DIR)" + @$(ECHO) " Package will be placed into $(PKG_DIR)" @$(ECHO) From 5f24378a4fc827721c2318bdc0d643111553244c Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Thu, 21 Mar 2013 16:21:45 +0200 Subject: [PATCH 53/68] EntireFlash: now works on all supported platforms --- Makefile | 8 +- flight/targets/EntireFlash/Makefile | 58 +++++----- flight/targets/EntireFlash/entire-flash.py | 121 +++++++++++++++++++++ 3 files changed, 156 insertions(+), 31 deletions(-) create mode 100644 flight/targets/EntireFlash/entire-flash.py diff --git a/Makefile b/Makefile index e6dc075fe..3031a35e9 100644 --- a/Makefile +++ b/Makefile @@ -410,18 +410,16 @@ define EF_TEMPLATE ef_$(1): ef_$(1)_bin ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw - $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)/dep + $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1) $(V1) cd $(ROOT_DIR)/flight/targets/EntireFlash && \ $$(MAKE) -r --no-print-directory \ BOARD_NAME=$(1) \ BOARD_SHORT_NAME=$(3) \ BUILD_TYPE=ef \ - TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \ DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \ - \ - TARGET=ef_$(1) \ + TOPDIR=$(ROOT_DIR)/flight/targets/EntireFlash \ OUTDIR=$(BUILD_DIR)/ef_$(1) \ - \ + TARGET=ef_$(1) \ $$* .PHONY: ef_$(1)_clean diff --git a/flight/targets/EntireFlash/Makefile b/flight/targets/EntireFlash/Makefile index 24d86a92d..6b2910f94 100644 --- a/flight/targets/EntireFlash/Makefile +++ b/flight/targets/EntireFlash/Makefile @@ -1,8 +1,5 @@ -##### -# Makefile for Entire Flash (EF) images -# -# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2012. # +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org # # 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 @@ -17,33 +14,43 @@ # 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., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -##### +# -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../) -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) +endif + +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk + +# Paths +TOPDIR = . +ENTIRE_FLASH = $(PYTHON) "$(TOPDIR)/entire-flash.py" + +ifeq ($(V), 1) + EF_VERBOSE := --verbose +else + EF_VERBOSE := +endif .PHONY: bin bin: $(OUTDIR)/$(TARGET).bin -FW_PRE_PAD = $(shell echo $$[$(FW_BANK_BASE)-$(BL_BANK_BASE)-$(BL_BANK_SIZE)]) -$(OUTDIR)/$(TARGET).fw_pre.pad: - $(V0) @echo $(MSG_PADDING) $@ - $(V1) dd status=noxfer if=/dev/zero count=$(FW_PRE_PAD) bs=1 2>/dev/null | tr '\000' '\377' > $@ - -FW_POST_PAD = $(shell echo $$[$(FW_BANK_SIZE)-$(FW_DESC_SIZE)-$$(stat -c%s $(FW_BIN))]) -$(OUTDIR)/$(TARGET).fw_post.pad: - $(V0) @echo $(MSG_PADDING) $@ - $(V1) dd status=noxfer if=/dev/zero count=$(FW_POST_PAD) bs=1 2>/dev/null | tr '\000' '\377' > $@ - - -BL_BIN = $(TOP)/build/bl_$(BOARD_NAME)/bl_$(BOARD_NAME).bin -FW_BIN = $(TOP)/build/fw_$(BOARD_NAME)/fw_$(BOARD_NAME).bin +BL_BIN = $(BUILD_DIR)/bl_$(BOARD_NAME)/bl_$(BOARD_NAME).bin +FW_BIN = $(BUILD_DIR)/fw_$(BOARD_NAME)/fw_$(BOARD_NAME).bin FWINFO_BIN = $(FW_BIN).firmwareinfo.bin -$(OUTDIR)/$(TARGET).bin: $(BL_BIN) $(FW_BIN) $(OUTDIR)/$(TARGET).fw_pre.pad $(OUTDIR)/$(TARGET).fw_post.pad - $(V0) @echo $(MSG_FLASH_IMG) $@ - $(V1) cat $(BL_BIN) $(OUTDIR)/$(TARGET).fw_pre.pad $(FW_BIN) $(OUTDIR)/$(TARGET).fw_post.pad $(FWINFO_BIN) > $@ + +$(OUTDIR)/$(TARGET).bin: $(BL_BIN) $(FW_BIN) + $(V0) @$(ECHO) $(MSG_FLASH_IMG) $@ + $(V1) $(ENTIRE_FLASH) $(EF_VERBOSE) \ + --bl-bank-base=$(BL_BANK_BASE) \ + --bl-bank-size=$(BL_BANK_SIZE) \ + --fw-bank-base=$(FW_BANK_BASE) \ + --fw-bank-size=$(FW_BANK_SIZE) \ + --fw-desc-size=$(FW_DESC_SIZE) \ + --bl-bin-path="$(BL_BIN)" \ + --fw-bin-path="$(FW_BIN)" \ + --fwinfo-bin-path="$(FWINFO_BIN)" \ + --outfile="$@" .PHONY: dfu dfu: $(OUTDIR)/$(TARGET).bin @@ -52,4 +59,3 @@ dfu: $(OUTDIR)/$(TARGET).bin sudo $(DFU_CMD) -l && \ sudo $(DFU_CMD) -d 0483:df11 -c 1 -i 0 -a 0 -D $< -s $(BL_BANK_BASE) ; \ ) - diff --git a/flight/targets/EntireFlash/entire-flash.py b/flight/targets/EntireFlash/entire-flash.py new file mode 100644 index 000000000..b60f38005 --- /dev/null +++ b/flight/targets/EntireFlash/entire-flash.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# +# Helper function to generate an entire flash image. +# +# (c) 2013, The OpenPilot Team, http://www.openpilot.org +# See also: The GNU Public License (GPL) Version 3 +# + +import optparse +import sys + +def append(verbose, text, data): + """Appends data to global image, updates global offset, prints details if verbose is set""" + global image, offset + if verbose: + print text, "0x%08x" % len(data), "@ 0x%08x" % offset, "%8d bytes" % len(data) + image += data + offset += len(data) + +def create_entire_flash(args): + """Generates entire flash image and prints it to stdout""" + global image, offset + + assert args.bl_bank_base is not None + assert args.bl_bank_size is not None + assert args.fw_bank_base is not None + assert args.fw_bank_size is not None + assert args.fw_desc_size is not None + assert args.bl_bin_path is not None + assert args.fw_bin_path is not None + assert args.fwinfo_bin_path is not None + + image = "" + offset = 0 + pad = chr(0xff) + + try: + bl_bin_file = open(args.bl_bin_path, "rb") + bl_bin = bl_bin_file.read() + bl_bin_file.close() + + fw_bin_file = open(args.fw_bin_path, "rb") + fw_bin = fw_bin_file.read() + fw_bin_file.close() + + fwinfo_bin_file = open(args.fwinfo_bin_path, "rb") + fwinfo_bin = fwinfo_bin_file.read() + fwinfo_bin_file.close() + + pre_pad_size = args.fw_bank_base - args.bl_bank_base - args.bl_bank_size + post_pad_size = args.fw_bank_size - args.fw_desc_size - len(fw_bin) + + append(args.verbose, "Bootloader image: ", bl_bin) + append(args.verbose, "Padding: ", pad * pre_pad_size) + append(args.verbose, "Firmware image: ", fw_bin) + append(args.verbose, "Padding: ", pad * post_pad_size) + append(args.verbose, "Firmware info blob: ", fwinfo_bin) + + if args.verbose: + print "Entire flash image size:", offset, "bytes" + + if args.outfile: + of = open(args.outfile, "wb") + of.write(image) + of.close() + + except: + import traceback + traceback.print_exc() + return -2 + + return 0 + +def main(): + """Entire image data will be written to OUTFILE (if given) as concatenation of: + - bootloader + padding + firmware + padding + firmware info + """ + + # Parse command line. + class RawDescriptionHelpFormatter(optparse.IndentedHelpFormatter): + """optparse formatter function to pretty print raw epilog""" + def format_epilog(self, epilog): + if epilog: + return "\n" + epilog + "\n" + else: + return "" + + parser = optparse.OptionParser( + formatter=RawDescriptionHelpFormatter(), + description = "Helper function to generate an entire flash image.", + epilog = main.__doc__); + + parser.add_option('--bl-bank-base', type='long', action='store', + help='start of bootloader flash'); + parser.add_option('--bl-bank-size', type='long', action='store', + help='should include BD_INFO region'); + parser.add_option('--fw-bank-base', type='long', action='store', + help='start of firmware flash'); + parser.add_option('--fw-bank-size', type='long', action='store', + help='should include FW_DESC_SIZE'); + parser.add_option('--fw-desc-size', type='long', action='store', + help='firmware description area size'); + parser.add_option('--bl-bin-path', action='store', + help='path to bootloader image'); + parser.add_option('--fw-bin-path', action='store', + help='path to firmware image'); + parser.add_option('--fwinfo-bin-path', action='store', + help='path to firmware info blob'); + parser.add_option('--outfile', action='store', + help='name of entire flash output file'); + parser.add_option('--verbose', action='store_true', + help='print addresses and sizes'); + (args, positional_args) = parser.parse_args() + + if (len(positional_args) != 0) or (len(sys.argv) == 1): + parser.error("incorrect number of arguments, try --help for help") + + return create_entire_flash(args) + +if __name__ == "__main__": + sys.exit(main()) From bd033badb9493c80262df894fa1a0733de3fdcc8 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Thu, 21 Mar 2013 16:24:08 +0200 Subject: [PATCH 54/68] BootloaderUpdater: move one level up, now next to EntireFlash and Bootloaders --- Makefile | 4 ++-- flight/targets/{Bootloaders => }/BootloaderUpdater/Makefile | 0 .../{Bootloaders => }/BootloaderUpdater/inc/pios_config.h | 0 flight/targets/{Bootloaders => }/BootloaderUpdater/main.c | 0 .../targets/{Bootloaders => }/BootloaderUpdater/pios_board.c | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename flight/targets/{Bootloaders => }/BootloaderUpdater/Makefile (100%) rename flight/targets/{Bootloaders => }/BootloaderUpdater/inc/pios_config.h (100%) rename flight/targets/{Bootloaders => }/BootloaderUpdater/main.c (100%) rename flight/targets/{Bootloaders => }/BootloaderUpdater/pios_board.c (100%) diff --git a/Makefile b/Makefile index 3031a35e9..c590823ae 100644 --- a/Makefile +++ b/Makefile @@ -387,13 +387,13 @@ bu_$(1): bu_$(1)_opfw bu_$(1)_%: bl_$(1)_bino $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep - $(V1) cd $(ROOT_DIR)/flight/targets/Bootloaders/BootloaderUpdater && \ + $(V1) cd $(ROOT_DIR)/flight/targets/BootloaderUpdater && \ $$(MAKE) -r --no-print-directory \ BOARD_NAME=$(1) \ BOARD_SHORT_NAME=$(3) \ BUILD_TYPE=bu \ HWDEFSINC=$(HWDEFS)/$(1) \ - TOPDIR=$(ROOT_DIR)/flight/targets/Bootloaders/BootloaderUpdater \ + TOPDIR=$(ROOT_DIR)/flight/targets/BootloaderUpdater \ OUTDIR=$(BUILD_DIR)/bu_$(1) \ TARGET=bu_$(1) \ $$* diff --git a/flight/targets/Bootloaders/BootloaderUpdater/Makefile b/flight/targets/BootloaderUpdater/Makefile similarity index 100% rename from flight/targets/Bootloaders/BootloaderUpdater/Makefile rename to flight/targets/BootloaderUpdater/Makefile diff --git a/flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h b/flight/targets/BootloaderUpdater/inc/pios_config.h similarity index 100% rename from flight/targets/Bootloaders/BootloaderUpdater/inc/pios_config.h rename to flight/targets/BootloaderUpdater/inc/pios_config.h diff --git a/flight/targets/Bootloaders/BootloaderUpdater/main.c b/flight/targets/BootloaderUpdater/main.c similarity index 100% rename from flight/targets/Bootloaders/BootloaderUpdater/main.c rename to flight/targets/BootloaderUpdater/main.c diff --git a/flight/targets/Bootloaders/BootloaderUpdater/pios_board.c b/flight/targets/BootloaderUpdater/pios_board.c similarity index 100% rename from flight/targets/Bootloaders/BootloaderUpdater/pios_board.c rename to flight/targets/BootloaderUpdater/pios_board.c From 096d0d744280d61771f0736bfc9b2bb07daa5120 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Thu, 21 Mar 2013 21:28:44 +0200 Subject: [PATCH 55/68] Packaging: move common part into the top Makefile This includes all dependencies and generates package directory with renamed firmware files. --- Makefile | 72 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index c590823ae..e049d7688 100644 --- a/Makefile +++ b/Makefile @@ -31,8 +31,8 @@ export OPENPILOT_IS_COOL := Fuck Yeah! export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) export TOOLS_DIR := $(ROOT_DIR)/tools export BUILD_DIR := $(ROOT_DIR)/build -export PKG_DIR := $(ROOT_DIR)/build/package export DL_DIR := $(ROOT_DIR)/downloads +export PKG_DIR := $(ROOT_DIR)/build/package # Set up default build configurations (debug | release) GCS_BUILD_CONF := release @@ -92,6 +92,7 @@ endif # Set up misc host tools export ECHO := echo export MKDIR := mkdir +export CP := cp export RM := rm export LN := ln export CAT := cat @@ -298,9 +299,9 @@ EF_TARGETS := $(addprefix ef_, $(EF_BOARDS)) # When building any of the "all_*" targets, tell all sub makefiles to display # additional details on each line of output to describe which build and target -# that each line applies to. The same applies also to opfw_resource and all -# targets -ifneq ($(strip $(filter all_% all opfw_resource,$(MAKECMDGOALS))),) +# that each line applies to. The same applies also to all, opfw_resource, +# package and clean_package targets +ifneq ($(strip $(filter all_% all opfw_resource package clean_package,$(MAKECMDGOALS))),) export ENABLE_MSG_EXTRA := yes endif @@ -783,13 +784,61 @@ $(OPFW_RESOURCE): $(FW_TARGETS) $(V1) $(MKDIR) -p $(dir $@) $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@ -.PHONY: package -package: - $(V1) cd $@ && $(MAKE) --no-print-directory $@ +# Packaging targets: package, clean_package +# - removes build directory (clean_package only) +# - builds all firmware, opfw_resource, gcs +# - copies firmware into a package directory +# - calls paltform-specific packaging script + +export PKG_LABEL := $(shell $(VERSION_INFO) --format=\$${LABEL}) +export PKG_NAME := OpenPilot +export PKG_SEP := - + +# Clean the build directory if clean_package is requested +ifneq ($(strip $(filter clean_package,$(MAKECMDGOALS))),) + $(info Cleaning build directory before packaging...) + ifneq ($(shell $(MAKE) all_clean >/dev/null 2>&1 && $(ECHO) "clean"), clean) + $(error Cannot clean build directory) + endif + +.PHONY: clean_package +clean_package: package +endif + +# Make sure we package release build of GCS +ifneq ($(GCS_BUILD_CONF),release) + $(error Packaging is currently supported for release builds only) +endif + +# Build GCS with embedded firmware if package or opfw_resource is requested +ifneq ($(strip $(filter package clean_package opfw_resource,$(MAKECMDGOALS))),) + $(eval openpilotgcs: | opfw_resource) +endif + +# Copy file template. Empty line before the endef is required, do not remove +define COPY_FW_FILES + $(V1) $(CP) "$(BUILD_DIR)/$(1)/$(1).opfw" "$(PKG_DIR)/firmware/$(1)$(PKG_SEP)$(PKG_LABEL).opfw" + +endef + +# Build and copy package files into the package directory +.PHONY: package +package: all_fw all_ground + $(V1) $(ECHO) "Packaging for $(UNAME) $(ARCH) into $(call toprel, $(PKG_DIR)) directory" + $(V1) [ ! -d "$(PKG_DIR)" ] || $(RM) -rf "$(PKG_DIR)" + $(V1) $(MKDIR) -p "$(PKG_DIR)/firmware" + $(foreach fw_targ, $(FW_TARGETS), $(call COPY_FW_FILES,$(fw_targ))) + +# Call platform-specific packaging script + + + + + + + + -.PHONY: package_resources -package_resources: - $(V1) cd package && $(MAKE) --no-print-directory opfw_resource ############################## # @@ -906,8 +955,9 @@ help: @$(ECHO) " supported groups are ($(UAVOBJ_TARGETS))" @$(ECHO) @$(ECHO) " [Packaging]" + @$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS" + @$(ECHO) " clean_package - Clean, build and package the OpenPilot platform-dependent package" @$(ECHO) " package - Build and package the OpenPilot platform-dependent package" - @$(ECHO) " with optional CLEAN_BUILD=YES|NO (default is YES)" @$(ECHO) @$(ECHO) " Hint: Add V=1 to your command line to see verbose build output." @$(ECHO) From 105e7d95c954c1ff64005dc111652d780182e148 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Thu, 21 Mar 2013 23:11:30 +0200 Subject: [PATCH 56/68] Packaging: now should work for all 3 platforms --- Makefile | 78 +++++++-------- package/{Makefile.osx => Darwin.mk} | 18 ++-- package/{Makefile.linux => Linux.mk} | 24 ++--- package/Makefile | 127 ------------------------ package/{Makefile.winx86 => Windows.mk} | 19 ++-- package/linux/deb_common/rules | 8 +- package/osx/package | 2 +- package/winx86/openpilotgcs.nsi | 12 +-- package/winx86/openpilotgcs.tpl | 4 +- 9 files changed, 80 insertions(+), 212 deletions(-) rename package/{Makefile.osx => Darwin.mk} (57%) rename package/{Makefile.linux => Linux.mk} (86%) delete mode 100644 package/Makefile rename package/{Makefile.winx86 => Windows.mk} (75%) diff --git a/Makefile b/Makefile index e049d7688..ca91dc384 100644 --- a/Makefile +++ b/Makefile @@ -28,11 +28,11 @@ export OPENPILOT_IS_COOL := Fuck Yeah! .DEFAULT_GOAL := help # Set up some macros for common directories within the tree -export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) -export TOOLS_DIR := $(ROOT_DIR)/tools -export BUILD_DIR := $(ROOT_DIR)/build -export DL_DIR := $(ROOT_DIR)/downloads -export PKG_DIR := $(ROOT_DIR)/build/package +export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) +export TOOLS_DIR := $(ROOT_DIR)/tools +export BUILD_DIR := $(ROOT_DIR)/build +export DL_DIR := $(ROOT_DIR)/downloads +export PACKAGE_DIR := $(ROOT_DIR)/build/package # Set up default build configurations (debug | release) GCS_BUILD_CONF := release @@ -784,61 +784,61 @@ $(OPFW_RESOURCE): $(FW_TARGETS) $(V1) $(MKDIR) -p $(dir $@) $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@ +# If opfw_resource is requested, GCS should depend on it +ifneq ($(strip $(filter opfw_resource,$(MAKECMDGOALS))),) + $(eval openpilotgcs: | opfw_resource) +endif + # Packaging targets: package, clean_package # - removes build directory (clean_package only) # - builds all firmware, opfw_resource, gcs # - copies firmware into a package directory # - calls paltform-specific packaging script -export PKG_LABEL := $(shell $(VERSION_INFO) --format=\$${LABEL}) -export PKG_NAME := OpenPilot -export PKG_SEP := - +# Do some checks and define some values if package is requested +ifneq ($(strip $(filter package clean_package,$(MAKECMDGOALS))),) + # Define some variables + export PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL}) + export PACKAGE_NAME := OpenPilot + export PACKAGE_SEP := - -# Clean the build directory if clean_package is requested -ifneq ($(strip $(filter clean_package,$(MAKECMDGOALS))),) - $(info Cleaning build directory before packaging...) - ifneq ($(shell $(MAKE) all_clean >/dev/null 2>&1 && $(ECHO) "clean"), clean) - $(error Cannot clean build directory) + # We can only package release builds + ifneq ($(GCS_BUILD_CONF),release) + $(error Packaging is currently supported for release builds only) endif -.PHONY: clean_package -clean_package: package -endif + # Packaged GCS should depend on opfw_resource + ifneq ($(strip $(filter package clean_package,$(MAKECMDGOALS))),) + $(eval openpilotgcs: | opfw_resource) + endif -# Make sure we package release build of GCS -ifneq ($(GCS_BUILD_CONF),release) - $(error Packaging is currently supported for release builds only) -endif + # Clean the build directory if clean_package is requested + ifneq ($(strip $(filter clean_package,$(MAKECMDGOALS))),) + $(info Cleaning build directory before packaging...) + ifneq ($(shell $(MAKE) all_clean >/dev/null 2>&1 && $(ECHO) "clean"), clean) + $(error Cannot clean build directory) + endif -# Build GCS with embedded firmware if package or opfw_resource is requested -ifneq ($(strip $(filter package clean_package opfw_resource,$(MAKECMDGOALS))),) - $(eval openpilotgcs: | opfw_resource) + .PHONY: clean_package + clean_package: package + endif endif # Copy file template. Empty line before the endef is required, do not remove define COPY_FW_FILES - $(V1) $(CP) "$(BUILD_DIR)/$(1)/$(1).opfw" "$(PKG_DIR)/firmware/$(1)$(PKG_SEP)$(PKG_LABEL).opfw" + $(V1) $(CP) "$(BUILD_DIR)/$(1)/$(1).opfw" "$(PACKAGE_DIR)/firmware/$(1)$(PACKAGE_SEP)$(PACKAGE_LBL).opfw" endef # Build and copy package files into the package directory +# and call platform-specific packaging script .PHONY: package -package: all_fw all_ground - $(V1) $(ECHO) "Packaging for $(UNAME) $(ARCH) into $(call toprel, $(PKG_DIR)) directory" - $(V1) [ ! -d "$(PKG_DIR)" ] || $(RM) -rf "$(PKG_DIR)" - $(V1) $(MKDIR) -p "$(PKG_DIR)/firmware" +package: all_fw all_ground uavobjects_matlab + $(V1) $(ECHO) "Packaging for $(UNAME) $(ARCH) into $(call toprel, $(PACKAGE_DIR)) directory" + $(V1) [ ! -d "$(PACKAGE_DIR)" ] || $(RM) -rf "$(PACKAGE_DIR)" + $(V1) $(MKDIR) -p "$(PACKAGE_DIR)/firmware" $(foreach fw_targ, $(FW_TARGETS), $(call COPY_FW_FILES,$(fw_targ))) - -# Call platform-specific packaging script - - - - - - - - - + $(MAKE) --no-print-directory -C $(ROOT_DIR)/package --file=$(UNAME).mk $@ ############################## # diff --git a/package/Makefile.osx b/package/Darwin.mk similarity index 57% rename from package/Makefile.osx rename to package/Darwin.mk index 132f9f2c7..1ada9f4c2 100644 --- a/package/Makefile.osx +++ b/package/Darwin.mk @@ -1,8 +1,15 @@ # -# MacOSX-specific packaging +# MacOSX-specific packaging script # -osx_package: gcs package_flight +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) +endif + +FW_DIR := $(PACKAGE_DIR)/firmware + +.PHONY: package +package: ( \ ROOT_DIR="$(ROOT_DIR)" \ BUILD_DIR="$(BUILD_DIR)" \ @@ -13,10 +20,3 @@ osx_package: gcs package_flight FW_DIR="$(FW_DIR)" \ "$(ROOT_DIR)/package/osx/package" \ ) - -gcs: uavobjects - $(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@ - -ground_package: | osx_package - -.PHONY: gcs ground_package osx_package diff --git a/package/Makefile.linux b/package/Linux.mk similarity index 86% rename from package/Makefile.linux rename to package/Linux.mk index 16bcb8817..66d3c284e 100644 --- a/package/Makefile.linux +++ b/package/Linux.mk @@ -1,18 +1,24 @@ # -# Linux-specific packaging +# Linux-specific packaging script # +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) +endif + +FW_DIR := $(PACKAGE_DIR)/firmware + # Update this number for every formal release. The Deb packaging system relies on this to know to update a # package or not. Otherwise, the user has to uninstall first. # Until we do that, package name does NOT include $(VERNUM) and uses $(PACKAGE_LBL) only -VERNUM := 0.1.0 +VERNUM := 0.1.0 VERSION_FULL := $(VERNUM)-$(PACKAGE_LBL) DEB_BUILD_DIR := $(ROOT_DIR)/debian SED_DATE_STRG = $(shell date -R) SED_SCRIPT = s//$(VERNUM)/;s//$(SED_DATE_STRG)/ -DEB_CFG_CMN := $(ROOT_DIR)/package/linux/deb_common +DEB_CFG_CMN := $(ROOT_DIR)/package/linux/deb_common DEB_CFG_I386_DIR := $(ROOT_DIR)/package/linux/deb_i386 DEB_CFG_AMD64_DIR := $(ROOT_DIR)/package/linux/deb_amd64 DEB_CFG_CMN_FILES := $(shell ls $(DEB_CFG_CMN)) @@ -34,7 +40,8 @@ FULL_PACKAGE_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL)$(PACKAGE_SEP)$( ALL_DEB_FILES = $(foreach f, $(DEB_CFG_CMN_FILES), $(DEB_BUILD_DIR)/$(f)) ALL_DEB_FILES += $(foreach f, $(DEB_MACHINE_FILES), $(DEB_BUILD_DIR)/$(f)) -linux_deb_package: $(ALL_DEB_FILES) gcs package_flight +.PHONY: package +package: $(ALL_DEB_FILES) $(V1) echo "Building Linux package, please wait..." $(V1) mkdir -p $(DEB_BUILD_DIR) $(V1)$(shell echo $(FW_DIR) > $(BUILD_DIR)/package_dir) @@ -44,8 +51,6 @@ linux_deb_package: $(ALL_DEB_FILES) gcs package_flight $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(BUILD_DIR)/$(FULL_PACKAGE_NAME).changes $(V1) rm -rf $(DEB_BUILD_DIR) -$(ALL_DEB_FILES): | uavobjects - define CP_DEB_FILES_TEMPLATE .PHONY: $(2)/$(1) $(2)/$(1): $(3)/$(1) @@ -55,10 +60,3 @@ endef $(foreach cpfile, $(DEB_CFG_CMN_FILES), $(eval $(call CP_DEB_FILES_TEMPLATE,$(cpfile),$(DEB_BUILD_DIR),$(DEB_CFG_CMN)))) $(foreach cpfile, $(DEB_MACHINE_FILES), $(eval $(call CP_DEB_FILES_TEMPLATE,$(cpfile),$(DEB_BUILD_DIR),$(DEB_MACHINE_DIR)))) - -gcs: uavobjects - $(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@ - -ground_package: | linux_deb_package - -.PHONY: gcs ground_package linux_deb_package diff --git a/package/Makefile b/package/Makefile deleted file mode 100644 index 87aa5b203..000000000 --- a/package/Makefile +++ /dev/null @@ -1,127 +0,0 @@ -# Set up a default goal -.DEFAULT_GOAL := help - -# Tried the best to support parallel (-j) builds. But since this Makefile -# uses other Makefiles to build few targets which in turn have similar -# dependencies on uavobjects and other generated files, it is difficult -# to support parallel builds perfectly. But at least it was tested with -# -j (unlimited job number) on Windows and Linux. - -# Locate the root of the tree -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -ROOT_DIR := $(realpath $(WHEREAMI)/../) - -# Set up some macros -BUILD_DIR := $(ROOT_DIR)/build -VERSION_CMD := python $(ROOT_DIR)/make/scripts/version-info.py --path="$(ROOT_DIR)" -PACKAGE_LBL := $(shell $(VERSION_CMD) --format=\$${LABEL}) -PACKAGE_DIR := $(BUILD_DIR)/package-$(PACKAGE_LBL) -PACKAGE_NAME := OpenPilot -PACKAGE_SEP := - -FW_DIR := $(PACKAGE_DIR)/firmware-$(PACKAGE_LBL) -BL_DIR := $(FW_DIR)/bootloaders -BU_DIR := $(FW_DIR)/bootloader-updaters - -# Clean build options (recommended for package testing only) -ifeq ($(CLEAN_BUILD), NO) -CLEAN_GROUND := NO -CLEAN_FLIGHT := NO -else -CLEAN_GROUND := YES -CLEAN_FLIGHT := YES -endif - -# Set up targets -ALL_BOARDS := coptercontrol pipxtreme revolution revomini osd -ALL_BOARDS_BU := coptercontrol pipxtreme -FW_TARGETS := $(addprefix fw_, $(ALL_BOARDS)) -FW_TARGETS_TOOLS := $(addprefix fw_, $(ALL_BOARDS)) -BL_TARGETS := $(addprefix bl_, $(ALL_BOARDS)) -BU_TARGETS := $(addprefix bu_, $(ALL_BOARDS_BU)) - -help: - $(V1) $(MAKE) -C $(ROOT_DIR) $@ - -# Clean and build uavobjects since all parts depend on them -uavobjects: all_clean - $(V1) $(MAKE) -C $(ROOT_DIR) $@ - -all_clean: -ifneq ($(CLEAN_GROUND), NO) - $(V1) $(MAKE) -C $(ROOT_DIR) $@ -endif - -# Install template: -# $1 = target -# $2 = dependencies -# $3 = install directory (must be defined) -# $4 = installed file name prefix (optional) -# $5 = installed file name suffix (optional) -# $6 = extra make options (for instance, USE_SPEKTRUM=YES) -# $7 = optional 'clean' string to clean target before rebuild -# $8 = list of targets to install (without _install suffix) -# $9 = inner make target (usually install, but can be other to just build) -define INSTALL_TEMPLATE -$(1): $(2) -ifeq ($(7),clean) -ifneq ($$(CLEAN_FLIGHT), NO) - $$(V1) +$(MAKE) -C $(ROOT_DIR) $(6) $(addsuffix _$(7), $(8)) -endif -endif - $$(V1) +$(MAKE) -C $(ROOT_DIR) INSTALL_DIR=$(3) INSTALL_PFX=$(4) INSTALL_SFX=$(5) $(6) $(addsuffix _$(9), $(8)) -.PHONY: $(1) -endef - -# Firmware -$(eval $(call INSTALL_TEMPLATE,all_fw,uavobjects,$(FW_DIR),,-$(PACKAGE_LBL),,,$(FW_TARGETS),install)) - -# Bootloaders (change 'install' to 'bin' if you don't want to install bootloaders) -$(eval $(call INSTALL_TEMPLATE,all_bl,uavobjects,$(BL_DIR),,-$(PACKAGE_LBL),,,$(BL_TARGETS),install)) - -# Bootloader updaters -$(eval $(call INSTALL_TEMPLATE,all_bu,all_bl,$(BU_DIR),,-$(PACKAGE_LBL),,,$(BU_TARGETS),install)) - -# Order-only dependencies -package_flight: | all_fw all_bu - -package_ground: | ground_package - -package: | package_flight package_ground - -.PHONY: help uavobjects all_clean package_flight package_ground package - -# opfw_resource must be generated before the ground package, -# and it depends on flight firmware images -ground_package: | opfw_resource - -.PHONY: opfw_resource -opfw_resource: all_fw - $(V1) $(MAKE) -C $(ROOT_DIR) $@ - -# Decide on a verbosity level based on the V= parameter -export AT := @ - -ifndef V -export V0 := -export V1 := $(AT) -else ifeq ($(V), 0) -export V0 := $(AT) -export V1 := $(AT) -else ifeq ($(V), 1) -endif - -ifneq ($(V),1) -MAKEFLAGS += --no-print-directory -endif - -# Platform-dependent stuff -PLATFORM := winx86 -UNAME := $(shell uname) -ifeq ($(UNAME), Linux) - PLATFORM := linux -endif -ifeq ($(UNAME), Darwin) - PLATFORM := osx -endif - -include $(WHEREAMI)/Makefile.$(PLATFORM) diff --git a/package/Makefile.winx86 b/package/Windows.mk similarity index 75% rename from package/Makefile.winx86 rename to package/Windows.mk index a2602ec3b..ec2c3c955 100644 --- a/package/Makefile.winx86 +++ b/package/Windows.mk @@ -1,7 +1,14 @@ # -# Windows-specific packaging +# Windows-specific packaging script # +ifndef OPENPILOT_IS_COOL + $(error Top level Makefile must be used to build this target) +endif + +VERSION_CMD := $(VERSION_INFO) +FW_DIR := $(PACKAGE_DIR)/firmware + NSIS_CMD := makensis.exe NSIS_OPTS := /V3 NSIS_DIR := $(ROOT_DIR)/package/winx86 @@ -9,7 +16,8 @@ NSIS_SCRIPT := $(NSIS_DIR)/openpilotgcs.nsi NSIS_TEMPLATE := $(NSIS_DIR)/openpilotgcs.tpl NSIS_HEADER := $(BUILD_DIR)/ground/openpilotgcs/openpilotgcs.nsh -win_package: gcs package_flight +.PHONY: package +package: $(V1) mkdir -p "$(dir $(NSIS_HEADER))" $(VERSION_CMD) \ --template="$(NSIS_TEMPLATE)" \ @@ -21,10 +29,3 @@ win_package: gcs package_flight $(V1) echo "If you have a script error in line 1 - use Unicode NSIS 2.46+" $(V1) echo " http://www.scratchpaper.com" $(NSIS_CMD) $(NSIS_OPTS) $(NSIS_SCRIPT) - -gcs: uavobjects - $(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@ - -ground_package: | win_package - -.PHONY: gcs ground_package win_package diff --git a/package/linux/deb_common/rules b/package/linux/deb_common/rules index ba22c1e9c..540b29109 100644 --- a/package/linux/deb_common/rules +++ b/package/linux/deb_common/rules @@ -33,10 +33,10 @@ install: dh_installdirs dh_installudev --priority=45 # Add here commands to install the package into debian/ - cp -arp build/ground/openpilotgcs/bin debian/openpilot/usr/local/OpenPilot - cp -arp build/ground/openpilotgcs/lib debian/openpilot/usr/local/OpenPilot - cp -arp build/ground/openpilotgcs/share debian/openpilot/usr/local/OpenPilot - cp -arp build/ground/openpilotgcs/.obj debian/openpilot/usr/local/OpenPilot + cp -arp build/ground/openpilotgcs/release/bin debian/openpilot/usr/local/OpenPilot + cp -arp build/ground/openpilotgcs/release/lib debian/openpilot/usr/local/OpenPilot + cp -arp build/ground/openpilotgcs/release/share debian/openpilot/usr/local/OpenPilot + cp -arp build/ground/openpilotgcs/release/.obj debian/openpilot/usr/local/OpenPilot cp -arp build/ground/openpilotgcs/gcsversioninfo.h debian/openpilot/usr/local/OpenPilot cp -arp package/linux/openpilot.desktop debian/openpilot/usr/share/applications cp -arp package/linux/openpilot.png debian/openpilot/usr/share/pixmaps diff --git a/package/osx/package b/package/osx/package index 2731b540c..73a80a835 100755 --- a/package/osx/package +++ b/package/osx/package @@ -4,7 +4,7 @@ : ${ROOT_DIR?} ${BUILD_DIR?} ${PACKAGE_LBL?} ${PACKAGE_DIR?} ${FW_DIR?} ${PACKAGE_NAME?} ${PACKAGE_SEP?} # more variables -APP_PATH="${BUILD_DIR}/ground/openpilotgcs/bin/OpenPilot GCS.app" +APP_PATH="${BUILD_DIR}/ground/openpilotgcs/release/bin/OpenPilot GCS.app" TEMP_FILE="${PACKAGE_DIR}/OpenPilot-temp.dmg" OUT_FILE="${PACKAGE_DIR}/../${PACKAGE_NAME}${PACKAGE_SEP}${PACKAGE_LBL}${PACKAGE_SEP}osx.dmg" VOL_NAME="OpenPilot" diff --git a/package/winx86/openpilotgcs.nsi b/package/winx86/openpilotgcs.nsi index c870deae0..48bf695f9 100644 --- a/package/winx86/openpilotgcs.nsi +++ b/package/winx86/openpilotgcs.nsi @@ -36,9 +36,9 @@ ; Tree root locations (relative to this script location) !define PROJECT_ROOT "..\.." !define NSIS_DATA_TREE "." - !define GCS_BUILD_TREE "..\..\build\ground\openpilotgcs" + !define GCS_BUILD_TREE "..\..\build\ground\openpilotgcs\release" !define UAVO_SYNTH_TREE "..\..\build\uavobject-synthetics" - !define AEROSIMRC_TREE "..\..\build\ground\AeroSIM-RC" + !define AEROSIMRC_TREE "${GCS_BUILD_TREE}\misc\AeroSIM-RC" ; Default installation folder InstallDir "$PROGRAMFILES\OpenPilot" @@ -61,7 +61,7 @@ ; !define PRODUCT_VERSION "0.0.0.0" ; !define FILE_VERSION "${TAG_OR_BRANCH}:${HASH8} ${DATETIME}" ; !define BUILD_DESCRIPTION "${TAG_OR_BRANCH}:${HASH8} built from ${ORIGIN}, committed ${DATETIME} as ${HASH}" - !include "${GCS_BUILD_TREE}\openpilotgcs.nsh" + !include "${GCS_BUILD_TREE}\..\openpilotgcs.nsh" Name "${PRODUCT_NAME}" OutFile "${PACKAGE_DIR}\..\${OUT_FILE}" @@ -203,12 +203,8 @@ SectionEnd ; Copy firmware files Section "Firmware" InSecFirmware -; SetOutPath "$INSTDIR\firmware\${FIRMWARE_DIR}" -; File /r "${PACKAGE_DIR}\${FIRMWARE_DIR}\*" SetOutPath "$INSTDIR\firmware" - File "${PACKAGE_DIR}\${FIRMWARE_DIR}\fw_coptercontrol-${PACKAGE_LBL}.opfw" - File "${PACKAGE_DIR}\${FIRMWARE_DIR}\fw_pipxtreme-${PACKAGE_LBL}.opfw" - File "${PACKAGE_DIR}\${FIRMWARE_DIR}\fw_revomini-${PACKAGE_LBL}.opfw" + File /r "${PACKAGE_DIR}\${FIRMWARE_DIR}\*" SectionEnd ; Copy utility files diff --git a/package/winx86/openpilotgcs.tpl b/package/winx86/openpilotgcs.tpl index 3669096c0..65b38e11e 100644 --- a/package/winx86/openpilotgcs.tpl +++ b/package/winx86/openpilotgcs.tpl @@ -15,8 +15,8 @@ !define PACKAGE_LBL "${PACKAGE_LBL}" !define PACKAGE_NAME "${PACKAGE_NAME}" !define PACKAGE_SEP "${PACKAGE_SEP}" -!define PACKAGE_DIR "..\..\build\package-$${PACKAGE_LBL}" -!define FIRMWARE_DIR "firmware-$${PACKAGE_LBL}" +!define PACKAGE_DIR "..\..\build\package" +!define FIRMWARE_DIR "firmware" !define OUT_FILE "$${PACKAGE_NAME}$${PACKAGE_SEP}$${PACKAGE_LBL}$${PACKAGE_SEP}win32.exe" ; Installer version info From 2eff6f5f3cda61dbf237eee28516fe1f2feb595c Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 23 Mar 2013 14:21:34 +0200 Subject: [PATCH 57/68] Posix compile-only fix (still needs a lot of rework) This is a patch to make simposix buildable. It does not use new makefiles and should be reworked. Conflicts: flight/targets/SimPosix/Makefile --- flight/PiOS/pios_sim_posix.h | 2 - flight/targets/RevoMini/Makefile.osx | 19 ++- flight/targets/Revolution/Makefile.osx | 21 ++- flight/targets/SimPosix/Makefile | 180 ++++++++----------------- 4 files changed, 75 insertions(+), 147 deletions(-) diff --git a/flight/PiOS/pios_sim_posix.h b/flight/PiOS/pios_sim_posix.h index b51837f3e..12fd81725 100644 --- a/flight/PiOS/pios_sim_posix.h +++ b/flight/PiOS/pios_sim_posix.h @@ -75,6 +75,4 @@ #include #endif -#define NELEMENTS(x) (sizeof(x) / sizeof(*(x))) - #endif /* PIOS_POSIX_H */ diff --git a/flight/targets/RevoMini/Makefile.osx b/flight/targets/RevoMini/Makefile.osx index 130871e7b..e7389be30 100644 --- a/flight/targets/RevoMini/Makefile.osx +++ b/flight/targets/RevoMini/Makefile.osx @@ -362,17 +362,14 @@ LDFLAGS += -L$(OUTDIR) # Define programs and commands. -CC = $(TCHAIN_PREFIX)gcc -CPP = $(TCHAIN_PREFIX)g++ -AR = $(TCHAIN_PREFIX)ar -OBJCOPY = $(TCHAIN_PREFIX)objcopy -OBJDUMP = $(TCHAIN_PREFIX)objdump -SIZE = $(TCHAIN_PREFIX)size -NM = $(TCHAIN_PREFIX)nm -REMOVE = $(REMOVE_CMD) -f -PYTHON = python -###SHELL = sh -###COPY = cp +CC = $(ARM_SDK_PREFIX)gcc +CPP = $(ARM_SDK_PREFIX)g++ +AR = $(ARM_SDK_PREFIX)ar +OBJCOPY = $(ARM_SDK_PREFIX)objcopy +OBJDUMP = $(ARM_SDK_PREFIX)objdump +SIZE = $(ARM_SDK_PREFIX)size +NM = $(ARM_SDK_PREFIX)nm +REMOVE = $(RM) -f diff --git a/flight/targets/Revolution/Makefile.osx b/flight/targets/Revolution/Makefile.osx index df14dbf0d..4a48fc9dc 100644 --- a/flight/targets/Revolution/Makefile.osx +++ b/flight/targets/Revolution/Makefile.osx @@ -23,7 +23,7 @@ ##### BOARD_NAME=revolution -TCHAIN_PREFIX ?= +ARM_SDK_PREFIX ?= WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) TOP := $(realpath $(WHEREAMI)/../../) include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk @@ -364,17 +364,14 @@ LDFLAGS += -L$(OUTDIR) # Define programs and commands. -CC = $(TCHAIN_PREFIX)gcc -CPP = $(TCHAIN_PREFIX)g++ -AR = $(TCHAIN_PREFIX)ar -OBJCOPY = $(TCHAIN_PREFIX)objcopy -OBJDUMP = $(TCHAIN_PREFIX)objdump -SIZE = $(TCHAIN_PREFIX)size -NM = $(TCHAIN_PREFIX)nm -REMOVE = $(REMOVE_CMD) -f -PYTHON = python -###SHELL = sh -###COPY = cp +CC = $(ARM_SDK_PREFIX)gcc +CPP = $(ARM_SDK_PREFIX)g++ +AR = $(ARM_SDK_PREFIX)ar +OBJCOPY = $(ARM_SDK_PREFIX)objcopy +OBJDUMP = $(ARM_SDK_PREFIX)objdump +SIZE = $(ARM_SDK_PREFIX)size +NM = $(ARM_SDK_PREFIX)nm +REMOVE = $(RM) -f diff --git a/flight/targets/SimPosix/Makefile b/flight/targets/SimPosix/Makefile index 449f62ea7..a779b5f21 100644 --- a/flight/targets/SimPosix/Makefile +++ b/flight/targets/SimPosix/Makefile @@ -1,8 +1,6 @@ ##### -# Project: OpenPilot INS # -# -# Makefile for OpenPilot INS project +# TODO: This file should be reworked. It will be done as a part of sim target refactoring. # # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009. # @@ -22,35 +20,16 @@ # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##### -WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST))) -TOP := $(realpath $(WHEREAMI)/../../../) - -override TCHAIN_PREFIX := +override ARM_SDK_PREFIX := override THUMB := -include $(TOP)/make/firmware-defs.mk -include $(TOP)/make/boards/$(BOARD_NAME)/board-info.mk -# Target file name (without extension). -TARGET := fw_$(BOARD_NAME) - -# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.) -OUTDIR := $(TOP)/build/$(TARGET) +include $(ROOT_DIR)/make/firmware-defs.mk +include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk # Set developer code and compile options # Set to YES for debugging DEBUG ?= YES -# Set to YES when using Code Sourcery toolchain -CODE_SOURCERY ?= NO - -ifeq ($(CODE_SOURCERY), YES) -REMOVE_CMD = cs-rm -else -REMOVE_CMD = rm -endif - -FLASH_TOOL = OPENOCD - # List of modules to include MODULES = ManualControl Stabilization GPS MODULES += PathPlanner @@ -66,11 +45,10 @@ PYMODULES = # Paths OPSYSTEM = ./System OPSYSTEMINC = $(OPSYSTEM)/inc -OPUAVTALK = ../../UAVTalk +OPUAVTALK = ../UAVTalk OPUAVTALKINC = $(OPUAVTALK)/inc -OPUAVOBJ = ../../UAVObjects +OPUAVOBJ = ../UAVObjects OPUAVOBJINC = $(OPUAVOBJ)/inc -PIOS = ../../PiOS.posix PIOSINC = $(PIOS)/inc OPMODULEDIR = ../../Modules FLIGHTLIB = ../../Libraries @@ -80,29 +58,40 @@ MATHLIBINC = $(FLIGHTLIB)/math PIOSPOSIX = $(PIOS)/posix PIOSCOMMON = $(PIOS)/posix PIOSBOARDS = $(PIOS)/Boards -PIOSCOMMONLIB = $(PIOSCOMMON)/Libraries -#APPLIBDIR = $(PIOSSTM32F4XX)/Libraries -OPUAVOBJ = ../../UAVObjects +PIOSCOMMONLIB = $(PIOS)/Common/Libraries +OPUAVOBJ = ../UAVObjects OPUAVOBJINC = $(OPUAVOBJ)/inc BOOT = BOOTINC = +PYMITE = $(FLIGHTLIB)/PyMite +PYMITELIB = $(PYMITE)/lib +PYMITEPLAT = $(PYMITE)/platform/openpilot +PYMITETOOLS = $(PYMITE)/tools +PYMITEVM = $(PYMITE)/vm +PYMITEINC = $(PYMITEVM) +PYMITEINC += $(PYMITEPLAT) +PYMITEINC += $(OUTDIR) FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans HWDEFSINC = ../board_hw_defs/$(BOARD_NAME) UAVOBJSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight -SRC = # optional component libraries -include $(PIOSCOMMONLIB)/FreeRTOS/library.mk -#include $(PIOSCOMMONLIB)/dosfs/library.mk -#include $(PIOSCOMMONLIB)/msheap/library.mk - -## PYMite support -#include $(FLIGHTLIB)/PyMite/pymite.mk +include $(PIOS)/Common/Libraries/FreeRTOS/library.mk # List C source files here. (C dependencies are automatically generated.) # use file-extension c for "c-only"-files +## PyMite files and modules +SRC += $(OUTDIR)/pmlib_img.c +SRC += $(OUTDIR)/pmlib_nat.c +SRC += $(OUTDIR)/pmlibusr_img.c +SRC += $(OUTDIR)/pmlibusr_nat.c +PYSRC += $(wildcard ${PYMITEVM}/*.c) +PYSRC += $(wildcard ${PYMITEPLAT}/*.c) +PYSRC += ${foreach MOD, ${PYMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} +SRC += $(PYSRC) + ## MODULES SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} SRC += ${OUTDIR}/InitMods.c @@ -127,53 +116,12 @@ SRC += $(FLIGHTLIB)/sanitycheck.c SRC += $(MATHLIB)/sin_lookup.c SRC += $(MATHLIB)/pid.c -## PIOS Hardware (STM32F4xx) +## PIOS Hardware include $(PIOS)/posix/library.mk -## PIOS Hardware (Common) -#SRC += $(PIOSCOMMON)/pios_mpu6000.c -#SRC += $(PIOSCOMMON)/pios_bma180.c -#SRC += $(PIOSCOMMON)/pios_l3gd20.c -#SRC += $(PIOSCOMMON)/pios_hmc5883.c -#SRC += $(PIOSCOMMON)/pios_ms5611.c -#SRC += $(PIOSCOMMON)/pios_crc.c -#SRC += $(PIOSCOMMON)/pios_com.c -#SRC += $(PIOSCOMMON)/pios_rcvr.c -#SRC += $(PIOSCOMMON)/pios_flash_jedec.c -#SRC += $(PIOSCOMMON)/pios_flashfs_objlist.c -#SRC += $(PIOSCOMMON)/printf-stdarg.c -#SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c -#SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c - include ./UAVObjects.inc SRC += $(UAVOBJSRC) -# List C source files here which must be compiled in ARM-Mode (no -mthumb). -# use file-extension c for "c-only"-files -## just for testing, timer.c could be compiled in thumb-mode too -SRCARM = - -# List C++ source files here. -# use file-extension .cpp for C++-files (not .C) -CPPSRC = - -# List C++ source files here which must be compiled in ARM-Mode. -# use file-extension .cpp for C++-files (not .C) -#CPPSRCARM = $(TARGET).cpp -CPPSRCARM = - -# List Assembler source files here. -# Make them always end in a capital .S. Files ending in a lowercase .s -# will not be considered source files but generated files (assembler -# output from the compiler), and will be deleted upon "make clean"! -# Even though the DOS/Win* filesystem matches both .s and .S the same, -# it will preserve the spelling of the filenames, and gcc itself does -# care about how the name is spelled on its command-line. - - -# List Assembler source files here which must be assembled in ARM-Mode.. -ASRCARM = - # List any extra directories to look for include files here. # Each directory must be seperated by a space. EXTRAINCDIRS += $(PIOS) @@ -186,39 +134,27 @@ EXTRAINCDIRS += $(OPUAVOBJINC) EXTRAINCDIRS += $(UAVOBJSYNTHDIR) EXTRAINCDIRS += $(FLIGHTLIBINC) EXTRAINCDIRS += $(MATHLIBINC) -#EXTRAINCDIRS += $(PIOSSTM32F4XX) EXTRAINCDIRS += $(PIOSCOMMON) EXTRAINCDIRS += $(PIOSBOARDS) -#EXTRAINCDIRS += $(STMSPDINCDIR) EXTRAINCDIRS += $(CMSISDIR) EXTRAINCDIRS += $(OPUAVSYNTHDIR) EXTRAINCDIRS += $(BOOTINC) +EXTRAINCDIRS += $(PYMITEINC) EXTRAINCDIRS += $(HWDEFSINC) +# Generate intermediate code +gencode: ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h + +$(PYSRC): gencode + +# Generate code for PyMite +${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h: $(wildcard ${PYMITELIB}/*.py) $(wildcard ${PYMITEPLAT}/*.py) $(wildcard ${FLIGHTPLANLIB}/*.py) $(wildcard ${FLIGHTPLANS}/*.py) + @$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@) + @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py) + @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h + @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py EXTRAINCDIRS += ${foreach MOD, ${MODULES} ${PYMODULES}, $(OPMODULEDIR)/${MOD}/inc} ${OPMODULEDIR}/System/inc -# List any extra directories to look for library files here. -# Also add directories where the linker should search for -# includes from linker-script to the list -# Each directory must be seperated by a space. -#EXTRA_LIBDIRS += - -# Extra Libraries -# Each library-name must be seperated by a space. -# i.e. to link with libxyz.a, libabc.a and libefsl.a: -# EXTRA_LIBS = xyz abc efsl -# for newlib-lpc (file: libnewlibc-lpc.a): -# EXTRA_LIBS = newlib-lpc -#EXTRA_LIBS += - -# Path to Linker-Scripts -#LINKERSCRIPTPATH = $(PIOSSTM32F4XX) - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) - - BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) @@ -238,19 +174,19 @@ CFLAGS += -finstrument-functions -ffixed-r10 else CFLAGS += -Os endif - - # common architecture-specific flags from the device-specific library makefile CFLAGS += $(ARCHFLAGS) CFLAGS += $(UAVOBJDEFINE) -CFLAGS += -DSTACK_DIAGNOSTICS -CFLAGS += -DMIXERSTATUS_DIAGNOSTICS -CFLAGS += -DRATEDESIRED_DIAGNOSTICS -CFLAGS += -DI2C_WDG_STATS_DIAGNOSTICS +CFLAGS += -DDIAG_STACK +CFLAGS += -DDIA_MIXERSTATUS +CFLAGS += -DDIAG_RATEDESIRED +CFLAGS += -DDIAG_I2C_WDG_STATS CFLAGS += -DDIAG_TASKS +# Or all of above: +#CFLAGS += -DDIAG_ALL # This is not the best place for these. Really should abstract out # to the board file or something @@ -350,7 +286,7 @@ LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP)) # Define programs and commands. -REMOVE = $(REMOVE_CMD) -f +REMOVE = $(RM) -f # List of all source files. ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) @@ -384,7 +320,7 @@ endif # Link: create ELF output file from object files. -$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ), $(ALLLIB))) +$(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) # Assemble: create object files from assembler source files. $(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) @@ -488,16 +424,16 @@ gencode: ${OUTDIR}/InitMods.c ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTD # Generate code for module initialization ${OUTDIR}/InitMods.c: Makefile - @echo ${MSG_MODINIT} - @echo ${quote}// Autogenerated file${quote} > ${OUTDIR}/InitMods.c - @echo ${quote}${foreach MOD, ${MODNAMES}, extern unsigned int ${MOD}Initialize(void);}${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}${foreach MOD, ${MODNAMES}, extern unsigned int ${MOD}Start(void);}${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}void InitModules() {${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}void StartModules() {${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Start();}${quote} >> ${OUTDIR}/InitMods.c - @echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c + $(V1) $(ECHO) $(MSG_MODINIT $(call toprel, $@)) + $(V1) $(ECHO) $(QUOTE)// Autogenerated file$(QUOTE) > ${OUTDIR}/InitMods.c + $(V1) $(ECHO) $(QUOTE)${foreach MOD, ${MODNAMES}, extern unsigned int ${MOD}Initialize(void);}$(QUOTE) >> ${OUTDIR}/InitMods.c + $(V1) $(ECHO) $(QUOTE)${foreach MOD, ${MODNAMES}, extern unsigned int ${MOD}Start(void);}$(QUOTE) >> ${OUTDIR}/InitMods.c + $(V1) $(ECHO) $(QUOTE)void InitModules() {$(QUOTE) >> ${OUTDIR}/InitMods.c + $(V1) $(ECHO) $(QUOTE)${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}$(QUOTE) >> ${OUTDIR}/InitMods.c + $(V1) $(ECHO) $(QUOTE)}$(QUOTE) >> ${OUTDIR}/InitMods.c + $(V1) $(ECHO) $(QUOTE)void StartModules() {$(QUOTE) >> ${OUTDIR}/InitMods.c + $(V1) $(ECHO) $(QUOTE)${foreach MOD, ${MODNAMES}, ${MOD}Start();}$(QUOTE) >> ${OUTDIR}/InitMods.c + $(V1) $(ECHO) $(QUOTE)}$(QUOTE) >> ${OUTDIR}/InitMods.c # Listing of phony targets. .PHONY : all build clean clean_list install From 151bd73bda041922b0140724a169b50cb50d8053 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 23 Mar 2013 23:24:15 +0200 Subject: [PATCH 58/68] Packaging: package ELF simposix file (executable), not OPFW (binary) --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ca91dc384..982ba335c 100644 --- a/Makefile +++ b/Makefile @@ -763,12 +763,16 @@ endif # ############################## +# Firmware files to package +PACKAGE_FW_TARGETS := $(filter-out fw_simposix, $(FW_TARGETS)) +PACKAGE_ELF_TARGETS := $(filter fw_simposix, $(FW_TARGETS)) + # Rules to generate GCS resources used to embed firmware binaries into the GCS. # They are used later by the vehicle setup wizard to update board firmware. # To open a firmware image use ":/firmware/fw_coptercontrol.opfw" OPFW_RESOURCE := $(BUILD_DIR)/ground/opfw_resource/opfw_resource.qrc OPFW_RESOURCE_PREFIX := ../../../ -OPFW_FILES := $(foreach fw_targ, $(FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw)) +OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw)) OPFW_CONTENTS := \ \ \ @@ -825,8 +829,11 @@ ifneq ($(strip $(filter package clean_package,$(MAKECMDGOALS))),) endif # Copy file template. Empty line before the endef is required, do not remove +# $(1) = copy file name without extension +# $(2) = source file extension +# $(3) = destination file extension define COPY_FW_FILES - $(V1) $(CP) "$(BUILD_DIR)/$(1)/$(1).opfw" "$(PACKAGE_DIR)/firmware/$(1)$(PACKAGE_SEP)$(PACKAGE_LBL).opfw" + $(V1) $(CP) "$(BUILD_DIR)/$(1)/$(1)$(2)" "$(PACKAGE_DIR)/firmware/$(1)$(PACKAGE_SEP)$(PACKAGE_LBL)$(3)" endef @@ -837,7 +844,8 @@ package: all_fw all_ground uavobjects_matlab $(V1) $(ECHO) "Packaging for $(UNAME) $(ARCH) into $(call toprel, $(PACKAGE_DIR)) directory" $(V1) [ ! -d "$(PACKAGE_DIR)" ] || $(RM) -rf "$(PACKAGE_DIR)" $(V1) $(MKDIR) -p "$(PACKAGE_DIR)/firmware" - $(foreach fw_targ, $(FW_TARGETS), $(call COPY_FW_FILES,$(fw_targ))) + $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call COPY_FW_FILES,$(fw_targ),.opfw,.opfw)) + $(foreach fw_targ, $(PACKAGE_ELF_TARGETS), $(call COPY_FW_FILES,$(fw_targ),.elf,)) $(MAKE) --no-print-directory -C $(ROOT_DIR)/package --file=$(UNAME).mk $@ ############################## From 8f977a4411731ba71ff5c1611da8a6b6fa80a7cf Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 24 Mar 2013 13:02:08 +0200 Subject: [PATCH 59/68] Final step: lot of small fixes, last commit in this commit series This is the first cleanup pass through makefiles and pios. Probably it is difficult to track changes due to the nature of them. I would recommend to look at resulting files and compiled code instead. NOTE: original branch was rebased and lot of conflicts were fixed on the way. So do not expect that every commit in this series will be buildable (unlike original branch). Only final result was tested. The main goal was to remove as much duplication of code (and copy/paste errors) as possible, moving common parts out of Makefiles. It still is not perfect, and mostly no code changes made - Makefiles and #ifdefs only. But please while testing make sure that all code works as before, and no modules/options are missed by accident. Brief list of changes: - Moved common parts of Makefiles into the set of *.mk files. - Changed method of passing common vars from top Makefile to lower ones. - Some pios cleanup, mostly #ifdefs, and all pios_config.h files. - Many obsolete files removed (for instance, AHRS files, op_config.h). - Many obsolete or unused macros removed or fixed/renamed (ALL_DIGNOSTICS). - Unified pios_config.h template. Please don't remove lines for board configs, only comment/uncomment them. Adding new PIOS options, please propagate them to all board files keeping the same order. - Some formatting, spacing, indentation (no line endings change yet). - Some cosmetic fixes (no more C:\X\Y\filename.c printings on Windows). - Added some library.mk files to move libs into AR achives later. - EntireFlash target now uses cross-platform python script to generate bin files. So it works on all supported platforms: Linux, OSX, Windows. - Top level packaging is completely rewritten. Now it is a part of top Makefile. As such, all dependencies are checked and accounted, no more 'make -j' problems should occur. - Default GCS_BUILD_CONF is release now, may be changed if necessary using 'make GCS_BUILD_CONF=debug gcs'. - GCS build paths are separated into debug and release, so no more obj file clashes. Packaging system supports only release builds. - New target is introduced: 'clean_package'. Now 'make package' does not clean build directory. Use clean_package instead for distributable builds. - Targets like 'all', 'opfw_resource', etc now will print extra contex in parallel builds too. - If any of 'package', 'clean_package', 'opfw_resource' targets are given on command line, GCS build will depend on the resource, so all fw_*.opfw targets will be built and embedded into GCS. By default GCS does not depend on resource, and will be built w/o firmware (unless the resource files already exist and the Qt resource file is generated). - fw_simposix (ELF executable) is now packaged for linux. Run'n'play! - Make help is refined and is now up to date. Still broken: - UnitTests, should be fixed - SimPosix: buildable, but should be reworked. Next planned passes to do: - toolchain bootstrapping and packaging (including windows - WIP) - CMSIS/StdPeriph lib cleanup - more PIOS cleanup - move libs into AR archives to save build time - sim targets refactir and cleanup - move android-related directories under /android - unit test targets fix - source code line ending changes (there are many different, were not changed) - coding style Merging this, please use --no-ff git option to make it the real commit point Conflicts: A lot of... :-) --- HISTORY.txt | 2 +- Makefile | 10 ++-- flight/Libraries/taskmonitor.c | 4 +- flight/Modules/Actuator/actuator.c | 6 +- flight/Modules/Stabilization/stabilization.c | 6 +- flight/Modules/System/systemmod.c | 12 ++-- .../PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h | 2 - .../PiOS/Common/Libraries/CMSIS2/library.mk | 2 +- flight/PiOS/STM32F10x/library.mk | 4 +- flight/PiOS/STM32F4xx/library.mk | 1 + flight/PiOS/pios.h | 37 +++++++----- flight/README.txt | 4 +- flight/targets/BootloaderUpdater/Makefile | 3 + flight/targets/CopterControl/Makefile | 12 ++-- .../CopterControl/System/inc/FreeRTOSConfig.h | 2 +- .../CopterControl/System/inc/pios_config.h | 35 +++++++---- flight/targets/OSD/Makefile | 17 +++--- flight/targets/OSD/System/inc/pios_config.h | 31 ++++++---- flight/targets/PipXtreme/Makefile | 15 ++--- .../PipXtreme/System/inc/FreeRTOSConfig.h | 2 +- .../PipXtreme/System/inc/pios_config.h | 30 ++++++---- flight/targets/RevoMini/Makefile | 20 ++++--- flight/targets/RevoMini/Makefile.osx | 1 - .../targets/RevoMini/System/inc/pios_config.h | 29 +++++---- flight/targets/Revolution/Makefile | 25 ++++---- flight/targets/Revolution/Makefile.osx | 1 - .../Revolution/System/inc/pios_config.h | 32 ++++++---- make/apps-defs.mk | 49 ++------------- make/boot-defs.mk | 15 ++--- make/common-defs.mk | 43 ++++++++++++- make/firmware-defs.mk | 60 +++++++++---------- make/tools.mk | 1 - package/linux/deb_common/rules | 2 +- package/osx/package | 8 +-- package/winx86/openpilotgcs.nsi | 6 +- 35 files changed, 286 insertions(+), 243 deletions(-) diff --git a/HISTORY.txt b/HISTORY.txt index aa6bc6ef4..23cf292fe 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -172,7 +172,7 @@ By default a lot of diagnostic objects that were enabled by default are now disabled in the build. This include TaskInfo (and all the FreeRTOS options that provide that debugging information). Also MixerStatus, I2CStatus, WatchdogStatus and RateDesired. These can be reenabled for debugging with --DDIAGNOSTICS. +-DDIAG_ALL. 2011-08-04 Fixed packaging aesthetic issues. Also avoid runtime issues on OSX Lion by diff --git a/Makefile b/Makefile index 982ba335c..65304d8af 100644 --- a/Makefile +++ b/Makefile @@ -105,7 +105,7 @@ export GIT := git export PYTHON := python export INSTALL := install -# version-info cmd to extract some repository data +# Command to extract version info data from the repository and source tree export VERSION_INFO := $(PYTHON) "$(ROOT_DIR)/make/scripts/version-info.py" --path="$(ROOT_DIR)" # Test if quotes are needed for the echo-command @@ -253,7 +253,7 @@ export DOXYGENDIR := $(ROOT_DIR)/flight/Doc/Doxygen export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight # Define supported board lists -ALL_BOARDS := coptercontrol pipxtreme revolution revomini simposix osd +ALL_BOARDS := coptercontrol pipxtreme revolution revomini osd simposix ALL_BOARDS_BU := coptercontrol pipxtreme simposix # Friendly names of each board (used to find source tree) @@ -261,16 +261,16 @@ coptercontrol_friendly := CopterControl pipxtreme_friendly := PipXtreme revolution_friendly := Revolution revomini_friendly := RevoMini -simposix_friendly := SimPosix osd_friendly := OSD +simposix_friendly := SimPosix # Short names of each board (used to display board name in parallel builds) coptercontrol_short := 'cc ' pipxtreme_short := 'pipx' revolution_short := 'revo' revomini_short := 'rm ' -simposix_short := 'posx' osd_short := 'osd ' +simposix_short := 'posx' # SimPosix only builds on Linux so drop it from the list for # all other platforms. @@ -841,7 +841,7 @@ endef # and call platform-specific packaging script .PHONY: package package: all_fw all_ground uavobjects_matlab - $(V1) $(ECHO) "Packaging for $(UNAME) $(ARCH) into $(call toprel, $(PACKAGE_DIR)) directory" + @$(ECHO) "Packaging for $(UNAME) $(ARCH) into $(call toprel, $(PACKAGE_DIR)) directory" $(V1) [ ! -d "$(PACKAGE_DIR)" ] || $(RM) -rf "$(PACKAGE_DIR)" $(V1) $(MKDIR) -p "$(PACKAGE_DIR)/firmware" $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call COPY_FW_FILES,$(fw_targ),.opfw,.opfw)) diff --git a/flight/Libraries/taskmonitor.c b/flight/Libraries/taskmonitor.c index f64d0e1b9..332e94cbf 100644 --- a/flight/Libraries/taskmonitor.c +++ b/flight/Libraries/taskmonitor.c @@ -47,7 +47,7 @@ int32_t TaskMonitorInitialize(void) lock = xSemaphoreCreateRecursiveMutex(); memset(handles, 0, sizeof(xTaskHandle)*TASKINFO_RUNNING_NUMELEM); lastMonitorTime = 0; -#if defined(DIAG_TASKS) +#ifdef DIAG_TASKS lastMonitorTime = portGET_RUN_TIME_COUNTER_VALUE(); #endif return 0; @@ -104,7 +104,7 @@ bool TaskMonitorQueryRunning(TaskInfoRunningElem task) */ void TaskMonitorUpdateAll(void) { -#if defined(DIAG_TASKS) +#ifdef DIAG_TASKS TaskInfoData data; int n; diff --git a/flight/Modules/Actuator/actuator.c b/flight/Modules/Actuator/actuator.c index 4f341d936..b01a753eb 100644 --- a/flight/Modules/Actuator/actuator.c +++ b/flight/Modules/Actuator/actuator.c @@ -128,7 +128,7 @@ int32_t ActuatorInitialize() // Primary output of this module ActuatorCommandInitialize(); -#if defined(MIXERSTATUS_DIAGNOSTICS) +#ifdef DIAG_MIXERSTATUS // UAVO only used for inspecting the internal status of the mixer during debug MixerStatusInitialize(); #endif @@ -218,7 +218,7 @@ static void actuatorTask(void* parameters) ActuatorDesiredGet(&desired); ActuatorCommandGet(&command); -#if defined(MIXERSTATUS_DIAGNOSTICS) +#ifdef DIAG_MIXERSTATUS MixerStatusGet(&mixerStatus); #endif int nMixers = 0; @@ -379,7 +379,7 @@ static void actuatorTask(void* parameters) // Update in case read only (eg. during servo configuration) ActuatorCommandGet(&command); -#if defined(MIXERSTATUS_DIAGNOSTICS) +#ifdef DIAG_MIXERSTATUS MixerStatusSet(&mixerStatus); #endif diff --git a/flight/Modules/Stabilization/stabilization.c b/flight/Modules/Stabilization/stabilization.c index 06cf27e3c..52ccc8f29 100644 --- a/flight/Modules/Stabilization/stabilization.c +++ b/flight/Modules/Stabilization/stabilization.c @@ -120,7 +120,7 @@ int32_t StabilizationInitialize() // Initialize variables StabilizationSettingsInitialize(); ActuatorDesiredInitialize(); -#if defined(RATEDESIRED_DIAGNOSTICS) +#ifdef DIAG_RATEDESIRED RateDesiredInitialize(); #endif @@ -173,7 +173,7 @@ static void stabilizationTask(void* parameters) StabilizationDesiredGet(&stabDesired); AttitudeActualGet(&attitudeActual); GyrosGet(&gyrosData); -#if defined(RATEDESIRED_DIAGNOSTICS) +#ifdef DIAG_RATEDESIRED RateDesiredGet(&rateDesired); #endif @@ -350,7 +350,7 @@ static void stabilizationTask(void* parameters) if (settings.VbarPiroComp == STABILIZATIONSETTINGS_VBARPIROCOMP_TRUE) stabilization_virtual_flybar_pirocomp(gyro_filtered[2], dT); -#if defined(RATEDESIRED_DIAGNOSTICS) +#ifdef DIAG_RATEDESIRED RateDesiredSet(&rateDesired); #endif diff --git a/flight/Modules/System/systemmod.c b/flight/Modules/System/systemmod.c index 5ac170608..8d6e88508 100644 --- a/flight/Modules/System/systemmod.c +++ b/flight/Modules/System/systemmod.c @@ -92,7 +92,7 @@ static void hwSettingsUpdatedCb(UAVObjEvent * ev); static void updateStats(); static void updateSystemAlarms(); static void systemTask(void *parameters); -#if defined(I2C_WDG_STATS_DIAGNOSTICS) +#ifdef DIAG_I2C_WDG_STATS static void updateI2Cstats(); static void updateWDGstats(); #endif @@ -125,10 +125,10 @@ int32_t SystemModInitialize(void) SystemStatsInitialize(); FlightStatusInitialize(); ObjectPersistenceInitialize(); -#if defined(DIAG_TASKS) +#ifdef DIAG_TASKS TaskInfoInitialize(); #endif -#if defined(I2C_WDG_STATS_DIAGNOSTICS) +#ifdef DIAG_I2C_WDG_STATS I2CStatsInitialize(); WatchdogStatusInitialize(); #endif @@ -181,12 +181,12 @@ static void systemTask(void *parameters) // Update the system alarms updateSystemAlarms(); -#if defined(I2C_WDG_STATS_DIAGNOSTICS) +#ifdef DIAG_I2C_WDG_STATS updateI2Cstats(); updateWDGstats(); #endif -#if defined(DIAG_TASKS) +#ifdef DIAG_TASKS // Update the task status object TaskMonitorUpdateAll(); #endif @@ -334,7 +334,7 @@ static void hwSettingsUpdatedCb(UAVObjEvent * ev) /** * Called periodically to update the I2C statistics */ -#if defined(I2C_WDG_STATS_DIAGNOSTICS) +#ifdef DIAG_I2C_WDG_STATS static void updateI2Cstats() { #if defined(PIOS_INCLUDE_I2C) diff --git a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h index 4a402b07a..d2a901bfb 100755 --- a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h @@ -288,14 +288,12 @@ extern uint32_t pios_rfm22b_id; //------------------------- // Packet Handler //------------------------- -#if defined(PIOS_INCLUDE_PACKET_HANDLER) extern uint32_t pios_packet_handler; #define PIOS_PACKET_HANDLER (pios_packet_handler) #define PIOS_PH_MAX_PACKET 255 #define PIOS_PH_WIN_SIZE 3 #define PIOS_PH_MAX_CONNECTIONS 1 #define RS_ECC_NPARITY 4 -#endif /* PIOS_INCLUDE_PACKET_HANDLER */ //------------------------- // Reed-Solomon ECC diff --git a/flight/PiOS/Common/Libraries/CMSIS2/library.mk b/flight/PiOS/Common/Libraries/CMSIS2/library.mk index e6c7a1567..fd9410ad0 100644 --- a/flight/PiOS/Common/Libraries/CMSIS2/library.mk +++ b/flight/PiOS/Common/Libraries/CMSIS2/library.mk @@ -8,7 +8,7 @@ EXTRAINCDIRS += $(CMSIS2_DIR)Include # Rules to build the ARM DSP library ifeq ($(USE_DSP_LIB), YES) DSPLIB_NAME := dsp - CMSIS_DSPLIB := $(CMSIS2_DIR)/DSP_Lib/Source + CMSIS_DSPLIB := $(CMSIS2_DIR)DSP_Lib/Source # Compile all files into output directory DSPLIB_SRC := $(wildcard $(CMSIS_DSPLIB)/*/*.c) diff --git a/flight/PiOS/STM32F10x/library.mk b/flight/PiOS/STM32F10x/library.mk index 0f10a7fd0..fc493c84a 100644 --- a/flight/PiOS/STM32F10x/library.mk +++ b/flight/PiOS/STM32F10x/library.mk @@ -1,5 +1,5 @@ # -# Rules to (help) build the F1xx device support. +# Rules to (help) build the F10x device support. # # Directory containing this makefile @@ -12,7 +12,6 @@ LINKER_SCRIPTS_PATH = $(PIOS_DEVLIB) CDEFS += -DSTM32F10X -DSTM32F10X_$(MODEL) CDEFS += -DUSE_STDPERIPH_DRIVER CDEFS += -DARM_MATH_CM3 - ARCHFLAGS += -mcpu=cortex-m3 # Board-specific startup files @@ -22,6 +21,7 @@ ASRC += $(PIOS_DEVLIB)startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S SRC += $(wildcard $(PIOS_DEVLIB)*.c) # CMSIS for the F1 +include $(PIOS)/Common/Libraries/CMSIS2/library.mk CMSIS_DIR = $(PIOS_DEVLIB)Libraries/CMSIS/Core/CM3 SRC += $(CMSIS_DIR)/core_cm3.c SRC += $(CMSIS_DIR)/system_stm32f10x.c diff --git a/flight/PiOS/STM32F4xx/library.mk b/flight/PiOS/STM32F4xx/library.mk index 25700e929..531dbbfb2 100644 --- a/flight/PiOS/STM32F4xx/library.mk +++ b/flight/PiOS/STM32F4xx/library.mk @@ -16,6 +16,7 @@ CDEFS += -DSTM32F4XX CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ) CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ) CDEFS += -DUSE_STDPERIPH_DRIVER +CDEFS += -DARM_MATH_CM4 -D__FPU_PRESENT=1 ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard # PIOS device library source and includes diff --git a/flight/PiOS/pios.h b/flight/PiOS/pios.h index 63329921e..96ca8304b 100644 --- a/flight/PiOS/pios.h +++ b/flight/PiOS/pios.h @@ -71,12 +71,6 @@ /* PIOS common functions */ #include -/* PIOS bootloader helper */ -#ifdef PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ -#include -#endif - /* PIOS FreeRTOS support */ #ifdef PIOS_INCLUDE_FREERTOS #include "FreeRTOS.h" @@ -85,6 +79,12 @@ #include "semphr.h" #endif +/* PIOS bootloader helper */ +#ifdef PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +#include +#endif + /* PIOS system functions */ #ifdef PIOS_INCLUDE_DELAY #include @@ -220,6 +220,10 @@ #include #endif +#ifdef PIOS_INCLUDE_PPM_FLEXI +/* PPM on CC flexi port */ +#endif + #ifdef PIOS_INCLUDE_DSM #include #endif @@ -232,6 +236,11 @@ /* only priv header */ #endif +/* PIOS abstract receiver interface */ +#ifdef PIOS_INCLUDE_RCVR +#include +#endif + /* PIOS common peripherals */ #ifdef PIOS_INCLUDE_LED #include @@ -271,19 +280,17 @@ #include #endif -/* PIOS Radio modules */ +/* PIOS radio modules */ #ifdef PIOS_INCLUDE_RFM22B -/* #define PIOS_INCLUDE_PACKET_HANDLER */ +/* #define PIOS_INCLUDE_PPM_OUT */ +/* #define PIOS_RFM22B_DEBUG_ON_TELEM */ #include - #ifdef PIOS_INCLUDE_RFM22B_COM #include #endif - #ifdef PIOS_INCLUDE_RFM22B_RCVR #include #endif - #endif /* PIOS_INCLUDE_RFM22B */ /* PIOS misc peripherals */ @@ -299,11 +306,6 @@ #include #endif -/* PIOS abstract receiver interface */ -#ifdef PIOS_INCLUDE_RCVR -#include -#endif - /* PIOS abstract comms interface with options */ #ifdef PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ @@ -320,6 +322,9 @@ #include #endif +/* Stabilization options */ +/* #define PIOS_QUATERNION_STABILIZATION */ + /* Performance counters */ /* #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 995998 */ diff --git a/flight/README.txt b/flight/README.txt index 7a8b04e9d..f5df8bc54 100644 --- a/flight/README.txt +++ b/flight/README.txt @@ -1,3 +1 @@ -Check the wiki - - +Check the wiki: http://wiki.openpilot.org/display/Doc/OpenPilot+Developer+Manual diff --git a/flight/targets/BootloaderUpdater/Makefile b/flight/targets/BootloaderUpdater/Makefile index 5bf59502b..27f10363e 100644 --- a/flight/targets/BootloaderUpdater/Makefile +++ b/flight/targets/BootloaderUpdater/Makefile @@ -23,6 +23,9 @@ endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk +# ARM DSP library +override USE_DSP_LIB := NO + # Paths TOPDIR = . OPSYSTEM = $(TOPDIR) diff --git a/flight/targets/CopterControl/Makefile b/flight/targets/CopterControl/Makefile index 44cf2a750..1db667a81 100644 --- a/flight/targets/CopterControl/Makefile +++ b/flight/targets/CopterControl/Makefile @@ -66,14 +66,8 @@ ifndef TESTAPP SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/eventdispatcher.c -else - ## Test Code - SRC += $(OPTESTS)/test_common.c - SRC += $(OPTESTS)/$(TESTAPP).c -endif -## UAVObjects -ifndef TESTAPP + ## UAVObjects SRC += $(OPUAVSYNTHDIR)/accessorydesired.c SRC += $(OPUAVSYNTHDIR)/objectpersistence.c SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c @@ -114,6 +108,10 @@ ifndef TESTAPP SRC += $(OPUAVSYNTHDIR)/txpidsettings.c SRC += $(OPUAVSYNTHDIR)/airspeedactual.c SRC += $(OPUAVSYNTHDIR)/mpu6000settings.c +else + ## Test Code + SRC += $(OPTESTS)/test_common.c + SRC += $(OPTESTS)/$(TESTAPP).c endif include $(ROOT_DIR)/make/apps-defs.mk diff --git a/flight/targets/CopterControl/System/inc/FreeRTOSConfig.h b/flight/targets/CopterControl/System/inc/FreeRTOSConfig.h index 996726133..01e4f5b1b 100644 --- a/flight/targets/CopterControl/System/inc/FreeRTOSConfig.h +++ b/flight/targets/CopterControl/System/inc/FreeRTOSConfig.h @@ -76,7 +76,7 @@ NVIC value of 255. */ #endif /* Enable run time stats collection */ -#if defined(DIAG_TASKS) +#ifdef DIAG_TASKS #define configCHECK_FOR_STACK_OVERFLOW 2 #define configGENERATE_RUN_TIME_STATS 1 diff --git a/flight/targets/CopterControl/System/inc/pios_config.h b/flight/targets/CopterControl/System/inc/pios_config.h index 8b7a5cc07..149f8490b 100644 --- a/flight/targets/CopterControl/System/inc/pios_config.h +++ b/flight/targets/CopterControl/System/inc/pios_config.h @@ -39,8 +39,14 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ -/* PIOS system functions */ +/* PIOS FreeRTOS support */ #define PIOS_INCLUDE_FREERTOS + +/* PIOS bootloader helper */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ + +/* PIOS system functions */ #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL #define PIOS_INCLUDE_SYS @@ -81,10 +87,14 @@ /* PIOS receiver drivers */ #define PIOS_INCLUDE_PWM #define PIOS_INCLUDE_PPM +#define PIOS_INCLUDE_PPM_FLEXI #define PIOS_INCLUDE_DSM #define PIOS_INCLUDE_SBUS #define PIOS_INCLUDE_GCSRCVR +/* PIOS abstract receiver interface */ +#define PIOS_INCLUDE_RCVR + /* PIOS common peripherals */ #define PIOS_INCLUDE_LED #define PIOS_INCLUDE_IAP @@ -98,15 +108,19 @@ #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS /* #define FLASH_FREERTOS */ /* #define PIOS_INCLUDE_FLASH_EEPROM */ + +/* PIOS radio modules */ /* #define PIOS_INCLUDE_RFM22B */ -/* #define PIOS_INCLUDE_PACKET_HANDLER */ +/* #define PIOS_INCLUDE_RFM22B_COM */ +/* #define PIOS_INCLUDE_RFM22B_RCVR */ +/* #define PIOS_INCLUDE_PPM_OUT */ +/* #define PIOS_RFM22B_DEBUG_ON_TELEM */ + +/* PIOS misc peripherals */ /* #define PIOS_INCLUDE_VIDEO */ /* #define PIOS_INCLUDE_WAVE */ /* #define PIOS_INCLUDE_UDP */ -/* PIOS abstract receiver interface */ -#define PIOS_INCLUDE_RCVR - /* PIOS abstract comms interface with options */ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ @@ -121,9 +135,8 @@ #define PIOS_INCLUDE_GPS_UBX_PARSER /* #define PIOS_GPS_SETS_HOMELOCATION */ -/* PIOS bootloader helper */ -#define PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +/* Stabilization options */ +/* #define PIOS_QUATERNION_STABILIZATION */ /* Performance counters */ #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 @@ -144,12 +157,12 @@ #define PIOS_TELEM_STACK_SIZE 500 #define PIOS_EVENTDISPATCHER_STACK_SIZE 130 -/* Stabilization options */ -/* #define PIOS_QUATERNION_STABILIZATION */ - /* This can't be too high to stop eventdispatcher thread overflowing */ #define PIOS_EVENTDISAPTCHER_QUEUE 10 +/* Revolution series */ +/* #define REVOLUTION */ + #endif /* PIOS_CONFIG_H */ /** * @} diff --git a/flight/targets/OSD/Makefile b/flight/targets/OSD/Makefile index a3e2d4842..9ff2df65d 100644 --- a/flight/targets/OSD/Makefile +++ b/flight/targets/OSD/Makefile @@ -23,6 +23,9 @@ endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk +# ARM DSP library +override USE_DSP_LIB := NO + # List of mandatory modules to include MODULES += Osd/osdgen MODULES += Osd/osdinput @@ -60,16 +63,11 @@ ifndef TESTAPP SRC += $(OPSYSTEM)/cm3_fault_handlers.c #endif + ## Misc library functions SRC += $(FLIGHTLIB)/printf2.c SRC += $(FLIGHTLIB)/WorldMagModel.c -else - ## Test Code - SRC += $(OPTESTS)/test_common.c - SRC += $(OPTESTS)/$(TESTAPP).c -endif -## UAVObjects -ifndef TESTAPP + ## UAVObjects SRC += $(OPUAVSYNTHDIR)/objectpersistence.c SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c @@ -92,7 +90,12 @@ ifndef TESTAPP SRC += $(OPUAVSYNTHDIR)/osdsettings.c SRC += $(OPUAVSYNTHDIR)/baroaltitude.c SRC += $(OPUAVSYNTHDIR)/magnetometer.c +else + ## Test Code + SRC += $(OPTESTS)/test_common.c + SRC += $(OPTESTS)/$(TESTAPP).c endif + # Optional component libraries include $(PIOS)/Common/Libraries/dosfs/library.mk diff --git a/flight/targets/OSD/System/inc/pios_config.h b/flight/targets/OSD/System/inc/pios_config.h index d81d6074a..92fc3ee9b 100644 --- a/flight/targets/OSD/System/inc/pios_config.h +++ b/flight/targets/OSD/System/inc/pios_config.h @@ -39,8 +39,14 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ -/* PIOS system functions */ +/* PIOS FreeRTOS support */ #define PIOS_INCLUDE_FREERTOS + +/* PIOS bootloader helper */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ + +/* PIOS system functions */ #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL #define PIOS_INCLUDE_SYS @@ -81,10 +87,14 @@ /* PIOS receiver drivers */ /* #define PIOS_INCLUDE_PWM */ /* #define PIOS_INCLUDE_PPM */ +/* #define PIOS_INCLUDE_PPM_FLEXI */ /* #define PIOS_INCLUDE_DSM */ /* #define PIOS_INCLUDE_SBUS */ /* #define PIOS_INCLUDE_GCSRCVR */ +/* PIOS abstract receiver interface */ +/* #define PIOS_INCLUDE_RCVR */ + /* PIOS common peripherals */ #define PIOS_INCLUDE_LED #define PIOS_INCLUDE_IAP @@ -98,15 +108,18 @@ /* #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS */ /* #define FLASH_FREERTOS */ /* #define PIOS_INCLUDE_FLASH_EEPROM */ + +/* PIOS radio modules */ /* #define PIOS_INCLUDE_RFM22B */ -/* #define PIOS_INCLUDE_PACKET_HANDLER */ +/* #define PIOS_INCLUDE_RFM22B_COM */ +/* #define PIOS_INCLUDE_RFM22B_RCVR */ +/* #define PIOS_INCLUDE_PPM_OUT */ +/* #define PIOS_RFM22B_DEBUG_ON_TELEM */ + #define PIOS_INCLUDE_VIDEO /* #define PIOS_INCLUDE_WAVE */ /* #define PIOS_INCLUDE_UDP */ -/* PIOS abstract receiver interface */ -/* #define PIOS_INCLUDE_RCVR */ - /* PIOS abstract comms interface with options */ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ @@ -121,9 +134,8 @@ #define PIOS_INCLUDE_GPS_UBX_PARSER #define PIOS_GPS_SETS_HOMELOCATION -/* PIOS bootloader helper */ -#define PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +/* Stabilization options */ +#define PIOS_QUATERNION_STABILIZATION /* Performance counters */ #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 8379692 @@ -144,9 +156,6 @@ /* #define PIOS_TELEM_STACK_SIZE 500 */ /* #define PIOS_EVENTDISPATCHER_STACK_SIZE 130 */ -/* Stabilization options */ -#define PIOS_QUATERNION_STABILIZATION - /* This can't be too high to stop eventdispatcher thread overflowing */ /* #define PIOS_EVENTDISAPTCHER_QUEUE 10 */ diff --git a/flight/targets/PipXtreme/Makefile b/flight/targets/PipXtreme/Makefile index 17577da68..8eeb6195b 100644 --- a/flight/targets/PipXtreme/Makefile +++ b/flight/targets/PipXtreme/Makefile @@ -23,6 +23,9 @@ endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk +# ARM DSP library +override USE_DSP_LIB := NO + # List of mandatory modules to include MODULES += RadioComBridge @@ -40,18 +43,16 @@ ifndef TESTAPP SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/eventdispatcher.c -else - ## Test Code - SRC += $(OPTESTS)/test_common.c - SRC += $(OPTESTS)/$(TESTAPP).c -endif -## UAVObjects -ifndef TESTAPP + ## UAVObjects SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c SRC += $(OPUAVSYNTHDIR)/oplinkstatus.c SRC += $(OPUAVSYNTHDIR)/oplinksettings.c SRC += $(OPUAVSYNTHDIR)/objectpersistence.c +else + ## Test Code + SRC += $(OPTESTS)/test_common.c + SRC += $(OPTESTS)/$(TESTAPP).c endif # Optional component libraries diff --git a/flight/targets/PipXtreme/System/inc/FreeRTOSConfig.h b/flight/targets/PipXtreme/System/inc/FreeRTOSConfig.h index 0c515b7f7..d83deb7bb 100755 --- a/flight/targets/PipXtreme/System/inc/FreeRTOSConfig.h +++ b/flight/targets/PipXtreme/System/inc/FreeRTOSConfig.h @@ -76,7 +76,7 @@ NVIC value of 255. */ #endif /* Enable run time stats collection */ -#if defined(STACK_DIAGNOSTICS) +#if defined(DIAG_STACK) #define configCHECK_FOR_STACK_OVERFLOW 2 #define configGENERATE_RUN_TIME_STATS 1 diff --git a/flight/targets/PipXtreme/System/inc/pios_config.h b/flight/targets/PipXtreme/System/inc/pios_config.h index 625a1b623..88feadc80 100755 --- a/flight/targets/PipXtreme/System/inc/pios_config.h +++ b/flight/targets/PipXtreme/System/inc/pios_config.h @@ -39,8 +39,14 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ -/* PIOS system functions */ +/* PIOS FreeRTOS support */ #define PIOS_INCLUDE_FREERTOS + +/* PIOS bootloader helper */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ + +/* PIOS system functions */ #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL #define PIOS_INCLUDE_SYS @@ -81,10 +87,14 @@ /* PIOS receiver drivers */ /* #define PIOS_INCLUDE_PWM */ #define PIOS_INCLUDE_PPM +/* #define PIOS_INCLUDE_PPM_FLEXI */ /* #define PIOS_INCLUDE_DSM */ /* #define PIOS_INCLUDE_SBUS */ /* #define PIOS_INCLUDE_GCSRCVR */ +/* PIOS abstract receiver interface */ +#define PIOS_INCLUDE_RCVR + /* PIOS common peripherals */ #define PIOS_INCLUDE_LED #define PIOS_INCLUDE_IAP @@ -98,19 +108,19 @@ /* #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS */ /* #define FLASH_FREERTOS */ #define PIOS_INCLUDE_FLASH_EEPROM + +/* PIOS radio modules */ #define PIOS_INCLUDE_RFM22B -#define PIOS_INCLUDE_PACKET_HANDLER +#define PIOS_INCLUDE_RFM22B_COM +/* #define PIOS_INCLUDE_RFM22B_RCVR */ #define PIOS_INCLUDE_PPM_OUT -/* Turn on debugging signals on the telemetry port */ /* #define PIOS_RFM22B_DEBUG_ON_TELEM */ +/* PIOS misc peripherals */ /* #define PIOS_INCLUDE_VIDEO */ /* #define PIOS_INCLUDE_WAVE */ /* #define PIOS_INCLUDE_UDP */ -/* PIOS abstract receiver interface */ -#define PIOS_INCLUDE_RCVR - /* PIOS abstract comms interface with options */ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ @@ -125,9 +135,8 @@ /* #define PIOS_INCLUDE_GPS_UBX_PARSER */ /* #define PIOS_GPS_SETS_HOMELOCATION */ -/* PIOS bootloader helper */ -#define PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +/* Stabilization options */ +/* #define PIOS_QUATERNION_STABILIZATION */ /* Performance counters */ #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 @@ -148,9 +157,6 @@ #define PIOS_TELEM_STACK_SIZE 500 #define PIOS_EVENTDISPATCHER_STACK_SIZE 130 -/* Stabilization options */ -/* #define PIOS_QUATERNION_STABILIZATION */ - /* This can't be too high to stop eventdispatcher thread overflowing */ #define PIOS_EVENTDISAPTCHER_QUEUE 10 diff --git a/flight/targets/RevoMini/Makefile b/flight/targets/RevoMini/Makefile index b883e6a0c..cd0eb15dc 100644 --- a/flight/targets/RevoMini/Makefile +++ b/flight/targets/RevoMini/Makefile @@ -24,6 +24,9 @@ endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk +# ARM DSP library +USE_DSP_LIB ?= NO + # List of mandatory modules to include MODULES += Sensors MODULES += Attitude/revolution @@ -41,16 +44,16 @@ MODULES += FirmwareIAP MODULES += Radio MODULES += PathPlanner MODULES += FixedWingPathFollower -#MODULES += VtolPathFollower ## OP-700: VtolPathFollower disabled because its currently unsafe - remove this line once Sambas code has been merged MODULES += Telemetry +#MODULES += VtolPathFollower ## OP-700: VtolPathFollower disabled because its currently unsafe - remove this line once Sambas code has been merged OPTMODULES = # Include all camera options CDEFS += -DUSE_INPUT_LPF -DUSE_GIMBAL_LPF -DUSE_GIMBAL_FF -# All diagnostics -CDEFS += -DDIAGNOSTICS -DDIAG_TASKS +# Some diagnostics +CDEFS += -DDIAG_TASKS # Misc options CFLAGS += -ffast-math @@ -73,21 +76,20 @@ ifndef TESTAPP SRC += $(OPSYSTEM)/cm3_fault_handlers.c #endif + ## Misc library functions SRC += $(FLIGHTLIB)/paths.c SRC += $(FLIGHTLIB)/WorldMagModel.c SRC += $(FLIGHTLIB)/insgps13state.c + + ## UAVObjects + include ./UAVObjects.inc + SRC += $(UAVOBJSRC) else ## Test Code SRC += $(OPTESTS)/test_common.c SRC += $(OPTESTS)/$(TESTAPP).c endif -## UAVObjects -ifndef TESTAPP - include ./UAVObjects.inc - SRC += $(UAVOBJSRC) -endif - # Optional component libraries include $(FLIGHTLIB)/rscode/library.mk diff --git a/flight/targets/RevoMini/Makefile.osx b/flight/targets/RevoMini/Makefile.osx index e7389be30..8786bd7c1 100644 --- a/flight/targets/RevoMini/Makefile.osx +++ b/flight/targets/RevoMini/Makefile.osx @@ -308,7 +308,6 @@ ifeq ($(DEBUG),YES) CFLAGS = -g$(DEBUGF) -DDEBUG endif -CFLAGS += -DDIAGNOSTICS CFLAGS += -DDIAG_TASKS CFLAGS += $(CFLAGS_UAVOBJECTS) diff --git a/flight/targets/RevoMini/System/inc/pios_config.h b/flight/targets/RevoMini/System/inc/pios_config.h index cefdad1a5..4a92e7965 100644 --- a/flight/targets/RevoMini/System/inc/pios_config.h +++ b/flight/targets/RevoMini/System/inc/pios_config.h @@ -39,8 +39,14 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ -/* PIOS system functions */ +/* PIOS FreeRTOS support */ #define PIOS_INCLUDE_FREERTOS + +/* PIOS bootloader helper */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ + +/* PIOS system functions */ #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL #define PIOS_INCLUDE_SYS @@ -81,10 +87,14 @@ /* PIOS receiver drivers */ #define PIOS_INCLUDE_PWM #define PIOS_INCLUDE_PPM +/* #define PIOS_INCLUDE_PPM_FLEXI */ #define PIOS_INCLUDE_DSM #define PIOS_INCLUDE_SBUS #define PIOS_INCLUDE_GCSRCVR +/* PIOS abstract receiver interface */ +#define PIOS_INCLUDE_RCVR + /* PIOS common peripherals */ #define PIOS_INCLUDE_LED #define PIOS_INCLUDE_IAP @@ -98,16 +108,19 @@ #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS #define FLASH_FREERTOS /* #define PIOS_INCLUDE_FLASH_EEPROM */ + +/* PIOS radio modules */ #define PIOS_INCLUDE_RFM22B #define PIOS_INCLUDE_RFM22B_COM #define PIOS_INCLUDE_RFM22B_RCVR +/* #define PIOS_INCLUDE_PPM_OUT */ +/* #define PIOS_RFM22B_DEBUG_ON_TELEM */ + +/* PIOS misc peripherals */ /* #define PIOS_INCLUDE_VIDEO */ /* #define PIOS_INCLUDE_WAVE */ /* #define PIOS_INCLUDE_UDP */ -/* PIOS abstract receiver interface */ -#define PIOS_INCLUDE_RCVR - /* PIOS abstract comms interface with options */ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ @@ -122,9 +135,8 @@ #define PIOS_INCLUDE_GPS_UBX_PARSER #define PIOS_GPS_SETS_HOMELOCATION -/* PIOS bootloader helper */ -#define PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +/* Stabilization options */ +/* #define PIOS_QUATERNION_STABILIZATION */ /* Performance counters */ #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 8379692 @@ -145,9 +157,6 @@ /* #define PIOS_TELEM_STACK_SIZE 500 */ /* #define PIOS_EVENTDISPATCHER_STACK_SIZE 130 */ -/* Stabilization options */ -/* #define PIOS_QUATERNION_STABILIZATION */ - /* This can't be too high to stop eventdispatcher thread overflowing */ #define PIOS_EVENTDISAPTCHER_QUEUE 10 diff --git a/flight/targets/Revolution/Makefile b/flight/targets/Revolution/Makefile index c0aae6765..4f0ecf458 100644 --- a/flight/targets/Revolution/Makefile +++ b/flight/targets/Revolution/Makefile @@ -24,6 +24,9 @@ endif include $(ROOT_DIR)/make/boards/$(BOARD_NAME)/board-info.mk include $(ROOT_DIR)/make/firmware-defs.mk +# ARM DSP library +USE_DSP_LIB ?= NO + # List of mandatory modules to include MODULES += Sensors MODULES += Attitude/revolution @@ -34,24 +37,23 @@ MODULES += Stabilization MODULES += ManualControl MODULES += Actuator MODULES += GPS -#MODULES += TxPID MODULES += CameraStab -#MODULES += Battery MODULES += FirmwareIAP -#MODULES += Radio MODULES += PathPlanner MODULES += FixedWingPathFollower -#MODULES += VtolPathFollower ## OP-700: VtolPathFollower disabled because its currently unsafe - remove this line once Sambas code has been merged MODULES += OveroSync MODULES += Telemetry +#MODULES += VtolPathFollower ## OP-700: VtolPathFollower disabled because its currently unsafe - remove this line once Sambas code has been merged +#MODULES += Battery +#MODULES += TxPID OPTMODULES = # Include all camera options CDEFS += -DUSE_INPUT_LPF -DUSE_GIMBAL_LPF -DUSE_GIMBAL_FF -# All diagnostics -CDEFS += -DDIAGNOSTICS -DDIAG_TASKS +# Some diagnostics +CDEFS += -DDIAG_TASKS # Misc options CFLAGS += -ffast-math @@ -74,20 +76,19 @@ ifndef TESTAPP SRC += $(OPSYSTEM)/cm3_fault_handlers.c #endif + ## Misc library functions SRC += $(FLIGHTLIB)/paths.c SRC += $(FLIGHTLIB)/WorldMagModel.c SRC += $(FLIGHTLIB)/insgps13state.c + + ## UAVObjects + include ./UAVObjects.inc + SRC += $(UAVOBJSRC) else ## Test Code SRC += $(OPTESTS)/test_common.c SRC += $(OPTESTS)/$(TESTAPP).c endif -## UAVObjects -ifndef TESTAPP - include ./UAVObjects.inc - SRC += $(UAVOBJSRC) -endif - include $(ROOT_DIR)/make/apps-defs.mk include $(ROOT_DIR)/make/common-defs.mk diff --git a/flight/targets/Revolution/Makefile.osx b/flight/targets/Revolution/Makefile.osx index 4a48fc9dc..180b3b3df 100644 --- a/flight/targets/Revolution/Makefile.osx +++ b/flight/targets/Revolution/Makefile.osx @@ -311,7 +311,6 @@ ifeq ($(DEBUG),YES) CFLAGS += -g$(DEBUGF) -DDEBUG endif -CFLAGS += -DDIAGNOSTICS CFLAGS += -DDIAG_TASKS CFLAGS += $(CFLAGS_UAVOBJECTS) diff --git a/flight/targets/Revolution/System/inc/pios_config.h b/flight/targets/Revolution/System/inc/pios_config.h index 2e86ecb79..575017d73 100644 --- a/flight/targets/Revolution/System/inc/pios_config.h +++ b/flight/targets/Revolution/System/inc/pios_config.h @@ -39,8 +39,14 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ -/* PIOS system functions */ +/* PIOS FreeRTOS support */ #define PIOS_INCLUDE_FREERTOS + +/* PIOS bootloader helper */ +#define PIOS_INCLUDE_BL_HELPER +/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ + +/* PIOS system functions */ #define PIOS_INCLUDE_DELAY #define PIOS_INCLUDE_INITCALL #define PIOS_INCLUDE_SYS @@ -81,10 +87,14 @@ /* PIOS receiver drivers */ #define PIOS_INCLUDE_PWM #define PIOS_INCLUDE_PPM +/* #define PIOS_INCLUDE_PPM_FLEXI */ #define PIOS_INCLUDE_DSM #define PIOS_INCLUDE_SBUS #define PIOS_INCLUDE_GCSRCVR +/* PIOS abstract receiver interface */ +#define PIOS_INCLUDE_RCVR + /* PIOS common peripherals */ #define PIOS_INCLUDE_LED #define PIOS_INCLUDE_IAP @@ -98,15 +108,19 @@ #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS #define FLASH_FREERTOS /* #define PIOS_INCLUDE_FLASH_EEPROM */ + +/* PIOS radio modules */ /* #define PIOS_INCLUDE_RFM22B */ -/* #define PIOS_INCLUDE_PACKET_HANDLER */ +/* #define PIOS_INCLUDE_RFM22B_COM */ +/* #define PIOS_INCLUDE_RFM22B_RCVR */ +/* #define PIOS_INCLUDE_PPM_OUT */ +/* #define PIOS_RFM22B_DEBUG_ON_TELEM */ + +/* PIOS misc peripherals */ /* #define PIOS_INCLUDE_VIDEO */ /* #define PIOS_INCLUDE_WAVE */ /* #define PIOS_INCLUDE_UDP */ -/* PIOS abstract receiver interface */ -#define PIOS_INCLUDE_RCVR - /* PIOS abstract comms interface with options */ #define PIOS_INCLUDE_COM /* #define PIOS_INCLUDE_COM_MSG */ @@ -121,9 +135,8 @@ #define PIOS_INCLUDE_GPS_UBX_PARSER #define PIOS_GPS_SETS_HOMELOCATION -/* PIOS bootloader helper */ -#define PIOS_INCLUDE_BL_HELPER -/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */ +/* Stabilization options */ +/* #define PIOS_QUATERNION_STABILIZATION */ /* Performance counters */ #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 8379692 @@ -144,9 +157,6 @@ /* #define PIOS_TELEM_STACK_SIZE 500 */ /* #define PIOS_EVENTDISPATCHER_STACK_SIZE 130 */ -/* Stabilization options */ -/* #define PIOS_QUATERNION_STABILIZATION */ - /* This can't be too high to stop eventdispatcher thread overflowing */ #define PIOS_EVENTDISAPTCHER_QUEUE 10 diff --git a/make/apps-defs.mk b/make/apps-defs.mk index a73d60716..b162a906e 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -20,23 +20,6 @@ ifndef OPENPILOT_IS_COOL $(error Top level Makefile must be used to build this target) endif -# Set developer code and compile options. -# Set to YES to compile for debugging -DEBUG ?= NO - -# Set to YES to use the Servo output pins for debugging via scope or logic analyser -ENABLE_DEBUG_PINS ?= NO - -# Include objects that are just nice information to show -STACK_DIAGNOSTICS ?= NO -MIXERSTATUS_DIAGNOSTICS ?= NO -RATEDESIRED_DIAGNOSTICS ?= NO -I2C_WDG_STATS_DIAGNOSTICS ?= NO -DIAG_TASKS ?= NO - -# Or just turn on all the above diagnostics. WARNING: this consumes massive amounts of memory. -ALL_DIGNOSTICS ?= NO - # Paths TOPDIR = . OPSYSTEM = $(TOPDIR)/System @@ -100,26 +83,26 @@ SRC += $(PIOSCOMMON)/pios_flash_jedec.c SRC += $(PIOSCOMMON)/pios_rcvr.c SRC += $(PIOSCOMMON)/pios_rfm22b.c SRC += $(PIOSCOMMON)/pios_rfm22b_com.c +SRC += $(PIOSCOMMON)/pios_rfm22b_rcvr.c SRC += $(PIOSCOMMON)/pios_sbus.c SRC += $(PIOSCOMMON)/pios_sdcard.c -# PIOS USB related files +## PIOS USB related files SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c SRC += $(PIOSCOMMON)/pios_usb_util.c -## Libraries for flight calculations +## Misc library functions SRC += $(FLIGHTLIB)/fifo_buffer.c SRC += $(FLIGHTLIB)/taskmonitor.c -SRC += $(FLIGHTLIB)/packet_handler.c SRC += $(FLIGHTLIB)/sanitycheck.c SRC += $(FLIGHTLIB)/CoordinateConversions.c SRC += $(MATHLIB)/sin_lookup.c SRC += $(MATHLIB)/pid.c ## Modules -SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -SRC += ${foreach MOD, ${OPTMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} +SRC += $(foreach mod, $(MODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) +SRC += $(foreach mod, $(OPTMODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) # List C source files here which must be compiled in ARM-Mode (no -mthumb). # Use file-extension c for "c-only"-files @@ -182,28 +165,6 @@ CFLAGS += # Declare all non-optional modules as built-in to force inclusion CDEFS += $(foreach mod, $(notdir $(MODULES)), -DMODULE_$(mod)_BUILTIN) -# The following Makefile command, ifneq (,$(filter) $(A), $(B) $(C)) -# is equivalent to the pseudocode `if (A == B || A == C)` -ifneq (,$(filter YES,$(STACK_DIAGNOSTICS) $(ALL_DIGNOSTICS))) - CFLAGS += -DSTACK_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(MIXERSTATUS_DIAGNOSTICS) $(ALL_DIGNOSTICS))) - CFLAGS += -DMIXERSTATUS_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(RATEDESIRED_DIAGNOSTICS) $(ALL_DIGNOSTICS))) - CFLAGS += -DRATEDESIRED_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(I2C_WDG_STATS_DIAGNOSTICS) $(ALL_DIGNOSTICS))) - CFLAGS += -DI2C_WDG_STATS_DIAGNOSTICS -endif - -ifneq (,$(filter YES,$(DIAG_TASKS) $(ALL_DIGNOSTICS))) - CFLAGS += -DDIAG_TASKS -endif - # Set linker-script name depending on selected submodel name ifeq ($(MCU),cortex-m3) LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_memory.ld diff --git a/make/boot-defs.mk b/make/boot-defs.mk index 410a6401e..5c0bbf32e 100644 --- a/make/boot-defs.mk +++ b/make/boot-defs.mk @@ -20,16 +20,6 @@ ifndef OPENPILOT_IS_COOL $(error Top level Makefile must be used to build this target) endif -# Set developer code and compile options. -# Set to YES to compile for debugging -DEBUG ?= NO - -# Set to YES to use the Servo output pins for debugging via scope or logic analyser -ENABLE_DEBUG_PINS ?= NO - -# Set to YES to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs -ENABLE_AUX_UART ?= NO - # Paths TOPDIR = . OPSYSTEM = $(TOPDIR) @@ -39,6 +29,9 @@ PIOSCOMMON = $(PIOS)/Common PIOSBOARDS = $(PIOS)/Boards FLIGHTLIBINC = $(FLIGHTLIB)/inc +# ARM DSP library +override USE_DSP_LIB := NO + ## PIOS Hardware ifeq ($(MCU),cortex-m3) include $(PIOS)/STM32F10x/library.mk @@ -124,7 +117,7 @@ BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) # Compiler flags -CFLAGS += $(BLONLY_CDEFS) +CDEFS += $(BLONLY_CDEFS) # Set linker-script name depending on selected submodel name ifeq ($(MCU),cortex-m3) diff --git a/make/common-defs.mk b/make/common-defs.mk index 7e27350e1..60be74a6f 100644 --- a/make/common-defs.mk +++ b/make/common-defs.mk @@ -20,6 +20,25 @@ ifndef OPENPILOT_IS_COOL $(error Top level Makefile must be used to build this target) endif +# Set to YES to compile for debugging +DEBUG ?= NO + +# Set to YES to use the Servo output pins for debugging via scope or logic analyser +ENABLE_DEBUG_PINS ?= NO + +# Set to YES to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs +ENABLE_AUX_UART ?= NO + +# Include objects that are just nice information to show +DIAG_STACK ?= NO +DIAG_MIXERSTATUS ?= NO +DIAG_RATEDESIRED ?= NO +DIAG_I2C_WDG_STATS ?= NO +DIAG_TASKS ?= NO + +# Or just turn on all the above diagnostics. WARNING: this consumes massive amounts of memory. +DIAG_ALL ?= NO + # Optimization level, can be [0, 1, 2, 3, s]. # 0 = turn off optimization. s = optimize for size. # Note: 3 is not always the best optimization level. @@ -50,6 +69,28 @@ ifeq ($(ENABLE_AUX_UART), YES) CDEFS += -DPIOS_ENABLE_AUX_UART endif +# The following Makefile command, ifneq (,$(filter) $(A), $(B) $(C)) +# is equivalent to the pseudocode `if (A == B || A == C)` +ifneq (,$(filter YES,$(DIAG_STACK) $(DIAG_ALL))) + CFLAGS += -DDIAG_STACK +endif + +ifneq (,$(filter YES,$(DIAG_MIXERSTATUS) $(DIAG_ALL))) + CFLAGS += -DDIAG_MIXERSTATUS +endif + +ifneq (,$(filter YES,$(DIAG_RATEDESIRED) $(DIAG_ALL))) + CFLAGS += -DDIAG_RATEDESIRED +endif + +ifneq (,$(filter YES,$(DIAG_I2C_WDG_STATS) $(DIAG_ALL))) + CFLAGS += -DDIAG_I2C_WDG_STATS +endif + +ifneq (,$(filter YES,$(DIAG_TASKS) $(DIAG_ALL))) + CFLAGS += -DDIAG_TASKS +endif + # Place project-specific -D and/or -U options for Assembler with preprocessor here. #ADEFS = -DUSE_IRQ_ASM_WRAPPER ADEFS = -D__ASSEMBLY__ @@ -235,4 +276,4 @@ $(shell $(MKDIR) -p $(OUTDIR) 2>/dev/null) -include $(shell $(MKDIR) -p $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) # Listing of phony targets. -.PHONY : all build clean install +.PHONY: all build clean install diff --git a/make/firmware-defs.mk b/make/firmware-defs.mk index 2330a6ef0..6da1281ef 100644 --- a/make/firmware-defs.mk +++ b/make/firmware-defs.mk @@ -40,34 +40,33 @@ else endif # Define Messages -# English -MSG_FORMATERROR = ${QUOTE} Can not handle output-format${QUOTE} -MSG_MODINIT = ${QUOTE} MODINIT $(MSG_EXTRA) ${QUOTE} -MSG_SIZE = ${QUOTE} SIZE $(MSG_EXTRA) ${QUOTE} -MSG_LOAD_FILE = ${QUOTE} BIN/HEX $(MSG_EXTRA) ${QUOTE} -MSG_BIN_OBJ = ${QUOTE} BINO $(MSG_EXTRA) ${QUOTE} -MSG_STRIP_FILE = ${QUOTE} STRIP $(MSG_EXTRA) ${QUOTE} -MSG_EXTENDED_LISTING = ${QUOTE} LIS $(MSG_EXTRA) ${QUOTE} -MSG_SYMBOL_TABLE = ${QUOTE} NM $(MSG_EXTRA) ${QUOTE} -MSG_ARCHIVING = ${QUOTE} AR $(MSG_EXTRA) ${QUOTE} -MSG_LINKING = ${QUOTE} LD $(MSG_EXTRA) ${QUOTE} -MSG_COMPILING = ${QUOTE} CC $(MSG_EXTRA) ${QUOTE} -MSG_COMPILING_ARM = ${QUOTE} CC-ARM $(MSG_EXTRA) ${QUOTE} -MSG_COMPILINGCXX = ${QUOTE} CXX $(MSG_EXTRA) ${QUOTE} -MSG_COMPILINGCXX_ARM = ${QUOTE} CXX-ARM $(MSG_EXTRA) ${QUOTE} -MSG_ASSEMBLING = ${QUOTE} AS $(MSG_EXTRA) ${QUOTE} -MSG_ASSEMBLING_ARM = ${QUOTE} AS-ARM $(MSG_EXTRA) ${QUOTE} -MSG_CLEANING = ${QUOTE} CLEAN $(MSG_EXTRA) ${QUOTE} -MSG_ASMFROMC = ${QUOTE} AS(C) $(MSG_EXTRA) ${QUOTE} -MSG_ASMFROMC_ARM = ${QUOTE} AS(C)-ARM $(MSG_EXTRA) ${QUOTE} -MSG_PYMITEINIT = ${QUOTE} PY $(MSG_EXTRA) ${QUOTE} -MSG_INSTALLING = ${QUOTE} INSTALL $(MSG_EXTRA) ${QUOTE} -MSG_OPFIRMWARE = ${QUOTE} OPFW $(MSG_EXTRA) ${QUOTE} -MSG_FWINFO = ${QUOTE} FWINFO $(MSG_EXTRA) ${QUOTE} -MSG_JTAG_PROGRAM = ${QUOTE} JTAG-PGM $(MSG_EXTRA) ${QUOTE} -MSG_JTAG_WIPE = ${QUOTE} JTAG-WIPE $(MSG_EXTRA) ${QUOTE} -MSG_PADDING = ${QUOTE} PADDING $(MSG_EXTRA) ${QUOTE} -MSG_FLASH_IMG = ${QUOTE} FLASH_IMG $(MSG_EXTRA) ${QUOTE} +MSG_FORMATERROR = $(QUOTE) Can not handle output-format$(QUOTE) +MSG_MODINIT = $(QUOTE) MODINIT $(MSG_EXTRA) $(QUOTE) +MSG_SIZE = $(QUOTE) SIZE $(MSG_EXTRA) $(QUOTE) +MSG_LOAD_FILE = $(QUOTE) BIN/HEX $(MSG_EXTRA) $(QUOTE) +MSG_BIN_OBJ = $(QUOTE) BINO $(MSG_EXTRA) $(QUOTE) +MSG_STRIP_FILE = $(QUOTE) STRIP $(MSG_EXTRA) $(QUOTE) +MSG_EXTENDED_LISTING = $(QUOTE) LIS $(MSG_EXTRA) $(QUOTE) +MSG_SYMBOL_TABLE = $(QUOTE) NM $(MSG_EXTRA) $(QUOTE) +MSG_ARCHIVING = $(QUOTE) AR $(MSG_EXTRA) $(QUOTE) +MSG_LINKING = $(QUOTE) LD $(MSG_EXTRA) $(QUOTE) +MSG_COMPILING = $(QUOTE) CC $(MSG_EXTRA) $(QUOTE) +MSG_COMPILING_ARM = $(QUOTE) CC-ARM $(MSG_EXTRA) $(QUOTE) +MSG_COMPILINGCXX = $(QUOTE) CXX $(MSG_EXTRA) $(QUOTE) +MSG_COMPILINGCXX_ARM = $(QUOTE) CXX-ARM $(MSG_EXTRA) $(QUOTE) +MSG_ASSEMBLING = $(QUOTE) AS $(MSG_EXTRA) $(QUOTE) +MSG_ASSEMBLING_ARM = $(QUOTE) AS-ARM $(MSG_EXTRA) $(QUOTE) +MSG_CLEANING = $(QUOTE) CLEAN $(MSG_EXTRA) $(QUOTE) +MSG_ASMFROMC = $(QUOTE) AS(C) $(MSG_EXTRA) $(QUOTE) +MSG_ASMFROMC_ARM = $(QUOTE) AS(C)-ARM $(MSG_EXTRA) $(QUOTE) +MSG_PYMITEINIT = $(QUOTE) PY $(MSG_EXTRA) $(QUOTE) +MSG_INSTALLING = $(QUOTE) INSTALL $(MSG_EXTRA) $(QUOTE) +MSG_OPFIRMWARE = $(QUOTE) OPFW $(MSG_EXTRA) $(QUOTE) +MSG_FWINFO = $(QUOTE) FWINFO $(MSG_EXTRA) $(QUOTE) +MSG_JTAG_PROGRAM = $(QUOTE) JTAG-PGM $(MSG_EXTRA) $(QUOTE) +MSG_JTAG_WIPE = $(QUOTE) JTAG-WIPE $(MSG_EXTRA) $(QUOTE) +MSG_PADDING = $(QUOTE) PADDING $(MSG_EXTRA) $(QUOTE) +MSG_FLASH_IMG = $(QUOTE) FLASH_IMG $(MSG_EXTRA) $(QUOTE) # Function for converting an absolute path to one relative # to the top of the source tree. @@ -210,9 +209,10 @@ else # limitation. It is assumed that if the object files directory # is given, all object files are in that directory. $(V1) ( \ - pushd $(3) >/dev/null && \ + pwd=`pwd` && \ + cd $(3) && \ $(AR) rcs $$@ $(notdir $(2)) && \ - popd >/dev/null \ + cd $$$${pwd} >/dev/null \ ) endif endef diff --git a/make/tools.mk b/make/tools.mk index 6ec2b4d20..402a4b1a3 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -340,4 +340,3 @@ gtest_install: gtest_clean gtest_clean: $(V0) @echo " CLEAN $(GTEST_DIR)" $(V1) [ ! -d "$(GTEST_DIR)" ] || $(RM) -rf "$(GTEST_DIR)" - diff --git a/package/linux/deb_common/rules b/package/linux/deb_common/rules index 540b29109..4f0fcdf26 100644 --- a/package/linux/deb_common/rules +++ b/package/linux/deb_common/rules @@ -44,7 +44,7 @@ install: cp -arp package/linux/openpilot_menu.menu debian/openpilot/etc/xdg/menus/applications-merged cp -arp package/linux/openpilot_menu.directory debian/openpilot/usr/share/desktop-directories ifdef PACKAGE_DIR - cp -a $(PACKAGE_DIR)/*.opfw debian/openpilot/usr/local/OpenPilot/firmware/ + cp -a $(PACKAGE_DIR)/* debian/openpilot/usr/local/OpenPilot/firmware/ else $(error PACKAGE_DIR not defined! $(PACKAGE_DIR)) endif diff --git a/package/osx/package b/package/osx/package index 73a80a835..0faf1c618 100755 --- a/package/osx/package +++ b/package/osx/package @@ -20,14 +20,8 @@ device=$(hdiutil attach "${TEMP_FILE}" | \ # packaging goes here cp -r "${APP_PATH}" "/Volumes/${VOL_NAME}" -#cp -r "${FW_DIR}" "/Volumes/${VOL_NAME}/firmware" -cp "${FW_DIR}/fw_coptercontrol-${PACKAGE_LBL}.opfw" "/Volumes/${VOL_NAME}/Firmware" -cp "${FW_DIR}/fw_revomini-${PACKAGE_LBL}.opfw" "/Volumes/${VOL_NAME}/Firmware" -cp "${FW_DIR}/fw_pipxtreme-${PACKAGE_LBL}.opfw" "/Volumes/${VOL_NAME}/Firmware" -cp "${FW_DIR}/fw_revolution-${PACKAGE_LBL}.opfw" "/Volumes/${VOL_NAME}/Firmware" - +ls "${FW_DIR}" | xargs -n 1 -I {} cp "${FW_DIR}/{}" "/Volumes/${VOL_NAME}/Firmware" cp "${BUILD_DIR}/uavobject-synthetics/matlab/OPLogConvert.m" "/Volumes/${VOL_NAME}/Utilities" - cp "${ROOT_DIR}/HISTORY.txt" "/Volumes/${VOL_NAME}" "${ROOT_DIR}/package/osx/libraries" \ diff --git a/package/winx86/openpilotgcs.nsi b/package/winx86/openpilotgcs.nsi index 48bf695f9..7d6dbbc69 100644 --- a/package/winx86/openpilotgcs.nsi +++ b/package/winx86/openpilotgcs.nsi @@ -1,7 +1,7 @@ # # Project: OpenPilot # NSIS configuration file for OpenPilot GCS -# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2010-2012. +# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2010-2013. # # 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 @@ -72,7 +72,7 @@ VIAddVersionKey "Comments" "${INSTALLER_NAME}. ${BUILD_DESCRIPTION}" VIAddVersionKey "CompanyName" "The OpenPilot Team, http://www.openpilot.org" VIAddVersionKey "LegalTrademarks" "${PRODUCT_NAME} is a trademark of The OpenPilot Team" - VIAddVersionKey "LegalCopyright" "© 2010-2012 The OpenPilot Team" + VIAddVersionKey "LegalCopyright" "© 2010-2013 The OpenPilot Team" VIAddVersionKey "FileDescription" "${INSTALLER_NAME}" ;-------------------------------- @@ -93,7 +93,7 @@ ;-------------------------------- ; Branding - BrandingText "© 2010-2012 The OpenPilot Team, http://www.openpilot.org" + BrandingText "© 2010-2013 The OpenPilot Team, http://www.openpilot.org" !define MUI_ICON "${NSIS_DATA_TREE}\resources\openpilot.ico" !define MUI_HEADERIMAGE From 30b362a5fae10589389fccdb9cdb065a70ac4789 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 24 Mar 2013 14:12:08 +0200 Subject: [PATCH 60/68] entire-flash.py: fix comment --- flight/targets/EntireFlash/entire-flash.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/targets/EntireFlash/entire-flash.py b/flight/targets/EntireFlash/entire-flash.py index b60f38005..0863451d1 100644 --- a/flight/targets/EntireFlash/entire-flash.py +++ b/flight/targets/EntireFlash/entire-flash.py @@ -18,7 +18,7 @@ def append(verbose, text, data): offset += len(data) def create_entire_flash(args): - """Generates entire flash image and prints it to stdout""" + """Generates entire flash image, prints image info and writes image to a file""" global image, offset assert args.bl_bank_base is not None From c2284d0c3fe7f906e5bb34e2c6fc373c335f3d23 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 24 Mar 2013 16:32:30 +0200 Subject: [PATCH 61/68] Makefile: fix package directory in the help message --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 65304d8af..67cc64622 100644 --- a/Makefile +++ b/Makefile @@ -971,5 +971,5 @@ help: @$(ECHO) @$(ECHO) " Note: All tools will be installed into $(TOOLS_DIR)" @$(ECHO) " All build output will be placed in $(BUILD_DIR)" - @$(ECHO) " Package will be placed into $(PKG_DIR)" + @$(ECHO) " Package will be placed into $(PACKAGE_DIR)" @$(ECHO) From 9f0710f9d5f6d7706f37a318627d2dd00b00231b Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sun, 24 Mar 2013 17:00:15 +0200 Subject: [PATCH 62/68] Makefile: add comment about Android GCS compatible version hashes --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 67cc64622..f7cca5298 100644 --- a/Makefile +++ b/Makefile @@ -587,6 +587,7 @@ androidgcs_clean: # Find the git hashes of each commit that changes uavobjects with: # git log --format=%h -- shared/uavobjectdefinition/ | head -n 2 # List only UAVO hashes of past releases, do not list current hash. +# Past compatible versions are so far: RELEASE-12.10.2 UAVO_GIT_VERSIONS := 5e14f53 # All versions includes also the current source tree UAVO hash From 8e7712a13f324c8886a51a4d4f46c8eddf1ebd80 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 25 Mar 2013 02:03:35 +0200 Subject: [PATCH 63/68] PyMite: fix nasty build bug with open file problem on Windows In fact, the cause of that error was badly written makefile rule which generated 5 same files 5 times. If used with make -j, it tried to open the same files for writing at the same time. Windows doesn't like this. This is fixed now. --- flight/Libraries/PyMite/pymite.mk | 94 ++++++++++++++++++++---------- flight/targets/RevoMini/Makefile | 1 + flight/targets/Revolution/Makefile | 3 + 3 files changed, 68 insertions(+), 30 deletions(-) diff --git a/flight/Libraries/PyMite/pymite.mk b/flight/Libraries/PyMite/pymite.mk index 02da15a5d..c009d416f 100644 --- a/flight/Libraries/PyMite/pymite.mk +++ b/flight/Libraries/PyMite/pymite.mk @@ -1,41 +1,75 @@ # -# Rules to add PYMite to a PiOS target +# Rules to add PyMite flight plan interpreter # -PYMITE = $(FLIGHTLIB)/PyMite -PYMITELIB = $(PYMITE)/lib -PYMITEPLAT = $(PYMITE)/platform/openpilot -PYMITETOOLS = $(PYMITE)/tools -PYMITEVM = $(PYMITE)/vm -PYMITEINC = $(PYMITEVM) -PYMITEINC += $(PYMITEPLAT) -PYMITEINC += $(OUTDIR) +# Paths +PYMITE := $(FLIGHTLIB)/PyMite +PYMITELIB := $(PYMITE)/lib +PYMITEPLAT := $(PYMITE)/platform/openpilot +PYMITETOOLS := $(PYMITE)/tools +PYMITEVM := $(PYMITE)/vm +PYMITEINC := $(PYMITEVM) +PYMITEINC += $(PYMITEPLAT) +PYMITEINC += $(OUTDIR) -# List C source files here. (C dependencies are automatically generated.) -# use file-extension c for "c-only"-files +# Flight plans +FLIGHTPLANLIB ?= $(OPMODULEDIR)/FlightPlan/lib +FLIGHTPLANS ?= $(OPMODULEDIR)/FlightPlan/flightplans -## PyMite files and modules -SRC += $(OUTDIR)/pmlib_img.c -SRC += $(OUTDIR)/pmlib_nat.c -SRC += $(OUTDIR)/pmlibusr_img.c -SRC += $(OUTDIR)/pmlibusr_nat.c -PYSRC += $(wildcard ${PYMITEVM}/*.c) -PYSRC += $(wildcard ${PYMITEPLAT}/*.c) -PYSRC += ${foreach MOD, ${PYMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -SRC += $(PYSRC) +# Extra modules +PYMODULES ?= FlightPlan -EXTRAINCDIRS += $(PYMITEINC) +# Modules +PYSRC += $(foreach mod, $(PYMODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) -# Generate intermediate code -gencode: ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h +# PyMite virtual machine and platform files +PYSRC += $(wildcard $(PYMITEVM)/*.c) +PYSRC += $(wildcard $(PYMITEPLAT)/*.c) -$(PYSRC): gencode +# Autogenerated files +PYLIB += $(addprefix $(OUTDIR)/, pmlib_img.c pmlib_nat.c) +PYLIB += $(addprefix $(OUTDIR)/, pmlibusr_img.c pmlibusr_nat.c) -PYTHON = python +# Scripts +PYSCRIPTS += $(wildcard $(PYMITELIB)/*.py) +PYSCRIPTS += $(wildcard $(PYMITEPLAT)/*.py) +PYSCRIPTS += $(wildcard $(FLIGHTPLANLIB)/*.py) +PYSCRIPTS += $(wildcard $(FLIGHTPLANS)/*.py) # Generate code for PyMite -${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h: $(wildcard ${PYMITELIB}/*.py) $(wildcard ${PYMITEPLAT}/*.py) $(wildcard ${FLIGHTPLANLIB}/*.py) $(wildcard ${FLIGHTPLANS}/*.py) - @echo $(MSG_PYMITEINIT) $(call toprel, $@) - @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py) - @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h - @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py +$(PYSRC): | $(PYLIB) $(OUTDIR)/pmfeatures.h + +$(OUTDIR)/pmfeatures.h: $(PYSCRIPTS) + @$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@) + $(V1) $(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $@ + +$(OUTDIR)/pmlib_img.c: | $(OUTDIR)/pmlib_nat.c + +$(OUTDIR)/pmlib_nat.c: $(PYSCRIPTS) + @$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@) + $(V1) $(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -c -s --memspace=flash \ + -f $(PYMITEPLAT)/pmfeatures.py \ + -o $(OUTDIR)/pmlib_img.c \ + --native-file=$(OUTDIR)/pmlib_nat.c \ + $(PYMITELIB)/list.py \ + $(PYMITELIB)/dict.py \ + $(PYMITELIB)/__bi.py \ + $(PYMITELIB)/sys.py \ + $(PYMITELIB)/string.py \ + $(wildcard $(FLIGHTPLANLIB)/*.py) + +$(OUTDIR)/pmlibusr_img.c: | $(OUTDIR)/pmlibusr_nat.c + +$(OUTDIR)/pmlibusr_nat.c: $(PYSCRIPTS) + @$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@) + $(V1) $(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -c -u \ + -f $(PYMITEPLAT)/pmfeatures.py \ + -o $(OUTDIR)/pmlibusr_img.c \ + --native-file=$(OUTDIR)/pmlibusr_nat.c \ + $(FLIGHTPLANS)/test.py + +# Add to the source and include lists +SRC += $(PYSRC) +SRC += $(PYLIB) +EXTRAINCDIRS += $(PYMITEINC) +EXTRAINCDIRS += $(foreach mod, $(PYMODULES), $(OPMODULEDIR)/$(mod)/inc) diff --git a/flight/targets/RevoMini/Makefile b/flight/targets/RevoMini/Makefile index cd0eb15dc..f432a535a 100644 --- a/flight/targets/RevoMini/Makefile +++ b/flight/targets/RevoMini/Makefile @@ -92,6 +92,7 @@ endif # Optional component libraries include $(FLIGHTLIB)/rscode/library.mk +#include $(FLIGHTLIB)/PyMite/pymite.mk include $(ROOT_DIR)/make/apps-defs.mk include $(ROOT_DIR)/make/common-defs.mk diff --git a/flight/targets/Revolution/Makefile b/flight/targets/Revolution/Makefile index 4f0ecf458..60ae27377 100644 --- a/flight/targets/Revolution/Makefile +++ b/flight/targets/Revolution/Makefile @@ -90,5 +90,8 @@ else SRC += $(OPTESTS)/$(TESTAPP).c endif +# Optional component libraries +#include $(FLIGHTLIB)/PyMite/pymite.mk + include $(ROOT_DIR)/make/apps-defs.mk include $(ROOT_DIR)/make/common-defs.mk From 17600ed09ff14a94206e87ae0d901e31271d650a Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 25 Mar 2013 02:59:40 +0200 Subject: [PATCH 64/68] PyMite: remove from simposix Makefile and use library instead --- flight/targets/SimPosix/Makefile | 37 ++------------------------------ 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/flight/targets/SimPosix/Makefile b/flight/targets/SimPosix/Makefile index a779b5f21..47b90c6ec 100644 --- a/flight/targets/SimPosix/Makefile +++ b/flight/targets/SimPosix/Makefile @@ -39,8 +39,6 @@ MODULES += CameraStab MODULES += Telemetry MODULES += FirmwareIAP #MODULES += OveroSync -PYMODULES = -#FlightPlan # Paths OPSYSTEM = ./System @@ -63,35 +61,16 @@ OPUAVOBJ = ../UAVObjects OPUAVOBJINC = $(OPUAVOBJ)/inc BOOT = BOOTINC = -PYMITE = $(FLIGHTLIB)/PyMite -PYMITELIB = $(PYMITE)/lib -PYMITEPLAT = $(PYMITE)/platform/openpilot -PYMITETOOLS = $(PYMITE)/tools -PYMITEVM = $(PYMITE)/vm -PYMITEINC = $(PYMITEVM) -PYMITEINC += $(PYMITEPLAT) -PYMITEINC += $(OUTDIR) -FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib -FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans HWDEFSINC = ../board_hw_defs/$(BOARD_NAME) UAVOBJSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight # optional component libraries include $(PIOS)/Common/Libraries/FreeRTOS/library.mk +include $(FLIGHTLIB)/PyMite/pymite.mk # List C source files here. (C dependencies are automatically generated.) # use file-extension c for "c-only"-files -## PyMite files and modules -SRC += $(OUTDIR)/pmlib_img.c -SRC += $(OUTDIR)/pmlib_nat.c -SRC += $(OUTDIR)/pmlibusr_img.c -SRC += $(OUTDIR)/pmlibusr_nat.c -PYSRC += $(wildcard ${PYMITEVM}/*.c) -PYSRC += $(wildcard ${PYMITEPLAT}/*.c) -PYSRC += ${foreach MOD, ${PYMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} -SRC += $(PYSRC) - ## MODULES SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} SRC += ${OUTDIR}/InitMods.c @@ -139,21 +118,9 @@ EXTRAINCDIRS += $(PIOSBOARDS) EXTRAINCDIRS += $(CMSISDIR) EXTRAINCDIRS += $(OPUAVSYNTHDIR) EXTRAINCDIRS += $(BOOTINC) -EXTRAINCDIRS += $(PYMITEINC) EXTRAINCDIRS += $(HWDEFSINC) -# Generate intermediate code -gencode: ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h - -$(PYSRC): gencode - -# Generate code for PyMite -${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h: $(wildcard ${PYMITELIB}/*.py) $(wildcard ${PYMITEPLAT}/*.py) $(wildcard ${FLIGHTPLANLIB}/*.py) $(wildcard ${FLIGHTPLANS}/*.py) - @$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@) - @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py) - @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h - @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py -EXTRAINCDIRS += ${foreach MOD, ${MODULES} ${PYMODULES}, $(OPMODULEDIR)/${MOD}/inc} ${OPMODULEDIR}/System/inc +EXTRAINCDIRS += ${foreach MOD, ${MODULES}, $(OPMODULEDIR)/${MOD}/inc} ${OPMODULEDIR}/System/inc BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) From 9335a50b18bb3f23a11914190869fddb033b09ca Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 25 Mar 2013 16:02:16 +0200 Subject: [PATCH 65/68] Makefile: use upper case for MODULE_MODULENAME_BUILTIN macros +review OPReview-422 --- flight/Modules/Airspeed/revolution/airspeed.c | 2 +- flight/Modules/Altitude/altitude.c | 2 +- flight/Modules/Autotune/autotune.c | 2 +- flight/Modules/Battery/battery.c | 2 +- flight/Modules/CameraStab/camerastab.c | 2 +- flight/Modules/ComUsbBridge/ComUsbBridge.c | 2 +- flight/Modules/Extensions/MagBaro/magbaro.c | 2 +- flight/Modules/Fault/Fault.c | 2 +- flight/Modules/OveroSync/overosync.c | 2 +- make/apps-defs.mk | 8 +++++--- 10 files changed, 14 insertions(+), 12 deletions(-) diff --git a/flight/Modules/Airspeed/revolution/airspeed.c b/flight/Modules/Airspeed/revolution/airspeed.c index ab817232a..fd1479d0f 100644 --- a/flight/Modules/Airspeed/revolution/airspeed.c +++ b/flight/Modules/Airspeed/revolution/airspeed.c @@ -89,7 +89,7 @@ int32_t AirspeedStart() */ int32_t AirspeedInitialize() { -#ifdef MODULE_Airspeed_BUILTIN +#ifdef MODULE_AIRSPEED_BUILTIN airspeedEnabled = true; #else diff --git a/flight/Modules/Altitude/altitude.c b/flight/Modules/Altitude/altitude.c index 4898829b0..4e11848e7 100644 --- a/flight/Modules/Altitude/altitude.c +++ b/flight/Modules/Altitude/altitude.c @@ -92,7 +92,7 @@ int32_t AltitudeStart() */ int32_t AltitudeInitialize() { -#ifdef MODULE_Altitude_BUILTIN +#ifdef MODULE_ALTITUDE_BUILTIN altitudeEnabled = 1; #else HwSettingsInitialize(); diff --git a/flight/Modules/Autotune/autotune.c b/flight/Modules/Autotune/autotune.c index 366ac190f..260f70750 100644 --- a/flight/Modules/Autotune/autotune.c +++ b/flight/Modules/Autotune/autotune.c @@ -82,7 +82,7 @@ static void update_stabilization_settings(); int32_t AutotuneInitialize(void) { // Create a queue, connect to manual control command and flightstatus -#ifdef MODULE_Autotune_BUILTIN +#ifdef MODULE_AUTOTUNE_BUILTIN autotuneEnabled = true; #else HwSettingsInitialize(); diff --git a/flight/Modules/Battery/battery.c b/flight/Modules/Battery/battery.c index 83c0002cd..ac9dcace3 100644 --- a/flight/Modules/Battery/battery.c +++ b/flight/Modules/Battery/battery.c @@ -78,7 +78,7 @@ int32_t BatteryInitialize(void) { -#ifdef MODULE_Battery_BUILTIN +#ifdef MODULE_BATTERY_BUILTIN batteryEnabled = true; #else uint8_t optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM]; diff --git a/flight/Modules/CameraStab/camerastab.c b/flight/Modules/CameraStab/camerastab.c index 12915be68..89f41e821 100644 --- a/flight/Modules/CameraStab/camerastab.c +++ b/flight/Modules/CameraStab/camerastab.c @@ -94,7 +94,7 @@ int32_t CameraStabInitialize(void) { bool cameraStabEnabled; -#ifdef MODULE_CameraStab_BUILTIN +#ifdef MODULE_CAMERASTAB_BUILTIN cameraStabEnabled = true; #else uint8_t optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM]; diff --git a/flight/Modules/ComUsbBridge/ComUsbBridge.c b/flight/Modules/ComUsbBridge/ComUsbBridge.c index 678e7039d..13c9f6ee4 100644 --- a/flight/Modules/ComUsbBridge/ComUsbBridge.c +++ b/flight/Modules/ComUsbBridge/ComUsbBridge.c @@ -94,7 +94,7 @@ static int32_t comUsbBridgeInitialize(void) usart_port = PIOS_COM_BRIDGE; vcp_port = PIOS_COM_VCP; -#ifdef MODULE_ComUsbBridge_BUILTIN +#ifdef MODULE_COMUSBBRIDGE_BUILTIN bridge_enabled = true; #else HwSettingsInitialize(); diff --git a/flight/Modules/Extensions/MagBaro/magbaro.c b/flight/Modules/Extensions/MagBaro/magbaro.c index e4db11261..ab02a902f 100644 --- a/flight/Modules/Extensions/MagBaro/magbaro.c +++ b/flight/Modules/Extensions/MagBaro/magbaro.c @@ -87,7 +87,7 @@ int32_t MagBaroStart() */ int32_t MagBaroInitialize() { -#ifdef MODULE_MagBaro_BUILTIN +#ifdef MODULE_MAGBARO_BUILTIN magbaroEnabled = 1; #else HwSettingsInitialize(); diff --git a/flight/Modules/Fault/Fault.c b/flight/Modules/Fault/Fault.c index 868330739..b707ed5a5 100644 --- a/flight/Modules/Fault/Fault.c +++ b/flight/Modules/Fault/Fault.c @@ -40,7 +40,7 @@ static uint8_t active_fault; static int32_t fault_initialize(void) { -#ifdef MODULE_Fault_BUILTIN +#ifdef MODULE_FAULT_BUILTIN module_enabled = true; #else HwSettingsInitialize(); diff --git a/flight/Modules/OveroSync/overosync.c b/flight/Modules/OveroSync/overosync.c index eaa2cb6fb..639082fce 100644 --- a/flight/Modules/OveroSync/overosync.c +++ b/flight/Modules/OveroSync/overosync.c @@ -75,7 +75,7 @@ struct overosync *overosync; int32_t OveroSyncInitialize(void) { -#ifdef MODULE_OveroSync_BUILTIN +#ifdef MODULE_OVEROSYNC_BUILTIN overoEnabled = true; #else diff --git a/make/apps-defs.mk b/make/apps-defs.mk index b162a906e..fa368084d 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -104,6 +104,11 @@ SRC += $(MATHLIB)/pid.c SRC += $(foreach mod, $(MODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) SRC += $(foreach mod, $(OPTMODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) +# Declare all non-optional modules as built-in to force inclusion. +# Built-in modules are always enabled and cannot be disabled. +MODULES_BUILTIN := $(foreach mod, $(notdir $(MODULES)), -DMODULE_$(shell $(ECHO) $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN) +CDEFS += $(MODULES_BUILTIN) + # List C source files here which must be compiled in ARM-Mode (no -mthumb). # Use file-extension c for "c-only"-files SRCARM += @@ -162,9 +167,6 @@ EXTRA_LIBS += m # Compiler flags CFLAGS += -# Declare all non-optional modules as built-in to force inclusion -CDEFS += $(foreach mod, $(notdir $(MODULES)), -DMODULE_$(mod)_BUILTIN) - # Set linker-script name depending on selected submodel name ifeq ($(MCU),cortex-m3) LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_memory.ld From 9424be584c788992d25c359d23939679c5b64533 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 25 Mar 2013 16:35:20 +0200 Subject: [PATCH 66/68] Makefile: fix MODULE_MODULENAME_BUILTIN generation bug for revo modules This converts 'ModuleName/revolution' into 'ModuleName' for macro. +review OPReview-422 --- make/apps-defs.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make/apps-defs.mk b/make/apps-defs.mk index fa368084d..3e2c86b37 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -106,7 +106,8 @@ SRC += $(foreach mod, $(OPTMODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) # Declare all non-optional modules as built-in to force inclusion. # Built-in modules are always enabled and cannot be disabled. -MODULES_BUILTIN := $(foreach mod, $(notdir $(MODULES)), -DMODULE_$(shell $(ECHO) $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN) +MODNAMES := $(notdir $(subst /revolution,,$(MODULES))) +MODULES_BUILTIN := $(foreach mod, $(MODNAMES), -DMODULE_$(shell $(ECHO) $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN) CDEFS += $(MODULES_BUILTIN) # List C source files here which must be compiled in ARM-Mode (no -mthumb). From 5d760d20fa7124815f27f1a1f5551534676ec2e0 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 25 Mar 2013 17:07:04 +0200 Subject: [PATCH 67/68] Makefile: better solution for MODULE_MODULENAME_BUILTIN name conversion Now it does not depend on board-specific part and uses module canonical name. +review OPReview-422 --- make/apps-defs.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/make/apps-defs.mk b/make/apps-defs.mk index 3e2c86b37..a54472188 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -106,8 +106,10 @@ SRC += $(foreach mod, $(OPTMODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) # Declare all non-optional modules as built-in to force inclusion. # Built-in modules are always enabled and cannot be disabled. -MODNAMES := $(notdir $(subst /revolution,,$(MODULES))) -MODULES_BUILTIN := $(foreach mod, $(MODNAMES), -DMODULE_$(shell $(ECHO) $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN) +# Module name 'ModuleName' or board-specific 'ModuleName/revolution' will be +# normalized to 'ModuleName' and defined as '-DMODULE_MODULENAME_BUILTIN' +MODNAMES := $(foreach mod,$(MODULES),$(firstword $(subst /, ,$(mod)))) +MODULES_BUILTIN := $(foreach mod,$(MODNAMES),-DMODULE_$(shell $(ECHO) $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN) CDEFS += $(MODULES_BUILTIN) # List C source files here which must be compiled in ARM-Mode (no -mthumb). From 927977216b46ec241b11650014ab5a0758563912 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 25 Mar 2013 17:27:47 +0200 Subject: [PATCH 68/68] Revert "Makefile: better solution for MODULE_MODULENAME_BUILTIN name conversion" The problem is that we have modules defined as: Airspeed or Airspeed/revolution or Extensions/MagBaro and, probably Extensions/MagBaro/revolution can be expected too. It is impossible to get module name from such mixed cases. So the better solution does not work for MagBaro, reverted. This reverts commit 5d760d20fa7124815f27f1a1f5551534676ec2e0. +review OPReview-422 --- make/apps-defs.mk | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/make/apps-defs.mk b/make/apps-defs.mk index a54472188..3e2c86b37 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -106,10 +106,8 @@ SRC += $(foreach mod, $(OPTMODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) # Declare all non-optional modules as built-in to force inclusion. # Built-in modules are always enabled and cannot be disabled. -# Module name 'ModuleName' or board-specific 'ModuleName/revolution' will be -# normalized to 'ModuleName' and defined as '-DMODULE_MODULENAME_BUILTIN' -MODNAMES := $(foreach mod,$(MODULES),$(firstword $(subst /, ,$(mod)))) -MODULES_BUILTIN := $(foreach mod,$(MODNAMES),-DMODULE_$(shell $(ECHO) $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN) +MODNAMES := $(notdir $(subst /revolution,,$(MODULES))) +MODULES_BUILTIN := $(foreach mod, $(MODNAMES), -DMODULE_$(shell $(ECHO) $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN) CDEFS += $(MODULES_BUILTIN) # List C source files here which must be compiled in ARM-Mode (no -mthumb).