File tree 7 files changed +42
-2
lines changed
7 files changed +42
-2
lines changed Original file line number Diff line number Diff line change 1
- TARGETS = firmware boot test_rig
1
+ TARGETS = firmware boot test_rig test_rig_boot
2
2
BUILD = build
3
3
4
4
all : $(TARGETS )
Original file line number Diff line number Diff line change 9
9
10
10
#pragma once
11
11
#include "class/dfu/dfu.h"
12
+
13
+ #ifdef TEST_RIG_BOOTLOADER
14
+ #include "test_rig/test_rig_board.h"
15
+ #define PIN_BTN PIN_START_BUTTON
16
+ #define PIN_LED DIGITAL_PINS[4]
17
+ #else
12
18
#include "common/board.h"
19
+ #endif
13
20
14
21
#define GCLK_SYSTEM 0
15
22
#define DFU_INTF 0
Original file line number Diff line number Diff line change @@ -82,21 +82,25 @@ void led_task() {
82
82
}
83
83
84
84
void bootloader_main () {
85
+ #ifndef TEST_RIG_BOOTLOADER
85
86
if (PM -> RCAUSE .reg & (PM_RCAUSE_POR | PM_RCAUSE_BOD12 | PM_RCAUSE_BOD33 )) {
86
87
// On powerup, power off MT7620
87
88
pin_low (PIN_SOC_RST );
88
89
pin_out (PIN_SOC_RST );
89
90
}
91
+ #endif
90
92
91
93
clock_init_usb (GCLK_SYSTEM );
92
94
init_systick ();
93
95
nvm_init ();
94
96
97
+ #ifndef TEST_RIG_BOOTLOADER
95
98
pin_low (PORT_A .power );
96
99
pin_out (PORT_A .power );
97
100
98
101
pin_low (PORT_B .power );
99
102
pin_out (PORT_B .power );
103
+ #endif
100
104
101
105
pin_out (PIN_LED );
102
106
Original file line number Diff line number Diff line change @@ -23,8 +23,13 @@ const USB_DeviceDescriptor device_descriptor = {
23
23
.bDeviceProtocol = USB_CSCP_NoDeviceProtocol ,
24
24
25
25
.bMaxPacketSize0 = 64 ,
26
+ #ifdef TEST_RIG_BOOTLOADER
27
+ .idVendor = 0x59E3 ,
28
+ .idProduct = 0xCDA7 ,
29
+ #else
26
30
.idVendor = 0x1209 ,
27
31
.idProduct = 0x7551 ,
32
+ #endif
28
33
.bcdDevice = 0x0002 ,
29
34
30
35
.iManufacturer = 0x01 ,
Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ $(TARGET)_SRC += \
13
13
test_rig/button.c \
14
14
15
15
$(TARGET)_DEFINE += -D __SAMD21J18A__
16
- $(TARGET)_LDSCRIPT = deps/sam0/linker_scripts/samd21/gcc/samd21j18a_flash .ld
16
+ $(TARGET)_LDSCRIPT = common/samd21g15a_firmware_partition .ld
Original file line number Diff line number Diff line change 8
8
9
9
#define REQ_INFO 0x30
10
10
#define REQ_INFO_GIT_HASH 0x0
11
+ #define REQ_BOOT 0xBB
11
12
12
13
USB_ENDPOINTS (5 );
13
14
@@ -215,6 +216,12 @@ void req_info(uint16_t wIndex) {
215
216
return usb_ep0_in (len );
216
217
}
217
218
219
+ void req_boot () {
220
+ wdt_reset (GCLK_32K );
221
+ usb_ep0_out ();
222
+ return usb_ep0_in (0 );
223
+ }
224
+
218
225
void usb_cb_control_setup (void ) {
219
226
uint8_t recipient = usb_setup .bmRequestType & USB_REQTYPE_RECIPIENT_MASK ;
220
227
if (recipient == USB_RECIPIENT_DEVICE ) {
@@ -228,6 +235,7 @@ void usb_cb_control_setup(void) {
228
235
return usb_control_req_digital_read_all ();
229
236
case ANALOG_SAMPLE :
230
237
return usb_control_req_analog_read (usb_setup .wIndex , usb_setup .wValue );
238
+ case REQ_BOOT : return req_boot ();
231
239
}
232
240
} else if (recipient == USB_RECIPIENT_INTERFACE ) {
233
241
}
Original file line number Diff line number Diff line change
1
+ TARGET := test_rig_boot
2
+
3
+ include common.mk
4
+ include usb.mk
5
+
6
+ $(TARGET)_INCLUDE += \
7
+ -I boot \
8
+
9
+ $(TARGET)_SRC += \
10
+ boot/main.c \
11
+ boot/usb.c \
12
+ $(USB_PATH ) /class/dfu/dfu.c
13
+
14
+ $(TARGET)_LDSCRIPT = deps/sam0/linker_scripts/samd21/gcc/samd21j18a_flash.ld
15
+ $(TARGET)_DEFINE += -D __SAMD21J18A__
16
+ $(TARGET)_DEFINE += -D TEST_RIG_BOOTLOADER
You can’t perform that action at this time.
0 commit comments