Skip to content

Commit 0177a82

Browse files
mindneverf5soh
authored andcommitted
Merged in mindnever/librepilot/LP-512_Support_F3_boards (pull request #426)
LP-512 Support F3 boards Approved-by: Lalanne Laurent <f5soh@free.fr> Approved-by: Mateusz Kaduk <mateusz.kaduk@gmail.com> Approved-by: Vladimir Zidar <mr_w@mindnever.org> Approved-by: Philippe Renon <philippe_renon@yahoo.fr>
2 parents a2d8d79 + d198b7c commit 0177a82

275 files changed

Lines changed: 29241 additions & 4097 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ PACKAGE_FW_TARGETS += fw_oplinkmini
340340
PACKAGE_FW_TARGETS += fw_gpsplatinum
341341
PACKAGE_FW_TARGETS += fw_osd
342342
PACKAGE_FW_TARGETS += fw_revoproto
343+
PACKAGE_FW_TARGETS += fw_spracingf3evo fw_spracingf3 fw_nucleof303re fw_pikoblx fw_tinyfish
343344

344345
# Rules to generate GCS resources used to embed firmware binaries into the GCS.
345346
# They are used later by the vehicle setup wizard to update board firmware.

flight/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ ALL_BOARDS += oplinkmini
1414
ALL_BOARDS += gpsplatinum
1515
ALL_BOARDS += osd
1616
ALL_BOARDS += discoveryf4bare
17+
ALL_BOARDS += ccf3d spracingf3 spracingf3evo nucleof303re pikoblx tinyfish
1718
# SimPosix only builds on Linux
1819
ifeq ($(UNAME), Linux)
1920
ALL_BOARDS += simposix
2021
endif
2122

2223
# Short names of each board (used to display board name in parallel builds)
24+
spracingf3_short := 'srf3'
25+
spracingf3evo_short := 'spev'
26+
ccf3d_short := 'cf3d'
2327
coptercontrol_short := 'cc '
2428
oplinkmini_short := 'oplm'
2529
revolution_short := 'revo'
@@ -30,6 +34,9 @@ sparky2_short := 'spk2'
3034
simposix_short := 'posx'
3135
discoveryf4bare_short := 'df4b'
3236
gpsplatinum_short := 'gps9'
37+
nucleof303re_short := 'nf3r'
38+
pikoblx_short := 'piko'
39+
tinyfish_short := 'tfsh'
3340

3441
# Start out assuming that we'll build fw, bl and bu for all boards
3542
FW_BOARDS := $(ALL_BOARDS)

flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj

Lines changed: 300 additions & 298 deletions
Large diffs are not rendered by default.

flight/targets/boards/revonano/firmware/cm3_fault_handlers.c renamed to flight/libraries/cm3_fault_handlers.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@
77

88
#include <stdint.h>
99
#include "inc/dcc_stdio.h"
10-
#ifdef STM32F4XX
10+
#ifdef STM32F4
1111
# include <stm32f4xx.h>
1212
#endif
13+
#ifdef STM32F3
14+
# include <stm32f30x.h>
15+
#endif
1316
#ifdef STM32F2XX
1417
# include <stm32f2xx.h>
1518
#endif
19+
#ifdef STM32F1
20+
# include <stm32f10x.h>
21+
#endif
1622

1723
#define FAULT_TRAMPOLINE(_vec) \
1824
__attribute__((naked, no_instrument_function)) \

flight/targets/boards/discoveryf4bare/firmware/dcc_stdio.c renamed to flight/libraries/dcc_stdio.c

File renamed without changes.

flight/targets/boards/discoveryf4bare/firmware/inc/dcc_stdio.h renamed to flight/libraries/inc/dcc_stdio.h

File renamed without changes.

flight/libraries/inc/op_dfu.h

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
******************************************************************************
33
*
44
* @file op_dfu.h
5+
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
56
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
67
* @brief
78
* @see The GNU Public License (GPL) Version 3
@@ -26,9 +27,91 @@
2627
/* Define to prevent recursive inclusion -------------------------------------*/
2728
#ifndef __OP_DFU_H
2829
#define __OP_DFU_H
29-
#include "common.h"
30+
3031
/* Includes ------------------------------------------------------------------*/
3132
/* Exported types ------------------------------------------------------------*/
33+
typedef enum {
34+
start, keepgoing,
35+
} DownloadAction;
36+
37+
/**************************************************/
38+
/* OP_DFU states */
39+
/**************************************************/
40+
41+
typedef enum {
42+
DFUidle, // 0
43+
uploading, // 1
44+
wrong_packet_received, // 2
45+
too_many_packets, // 3
46+
too_few_packets, // 4
47+
Last_operation_Success, // 5
48+
downloading, // 6
49+
BLidle, // 7
50+
Last_operation_failed, // 8
51+
uploadingStarting, // 9
52+
outsideDevCapabilities, // 10
53+
CRC_Fail, // 11
54+
failed_jump,
55+
// 12
56+
} DFUStates;
57+
/**************************************************/
58+
/* OP_DFU commands */
59+
/**************************************************/
60+
typedef enum {
61+
Reserved, // 0
62+
Req_Capabilities, // 1
63+
Rep_Capabilities, // 2
64+
EnterDFU, // 3
65+
JumpFW, // 4
66+
Reset, // 5
67+
Abort_Operation, // 6
68+
Upload, // 7
69+
Op_END, // 8
70+
Download_Req, // 9
71+
Download, // 10
72+
Status_Request, // 11
73+
Status_Rep
74+
// 12
75+
} DFUCommands;
76+
77+
typedef enum {
78+
High_Density, Medium_Density
79+
} DeviceType;
80+
/**************************************************/
81+
/* OP_DFU transfer types */
82+
/**************************************************/
83+
typedef enum {
84+
FW, // 0
85+
Descript
86+
// 2
87+
} DFUTransfer;
88+
/**************************************************/
89+
/* OP_DFU transfer port */
90+
/**************************************************/
91+
typedef enum {
92+
Usb, // 0
93+
Serial
94+
// 2
95+
} DFUPort;
96+
/**************************************************/
97+
/* OP_DFU programable programable HW types */
98+
/**************************************************/
99+
typedef enum {
100+
Self_flash, // 0
101+
Remote_flash_via_spi
102+
// 1
103+
} DFUProgType;
104+
/**************************************************/
105+
/* OP_DFU programable sources */
106+
/**************************************************/
107+
#define USB 0
108+
#define SPI 1
109+
110+
#define DownloadDelay 100000
111+
112+
#define MAX_DEL_RETRYS 3
113+
#define MAX_WRI_RETRYS 3
114+
32115
typedef struct {
33116
uint8_t programmingType;
34117
uint8_t readWriteFlags;

flight/libraries/notification.c

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@
4242
#define ALARM_LED_OFF()
4343
#endif
4444

45+
#ifdef PIOS_BUZZER_ALARM
46+
#define ALARM_BUZZER_ON() \
47+
{ if (buzzer_enabled) { PIOS_LED_On(PIOS_BUZZER_ALARM); } \
48+
}
49+
#define ALARM_BUZZER_OFF() \
50+
{ if (buzzer_enabled) { PIOS_LED_Off(PIOS_BUZZER_ALARM); } \
51+
}
52+
#else
53+
#define ALARM_BUZZER_ON()
54+
#define ALARM_BUZZER_OFF()
55+
#endif
56+
4557
#ifdef PIOS_LED_HEARTBEAT
4658
#define HEARTBEAT_LED_ON() PIOS_LED_On(PIOS_LED_HEARTBEAT)
4759
#define HEARTBEAT_LED_OFF() PIOS_LED_Off(PIOS_LED_HEARTBEAT)
@@ -135,9 +147,10 @@ static volatile FlightStatusData currentFlightStatus;
135147
static volatile bool started = false;
136148
static volatile pios_notify_notification nextNotification = NOTIFY_NONE;
137149

138-
#ifdef PIOS_LED_ALARM
150+
151+
#if defined(PIOS_LED_ALARM) || defined(PIOS_BUZZER_ALARM)
139152
static bool handleAlarms(uint16_t *r_pattern, uint16_t *b_pattern);
140-
#endif // PIOS_LED_ALARM
153+
#endif // PIOS_LED_ALARM || PIOS_BUZZER_ALARM
141154
static bool handleNotifications(pios_notify_notification runningNotification, uint16_t *r_pattern, uint16_t *b_pattern);
142155
static void handleFlightMode(uint16_t *r_pattern, uint16_t *b_pattern);
143156
static void handleHeartbeat(uint16_t *r_pattern, uint16_t *b_pattern);
@@ -163,6 +176,10 @@ void NotificationOnboardLedsRun()
163176
static uint8_t lastFlightMode = -1;
164177
static bool forceShowFlightMode = false;
165178
static pios_notify_notification runningNotification = NOTIFY_NONE;
179+
180+
#ifdef PIOS_BUZZER_ALARM
181+
static bool buzzer_enabled = false;
182+
#endif
166183
static enum {
167184
STATUS_NOTIFY,
168185
STATUS_ALARM,
@@ -206,13 +223,17 @@ void NotificationOnboardLedsRun()
206223
if (cycleCount & 0x10) {
207224
HEARTBEAT_LED_OFF();
208225
ALARM_LED_OFF();
226+
ALARM_BUZZER_OFF();
209227
cycleCount = 0x0;
210228
forceShowFlightMode = false;
211229
// Notification has been just shown, cleanup
212230
if (status == STATUS_NOTIFY) {
213231
runningNotification = NOTIFY_NONE;
214232
}
215233
status = (status + 1) % STATUS_LENGHT;
234+
#ifdef PIOS_BUZZER_ALARM
235+
buzzer_enabled = true; /* This is the place where we update buzzer_enabled status based on (not yet implemented) NotificationSettings.Buzzer config */
236+
#endif
216237
}
217238

218239
if (status == STATUS_NOTIFY) {
@@ -224,7 +245,7 @@ void NotificationOnboardLedsRun()
224245

225246
// Handles Alarm display
226247
if (status == STATUS_ALARM) {
227-
#ifdef PIOS_LED_ALARM
248+
#if defined(PIOS_LED_ALARM) || defined(PIOS_BUZZER_ALARM)
228249
if (!cycleCount && !handleAlarms(&r_pattern, &b_pattern)) {
229250
// no alarms, advance
230251
status++;
@@ -252,14 +273,16 @@ void NotificationOnboardLedsRun()
252273
}
253274
if (r_pattern & 0x1) {
254275
ALARM_LED_ON();
276+
ALARM_BUZZER_ON();
255277
} else {
256278
ALARM_LED_OFF();
279+
ALARM_BUZZER_OFF();
257280
}
258281
r_pattern >>= 1;
259282
b_pattern >>= 1;
260283
}
261284

262-
#if defined(PIOS_LED_ALARM)
285+
#if defined(PIOS_LED_ALARM) || defined(PIOS_BUZZER_ALARM)
263286
static bool handleAlarms(uint16_t *r_pattern, uint16_t *b_pattern)
264287
{
265288
if (currentAlarmLevel == SYSTEMALARMS_ALARM_OK) {
@@ -269,7 +292,7 @@ static bool handleAlarms(uint16_t *r_pattern, uint16_t *b_pattern)
269292
*r_pattern = BLINK_R_ALARM_PATTERN(currentAlarmLevel);
270293
return true;
271294
}
272-
#endif /* PIOS_LED_ALARM */
295+
#endif /* PIOS_LED_ALARM || PIOS_BUZZER_ALARM */
273296

274297

275298
static bool handleNotifications(pios_notify_notification runningNotification, uint16_t *r_pattern, uint16_t *b_pattern)

flight/libraries/op_dfu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ void processComand(uint8_t *xReceive_Buffer)
157157
switch (Command) {
158158
case EnterDFU:
159159
if (((DeviceState == BLidle) && (Data0 < numberOfDevices))
160-
|| (DeviceState == DFUidle)) {
160+
|| (DeviceState == DFUidle)
161+
|| (DeviceState == failed_jump)) {
161162
if (Data0 > 0) {
162163
OPDfuIni(true);
163164
}

flight/make/apps-defs.mk

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,16 @@ include $(FREERTOS_DIR)/library.mk
5454
OPTESTS = $(TOPDIR)/Tests
5555

5656
## PIOS Hardware
57-
ifeq ($(MCU),cortex-m3)
57+
ifneq (,$(findstring STM32F10,$(CHIP)))
5858
include $(PIOS)/stm32f10x/library.mk
59-
else ifeq ($(MCU),cortex-m4)
59+
else ifneq (,$(findstring STM32F4,$(CHIP)))
6060
include $(PIOS)/stm32f4xx/library.mk
61-
else ifeq ($(MCU),cortex-m0)
61+
else ifneq (,$(findstring STM32F30,$(CHIP)))
62+
include $(PIOS)/stm32f30x/library.mk
63+
else ifneq (,$(findstring STM32F0,$(CHIP)))
6264
include $(PIOS)/stm32f0x/library.mk
6365
else
64-
$(error Unsupported MCU: $(MCU))
66+
$(error Unsupported CHIP: $(CHIP))
6567
endif
6668

6769
# List C source files here (C dependencies are automatically generated).
@@ -83,6 +85,7 @@ SRC += $(PIOSCOMMON)/pios_mpu9250.c
8385
SRC += $(PIOSCOMMON)/pios_mpxv.c
8486
SRC += $(PIOSCOMMON)/pios_ms4525do.c
8587
SRC += $(PIOSCOMMON)/pios_ms5611.c
88+
SRC += $(PIOSCOMMON)/pios_bmp280.c
8689
SRC += $(PIOSCOMMON)/pios_oplinkrcvr.c
8790
SRC += $(PIOSCOMMON)/pios_video.c
8891
SRC += $(PIOSCOMMON)/pios_wavplay.c
@@ -150,6 +153,11 @@ ifeq ($(USE_CXX),YES)
150153
CPPSRC += $(FLIGHTLIB)/mini_cpp.cpp
151154
endif
152155

156+
ifeq ($(DEBUG), YES)
157+
SRC += $(FLIGHTLIB)/dcc_stdio.c
158+
SRC += $(FLIGHTLIB)/cm3_fault_handlers.c
159+
endif
160+
153161
## Modules
154162
SRC += $(foreach mod, $(MODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.c)))
155163
CPPSRC += $(foreach mod, $(MODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.cpp)))

0 commit comments

Comments
 (0)