Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,21 +219,23 @@ static void stop_mp(void) {

// Unmount all heap allocated vfs mounts.
mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table);
do {
if (gc_ptr_on_heap(vfs)) {
// mp_vfs_umount will splice out an unmounted vfs from the vfs_mount_table linked list.
mp_vfs_umount(vfs->obj);
// Start over at the beginning of the list since the first entry may have been removed.
vfs = MP_STATE_VM(vfs_mount_table);
continue;
}
vfs = vfs->next;
} while (vfs != NULL);
if (vfs != NULL) {
do {
if (gc_ptr_on_heap(vfs)) {
// mp_vfs_umount will splice out an unmounted vfs from the vfs_mount_table linked list.
mp_vfs_umount(vfs->obj);
// Start over at the beginning of the list since the first entry may have been removed.
vfs = MP_STATE_VM(vfs_mount_table);
continue;
}
vfs = vfs->next;
} while (vfs != NULL);

// The last vfs is CIRCUITPY and the root directory.
vfs = MP_STATE_VM(vfs_mount_table);
while (vfs->next != NULL) {
vfs = vfs->next;
// The last vfs is CIRCUITPY and the root directory.
vfs = MP_STATE_VM(vfs_mount_table);
while (vfs->next != NULL) {
vfs = vfs->next;
}
}
MP_STATE_VM(vfs_cur) = vfs;
#endif
Expand Down
10 changes: 10 additions & 0 deletions ports/zephyr-cp/app.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
&zephyr_udc0 {
cdc_acm_console: cdc_acm_console {
compatible = "zephyr,cdc-acm-uart";
label = "CircuitPython Console";
};
cdc_acm_data: cdc_acm_data {
compatible = "zephyr,cdc-acm-uart";
label = "CircuitPython Data";
};
};
2 changes: 2 additions & 0 deletions ports/zephyr-cp/boards/board_aliases.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set(nordic_nrf54l15dk_BOARD_ALIAS nrf54l15dk/nrf54l15/cpuapp)
set(nordic_nrf54h20dk_BOARD_ALIAS nrf54h20dk/nrf54h20/cpuapp)
set(nordic_nrf5340dk_BOARD_ALIAS nrf5340dk/nrf5340/cpuapp)
set(nordic_nrf7002dk_BOARD_ALIAS nrf7002dk/nrf5340/cpuapp)
set(nxp_frdm_mcxn947_BOARD_ALIAS frdm_mcxn947/mcxn947/cpu0)
set(nxp_mimxrt1170_evk_BOARD_ALIAS mimxrt1170_evk@A/mimxrt1176/cm7)
set(st_stm32h7b3i_dk_BOARD_ALIAS stm32h7b3i_dk)
set(st_nucleo_u575zi_q_BOARD_ALIAS nucleo_u575zi_q/stm32u575xx)
set(st_nucleo_n657x0_q_BOARD_ALIAS nucleo_n657x0_q/stm32n657xx)
2 changes: 2 additions & 0 deletions ports/zephyr-cp/boards/ek_ra8d1.overlay
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
&s28hl512t {
/delete-node/ partitions;
};

#include "../app.overlay"
5 changes: 5 additions & 0 deletions ports/zephyr-cp/boards/frdm_mcxn947_mcxn947_cpu0.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
&w25q64jvssiq {
/delete-node/ partitions;
};

#include "../app.overlay"
11 changes: 11 additions & 0 deletions ports/zephyr-cp/boards/mimxrt1170_evk_mimxrt1176_cm7.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
&is25wp128 {
partitions{
/delete-node/ storage_partition;
circuitpy_partition: partition@E20000 {
label = "circuitpy";
reg = <0x00E20000 (DT_SIZE_M(2) - DT_SIZE_K(128))>;
};
};
};

#include "../app.overlay"
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ touchio = false
traceback = true
uheap = false
usb = false
usb_cdc = false
usb_cdc = true
usb_hid = false
usb_host = false
usb_midi = false
Expand Down
2 changes: 2 additions & 0 deletions ports/zephyr-cp/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@
memory-regions = <&cpuapp_dma_region>;
status = "okay";
};

#include "../app.overlay"
1 change: 1 addition & 0 deletions ports/zephyr-cp/boards/nrf54l15dk_nrf54l15_cpuapp.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// No app.overlay because it doesn't have USB.
Empty file.
114 changes: 114 additions & 0 deletions ports/zephyr-cp/boards/nxp/frdm_mcxn947/autogen_board_info.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# This file is autogenerated when a board is built. Do not edit. Do commit it to git. Other scripts use its info.
name = "NXP Semiconductors FRDM-MCXN947"

[modules]
__future__ = false
_bleio = false
_eve = false
_pew = false
_pixelmap = false
_stage = false
adafruit_bus_device = false
adafruit_pixelbuf = false
aesio = false
alarm = false
analogbufio = false
analogio = false
atexit = false
audiobusio = false
audiocore = false
audiodelays = false
audiofilters = false
audiofreeverb = false
audioio = false
audiomixer = false
audiomp3 = false
audiopwmio = false
aurora_epaper = false
bitbangio = false
bitmapfilter = true # Zephyr board has busio
bitmaptools = true # Zephyr board has busio
bitops = false
board = false
busdisplay = true # Zephyr board has busio
busio = true # Zephyr board has busio
camera = false
canio = false
codeop = false
countio = false
digitalio = true
displayio = true # Zephyr board has busio
dotclockframebuffer = false
dualbank = false
epaperdisplay = true # Zephyr board has busio
floppyio = false
fontio = true # Zephyr board has busio
fourwire = true # Zephyr board has busio
framebufferio = true # Zephyr board has busio
frequencyio = false
getpass = false
gifio = false
gnss = false
hashlib = false
i2cdisplaybus = true # Zephyr board has busio
i2ctarget = false
imagecapture = false
ipaddress = false
is31fl3741 = false
jpegio = false
keypad = false
keypad_demux = false
locale = false
lvfontio = true # Zephyr board has busio
math = false
max3421e = false
mdns = false
memorymap = false
memorymonitor = false
microcontroller = true
mipidsi = false
msgpack = false
neopixel_write = false
nvm = false
onewireio = false
os = true
paralleldisplaybus = false
ps2io = false
pulseio = false
pwmio = false
qrio = false
rainbowio = true
random = true
rclcpy = false
rgbmatrix = false
rotaryio = false
rtc = false
sdcardio = true # Zephyr board has busio
sdioio = false
sharpdisplay = true # Zephyr board has busio
socketpool = false
spitarget = false
ssl = false
storage = true # Zephyr board has flash
struct = true
supervisor = true
synthio = false
terminalio = true # Zephyr board has busio
tilepalettemapper = true # Zephyr board has busio
time = true
touchio = false
traceback = true
uheap = false
usb = false
usb_cdc = true
usb_hid = false
usb_host = false
usb_midi = false
usb_video = false
ustack = false
vectorio = true # Zephyr board has busio
warnings = true
watchdog = false
wifi = false
zephyr_kernel = false
zlib = false
1 change: 1 addition & 0 deletions ports/zephyr-cp/boards/nxp/frdm_mcxn947/circuitpython.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CIRCUITPY_BUILD_EXTENSIONS = ["elf"]
114 changes: 114 additions & 0 deletions ports/zephyr-cp/boards/nxp/mimxrt1170_evk/autogen_board_info.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# This file is autogenerated when a board is built. Do not edit. Do commit it to git. Other scripts use its info.
name = "NXP Semiconductors MIMXRT1170-EVK/EVKB"

[modules]
__future__ = false
_bleio = false
_eve = false
_pew = false
_pixelmap = false
_stage = false
adafruit_bus_device = false
adafruit_pixelbuf = false
aesio = false
alarm = false
analogbufio = false
analogio = false
atexit = false
audiobusio = false
audiocore = false
audiodelays = false
audiofilters = false
audiofreeverb = false
audioio = false
audiomixer = false
audiomp3 = false
audiopwmio = false
aurora_epaper = false
bitbangio = false
bitmapfilter = true # Zephyr board has busio
bitmaptools = true # Zephyr board has busio
bitops = false
board = false
busdisplay = true # Zephyr board has busio
busio = true # Zephyr board has busio
camera = false
canio = false
codeop = false
countio = false
digitalio = true
displayio = true # Zephyr board has busio
dotclockframebuffer = false
dualbank = false
epaperdisplay = true # Zephyr board has busio
floppyio = false
fontio = true # Zephyr board has busio
fourwire = true # Zephyr board has busio
framebufferio = true # Zephyr board has busio
frequencyio = false
getpass = false
gifio = false
gnss = false
hashlib = false
i2cdisplaybus = true # Zephyr board has busio
i2ctarget = false
imagecapture = false
ipaddress = false
is31fl3741 = false
jpegio = false
keypad = false
keypad_demux = false
locale = false
lvfontio = true # Zephyr board has busio
math = false
max3421e = false
mdns = false
memorymap = false
memorymonitor = false
microcontroller = true
mipidsi = false
msgpack = false
neopixel_write = false
nvm = false
onewireio = false
os = true
paralleldisplaybus = false
ps2io = false
pulseio = false
pwmio = false
qrio = false
rainbowio = true
random = true
rclcpy = false
rgbmatrix = false
rotaryio = false
rtc = false
sdcardio = true # Zephyr board has busio
sdioio = false
sharpdisplay = true # Zephyr board has busio
socketpool = false
spitarget = false
ssl = false
storage = false
struct = true
supervisor = true
synthio = false
terminalio = true # Zephyr board has busio
tilepalettemapper = true # Zephyr board has busio
time = true
touchio = false
traceback = true
uheap = false
usb = false
usb_cdc = true
usb_hid = false
usb_host = false
usb_midi = false
usb_video = false
ustack = false
vectorio = true # Zephyr board has busio
warnings = true
watchdog = false
wifi = false
zephyr_kernel = false
zlib = false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CIRCUITPY_BUILD_EXTENSIONS = ["elf"]
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ touchio = false
traceback = true
uheap = false
usb = false
usb_cdc = false # No TinyUSB settings for r7fa6m5bh3cfc
usb_cdc = true
usb_hid = false
usb_host = false
usb_midi = false
Expand Down
2 changes: 2 additions & 0 deletions ports/zephyr-cp/boards/renesas/ek_ra6m5/circuitpython.toml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# TX is on pin P411. RX is on pin P410.

CIRCUITPY_BUILD_EXTENSIONS = ["elf"]
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ touchio = false
traceback = true
uheap = false
usb = false
usb_cdc = false # No TinyUSB settings for r7fa8d1bhecbd
usb_cdc = true
usb_hid = false
usb_host = false
usb_midi = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ touchio = false
traceback = true
uheap = false
usb = false
usb_cdc = false # No TinyUSB settings for stm32n657xx
usb_cdc = true
usb_hid = false
usb_host = false
usb_midi = false
Expand Down
11 changes: 10 additions & 1 deletion ports/zephyr-cp/common-hal/busio/UART.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ mp_obj_t common_hal_busio_uart_construct_from_device(busio_uart_obj_t *self, con

k_msgq_init(&self->msgq, receiver_buffer, 1, receiver_buffer_size);

self->timeout = K_USEC(100);
self->timeout = K_FOREVER;
self->write_timeout = K_FOREVER;
self->rx_paused = false;
uart_irq_rx_enable(uart_device);

Expand Down Expand Up @@ -136,6 +137,14 @@ void common_hal_busio_uart_set_timeout(busio_uart_obj_t *self, mp_float_t timeou
self->timeout = K_USEC((uint64_t)(timeout * 1000000));
}

mp_float_t common_hal_busio_uart_get_write_timeout(busio_uart_obj_t *self) {
return (mp_float_t)self->write_timeout.ticks / 1000000.0;
}

void common_hal_busio_uart_set_write_timeout(busio_uart_obj_t *self, mp_float_t write_timeout) {
self->write_timeout = K_USEC((uint64_t)(write_timeout * 1000000));
}

uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
return k_msgq_num_used_get(&self->msgq);
}
Expand Down
1 change: 1 addition & 0 deletions ports/zephyr-cp/common-hal/busio/UART.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef struct {
struct k_msgq msgq;

k_timeout_t timeout;
k_timeout_t write_timeout;

bool rx_paused; // set by irq if no space in rbuf
} busio_uart_obj_t;
Expand Down
Loading
Loading