Fixes to make the firmware run.
This commit is contained in:
parent
a0e5107ba2
commit
4a93fc550f
|
@ -25,12 +25,12 @@ endif
|
|||
|
||||
# Linker extra options here.
|
||||
ifeq ($(USE_LDOPT),)
|
||||
USE_LDOPT = -flto=4
|
||||
USE_LDOPT =
|
||||
endif
|
||||
|
||||
# Enable this if you want link time optimizations (LTO)
|
||||
ifeq ($(USE_LTO),)
|
||||
USE_LTO = yes
|
||||
USE_LTO = no
|
||||
endif
|
||||
|
||||
# If enabled, this option allows to compile the application in THUMB mode.
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#define STM32_HSI_ENABLED TRUE
|
||||
#define STM32_LSI_ENABLED TRUE
|
||||
#define STM32_HSE_ENABLED TRUE
|
||||
#define STM32_LSE_ENABLED TRUE
|
||||
#define STM32_LSE_ENABLED FALSE
|
||||
#define STM32_CLOCK48_REQUIRED TRUE
|
||||
#define STM32_SW STM32_SW_PLL
|
||||
#define STM32_PLLSRC STM32_PLLSRC_HSE
|
||||
|
|
|
@ -70,7 +70,7 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
|
|||
|
||||
if (!main_loop_started) {
|
||||
print("fatal %s %s:%d\r\n", msg, file, line);
|
||||
chThdSleepSeconds(1);
|
||||
// chThdSleepSeconds(1);
|
||||
chSysHalt("Main loop did not start");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -304,8 +304,8 @@ void initCan(void) {
|
|||
#else
|
||||
canStart(&CAND1, &canConfig);
|
||||
#endif
|
||||
|
||||
canStart(&EFI_CAN_DEVICE, &canConfig);
|
||||
// FIXME: Can't start a driver twice.
|
||||
//canStart(&EFI_CAN_DEVICE, &canConfig);
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
|
||||
chThdCreateStatic(canTreadStack, sizeof(canTreadStack), NORMALPRIO, (tfunc_t) canThread, NULL);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -14,9 +14,10 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
#include "hal.h"
|
||||
|
||||
#if HAL_USE_SERIAL_USB || defined(__DOXYGEN__)
|
||||
/* Virtual serial port over USB.*/
|
||||
SerialUSBDriver SDU1;
|
||||
|
||||
/*
|
||||
* Endpoints to be used for USBD1.
|
||||
|
@ -287,6 +288,12 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
|
|||
case USB_EVENT_UNCONFIGURED:
|
||||
return;
|
||||
case USB_EVENT_SUSPEND:
|
||||
chSysLockFromISR();
|
||||
|
||||
/* Disconnection event on suspend.*/
|
||||
sduDisconnectI(&SDU1);
|
||||
|
||||
chSysUnlockFromISR();
|
||||
return;
|
||||
case USB_EVENT_WAKEUP:
|
||||
return;
|
||||
|
@ -296,6 +303,18 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handles the USB driver global events.
|
||||
*/
|
||||
static void sof_handler(USBDriver *usbp) {
|
||||
|
||||
(void)usbp;
|
||||
|
||||
osalSysLockFromISR();
|
||||
sduSOFHookI(&SDU1);
|
||||
osalSysUnlockFromISR();
|
||||
}
|
||||
|
||||
/*
|
||||
* USB driver configuration.
|
||||
*/
|
||||
|
@ -303,7 +322,7 @@ const USBConfig usbcfg = {
|
|||
usb_event,
|
||||
get_descriptor,
|
||||
sduRequestsHook,
|
||||
NULL
|
||||
sof_handler
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -315,7 +334,3 @@ const SerialUSBConfig serusbcfg = {
|
|||
USBD1_DATA_AVAILABLE_EP,
|
||||
USBD1_INTERRUPT_REQUEST_EP
|
||||
};
|
||||
|
||||
/* Virtual serial port over USB.*/
|
||||
SerialUSBDriver SDU1;
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,7 @@ int getRemainingStack(thread_t *otp) {
|
|||
otp->activeStack = r13;
|
||||
|
||||
int remainingStack;
|
||||
if (dbg_isr_cnt > 0) {
|
||||
if (ch.dbg.isr_cnt > 0) {
|
||||
// ISR context
|
||||
remainingStack = (int)(r13 - 1) - (int)&__main_stack_base__;
|
||||
} else {
|
||||
|
|
|
@ -111,7 +111,7 @@ static ICUDriver *turnOnTriggerInputPin(const char *msg, brain_pin_e hwPin, ICUC
|
|||
|
||||
efiIcuStart(driver, icucfg);
|
||||
if (driver->state == ICU_READY) {
|
||||
icuEnableNotifications(driver);
|
||||
icuStartCapture(driver);
|
||||
} else {
|
||||
// we would be here for example if same pin is used for multiple input capture purposes
|
||||
firmwareError(CUSTOM_ERR_ICU_STATE, "ICU unexpected state [%s]", hwPortname(hwPin));
|
||||
|
@ -123,7 +123,7 @@ static ICUDriver *turnOnTriggerInputPin(const char *msg, brain_pin_e hwPin, ICUC
|
|||
static void turnOffTriggerInputPin(brain_pin_e hwPin) {
|
||||
ICUDriver *driver = getInputCaptureDriver("trigger_off", hwPin);
|
||||
if (driver != NULL) {
|
||||
icuDisableNotificationsI(driver);
|
||||
icuStopCapture(driver);
|
||||
icuStop(driver);
|
||||
scheduleMsg(logger, "turnOffTriggerInputPin %s", hwPortname(hwPin));
|
||||
unmarkPin(hwPin);
|
||||
|
|
|
@ -15,16 +15,14 @@
|
|||
|
||||
#include "histogram.h"
|
||||
|
||||
extern cnt_t dbg_lock_cnt;
|
||||
extern cnt_t dbg_isr_cnt;
|
||||
#define isLocked() (dbg_lock_cnt > 0)
|
||||
#define isLocked() (ch.dbg.lock_cnt > 0)
|
||||
|
||||
/**
|
||||
* Unfortunately ChibiOS has two versions of methods for different
|
||||
* contexts.
|
||||
*/
|
||||
|
||||
#define isIsrContext() (dbg_isr_cnt > 0)
|
||||
#define isIsrContext() (ch.dbg.isr_cnt > 0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
|
Loading…
Reference in New Issue