From b9ff777827c6a3321bd79182b30c37def2156ed9 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Wed, 20 Feb 2019 19:51:28 +0200 Subject: [PATCH 1/6] v1.2 change log update --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index c20040c..2335ae2 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,10 @@ If you're not running Linux or OSX natively, you can use ### Change Log +#### v1.2 + +* Added a new CLI command: `gpio`. This command allows one to control the SMD GPIO pads via USB/UART. + #### v1.1 * CAN terminator is turned ON by default. From 50065eb399ccbfb79f0d7eea5592facd637bc1ea Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 21 Feb 2019 14:44:29 +0200 Subject: [PATCH 2/6] Fixed https://youtrack.zubax.com/issue/UAVCAN-7 --- bootloader/src/cli.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootloader/src/cli.cpp b/bootloader/src/cli.cpp index fc2f9d5..f7ce71b 100644 --- a/bootloader/src/cli.cpp +++ b/bootloader/src/cli.cpp @@ -92,8 +92,8 @@ class ZubaxIDCommand : public os::shell::ICommandHandler if (appinfo.second) { const auto& inf = appinfo.first; - ios.print("fw_version : '%u.%u'\n", inf.major_version, inf.minor_version); - ios.print("fw_vcs_commit: %u\n", inf.vcs_commit); + ios.print("sw_version : '%u.%u'\n", inf.major_version, inf.minor_version); + ios.print("sw_vcs_commit: %u\n", inf.vcs_commit); } } } static cmd_zubax_id; From 5c62f4f1ea2322a764131b5d80c2f841c58fe5c0 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 21 Feb 2019 14:55:01 +0200 Subject: [PATCH 3/6] GCC 7 warning fixes --- firmware/src/board/board.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/firmware/src/board/board.cpp b/firmware/src/board/board.cpp index 6116a96..77d5c2c 100644 --- a/firmware/src/board/board.cpp +++ b/firmware/src/board/board.cpp @@ -171,23 +171,23 @@ void restart() void setStatusLED(bool state) { - palWritePad(GPIOE, GPIOE_LED_STATUS, !state); + palWritePad(GPIOE, GPIOE_LED_STATUS, std::uint8_t(!state)); } void setTrafficLED(bool state) { - palWritePad(GPIOE, GPIOE_LED_TRAFFIC, !state); + palWritePad(GPIOE, GPIOE_LED_TRAFFIC, std::uint8_t(!state)); } void enableCANPower(bool state) { - palWritePad(GPIOA, GPIOA_CAN_POWER_DIS, !state); - palWritePad(GPIOB, GPIOB_LED_CAN_POWER_DIS, !state); + palWritePad(GPIOA, GPIOA_CAN_POWER_DIS, std::uint8_t(!state)); + palWritePad(GPIOB, GPIOB_LED_CAN_POWER_DIS, std::uint8_t(!state)); } void enableCANTerminator(bool state) { - palWritePad(GPIOB, GPIOB_CAN_TERMINATOR_EN, state); + palWritePad(GPIOB, GPIOB_CAN_TERMINATOR_EN, std::uint8_t(state)); } float getBusVoltage() From 3958649eb624fa8031bbc12fef245bdfd6ae3bce Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 21 Feb 2019 14:57:17 +0200 Subject: [PATCH 4/6] Bootloader version bump --- bootloader/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootloader/Makefile b/bootloader/Makefile index b1d287a..9adfbd8 100644 --- a/bootloader/Makefile +++ b/bootloader/Makefile @@ -21,7 +21,7 @@ PROJECT = com.zubax.babel HW_VERSION = 1 BL_VERSION_MAJOR = 1 -BL_VERSION_MINOR = 0 +BL_VERSION_MINOR = 1 APPLICATION_OFFSET = 32768 From ad6e50441cf676a3f2a39a1e33094e1704ad9f0d Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 21 Feb 2019 15:54:04 +0200 Subject: [PATCH 5/6] Fixed https://youtrack.zubax.com/issue/UAVCAN-12 --- bootloader/src/usb_cdc.cpp | 18 +++++++++++++++++- firmware/src/usb_cdc.cpp | 20 ++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/bootloader/src/usb_cdc.cpp b/bootloader/src/usb_cdc.cpp index d28f15d..b09cc0d 100644 --- a/bootloader/src/usb_cdc.cpp +++ b/bootloader/src/usb_cdc.cpp @@ -242,6 +242,22 @@ static const USBDescriptor *get_descriptor(USBDriver *usbp, uint8_t dtype, uint8 return NULL; } +/* + * USB stack crash workaround. + * See http://www.chibios.com/forum/viewtopic.php?f=25&t=4568&p=32429 + * This bug is fixed in ChibiOS 18+, so the workaround does not have to be here after the OS is updated. + */ +static void sduDataReceivedProxy(USBDriver* const usbp, const usbep_t ep) +{ + if (auto sdup = static_cast(usbp->out_params[ep - 1U])) + { + if (usbGetReceiveTransactionSizeX(sdup->config->usbp, sdup->config->bulk_out) > 0) + { + sduDataReceived(usbp, ep); + } + } +} + /* * USB endpoints */ @@ -267,7 +283,7 @@ static const USBEndpointConfig ep2config = ///< EP1 initialization structur USB_EP_MODE_TYPE_BULK, NULL, sduDataTransmitted, - sduDataReceived, + sduDataReceivedProxy, 0x0040, 0x0040, &ep2instate, diff --git a/firmware/src/usb_cdc.cpp b/firmware/src/usb_cdc.cpp index 434624d..3ec897a 100644 --- a/firmware/src/usb_cdc.cpp +++ b/firmware/src/usb_cdc.cpp @@ -240,6 +240,22 @@ static const USBDescriptor *get_descriptor(USBDriver *usbp, uint8_t dtype, uint8 return NULL; } +/* + * USB stack crash workaround. + * See http://www.chibios.com/forum/viewtopic.php?f=25&t=4568&p=32429 + * This bug is fixed in ChibiOS 18+, so the workaround does not have to be here after the OS is updated. + */ +static void sduDataReceivedProxy(USBDriver* const usbp, const usbep_t ep) +{ + if (auto sdup = static_cast(usbp->out_params[ep - 1U])) + { + if (usbGetReceiveTransactionSizeX(sdup->config->usbp, sdup->config->bulk_out) > 0) + { + sduDataReceived(usbp, ep); + } + } +} + /* * USB endpoints */ @@ -265,7 +281,7 @@ static const USBEndpointConfig ep2config = ///< EP1 initialization structur USB_EP_MODE_TYPE_BULK, NULL, sduDataTransmitted, - sduDataReceived, + sduDataReceivedProxy, 0x0040, 0x0040, &ep2instate, @@ -299,7 +315,7 @@ static void usb_event(USBDriver* usbp, usbevent_t event) chSysLockFromISR(); /* - * Enables the endpoints specified into the configuration. + * Enables the endpoints specified in the configuration. * Note, this callback is invoked from an ISR so I-Class functions * must be used. */ From 0ee9ade3766851de8294dabb43699ef6e6034eca Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 21 Feb 2019 15:55:47 +0200 Subject: [PATCH 6/6] Changelog update --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2335ae2..178e081 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ If you're not running Linux or OSX natively, you can use #### v1.2 * Added a new CLI command: `gpio`. This command allows one to control the SMD GPIO pads via USB/UART. +* [Fixed handling of zero-length USB transactions](http://www.chibios.com/forum/viewtopic.php?f=25&t=4568&p=32429). +* Fixed naming of software version fields in the bootloader: `fw_` --> `sw_`. #### v1.1