summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/alif/alif_flash.c2
-rw-r--r--ports/alif/boards/manifest.py2
-rw-r--r--ports/alif/main.c4
-rw-r--r--ports/alif/modalif.c2
-rw-r--r--ports/alif/modules/he/_boot.py21
-rw-r--r--ports/alif/modules/hp/_boot.py (renamed from ports/alif/modules/_boot.py)0
-rw-r--r--ports/alif/mpconfigport.h20
-rw-r--r--ports/alif/mpconfigport.mk1
-rw-r--r--ports/alif/mphalport.c2
-rw-r--r--ports/alif/ospi_flash.c4
-rw-r--r--ports/alif/tinyusb_port/tusb_config.h2
11 files changed, 50 insertions, 10 deletions
diff --git a/ports/alif/alif_flash.c b/ports/alif/alif_flash.c
index e3b212580..f2ea5ac85 100644
--- a/ports/alif/alif_flash.c
+++ b/ports/alif/alif_flash.c
@@ -30,6 +30,7 @@
#include "modalif.h"
#include "ospi_flash.h"
+#if MICROPY_HW_ENABLE_OSPI
typedef struct _alif_flash_obj_t {
mp_obj_base_t base;
uint32_t flash_base_addr;
@@ -158,3 +159,4 @@ MP_DEFINE_CONST_OBJ_TYPE(
make_new, alif_flash_make_new,
locals_dict, &alif_flash_locals_dict
);
+#endif // MICROPY_HW_ENABLE_OSPI
diff --git a/ports/alif/boards/manifest.py b/ports/alif/boards/manifest.py
index 148f1d6a6..1dc9e179a 100644
--- a/ports/alif/boards/manifest.py
+++ b/ports/alif/boards/manifest.py
@@ -1,4 +1,4 @@
-freeze("$(PORT_DIR)/modules")
+freeze("$(PORT_DIR)/modules/$(MCU_CORE)")
include("$(MPY_DIR)/extmod/asyncio")
require("dht")
require("neopixel")
diff --git a/ports/alif/main.c b/ports/alif/main.c
index 2d3134176..975ee7ed2 100644
--- a/ports/alif/main.c
+++ b/ports/alif/main.c
@@ -68,11 +68,11 @@ void _start(void) {
#if MICROPY_HW_ENABLE_UART_REPL
mp_uart_init();
#endif
-
+ #if MICROPY_HW_ENABLE_OSPI
if (ospi_flash_init() != 0) {
MICROPY_BOARD_FATAL_ERROR("ospi_init failed");
}
-
+ #endif
#if MICROPY_HW_ENABLE_USBDEV
NVIC_ClearPendingIRQ(USB_IRQ_IRQn);
NVIC_SetPriority(USB_IRQ_IRQn, IRQ_PRI_USB);
diff --git a/ports/alif/modalif.c b/ports/alif/modalif.c
index 5577b53ea..1c3c34394 100644
--- a/ports/alif/modalif.c
+++ b/ports/alif/modalif.c
@@ -37,7 +37,9 @@ static MP_DEFINE_CONST_FUN_OBJ_0(alif_info_obj, alif_info);
static const mp_rom_map_elem_t alif_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alif) },
+ #if MICROPY_HW_ENABLE_OSPI
{ MP_ROM_QSTR(MP_QSTR_Flash), MP_ROM_PTR(&alif_flash_type) },
+ #endif
{ MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&alif_info_obj) },
#if MICROPY_HW_USB_MSC
// Attribute to indicate USB MSC is enabled.
diff --git a/ports/alif/modules/he/_boot.py b/ports/alif/modules/he/_boot.py
new file mode 100644
index 000000000..bc1320f19
--- /dev/null
+++ b/ports/alif/modules/he/_boot.py
@@ -0,0 +1,21 @@
+import openamp
+import time
+from machine import Pin
+
+
+def ept_recv_callback(src_addr, data):
+ print("Received message on endpoint", data)
+
+
+# Create a new RPMsg endpoint to communicate with main core.
+ept = openamp.Endpoint("vuart-channel", callback=ept_recv_callback)
+
+pin = Pin("LED_BLUE", Pin.OUT)
+
+count = 0
+while True:
+ if ept.is_ready():
+ ept.send("Hello from HE %d" % count, timeout=1000)
+ count += 1
+ time.sleep_ms(100)
+ pin(not pin())
diff --git a/ports/alif/modules/_boot.py b/ports/alif/modules/hp/_boot.py
index 36044b461..36044b461 100644
--- a/ports/alif/modules/_boot.py
+++ b/ports/alif/modules/hp/_boot.py
diff --git a/ports/alif/mpconfigport.h b/ports/alif/mpconfigport.h
index 95b5e3ca9..df33b9220 100644
--- a/ports/alif/mpconfigport.h
+++ b/ports/alif/mpconfigport.h
@@ -36,13 +36,18 @@
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_FULL_FEATURES)
#endif
-#define MICROPY_HW_ENABLE_UART_REPL (1) // useful if there is no USB
-#define MICROPY_HW_ENABLE_USBDEV (1)
-
+#ifndef MICROPY_HW_ENABLE_OSPI
+#define MICROPY_HW_ENABLE_OSPI (CORE_M55_HP)
+#endif
+#ifndef MICROPY_HW_ENABLE_USBDEV
+#define MICROPY_HW_ENABLE_USBDEV (CORE_M55_HP)
+#endif
#ifndef MICROPY_HW_USB_PRODUCT_FS_STRING
#define MICROPY_HW_USB_PRODUCT_FS_STRING "Board in HS mode"
#endif
-#define MICROPY_HW_USB_CDC (1)
+#ifndef MICROPY_HW_USB_CDC
+#define MICROPY_HW_USB_CDC (CORE_M55_HP)
+#endif
#define MICROPY_HW_USB_CDC_TX_TIMEOUT (500)
#ifndef MICROPY_HW_USB_MSC
#define MICROPY_HW_USB_MSC (0)
@@ -53,7 +58,9 @@
#ifndef MICROPY_HW_USB_PID
#define MICROPY_HW_USB_PID (0x9802) // interface has CDC only
#endif
-
+#ifndef MICROPY_HW_ENABLE_UART_REPL
+#define MICROPY_HW_ENABLE_UART_REPL (CORE_M55_HP) // useful if there is no USB
+#endif
#define MICROPY_HW_FLASH_BLOCK_SIZE_BYTES (4096)
// Memory allocation policies
@@ -78,6 +85,9 @@
#define MICROPY_ENABLE_GC (1)
#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
+#ifndef MICROPY_FLOAT_IMPL
+#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
+#endif
#define MICROPY_SCHEDULER_DEPTH (8)
#define MICROPY_SCHEDULER_STATIC_NODES (1)
#define MICROPY_USE_INTERNAL_ERRNO (1)
diff --git a/ports/alif/mpconfigport.mk b/ports/alif/mpconfigport.mk
index 3d04450a6..92d9a5db8 100644
--- a/ports/alif/mpconfigport.mk
+++ b/ports/alif/mpconfigport.mk
@@ -10,3 +10,4 @@ MICROPY_VFS_LFS2 ?= 1
# File containing description of content to be frozen into firmware.
FROZEN_MANIFEST ?= boards/manifest.py
+MICROPY_MANIFEST_MCU_CORE := $(shell echo $(MCU_CORE) | awk -F'_' '{print tolower($$2)}')
diff --git a/ports/alif/mphalport.c b/ports/alif/mphalport.c
index ba58923f2..9769ddeae 100644
--- a/ports/alif/mphalport.c
+++ b/ports/alif/mphalport.c
@@ -85,8 +85,10 @@ int mp_hal_stdin_rx_chr(void) {
// Send string of given length
mp_uint_t mp_hal_stdout_tx_strn(const char *str, size_t len) {
+ #if MICROPY_HW_ENABLE_UART_REPL || MICROPY_HW_USB_CDC || MICROPY_PY_OS_DUPTERM
mp_uint_t ret = len;
bool did_write = false;
+ #endif
#if MICROPY_HW_ENABLE_UART_REPL
mp_uart_write_strn(str, len);
diff --git a/ports/alif/ospi_flash.c b/ports/alif/ospi_flash.c
index fa96053b3..f84761366 100644
--- a/ports/alif/ospi_flash.c
+++ b/ports/alif/ospi_flash.c
@@ -26,8 +26,9 @@
#include "py/mperrno.h"
#include "py/mphal.h"
-#include "ospi_flash.h"
+#if MICROPY_HW_ENABLE_OSPI
+#include "ospi_flash.h"
#include "ospi_drv.h"
#include "pinconf.h"
@@ -263,3 +264,4 @@ int ospi_flash_write(uint32_t addr, uint32_t len, const uint8_t *src) {
}
return ret;
}
+#endif // MICROPY_HW_ENABLE_OSPI
diff --git a/ports/alif/tinyusb_port/tusb_config.h b/ports/alif/tinyusb_port/tusb_config.h
index d244b4c24..6c4ead112 100644
--- a/ports/alif/tinyusb_port/tusb_config.h
+++ b/ports/alif/tinyusb_port/tusb_config.h
@@ -44,7 +44,7 @@
#define CFG_TUSB_DEBUG 0
// Enable Device stack
-#define CFG_TUD_ENABLED 1
+#define CFG_TUD_ENABLED (CORE_M55_HP)
// Default is max speed that hardware controller could support with on-chip PHY
#define CFG_TUD_MAX_SPEED OPT_MODE_HIGH_SPEED