From 403c8eeabc4f5e9b25dd96f4ab7a181f517e4de1 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Wed, 29 Mar 2023 22:36:17 -0400 Subject: [PATCH 01/15] clean up unused file --- firmware/src/apollo | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 firmware/src/apollo diff --git a/firmware/src/apollo b/firmware/src/apollo deleted file mode 100644 index 3431ae2..0000000 --- a/firmware/src/apollo +++ /dev/null @@ -1,14 +0,0 @@ -{ - "folders": [ - { - "path": "/home/ktemkin/Projects/luna/firmware/apollo" - }, - { - "path": "/home/ktemkin/Projects/luna/tools" - }, - { - "path": "/home/ktemkin/Projects/luna/gateware/blinky_verilog" - } - ], - "settings": {} -} From ce33ddec88fa47709f632a6faaa0f7d16c1cdaf5 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Wed, 29 Mar 2023 22:41:18 -0400 Subject: [PATCH 02/15] fix SPI tunnel selection bug --- apollo_fpga/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apollo_fpga/__init__.py b/apollo_fpga/__init__.py index bc15ac4..c2a93e3 100644 --- a/apollo_fpga/__init__.py +++ b/apollo_fpga/__init__.py @@ -196,13 +196,13 @@ def create_jtag_spi(self, jtag_chain): if self.major == self.EXTERNAL_BOARD_MAJOR: return None, None - # Otherwise, if we have a revision greater than r0.2, our SPI should be via JTAG. - elif self.minor >= 0.3: - return ECP5_JTAGDebugSPIConnection(jtag_chain, self), ECP5_JTAGRegisters(jtag_chain) + # Use a real debug SPI on r0.1 and r0.2. + elif self.major == 0 and self.minor < 3: + return None, None - # Otherwise, we'll want to use a real debug SPI, rather than a JTAG-SPI. + # Otherwise, if we have a revision greater than r0.2, our SPI should be via JTAG. else: - return None, None + return ECP5_JTAGDebugSPIConnection(jtag_chain, self), ECP5_JTAGRegisters(jtag_chain) From 3467546d8dcc24531cb900911763de94a969ce9b Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Fri, 31 Mar 2023 07:52:54 -0400 Subject: [PATCH 03/15] firmware: add support for Cynthion r1 --- firmware/Makefile | 19 ++++--- firmware/src/boards/daisho/usb_switch.c | 31 ++++++++++++ firmware/src/boards/luna_d11/apollo_board.h | 14 ++++-- firmware/src/boards/luna_d11/fpga.c | 18 +++---- firmware/src/boards/luna_d11/usb_switch.c | 50 +++++++++++++++++++ firmware/src/boards/luna_d21/usb_switch.c | 34 +++++++++++++ .../src/boards/samd11_xplained/usb_switch.c | 31 ++++++++++++ firmware/src/main.c | 3 ++ firmware/src/usb_switch.h | 30 +++++++++++ 9 files changed, 209 insertions(+), 21 deletions(-) create mode 100644 firmware/src/boards/daisho/usb_switch.c create mode 100644 firmware/src/boards/luna_d11/usb_switch.c create mode 100644 firmware/src/boards/luna_d21/usb_switch.c create mode 100644 firmware/src/boards/samd11_xplained/usb_switch.c create mode 100644 firmware/src/usb_switch.h diff --git a/firmware/Makefile b/firmware/Makefile index 228c4b7..991b28a 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -4,19 +4,24 @@ # Ensure that a APOLLO_BOARD is selected. ifeq ($(APOLLO_BOARD), ) - BOARD:=$(error You need to specify an APOLLO_BOARD as a make variable (e.g. APOLLO_BOARD=luna)!) + BOARD:=$(error You need to specify an APOLLO_BOARD as a make variable (e.g. APOLLO_BOARD=cynthion)!) endif -# If the board is specified as 'luna' without a processor, we'll try to emulate the behavior -# of LUNA's Apollo as much as we can. +ifeq ($(APOLLO_BOARD), cynthion) + BOARD := luna_d11 +endif + +# Allow Cynthion's old name "LUNA" for backward compatibility. ifeq ($(APOLLO_BOARD), luna) BOARD := luna_d11 +endif - # These should default to the latest revision; but can be set on the command line. - BOARD_REVISION_MAJOR ?= 0 - BOARD_REVISION_MINOR ?= 4 +ifeq ($(BOARD), luna_d11) + # These should default to the latest revision but can be set on the command line. + BOARD_REVISION_MAJOR ?= 1 + BOARD_REVISION_MINOR ?= 0 - # On r0.1 or r0.2 boards, we want to target the SAMD21 / luna_d11 configuration. + # On r0.1 or r0.2 boards, we target the SAMD21 configuration. ifeq ($(BOARD_REVISION_MAJOR), 0) ifeq ($(BOARD_REVISION_MINOR), 1) BOARD := luna_d21 diff --git a/firmware/src/boards/daisho/usb_switch.c b/firmware/src/boards/daisho/usb_switch.c new file mode 100644 index 0000000..21646b3 --- /dev/null +++ b/firmware/src/boards/daisho/usb_switch.c @@ -0,0 +1,31 @@ +/** + * switch control for USB port shared by Apollo and FPGA + * + * This file is part of Apollo. + * + * Copyright (c) 2023 Great Scott Gadgets + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "usb_switch.h" + +/** + * Hand off shared USB port to FPGA. + */ +void hand_off_usb(void) +{ +} + +/** + * Take control of USB port from FPGA. + */ +void take_over_usb(void) +{ +} + +/** + * Handle switch control user request. + */ +void switch_control_task(void) +{ +} diff --git a/firmware/src/boards/luna_d11/apollo_board.h b/firmware/src/boards/luna_d11/apollo_board.h index e3675eb..be13ceb 100644 --- a/firmware/src/boards/luna_d11/apollo_board.h +++ b/firmware/src/boards/luna_d11/apollo_board.h @@ -29,7 +29,7 @@ typedef enum { /** - * GPIO pin numbers. + * GPIO pins for FPGA JTAG */ enum { // Each of the JTAG pins. @@ -41,11 +41,17 @@ enum { /** - * List of pins used for FPGA interfacing. + * Other GPIO pins */ enum { - PROGRAM_GPIO = PIN_PA08, - PIN_PHY_RESET = PIN_PA09 + FPGA_PROGRAM = PIN_PA08, +#if _BOARD_REVISION_MAJOR_ == 1 + PROGRAM_BUTTON = PIN_PA02, + USB_SWITCH = PIN_PA06 +#else + PROGRAM_BUTTON = PIN_PA16, + PHY_RESET = PIN_PA09 +#endif }; diff --git a/firmware/src/boards/luna_d11/fpga.c b/firmware/src/boards/luna_d11/fpga.c index 23ca893..bdafd4e 100644 --- a/firmware/src/boards/luna_d11/fpga.c +++ b/firmware/src/boards/luna_d11/fpga.c @@ -18,10 +18,8 @@ void fpga_io_init(void) { // By default, keep PROGRAM_N from being driven. - gpio_set_pin_level(PROGRAM_GPIO, true); - gpio_set_pin_direction(PROGRAM_GPIO, GPIO_DIRECTION_IN); - - gpio_set_pin_direction(PIN_PHY_RESET, GPIO_DIRECTION_IN); + gpio_set_pin_level(FPGA_PROGRAM, true); + gpio_set_pin_direction(FPGA_PROGRAM, GPIO_DIRECTION_IN); } @@ -30,13 +28,13 @@ void fpga_io_init(void) */ void trigger_fpga_reconfiguration(void) { - gpio_set_pin_direction(PROGRAM_GPIO, GPIO_DIRECTION_OUT); - gpio_set_pin_level(PROGRAM_GPIO, false); + gpio_set_pin_direction(FPGA_PROGRAM, GPIO_DIRECTION_OUT); + gpio_set_pin_level(FPGA_PROGRAM, false); board_delay(1); - gpio_set_pin_level(PROGRAM_GPIO, true); - gpio_set_pin_direction(PROGRAM_GPIO, GPIO_DIRECTION_IN); + gpio_set_pin_level(FPGA_PROGRAM, true); + gpio_set_pin_direction(FPGA_PROGRAM, GPIO_DIRECTION_IN); } @@ -45,6 +43,6 @@ void trigger_fpga_reconfiguration(void) */ void force_fpga_offline(void) { - gpio_set_pin_direction(PROGRAM_GPIO, GPIO_DIRECTION_OUT); - gpio_set_pin_level(PROGRAM_GPIO, false); + gpio_set_pin_direction(FPGA_PROGRAM, GPIO_DIRECTION_OUT); + gpio_set_pin_level(FPGA_PROGRAM, false); } diff --git a/firmware/src/boards/luna_d11/usb_switch.c b/firmware/src/boards/luna_d11/usb_switch.c new file mode 100644 index 0000000..82a82d8 --- /dev/null +++ b/firmware/src/boards/luna_d11/usb_switch.c @@ -0,0 +1,50 @@ +/** + * switch control for USB port shared by Apollo and FPGA + * + * This file is part of Apollo. + * + * Copyright (c) 2023 Great Scott Gadgets + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "usb_switch.h" +#include "apollo_board.h" +#include "led.h" +#include + +/** + * Hand off shared USB port to FPGA. + */ +void hand_off_usb(void) +{ +#if _BOARD_REVISION_MAJOR_ == 1 + gpio_set_pin_level(USB_SWITCH, false); + gpio_set_pin_direction(USB_SWITCH, GPIO_DIRECTION_OUT); + led_off(LED_D); +#else + led_on(LED_D); +#endif +} + +/** + * Take control of USB port from FPGA. + */ +void take_over_usb(void) +{ +#if _BOARD_REVISION_MAJOR_ == 1 + gpio_set_pin_level(USB_SWITCH, true); + gpio_set_pin_direction(USB_SWITCH, GPIO_DIRECTION_OUT); +#endif + led_on(LED_D); +} + +/** + * Handle switch control user request. + */ +void switch_control_task(void) +{ + gpio_set_pin_direction(PROGRAM_BUTTON, GPIO_DIRECTION_IN); + if (gpio_get_pin_level(PROGRAM_BUTTON) == false) { + take_over_usb(); + } +} diff --git a/firmware/src/boards/luna_d21/usb_switch.c b/firmware/src/boards/luna_d21/usb_switch.c new file mode 100644 index 0000000..3fc31aa --- /dev/null +++ b/firmware/src/boards/luna_d21/usb_switch.c @@ -0,0 +1,34 @@ +/** + * switch control for USB port shared by Apollo and FPGA + * + * This file is part of Apollo. + * + * Copyright (c) 2023 Great Scott Gadgets + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "led.h" +#include "usb_switch.h" + +/** + * Hand off shared USB port to FPGA. + */ +void hand_off_usb(void) +{ + led_on(LED_D); +} + +/** + * Take control of USB port from FPGA. + */ +void take_over_usb(void) +{ + led_on(LED_D); +} + +/** + * Handle switch control user request. + */ +void switch_control_task(void) +{ +} diff --git a/firmware/src/boards/samd11_xplained/usb_switch.c b/firmware/src/boards/samd11_xplained/usb_switch.c new file mode 100644 index 0000000..21646b3 --- /dev/null +++ b/firmware/src/boards/samd11_xplained/usb_switch.c @@ -0,0 +1,31 @@ +/** + * switch control for USB port shared by Apollo and FPGA + * + * This file is part of Apollo. + * + * Copyright (c) 2023 Great Scott Gadgets + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "usb_switch.h" + +/** + * Hand off shared USB port to FPGA. + */ +void hand_off_usb(void) +{ +} + +/** + * Take control of USB port from FPGA. + */ +void take_over_usb(void) +{ +} + +/** + * Handle switch control user request. + */ +void switch_control_task(void) +{ +} diff --git a/firmware/src/main.c b/firmware/src/main.c index de46101..d5a57c6 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -37,6 +37,7 @@ #include "fpga.h" #include "console.h" #include "debug_spi.h" +#include "usb_switch.h" //#include "selftest.h" @@ -52,6 +53,7 @@ int main(void) fpga_io_init(); led_init(); debug_spi_init(); + hand_off_usb(); // Trigger an FPGA reconfiguration; so the FPGA automatically // configures itself from its SPI ROM on reset. This effectively @@ -62,6 +64,7 @@ int main(void) tud_task(); // tinyusb device task console_task(); heartbeat_task(); + switch_control_task(); } return 0; diff --git a/firmware/src/usb_switch.h b/firmware/src/usb_switch.h new file mode 100644 index 0000000..1e9d9be --- /dev/null +++ b/firmware/src/usb_switch.h @@ -0,0 +1,30 @@ +/* + * switch control for USB port shared by Apollo and FPGA + * + * This file is part of Apollo. + * + * Copyright (c) 2023 Great Scott Gadgets + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __USB_SWITCH_H__ +#define __USB_SWITCH_H__ + + +/** + * Hand off shared USB port to FPGA. + */ +void hand_off_usb(void); + +/** + * Take control of USB port from FPGA. + */ +void take_over_usb(void); + +/** + * Handle switch control user request. + */ +void switch_control_task(void); + + +#endif From fd7cdc44b366f0d77e53f4315c5cdfe4e02e5594 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Wed, 26 Apr 2023 10:50:48 -0400 Subject: [PATCH 04/15] firmware: take over USB when requested by FPGA --- firmware/src/boards/luna_d11/apollo_board.h | 3 ++- firmware/src/boards/luna_d11/usb_switch.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/firmware/src/boards/luna_d11/apollo_board.h b/firmware/src/boards/luna_d11/apollo_board.h index be13ceb..a68b0fe 100644 --- a/firmware/src/boards/luna_d11/apollo_board.h +++ b/firmware/src/boards/luna_d11/apollo_board.h @@ -47,7 +47,8 @@ enum { FPGA_PROGRAM = PIN_PA08, #if _BOARD_REVISION_MAJOR_ == 1 PROGRAM_BUTTON = PIN_PA02, - USB_SWITCH = PIN_PA06 + USB_SWITCH = PIN_PA06, + FPGA_INT = PIN_PA09, #else PROGRAM_BUTTON = PIN_PA16, PHY_RESET = PIN_PA09 diff --git a/firmware/src/boards/luna_d11/usb_switch.c b/firmware/src/boards/luna_d11/usb_switch.c index 82a82d8..afcb6cc 100644 --- a/firmware/src/boards/luna_d11/usb_switch.c +++ b/firmware/src/boards/luna_d11/usb_switch.c @@ -44,7 +44,8 @@ void take_over_usb(void) void switch_control_task(void) { gpio_set_pin_direction(PROGRAM_BUTTON, GPIO_DIRECTION_IN); - if (gpio_get_pin_level(PROGRAM_BUTTON) == false) { + gpio_set_pin_direction(FPGA_INT, GPIO_DIRECTION_IN); + if ((gpio_get_pin_level(PROGRAM_BUTTON) == false) || (gpio_get_pin_level(FPGA_INT) == true)) { take_over_usb(); } } From 787da97f89d8c6fd5e688d6b414b40bce5244903 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Tue, 9 May 2023 11:22:17 -0400 Subject: [PATCH 05/15] firmware: add support for Cynthion r0.6, r0.7 --- firmware/src/boards/luna_d11/apollo_board.h | 8 ++++---- firmware/src/boards/luna_d11/usb_switch.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/firmware/src/boards/luna_d11/apollo_board.h b/firmware/src/boards/luna_d11/apollo_board.h index a68b0fe..35fe8c6 100644 --- a/firmware/src/boards/luna_d11/apollo_board.h +++ b/firmware/src/boards/luna_d11/apollo_board.h @@ -45,13 +45,13 @@ enum { */ enum { FPGA_PROGRAM = PIN_PA08, -#if _BOARD_REVISION_MAJOR_ == 1 +#if ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 6)) + PROGRAM_BUTTON = PIN_PA16, + PHY_RESET = PIN_PA09, +#else PROGRAM_BUTTON = PIN_PA02, USB_SWITCH = PIN_PA06, FPGA_INT = PIN_PA09, -#else - PROGRAM_BUTTON = PIN_PA16, - PHY_RESET = PIN_PA09 #endif }; diff --git a/firmware/src/boards/luna_d11/usb_switch.c b/firmware/src/boards/luna_d11/usb_switch.c index afcb6cc..771f4fc 100644 --- a/firmware/src/boards/luna_d11/usb_switch.c +++ b/firmware/src/boards/luna_d11/usb_switch.c @@ -17,12 +17,12 @@ */ void hand_off_usb(void) { -#if _BOARD_REVISION_MAJOR_ == 1 +#if ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 6)) + led_on(LED_D); +#else gpio_set_pin_level(USB_SWITCH, false); gpio_set_pin_direction(USB_SWITCH, GPIO_DIRECTION_OUT); led_off(LED_D); -#else - led_on(LED_D); #endif } @@ -31,7 +31,7 @@ void hand_off_usb(void) */ void take_over_usb(void) { -#if _BOARD_REVISION_MAJOR_ == 1 +#if (((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ >= 6)) || (_BOARD_REVISION_MAJOR_ == 1)) gpio_set_pin_level(USB_SWITCH, true); gpio_set_pin_direction(USB_SWITCH, GPIO_DIRECTION_OUT); #endif From c1e64c337ac47589377409bad55de520728b1748 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Tue, 9 May 2023 11:50:40 -0400 Subject: [PATCH 06/15] firmware: disable internal PROGRAM pull-up There is an external pull-up starting in Cynthion r0.6. The internal pull-up could cause problems starting in Cynthion r0.7. --- firmware/src/boards/luna_d11/usb_switch.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/firmware/src/boards/luna_d11/usb_switch.c b/firmware/src/boards/luna_d11/usb_switch.c index 771f4fc..845e14b 100644 --- a/firmware/src/boards/luna_d11/usb_switch.c +++ b/firmware/src/boards/luna_d11/usb_switch.c @@ -43,6 +43,11 @@ void take_over_usb(void) */ void switch_control_task(void) { +#if ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 6)) + gpio_set_pin_pull_mode(PROGRAM_BUTTON, GPIO_PULL_UP); +#else + gpio_set_pin_pull_mode(PROGRAM_BUTTON, GPIO_PULL_OFF); +#endif gpio_set_pin_direction(PROGRAM_BUTTON, GPIO_DIRECTION_IN); gpio_set_pin_direction(FPGA_INT, GPIO_DIRECTION_IN); if ((gpio_get_pin_level(PROGRAM_BUTTON) == false) || (gpio_get_pin_level(FPGA_INT) == true)) { From 91326288f456637d2421eef6ccaa7fa3ab47a7ba Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Wed, 27 Sep 2023 10:45:39 -0400 Subject: [PATCH 07/15] Ignore FPGA_INT Spurious interrupts during FPGA configuration on Cynthion have convinced us to develop a more sophisticated method for the FPGA to communicate its needs to the microcontroller. --- firmware/src/boards/luna_d11/usb_switch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/firmware/src/boards/luna_d11/usb_switch.c b/firmware/src/boards/luna_d11/usb_switch.c index 845e14b..7cecc76 100644 --- a/firmware/src/boards/luna_d11/usb_switch.c +++ b/firmware/src/boards/luna_d11/usb_switch.c @@ -49,8 +49,7 @@ void switch_control_task(void) gpio_set_pin_pull_mode(PROGRAM_BUTTON, GPIO_PULL_OFF); #endif gpio_set_pin_direction(PROGRAM_BUTTON, GPIO_DIRECTION_IN); - gpio_set_pin_direction(FPGA_INT, GPIO_DIRECTION_IN); - if ((gpio_get_pin_level(PROGRAM_BUTTON) == false) || (gpio_get_pin_level(FPGA_INT) == true)) { + if (gpio_get_pin_level(PROGRAM_BUTTON) == false) { take_over_usb(); } } From 38029567b7e181a3008b997437e7e89635b3a8d0 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Sun, 1 Oct 2023 18:27:33 -0400 Subject: [PATCH 08/15] firmware: update tinyusb A post-0.14.0 commit of tinyusb is used in order to incorporate the recent renaming of Cynthion (from LUNA to Cynthion) and the change to a 2 KiB bootloader for Cynthion. Also rename the Apollo board from luna to cynthion to match tinyusb. --- firmware/Makefile | 11 +++++------ .../boards/{luna_d11 => cynthion_d11}/apollo_board.h | 0 .../src/boards/{luna_d11 => cynthion_d11}/board.mk | 0 .../src/boards/{luna_d11 => cynthion_d11}/debug_spi.c | 0 firmware/src/boards/{luna_d11 => cynthion_d11}/dfu.c | 0 firmware/src/boards/{luna_d11 => cynthion_d11}/fpga.c | 2 +- firmware/src/boards/{luna_d11 => cynthion_d11}/jtag.c | 0 firmware/src/boards/{luna_d11 => cynthion_d11}/led.c | 2 +- .../boards/{luna_d11 => cynthion_d11}/platform_jtag.h | 0 firmware/src/boards/{luna_d11 => cynthion_d11}/spi.c | 2 -- firmware/src/boards/{luna_d11 => cynthion_d11}/spi.h | 0 .../boards/{luna_d11 => cynthion_d11}/tusb_config.h | 0 firmware/src/boards/{luna_d11 => cynthion_d11}/uart.c | 0 .../{luna_d11 => cynthion_d11}/usb_descriptors.c | 0 .../boards/{luna_d11 => cynthion_d11}/usb_switch.c | 0 .../boards/{luna_d21 => cynthion_d21}/apollo_board.h | 0 .../src/boards/{luna_d21 => cynthion_d21}/board.mk | 0 .../src/boards/{luna_d21 => cynthion_d21}/debug_spi.c | 0 firmware/src/boards/{luna_d21 => cynthion_d21}/dfu.c | 0 firmware/src/boards/{luna_d21 => cynthion_d21}/fpga.c | 2 +- firmware/src/boards/{luna_d21 => cynthion_d21}/jtag.c | 0 firmware/src/boards/{luna_d21 => cynthion_d21}/led.c | 2 +- .../boards/{luna_d21 => cynthion_d21}/platform_jtag.h | 0 .../src/boards/{luna_d21 => cynthion_d21}/selftest.c | 0 .../src/boards/{luna_d21 => cynthion_d21}/selftest.h | 0 firmware/src/boards/{luna_d21 => cynthion_d21}/spi.c | 2 -- firmware/src/boards/{luna_d21 => cynthion_d21}/spi.h | 0 .../boards/{luna_d21 => cynthion_d21}/tusb_config.h | 0 firmware/src/boards/{luna_d21 => cynthion_d21}/uart.c | 0 .../{luna_d21 => cynthion_d21}/usb_descriptors.c | 0 .../boards/{luna_d21 => cynthion_d21}/usb_switch.c | 0 firmware/src/boards/daisho/fpga.c | 2 +- firmware/src/boards/daisho/led.c | 2 +- firmware/src/boards/qtpy/fpga.c | 2 +- firmware/src/boards/qtpy/led.c | 2 +- firmware/src/boards/qtpy/spi.c | 2 -- firmware/src/boards/samd11_xplained/fpga.c | 2 +- firmware/src/boards/samd11_xplained/led.c | 2 +- firmware/src/boards/samd11_xplained/spi.c | 2 -- firmware/src/debug_spi.c | 2 +- firmware/src/jtag_tap.c | 2 +- firmware/src/main.c | 2 +- lib/tinyusb | 2 +- 43 files changed, 19 insertions(+), 28 deletions(-) rename firmware/src/boards/{luna_d11 => cynthion_d11}/apollo_board.h (100%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/board.mk (100%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/debug_spi.c (100%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/dfu.c (100%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/fpga.c (97%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/jtag.c (100%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/led.c (99%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/platform_jtag.h (100%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/spi.c (99%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/spi.h (100%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/tusb_config.h (100%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/uart.c (100%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/usb_descriptors.c (100%) rename firmware/src/boards/{luna_d11 => cynthion_d11}/usb_switch.c (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/apollo_board.h (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/board.mk (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/debug_spi.c (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/dfu.c (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/fpga.c (98%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/jtag.c (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/led.c (99%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/platform_jtag.h (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/selftest.c (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/selftest.h (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/spi.c (99%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/spi.h (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/tusb_config.h (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/uart.c (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/usb_descriptors.c (100%) rename firmware/src/boards/{luna_d21 => cynthion_d21}/usb_switch.c (100%) diff --git a/firmware/Makefile b/firmware/Makefile index 991b28a..872326b 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -8,15 +8,15 @@ ifeq ($(APOLLO_BOARD), ) endif ifeq ($(APOLLO_BOARD), cynthion) - BOARD := luna_d11 + BOARD := cynthion_d11 endif # Allow Cynthion's old name "LUNA" for backward compatibility. ifeq ($(APOLLO_BOARD), luna) - BOARD := luna_d11 + BOARD := cynthion_d11 endif -ifeq ($(BOARD), luna_d11) +ifeq ($(BOARD), cynthion_d11) # These should default to the latest revision but can be set on the command line. BOARD_REVISION_MAJOR ?= 1 BOARD_REVISION_MINOR ?= 0 @@ -24,10 +24,10 @@ ifeq ($(BOARD), luna_d11) # On r0.1 or r0.2 boards, we target the SAMD21 configuration. ifeq ($(BOARD_REVISION_MAJOR), 0) ifeq ($(BOARD_REVISION_MINOR), 1) - BOARD := luna_d21 + BOARD := cynthion_d21 endif ifeq ($(BOARD_REVISION_MINOR), 2) - BOARD := luna_d21 + BOARD := cynthion_d21 endif endif else @@ -48,7 +48,6 @@ ifeq ($(CC), intercept-cc) endif # Include the tinyusb basis BSP. -include $(TINYUSB_PATH)/tools/top.mk include $(TINYUSB_PATH)/examples/make.mk # If we're using intercept-build, override our compiler back to intercept-cc. diff --git a/firmware/src/boards/luna_d11/apollo_board.h b/firmware/src/boards/cynthion_d11/apollo_board.h similarity index 100% rename from firmware/src/boards/luna_d11/apollo_board.h rename to firmware/src/boards/cynthion_d11/apollo_board.h diff --git a/firmware/src/boards/luna_d11/board.mk b/firmware/src/boards/cynthion_d11/board.mk similarity index 100% rename from firmware/src/boards/luna_d11/board.mk rename to firmware/src/boards/cynthion_d11/board.mk diff --git a/firmware/src/boards/luna_d11/debug_spi.c b/firmware/src/boards/cynthion_d11/debug_spi.c similarity index 100% rename from firmware/src/boards/luna_d11/debug_spi.c rename to firmware/src/boards/cynthion_d11/debug_spi.c diff --git a/firmware/src/boards/luna_d11/dfu.c b/firmware/src/boards/cynthion_d11/dfu.c similarity index 100% rename from firmware/src/boards/luna_d11/dfu.c rename to firmware/src/boards/cynthion_d11/dfu.c diff --git a/firmware/src/boards/luna_d11/fpga.c b/firmware/src/boards/cynthion_d11/fpga.c similarity index 97% rename from firmware/src/boards/luna_d11/fpga.c rename to firmware/src/boards/cynthion_d11/fpga.c index bdafd4e..d30af66 100644 --- a/firmware/src/boards/luna_d11/fpga.c +++ b/firmware/src/boards/cynthion_d11/fpga.c @@ -7,7 +7,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include #include #include diff --git a/firmware/src/boards/luna_d11/jtag.c b/firmware/src/boards/cynthion_d11/jtag.c similarity index 100% rename from firmware/src/boards/luna_d11/jtag.c rename to firmware/src/boards/cynthion_d11/jtag.c diff --git a/firmware/src/boards/luna_d11/led.c b/firmware/src/boards/cynthion_d11/led.c similarity index 99% rename from firmware/src/boards/luna_d11/led.c rename to firmware/src/boards/cynthion_d11/led.c index 3969327..22ab9f5 100644 --- a/firmware/src/boards/luna_d11/led.c +++ b/firmware/src/boards/cynthion_d11/led.c @@ -14,7 +14,7 @@ #include #include -#include +#include #include diff --git a/firmware/src/boards/luna_d11/platform_jtag.h b/firmware/src/boards/cynthion_d11/platform_jtag.h similarity index 100% rename from firmware/src/boards/luna_d11/platform_jtag.h rename to firmware/src/boards/cynthion_d11/platform_jtag.h diff --git a/firmware/src/boards/luna_d11/spi.c b/firmware/src/boards/cynthion_d11/spi.c similarity index 99% rename from firmware/src/boards/luna_d11/spi.c rename to firmware/src/boards/cynthion_d11/spi.c index 2ce80b3..fb40cbf 100644 --- a/firmware/src/boards/luna_d11/spi.c +++ b/firmware/src/boards/cynthion_d11/spi.c @@ -16,8 +16,6 @@ #include "spi.h" #include "led.h" -#include - // Hide the ugly Atmel Sercom object name. typedef Sercom sercom_t; diff --git a/firmware/src/boards/luna_d11/spi.h b/firmware/src/boards/cynthion_d11/spi.h similarity index 100% rename from firmware/src/boards/luna_d11/spi.h rename to firmware/src/boards/cynthion_d11/spi.h diff --git a/firmware/src/boards/luna_d11/tusb_config.h b/firmware/src/boards/cynthion_d11/tusb_config.h similarity index 100% rename from firmware/src/boards/luna_d11/tusb_config.h rename to firmware/src/boards/cynthion_d11/tusb_config.h diff --git a/firmware/src/boards/luna_d11/uart.c b/firmware/src/boards/cynthion_d11/uart.c similarity index 100% rename from firmware/src/boards/luna_d11/uart.c rename to firmware/src/boards/cynthion_d11/uart.c diff --git a/firmware/src/boards/luna_d11/usb_descriptors.c b/firmware/src/boards/cynthion_d11/usb_descriptors.c similarity index 100% rename from firmware/src/boards/luna_d11/usb_descriptors.c rename to firmware/src/boards/cynthion_d11/usb_descriptors.c diff --git a/firmware/src/boards/luna_d11/usb_switch.c b/firmware/src/boards/cynthion_d11/usb_switch.c similarity index 100% rename from firmware/src/boards/luna_d11/usb_switch.c rename to firmware/src/boards/cynthion_d11/usb_switch.c diff --git a/firmware/src/boards/luna_d21/apollo_board.h b/firmware/src/boards/cynthion_d21/apollo_board.h similarity index 100% rename from firmware/src/boards/luna_d21/apollo_board.h rename to firmware/src/boards/cynthion_d21/apollo_board.h diff --git a/firmware/src/boards/luna_d21/board.mk b/firmware/src/boards/cynthion_d21/board.mk similarity index 100% rename from firmware/src/boards/luna_d21/board.mk rename to firmware/src/boards/cynthion_d21/board.mk diff --git a/firmware/src/boards/luna_d21/debug_spi.c b/firmware/src/boards/cynthion_d21/debug_spi.c similarity index 100% rename from firmware/src/boards/luna_d21/debug_spi.c rename to firmware/src/boards/cynthion_d21/debug_spi.c diff --git a/firmware/src/boards/luna_d21/dfu.c b/firmware/src/boards/cynthion_d21/dfu.c similarity index 100% rename from firmware/src/boards/luna_d21/dfu.c rename to firmware/src/boards/cynthion_d21/dfu.c diff --git a/firmware/src/boards/luna_d21/fpga.c b/firmware/src/boards/cynthion_d21/fpga.c similarity index 98% rename from firmware/src/boards/luna_d21/fpga.c rename to firmware/src/boards/cynthion_d21/fpga.c index 3dab43f..63feaba 100644 --- a/firmware/src/boards/luna_d21/fpga.c +++ b/firmware/src/boards/cynthion_d21/fpga.c @@ -7,7 +7,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include #include // List of pins used for FPGA interfacing. diff --git a/firmware/src/boards/luna_d21/jtag.c b/firmware/src/boards/cynthion_d21/jtag.c similarity index 100% rename from firmware/src/boards/luna_d21/jtag.c rename to firmware/src/boards/cynthion_d21/jtag.c diff --git a/firmware/src/boards/luna_d21/led.c b/firmware/src/boards/cynthion_d21/led.c similarity index 99% rename from firmware/src/boards/luna_d21/led.c rename to firmware/src/boards/cynthion_d21/led.c index fa3f49c..44e7161 100644 --- a/firmware/src/boards/luna_d21/led.c +++ b/firmware/src/boards/cynthion_d21/led.c @@ -14,7 +14,7 @@ #include #include -#include +#include #include diff --git a/firmware/src/boards/luna_d21/platform_jtag.h b/firmware/src/boards/cynthion_d21/platform_jtag.h similarity index 100% rename from firmware/src/boards/luna_d21/platform_jtag.h rename to firmware/src/boards/cynthion_d21/platform_jtag.h diff --git a/firmware/src/boards/luna_d21/selftest.c b/firmware/src/boards/cynthion_d21/selftest.c similarity index 100% rename from firmware/src/boards/luna_d21/selftest.c rename to firmware/src/boards/cynthion_d21/selftest.c diff --git a/firmware/src/boards/luna_d21/selftest.h b/firmware/src/boards/cynthion_d21/selftest.h similarity index 100% rename from firmware/src/boards/luna_d21/selftest.h rename to firmware/src/boards/cynthion_d21/selftest.h diff --git a/firmware/src/boards/luna_d21/spi.c b/firmware/src/boards/cynthion_d21/spi.c similarity index 99% rename from firmware/src/boards/luna_d21/spi.c rename to firmware/src/boards/cynthion_d21/spi.c index e732d26..0fddf91 100644 --- a/firmware/src/boards/luna_d21/spi.c +++ b/firmware/src/boards/cynthion_d21/spi.c @@ -16,8 +16,6 @@ #include "spi.h" #include "led.h" -#include - // Hide the ugly Atmel Sercom object name. typedef Sercom sercom_t; diff --git a/firmware/src/boards/luna_d21/spi.h b/firmware/src/boards/cynthion_d21/spi.h similarity index 100% rename from firmware/src/boards/luna_d21/spi.h rename to firmware/src/boards/cynthion_d21/spi.h diff --git a/firmware/src/boards/luna_d21/tusb_config.h b/firmware/src/boards/cynthion_d21/tusb_config.h similarity index 100% rename from firmware/src/boards/luna_d21/tusb_config.h rename to firmware/src/boards/cynthion_d21/tusb_config.h diff --git a/firmware/src/boards/luna_d21/uart.c b/firmware/src/boards/cynthion_d21/uart.c similarity index 100% rename from firmware/src/boards/luna_d21/uart.c rename to firmware/src/boards/cynthion_d21/uart.c diff --git a/firmware/src/boards/luna_d21/usb_descriptors.c b/firmware/src/boards/cynthion_d21/usb_descriptors.c similarity index 100% rename from firmware/src/boards/luna_d21/usb_descriptors.c rename to firmware/src/boards/cynthion_d21/usb_descriptors.c diff --git a/firmware/src/boards/luna_d21/usb_switch.c b/firmware/src/boards/cynthion_d21/usb_switch.c similarity index 100% rename from firmware/src/boards/luna_d21/usb_switch.c rename to firmware/src/boards/cynthion_d21/usb_switch.c diff --git a/firmware/src/boards/daisho/fpga.c b/firmware/src/boards/daisho/fpga.c index ee88288..ddb2345 100644 --- a/firmware/src/boards/daisho/fpga.c +++ b/firmware/src/boards/daisho/fpga.c @@ -7,7 +7,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include #include diff --git a/firmware/src/boards/daisho/led.c b/firmware/src/boards/daisho/led.c index 5346836..0ce2bc8 100644 --- a/firmware/src/boards/daisho/led.c +++ b/firmware/src/boards/daisho/led.c @@ -13,7 +13,7 @@ #include #include -#include +#include #include diff --git a/firmware/src/boards/qtpy/fpga.c b/firmware/src/boards/qtpy/fpga.c index b46c7c1..8f67094 100644 --- a/firmware/src/boards/qtpy/fpga.c +++ b/firmware/src/boards/qtpy/fpga.c @@ -7,7 +7,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include #include #include diff --git a/firmware/src/boards/qtpy/led.c b/firmware/src/boards/qtpy/led.c index 47c1e9f..68a1c13 100644 --- a/firmware/src/boards/qtpy/led.c +++ b/firmware/src/boards/qtpy/led.c @@ -14,7 +14,7 @@ #include #include -#include +#include #include diff --git a/firmware/src/boards/qtpy/spi.c b/firmware/src/boards/qtpy/spi.c index fb8d14c..1a4de56 100644 --- a/firmware/src/boards/qtpy/spi.c +++ b/firmware/src/boards/qtpy/spi.c @@ -16,8 +16,6 @@ #include "spi.h" #include "led.h" -#include - // Hide the ugly Atmel Sercom object name. typedef Sercom sercom_t; diff --git a/firmware/src/boards/samd11_xplained/fpga.c b/firmware/src/boards/samd11_xplained/fpga.c index 2dae7fe..358f466 100644 --- a/firmware/src/boards/samd11_xplained/fpga.c +++ b/firmware/src/boards/samd11_xplained/fpga.c @@ -7,7 +7,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include #include // List of pins used for FPGA interfacing. diff --git a/firmware/src/boards/samd11_xplained/led.c b/firmware/src/boards/samd11_xplained/led.c index 5346836..0ce2bc8 100644 --- a/firmware/src/boards/samd11_xplained/led.c +++ b/firmware/src/boards/samd11_xplained/led.c @@ -13,7 +13,7 @@ #include #include -#include +#include #include diff --git a/firmware/src/boards/samd11_xplained/spi.c b/firmware/src/boards/samd11_xplained/spi.c index 6a4b967..907fdf8 100644 --- a/firmware/src/boards/samd11_xplained/spi.c +++ b/firmware/src/boards/samd11_xplained/spi.c @@ -16,8 +16,6 @@ #include "spi.h" #include "led.h" -#include - // Hide the ugly Atmel Sercom object name. typedef Sercom sercom_t; diff --git a/firmware/src/debug_spi.c b/firmware/src/debug_spi.c index 6492040..cf09c34 100644 --- a/firmware/src/debug_spi.c +++ b/firmware/src/debug_spi.c @@ -10,7 +10,7 @@ */ #include -#include +//#include #include #include "led.h" diff --git a/firmware/src/jtag_tap.c b/firmware/src/jtag_tap.c index a748022..0cd8c5f 100644 --- a/firmware/src/jtag_tap.c +++ b/firmware/src/jtag_tap.c @@ -11,7 +11,7 @@ #include #include -#include +#include #include diff --git a/firmware/src/main.c b/firmware/src/main.c index d5a57c6..225999d 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include "led.h" diff --git a/lib/tinyusb b/lib/tinyusb index 9e91b02..5b08a65 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 9e91b02ec7fb3502747b5c413a4824654fa7fc7e +Subproject commit 5b08a65ad2e695332d56bd4676841a91f34dd5b1 From 0117e305169e11740484198e19be21d884871453 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Sun, 1 Oct 2023 19:03:03 -0400 Subject: [PATCH 09/15] ci: change board name from luna to cynthion --- .github/workflows/firmware.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/firmware.yml b/.github/workflows/firmware.yml index 517e277..3e81282 100644 --- a/.github/workflows/firmware.yml +++ b/.github/workflows/firmware.yml @@ -8,8 +8,7 @@ jobs: fail-fast: false matrix: target-board: - - 'luna_d11' - - 'luna_d21' + - 'cynthion' - 'samd11_xplained' - 'qtpy' steps: From 24f5b5ea98b94b48fbd4ab0d11d257af6eea309d Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Sun, 1 Oct 2023 19:33:47 -0400 Subject: [PATCH 10/15] ci: Use tinyusb's new `get-deps` facility Previously we required a recursive installation of a large number of submodules, but now those dependencies are fetched on demand and are limited to those required for the target platform. --- .github/workflows/firmware.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/firmware.yml b/.github/workflows/firmware.yml index 3e81282..d1aee68 100644 --- a/.github/workflows/firmware.yml +++ b/.github/workflows/firmware.yml @@ -25,4 +25,4 @@ jobs: - name: Build Apollo firmware for ${{ matrix.target-board }} run: | cd firmware - APOLLO_BOARD=${{ matrix.target-board }} make all + APOLLO_BOARD=${{ matrix.target-board }} make get-deps all From 4376a6a9831194cbaee7b4c1f1030eb7dc2f09a5 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Sun, 1 Oct 2023 19:42:23 -0400 Subject: [PATCH 11/15] Fill in README with essential information --- README.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fa52529..6a5b1db 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,29 @@ - # Apollo FPGA Programmer / Debugger -This repository contains the work-in-progress extraction of the Apollo programmer from the LUNA repository. +Apollo is the on-board debugger and programmer on [Cynthion](https://greatscottgadgets.com/cynthion/). It is used to load gateware over USB onto Cynthion's FPGA. Alternatively it may be used as an on-board or external debugger for certain other FPGA platforms. + +Apollo consists of two main parts: firmware for the on-board debug microcontroller and Python-based software for the host computer. + +Saturn-V uses only 2 KiB of flash memory, leaving plenty of space for application firmware. Space optimization in Saturn-V was achieved using some of the tricks in [SAMDx1-USB-DFU-Bootloader](https://github.com/majbthrd/SAMDx1-USB-DFU-Bootloader) which is even smaller at 1 KiB but lacks features such as [Microsoft-compatible descriptors](https://github.com/pbatard/libwdi/wiki/WCID-Devices). + +## Building and Installing Firmware + +First activate Cynthion's Saturn-V bootloader by holding down the PROGRAM button while connecting power or while pressing and releasing the RESET button. LED C will blink, indicating that Saturn-V is running. + +To compile for the latest Cynthion hardware revision, type: + +``` +$ cd apollo/firmware +$ make APOLLO_BOARD=cynthion get-deps dfu +``` + +This will download dependencies, compile the firmware, and install it onto Cynthion with Saturn-V. + +Alternatively you can use variables to specify the hardware revision: + +``` +$ cd apollo/firmware +$ make APOLLO_BOARD=cynthion BOARD_REVISION_MAJOR=1 BOARD_REVISION_MINOR=3 get-deps dfu +``` + +Once installation is complete, LED E should blink, indicating that Apollo is running and idle. From 80ba409c5364e6bf7d5fbf2eddcc2a738f5637ba Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Sun, 1 Oct 2023 19:48:51 -0400 Subject: [PATCH 12/15] firmware: add qtpy/usb_switch.c --- firmware/src/boards/qtpy/usb_switch.c | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 firmware/src/boards/qtpy/usb_switch.c diff --git a/firmware/src/boards/qtpy/usb_switch.c b/firmware/src/boards/qtpy/usb_switch.c new file mode 100644 index 0000000..21646b3 --- /dev/null +++ b/firmware/src/boards/qtpy/usb_switch.c @@ -0,0 +1,31 @@ +/** + * switch control for USB port shared by Apollo and FPGA + * + * This file is part of Apollo. + * + * Copyright (c) 2023 Great Scott Gadgets + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "usb_switch.h" + +/** + * Hand off shared USB port to FPGA. + */ +void hand_off_usb(void) +{ +} + +/** + * Take control of USB port from FPGA. + */ +void take_over_usb(void) +{ +} + +/** + * Handle switch control user request. + */ +void switch_control_task(void) +{ +} From 6ec494d4a3e1bf61b0ddfa46bfce639e4e663cd4 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Sun, 1 Oct 2023 19:50:49 -0400 Subject: [PATCH 13/15] README: fix copy/paste error --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 6a5b1db..cf639b5 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ Apollo is the on-board debugger and programmer on [Cynthion](https://greatscottg Apollo consists of two main parts: firmware for the on-board debug microcontroller and Python-based software for the host computer. -Saturn-V uses only 2 KiB of flash memory, leaving plenty of space for application firmware. Space optimization in Saturn-V was achieved using some of the tricks in [SAMDx1-USB-DFU-Bootloader](https://github.com/majbthrd/SAMDx1-USB-DFU-Bootloader) which is even smaller at 1 KiB but lacks features such as [Microsoft-compatible descriptors](https://github.com/pbatard/libwdi/wiki/WCID-Devices). - ## Building and Installing Firmware First activate Cynthion's Saturn-V bootloader by holding down the PROGRAM button while connecting power or while pressing and releasing the RESET button. LED C will blink, indicating that Saturn-V is running. From 7c7fdbe8692dcd2b91f12e082638d4a4a863426e Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Tue, 3 Oct 2023 11:42:19 -0400 Subject: [PATCH 14/15] Remove redundant pin configuration --- firmware/src/boards/cynthion_d11/usb_switch.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/firmware/src/boards/cynthion_d11/usb_switch.c b/firmware/src/boards/cynthion_d11/usb_switch.c index 7cecc76..f0320a4 100644 --- a/firmware/src/boards/cynthion_d11/usb_switch.c +++ b/firmware/src/boards/cynthion_d11/usb_switch.c @@ -43,12 +43,6 @@ void take_over_usb(void) */ void switch_control_task(void) { -#if ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 6)) - gpio_set_pin_pull_mode(PROGRAM_BUTTON, GPIO_PULL_UP); -#else - gpio_set_pin_pull_mode(PROGRAM_BUTTON, GPIO_PULL_OFF); -#endif - gpio_set_pin_direction(PROGRAM_BUTTON, GPIO_DIRECTION_IN); if (gpio_get_pin_level(PROGRAM_BUTTON) == false) { take_over_usb(); } From 338e921e370cee102eb1f5d3b4600d8ea75031d3 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Thu, 5 Oct 2023 21:37:48 -0400 Subject: [PATCH 15/15] firmware: Do not indicate USB switch state If we want to use LED(s) to indicate the switch state, we should do it in a way that the existing LED usage does not override. --- firmware/src/boards/cynthion_d11/usb_switch.c | 7 +------ firmware/src/boards/cynthion_d21/usb_switch.c | 3 --- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/firmware/src/boards/cynthion_d11/usb_switch.c b/firmware/src/boards/cynthion_d11/usb_switch.c index f0320a4..d0639d6 100644 --- a/firmware/src/boards/cynthion_d11/usb_switch.c +++ b/firmware/src/boards/cynthion_d11/usb_switch.c @@ -9,7 +9,6 @@ #include "usb_switch.h" #include "apollo_board.h" -#include "led.h" #include /** @@ -17,12 +16,9 @@ */ void hand_off_usb(void) { -#if ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 6)) - led_on(LED_D); -#else +#if (((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ >= 6)) || (_BOARD_REVISION_MAJOR_ == 1)) gpio_set_pin_level(USB_SWITCH, false); gpio_set_pin_direction(USB_SWITCH, GPIO_DIRECTION_OUT); - led_off(LED_D); #endif } @@ -35,7 +31,6 @@ void take_over_usb(void) gpio_set_pin_level(USB_SWITCH, true); gpio_set_pin_direction(USB_SWITCH, GPIO_DIRECTION_OUT); #endif - led_on(LED_D); } /** diff --git a/firmware/src/boards/cynthion_d21/usb_switch.c b/firmware/src/boards/cynthion_d21/usb_switch.c index 3fc31aa..21646b3 100644 --- a/firmware/src/boards/cynthion_d21/usb_switch.c +++ b/firmware/src/boards/cynthion_d21/usb_switch.c @@ -7,7 +7,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "led.h" #include "usb_switch.h" /** @@ -15,7 +14,6 @@ */ void hand_off_usb(void) { - led_on(LED_D); } /** @@ -23,7 +21,6 @@ void hand_off_usb(void) */ void take_over_usb(void) { - led_on(LED_D); } /**