summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-12-11 15:33:16 +0100
committerDamien George <damien@micropython.org>2022-12-14 12:50:04 +1100
commit17ab2f671b1abe93ccd0024c6750a63e0c20ee6a (patch)
tree291deade2d0f9fd177d0043cacbef23f4fbfc796
parente69313f89c607976da2a7e06ad49b8db9fe1caf9 (diff)
samd: Support entering bootloader via USB CDC 1200bps touch.
-rw-r--r--ports/samd/Makefile1
-rw-r--r--ports/samd/modmachine.c5
-rw-r--r--ports/samd/modmachine.h2
-rw-r--r--ports/samd/mpconfigport.h2
4 files changed, 7 insertions, 3 deletions
diff --git a/ports/samd/Makefile b/ports/samd/Makefile
index 581762091..fc5fa9e43 100644
--- a/ports/samd/Makefile
+++ b/ports/samd/Makefile
@@ -117,6 +117,7 @@ SHARED_SRC_C += \
shared/runtime/stdout_helpers.c \
shared/runtime/sys_stdio_mphal.c \
shared/timeutils/timeutils.c \
+ shared/tinyusb/mp_cdc_common.c \
ASF4_SRC_C += $(addprefix lib/asf4/$(MCU_SERIES_LOWER)/,\
hal/src/hal_atomic.c \
diff --git a/ports/samd/modmachine.c b/ports/samd/modmachine.c
index 8adc06f52..ec3e99f16 100644
--- a/ports/samd/modmachine.c
+++ b/ports/samd/modmachine.c
@@ -74,15 +74,14 @@ STATIC mp_obj_t machine_reset(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
-STATIC mp_obj_t machine_bootloader(void) {
+NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args) {
*DBL_TAP_ADDR = DBL_TAP_MAGIC_LOADER;
#ifdef DBL_TAP_ADDR_ALT
*DBL_TAP_ADDR_ALT = DBL_TAP_MAGIC_LOADER;
#endif
NVIC_SystemReset();
- return mp_const_none;
}
-MP_DEFINE_CONST_FUN_OBJ_0(machine_bootloader_obj, machine_bootloader);
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_bootloader_obj, 0, 1, machine_bootloader);
STATIC mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
diff --git a/ports/samd/modmachine.h b/ports/samd/modmachine.h
index 792fca1b9..e8738df4b 100644
--- a/ports/samd/modmachine.h
+++ b/ports/samd/modmachine.h
@@ -41,4 +41,6 @@ extern const mp_obj_type_t machine_wdt_type;
extern const mp_obj_type_t machine_rtc_type;
#endif
+NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args);
+
#endif // MICROPY_INCLUDED_SAMD_MODMACHINE_H
diff --git a/ports/samd/mpconfigport.h b/ports/samd/mpconfigport.h
index 878f481f4..b3ca67cae 100644
--- a/ports/samd/mpconfigport.h
+++ b/ports/samd/mpconfigport.h
@@ -58,7 +58,9 @@
#define MICROPY_PY_BUILTINS_HELP_TEXT samd_help_text
#define MICROPY_PY_BUILTINS_HELP_MODULES (1)
#define MICROPY_ENABLE_SCHEDULER (1)
+#define MICROPY_SCHEDULER_STATIC_NODES (1)
#define MICROPY_MODULE_WEAK_LINKS (1)
+#define MICROPY_HW_USB_CDC_1200BPS_TOUCH (1)
// Control over Python builtins
#define MICROPY_PY_BUILTINS_BYTES_HEX (1)