Skip to content

Commit 9d13f80

Browse files
committed
Merge branch 'dfu_wait_no_serialport' into irq_management_revision
Former-commit-id: 068d62b
2 parents c3d93c1 + 27909a5 commit 9d13f80

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.

drivers/santiago.inf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ DriverVer = 01/08/2022,10.55.00.000
1818

1919
[Standard.NTamd64]
2020
%DeviceName%=USB_Install, USB\VID_2341&PID_0369&MI_00
21+
%DeviceNameDFUOnly%=USB_Install, USB\VID_2341&PID_0369
2122

2223
; ========== Class definition ===========
2324

@@ -55,5 +56,6 @@ HKR,,DeviceInterfaceGUIDs,0x10000,"{51de5bfa-d59d-4f3e-9b36-0b4b210dd53f}"
5556
[Strings]
5657
ManufacturerName="Arduino"
5758
DeviceName="Arduino Santiago"
59+
DeviceNameDFUOnly="Arduino Santiago"
5860
ClassName="Universal Serial Bus devices"
5961
REG_MULTI_SZ = 0x00010000

extras/package_index.json.template

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"name": "Arduino Renesas Boards",
1414
"architecture": "renesas",
1515
"version": "%%VERSION%%",
16-
"deprecated": true,
1716
"category": "Arduino",
1817
"url": "http://downloads.arduino.cc/cores/staging/%%FILENAME%%",
1918
"archiveFileName": "%%FILENAME%%",
@@ -43,7 +42,7 @@
4342
},
4443
{
4544
"packager": "arduino",
46-
"version": "0.11.0-arduino1",
45+
"version": "0.11.0-arduino3",
4746
"name": "dfu-util"
4847
}
4948
]

extras/tinyusb

libraries/SPI/SPI.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include "SPI.h"
1515

16+
using namespace arduino;
17+
1618
extern const spi_extended_cfg_t g_spi0_ext_cfg;
1719
extern const spi_extended_cfg_t g_spi1_ext_cfg;
1820
extern const sci_spi_extended_cfg_t g_spi2_cfg_extend;
@@ -71,13 +73,13 @@ void ArduinoSPI::begin()
7173
periphBusCfg = SPI_BUS;
7274
}
7375
#endif
74-
#if SERIAL_HOWMANY > 1
76+
#if SPI_HOWMANY > 1
7577
if (_channel == SPI1_CHANNEL) {
7678
isSPIObject = true;
7779
periphBusCfg = SPI1_BUS;
7880
}
7981
#endif
80-
#if SERIAL_HOWMANY > 2
82+
#if SPI_HOWMANY > 2
8183
if (_channel == SPI2_CHANNEL) {
8284
isSPIObject = true;
8385
periphBusCfg = SPI2_BUS;

libraries/SPI/SPI.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
//extern const spi_extended_cfg_t g_spi0_ext_cfg;
2424
//extern const sci_spi_extended_cfg_t g_spi1_cfg_extend;
2525

26-
class ArduinoSPI : public arduino::SPIClass
26+
namespace arduino {
27+
28+
class ArduinoSPI : public SPIClass
2729
{
2830
public:
2931
ArduinoSPI(spi_ctrl_t *g_spi_ctrl
@@ -79,14 +81,16 @@ class ArduinoSPI : public arduino::SPIClass
7981
bool _is_sci;
8082
};
8183

84+
}
85+
8286
#if SPI_HOWMANY > 0
83-
extern ArduinoSPI SPI;
87+
extern arduino::ArduinoSPI SPI;
8488
#endif
8589
#if SPI_HOWMANY > 1
8690
#ifdef SPI1
8791
#undef SPI1
8892
#endif
89-
extern ArduinoSPI SPI1;
93+
extern arduino::ArduinoSPI SPI1;
9094
#endif
9195

9296
#endif

platform.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ compiler.warning_flags.all=-Wall -Wextra
1616

1717
compiler.path={build.compiler_path}
1818
compiler.c.cmd={build.crossprefix}gcc
19-
compiler.c.flags=-c {compiler.warning_flags} -Os -g3 --specs=nano.specs -nostdlib {build.defines} -MMD -std=gnu11 -mcpu={build.mcu} {build.float-abi} {build.fpu} -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections
19+
compiler.c.flags=-c {compiler.warning_flags} -Os -g3 --specs=nano.specs -nostdlib {build.defines} -MMD -std=gnu11 -mcpu={build.mcu} {build.float-abi} {build.fpu} -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin
2020
compiler.c.elf.cmd={build.crossprefix}g++
21-
compiler.c.elf.flags=-Wl,--gc-sections --specs=nano.specs {compiler.warning_flags} -mcpu={build.mcu} {build.float-abi} {build.fpu} -fsigned-char -ffunction-sections -fdata-sections
21+
compiler.c.elf.flags=-Wl,--gc-sections --specs=nano.specs --specs=nosys.specs {compiler.warning_flags} -mcpu={build.mcu} {build.float-abi} {build.fpu}
2222
compiler.S.cmd={build.crossprefix}g++
2323
compiler.S.flags=-c -g -x assembler-with-cpp -Os -mcpu={build.mcu} {build.float-abi} {build.fpu} -fsigned-char -ffunction-sections -fdata-sections
2424
compiler.cpp.cmd={build.crossprefix}g++
25-
compiler.cpp.flags=-c {compiler.warning_flags} -Os --specs=nano.specs -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib {build.defines} -MMD -std=gnu++11 -mcpu={build.mcu} {build.float-abi} {build.fpu} -fsigned-char -ffunction-sections -fdata-sections
25+
compiler.cpp.flags=-c {compiler.warning_flags} -Os --specs=nano.specs -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib {build.defines} -MMD -std=gnu++11 -mcpu={build.mcu} {build.float-abi} {build.fpu} -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin
2626
compiler.ar.cmd={build.crossprefix}ar
2727
compiler.ar.flags=rcs
2828
compiler.ar.extra_flags=
@@ -73,7 +73,7 @@ recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -D
7373
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
7474

7575
## Combine gc-sections, archives, and objects
76-
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {build.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" "-L{build.variant.path}" "-T{build.variant.path}/fsp.ld" {object_files} -Wl,--whole-archive "{build.path}/{archive_file}" {compiler.fsp} -Wl,--no-whole-archive -Wl,--start-group {compiler.fsp.extra_ldflags} {compiler.libraries.ldflags} -Wl,-Map,{build.path}/{build.project_name}.map -Wl,--end-group
76+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {build.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" "-L{build.variant.path}" "-T{build.variant.path}/fsp.ld" {object_files} -Wl,--start-group {compiler.fsp} "{build.path}/{archive_file}" {compiler.fsp.extra_ldflags} {compiler.libraries.ldflags} -Wl,--end-group -Wl,-Map,{build.path}/{build.project_name}.map
7777

7878
## Create output (bin file)
7979
recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.bin.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
@@ -97,4 +97,4 @@ tools.dfu-util.path={runtime.tools.dfu-util.path}
9797
tools.dfu-util.cmd=dfu-util
9898
tools.dfu-util.upload.params.verbose=-d
9999
tools.dfu-util.upload.params.quiet=
100-
tools.dfu-util.upload.pattern="{path}/{cmd}" --device {upload.vid}:{upload.pid} -D "{build.path}/{build.project_name}.bin" -a{upload.interface} -R
100+
tools.dfu-util.upload.pattern="{path}/{cmd}" --device {upload.vid}:{upload.pid} -D "{build.path}/{build.project_name}.bin" -a{upload.interface} -R -w

variants/SANTIAGO/fsp.ld

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ SECTIONS
467467
{
468468
. = ALIGN(8);
469469
__HeapBase = .;
470+
end = .;
470471
/* Place the STD heap here. */
471472
KEEP(*(.heap))
472473
__HeapLimit = .;

0 commit comments

Comments
 (0)