mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
ports/alif: Switch to new protocol.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
parent
0718c4bfbd
commit
bb517e5cdd
@ -176,8 +176,8 @@ LDFLAGS = -mthumb \
|
||||
|
||||
ifeq ($(MCU_CORE),M55_HP)
|
||||
# Linker Flags
|
||||
LDFLAGS += -Wl,--wrap=mp_usbd_task \
|
||||
-Wl,--wrap=tud_cdc_rx_cb \
|
||||
LDFLAGS += -Wl,--wrap=tud_cdc_rx_cb \
|
||||
-Wl,--wrap=tud_cdc_line_state_cb \
|
||||
-Wl,--wrap=mp_hal_stdio_poll \
|
||||
-Wl,--wrap=mp_hal_stdout_tx_strn
|
||||
endif
|
||||
@ -186,6 +186,7 @@ endif
|
||||
include lib/cmsis/cmsis.mk
|
||||
include lib/alif/alif.mk
|
||||
include common/common.mk
|
||||
include protocol/protocol.mk
|
||||
include drivers/drivers.mk
|
||||
include lib/imlib/imlib.mk
|
||||
include lib/tflm/tflm.mk
|
||||
|
@ -69,8 +69,6 @@
|
||||
|
||||
#include "omv_boardconfig.h"
|
||||
#include "framebuffer.h"
|
||||
#include "usbdbg.h"
|
||||
#include "tinyusb_debug.h"
|
||||
#include "fb_alloc.h"
|
||||
#include "file_utils.h"
|
||||
#include "mp_utils.h"
|
||||
@ -81,6 +79,7 @@
|
||||
#include "py_audio.h"
|
||||
#include "py_imu.h"
|
||||
#include "omv_gpio.h"
|
||||
#include "omv_protocol.h"
|
||||
|
||||
NORETURN void __fatal_error(const char *msg);
|
||||
extern void machine_pin_irq_deinit(void);
|
||||
@ -125,9 +124,6 @@ soft_reset:
|
||||
#ifdef IMLIB_ENABLE_IMAGE_FILE_IO
|
||||
file_buffer_init0();
|
||||
#endif
|
||||
#if CORE_M55_HP
|
||||
usbdbg_init();
|
||||
#endif
|
||||
#if MICROPY_PY_IMU
|
||||
py_imu_init();
|
||||
#endif
|
||||
@ -138,6 +134,11 @@ soft_reset:
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CORE_M55_HP
|
||||
// Initialize OpenMV protocol
|
||||
omv_protocol_init_default();
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_LWIP
|
||||
// lwIP can only be initialized once, because the system timeout
|
||||
// list (next_timeout), is only ever reset by BSS clearing.
|
||||
@ -168,17 +169,6 @@ soft_reset:
|
||||
mod_network_init();
|
||||
#endif
|
||||
|
||||
// TODO: _boot on HP uses OSPI which is disabled right now.
|
||||
#if MICROPY_HW_ENABLE_OSPI || CORE_M55_HE
|
||||
// Execute _boot.py.
|
||||
pyexec_frozen_module("_boot.py", false);
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_ENABLE_OSPI
|
||||
// Mark the filesystem as an OpenMV storage.
|
||||
file_ll_touch(".openmv_disk");
|
||||
#endif
|
||||
|
||||
// Initialize TinyUSB after the filesystem is mounted.
|
||||
#if MICROPY_HW_ENABLE_USBDEV
|
||||
if (!tusb_inited()) {
|
||||
@ -186,26 +176,25 @@ soft_reset:
|
||||
}
|
||||
#endif
|
||||
|
||||
// Run boot.py script.
|
||||
bool interrupted = mp_exec_bootscript("boot.py", true);
|
||||
// Execute _boot.py.
|
||||
pyexec_frozen_module("_boot.py", false);
|
||||
|
||||
// Run main.py script on first soft-reset.
|
||||
if (first_soft_reset && !interrupted && mp_vfs_import_stat("main.py")) {
|
||||
mp_exec_bootscript("main.py", true);
|
||||
goto soft_reset_exit;
|
||||
// Run boot.py every reset and main.py on first soft-reset
|
||||
if (pyexec_file_if_exists("boot.py") && first_soft_reset) {
|
||||
pyexec_file_if_exists("main.py");
|
||||
}
|
||||
|
||||
#if CORE_M55_HE
|
||||
goto soft_reset_exit;
|
||||
#endif
|
||||
|
||||
// If there's no script ready, just re-exec REPL
|
||||
while (!usbdbg_script_ready()) {
|
||||
while (!omv_protocol_exec_script()) {
|
||||
nlr_buf_t nlr;
|
||||
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
// enable IDE interrupt
|
||||
usbdbg_set_irq_enabled(true);
|
||||
// run REPL
|
||||
// Enable Ctrl+C to interrupt script or REPL.
|
||||
mp_hal_set_interrupt_char(CHAR_CTRL_C);
|
||||
|
||||
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
|
||||
if (pyexec_raw_repl() != 0) {
|
||||
break;
|
||||
@ -219,22 +208,10 @@ soft_reset:
|
||||
}
|
||||
}
|
||||
|
||||
if (usbdbg_script_ready()) {
|
||||
nlr_buf_t nlr;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
// Enable IDE interrupt
|
||||
usbdbg_set_irq_enabled(true);
|
||||
// Execute the script.
|
||||
pyexec_str(usbdbg_get_script(), true);
|
||||
// Disable IDE interrupts
|
||||
usbdbg_set_irq_enabled(false);
|
||||
nlr_pop();
|
||||
} else {
|
||||
mp_obj_print_exception(&mp_plat_print, (mp_obj_t) nlr.ret_val);
|
||||
}
|
||||
}
|
||||
|
||||
#if CORE_M55_HE
|
||||
soft_reset_exit:
|
||||
#endif
|
||||
mp_hal_set_interrupt_char(-1);
|
||||
mp_printf(MP_PYTHON_PRINTER, "MPY: soft reboot\n");
|
||||
#if MICROPY_PY_CSI
|
||||
omv_csi_abort_all();
|
||||
|
Loading…
Reference in New Issue
Block a user