Skip to content

Commit 068d62b

Browse files
committed
Merge branch 'dfu_wait_no_serialport' into irq_management_revision
2 parents e39b49c + 0d48d4c commit 068d62b

File tree

17 files changed

+792
-879
lines changed

17 files changed

+792
-879
lines changed

boards.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ portenta_h33.upload.pid=0x0368
4141
portenta_h33.upload.address=0x00010000
4242
portenta_h33.upload.interface=0
4343
portenta_h33.upload.use_1200bps_touch=true
44-
portenta_h33.upload.wait_for_upload_port=true
44+
portenta_h33.upload.wait_for_upload_port=false
4545
portenta_h33.upload.native_usb=true
4646
portenta_h33.upload.maximum_size=2097152
4747
portenta_h33.upload.maximum_data_size=523624
@@ -89,7 +89,7 @@ santiago.upload.pid=0x0369
8989
santiago.upload.address=0x00010000
9090
santiago.upload.interface=0
9191
santiago.upload.use_1200bps_touch=true
92-
santiago.upload.wait_for_upload_port=true
92+
santiago.upload.wait_for_upload_port=false
9393
santiago.upload.native_usb=true
9494
santiago.upload.maximum_size=262144
9595
santiago.upload.maximum_data_size=32768

bootloaders/SANTIAGO/dfu.elf

71.6 KB
Binary file not shown.

bootloaders/SANTIAGO/dfu.hex

Lines changed: 706 additions & 836 deletions
Large diffs are not rendered by default.

cores/arduino/Arduino.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111

1212

1313
#if defined(__cplusplus)
14+
15+
using namespace arduino;
16+
1417
#include "usb/SerialUSB.h"
1518
#include "pwm.h"
1619
#include "Serial.h"
1720
#endif
1821

19-
2022
#if defined(__cplusplus)
2123

2224
#undef F
@@ -40,6 +42,7 @@ void analogWriteResolution(int bits);
4042
int getAnalogWriteResolution();
4143
ioport_peripheral_t getPinConfig(bsp_io_port_pin_t pin);
4244

45+
#if defined(__cplusplus)
4346
using rtc_simple_cbk_t = void (*)();
4447
bool openRtc();
4548
bool setRtcTime(rtc_time_t time);
@@ -50,7 +53,7 @@ bool setRtcAlarm(rtc_alarm_time_t alarm_time);
5053
bool isRtcRunning();
5154
void setRtcPeriodicClbk(rtc_simple_cbk_t f);
5255
void setRtcAlarmClbk(rtc_simple_cbk_t f);
53-
56+
#endif
5457

5558
// Definitions for PWM channels
5659
typedef enum _EPWMChannel
@@ -164,6 +167,14 @@ extern sciTable_t SciTable[];
164167
#define digitalPinToPwmPin(P) (g_APinDescription[P].PWMChannel)
165168
#define digitalPinToPwmObj(P) (pwmTable[digitalPinToPwmPin(P)].pwm)
166169

170+
#define IOPORT_PRV_PORT_ADDRESS(port_number) ((uint32_t) (R_PORT1 - R_PORT0) * (port_number) + R_PORT0)
171+
172+
#define digitalPinToPort(P) (digitalPinToBspPin(P) >> 8)
173+
#define digitalPinToBitMask(P) (1 << (digitalPinToBspPin(P) & 0xFF))
174+
#define portOutputRegister(port) &(((R_PORT0_Type *)IOPORT_PRV_PORT_ADDRESS(port))->PODR)
175+
#define portInputRegister(port) &(((R_PORT0_Type *)IOPORT_PRV_PORT_ADDRESS(port))->PIDR)
176+
#define portModeRegister(port) &(((R_PORT0_Type *)IOPORT_PRV_PORT_ADDRESS(port))->PDR)
177+
167178
void pinPeripheral(bsp_io_port_pin_t bspPin, uint32_t bspPeripheral);
168179
#if defined(__cplusplus)
169180
void pinPeripheral(uint32_t pinNumber, uint32_t bspPeripheral);

cores/arduino/Serial.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -298,25 +298,4 @@ int UART::read() {
298298
void UART::flush() {
299299
/* -------------------------------------------------------------------------- */
300300
while (tx_st == TX_STARTED){};
301-
}
302-
303-
304-
#if SERIAL_HOWMANY > 0
305-
UART _UART1_(UART1_CHANNEL);
306-
#endif
307-
308-
#if SERIAL_HOWMANY > 1
309-
UART _UART2_(UART2_CHANNEL);
310-
#endif
311-
312-
#if SERIAL_HOWMANY > 2
313-
UART _UART3_(UART3_CHANNEL);
314-
#endif
315-
316-
#if SERIAL_HOWMANY > 3
317-
UART _UART4_(UART4_CHANNEL);
318-
#endif
319-
320-
#if SERIAL_HOWMANY > 4
321-
UART _UART5_(UART5_CHANNEL);
322-
#endif
301+
}

cores/arduino/SerialObjs.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include "Serial.h"
2+
3+
#if SERIAL_HOWMANY > 0
4+
UART _UART1_(UART1_CHANNEL);
5+
#endif
6+
7+
#if SERIAL_HOWMANY > 1
8+
UART _UART2_(UART2_CHANNEL);
9+
#endif
10+
11+
#if SERIAL_HOWMANY > 2
12+
UART _UART3_(UART3_CHANNEL);
13+
#endif
14+
15+
#if SERIAL_HOWMANY > 3
16+
UART _UART4_(UART4_CHANNEL);
17+
#endif
18+
19+
#if SERIAL_HOWMANY > 4
20+
UART _UART5_(UART5_CHANNEL);
21+
#endif

cores/arduino/cortex_handlers.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include "Arduino.h"
2+
3+
#if 0
4+
5+
// TODO: check if gdb is able to unwind the call stack even without this
6+
7+
/*
8+
test code:
9+
10+
int illegal_instruction_execution(void) {
11+
int (*bad_instruction)(void) = (int (*)())0xE0000000;
12+
return bad_instruction();
13+
}
14+
*/
15+
16+
/* On hard fault, copy HARDFAULT_PSP to the sp reg so gdb can give a trace */
17+
void **HARDFAULT_PSP;
18+
register void *stack_pointer asm("sp");
19+
void HardFault_Handler(void) {
20+
asm("mrs %0, psp" : "=r"(HARDFAULT_PSP) : :);
21+
stack_pointer = HARDFAULT_PSP;
22+
while(1);
23+
}
24+
25+
#endif

cores/arduino/main.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ void arduino_main(void)
3737
_init();
3838
initVariant();
3939
__USBStart();
40+
Serial.begin(115200);
4041
startAgt();
4142
setup();
4243
while (1)
@@ -57,7 +58,4 @@ extern "C" {
5758
arduino_main();
5859
}
5960
}
60-
#endif
61-
62-
extern "C" void __cxa_pure_virtual() { while(1); }
63-
extern "C" void __cxa_deleted_virtual() { while(1); }
61+
#endif

cores/arduino/usb/SerialUSB.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ static void CheckSerialReset() {
138138
R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_PRC1_UNLOCK;
139139
BOOT_DOUBLE_TAP_DATA = DOUBLE_TAP_MAGIC;
140140
R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_LOCK;
141+
((R_USB_FS0_Type*)R_USB_FS0_BASE)->SYSCFG_b.DPRPU = 0;
141142
NVIC_SystemReset();
142143
while (1); // WDT will fire here
143144
}

drivers/santiago.cat

-12 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)