Skip to content

Two enhancements for Fruit Jam launcher #10238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
[submodule "ports/raspberrypi/sdk"]
path = ports/raspberrypi/sdk
url = https://github.com/adafruit/pico-sdk.git
branch = force_inline_critical_section
branch = force_inline_critical_section_2.1.1
[submodule "data/nvm.toml"]
path = data/nvm.toml
url = https://github.com/adafruit/nvm.toml.git
Expand Down
6 changes: 5 additions & 1 deletion extmod/vfs_fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

// CIRCUITPY-CHANGE: extra includes
#include <string.h>
#include "py/gc.h"
#include "py/obj.h"
#include "py/objproperty.h"
#include "py/runtime.h"
Expand Down Expand Up @@ -342,7 +343,10 @@ static mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
FRESULT res = f_stat(&self->fatfs, path, &fno);
if (res != FR_OK) {
// CIRCUITPY-CHANGE
mp_raise_OSError_fresult(res);
if (gc_alloc_possible()) {
mp_raise_OSError_fresult(res);
}
return mp_const_none;
}
}

Expand Down
10 changes: 6 additions & 4 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,19 @@ static bool __attribute__((noinline)) run_code_py(safe_mode_t safe_mode, bool *s
usb_setup_with_vm();
#endif

// Always return to root before trying to run files.
common_hal_os_chdir("/");
// Check if a different run file has been allocated
if (next_code_configuration != NULL) {
next_code_configuration->options &= ~SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET;
next_code_options = next_code_configuration->options;
if (next_code_configuration->filename[0] != '\0') {
if (next_code_configuration->working_directory != NULL) {
common_hal_os_chdir(next_code_configuration->working_directory);
}
// This is where the user's python code is actually executed:
const char *const filenames[] = { next_code_configuration->filename };
found_main = maybe_run_list(filenames, MP_ARRAY_SIZE(filenames));
found_main = maybe_run_list(filenames, 1);
if (!found_main) {
serial_write(next_code_configuration->filename);
serial_write_compressed(MP_ERROR_TEXT(" not found.\n"));
Expand Down Expand Up @@ -1109,9 +1114,6 @@ int __attribute__((used)) main(void) {
}
simulate_reset = false;

// Always return to root before trying to run files.
common_hal_os_chdir("/");

if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
// If code.py did a fake deep sleep, pretend that we
// are running code.py for the first time after a hard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ"
LONGINT_IMPL = MPZ

CIRCUITPY_CODEOP = 0
CIRCUITPY_JPEGIO = 0
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "S25FL064L"
LONGINT_IMPL = MPZ

CIRCUITPY_CODEOP = 0
1 change: 1 addition & 0 deletions ports/atmel-samd/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CIRCUITPY_LTO = 1

CIRCUITPY_KEYPAD_DEMUX ?= 0
CIRCUITPY_LVFONTIO ?= 0
CIRCUITPY_PATHLIB ?= 0

######################################################################
# Put samd21-only choices here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ nvm = false
onewireio = false
os = true
paralleldisplaybus = false
pathlib = false
ps2io = false
pulseio = false
pwmio = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ nvm = false
onewireio = false
os = true
paralleldisplaybus = false
pathlib = false
ps2io = false
pulseio = false
pwmio = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ nvm = false
onewireio = false
os = true
paralleldisplaybus = false
pathlib = false
ps2io = false
pulseio = false
pwmio = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ nvm = false
onewireio = false
os = true
paralleldisplaybus = false
pathlib = false
ps2io = false
pulseio = false
pwmio = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ nvm = false
onewireio = false
os = true
paralleldisplaybus = false
pathlib = false
ps2io = false
pulseio = false
pwmio = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ nvm = false
onewireio = false
os = true
paralleldisplaybus = false
pathlib = false
ps2io = false
pulseio = false
pwmio = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ nvm = false
onewireio = false
os = true
paralleldisplaybus = false
pathlib = false
ps2io = false
pulseio = false
pwmio = false
Expand Down
5 changes: 5 additions & 0 deletions py/circuitpy_defns.mk
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ endif
ifeq ($(CIRCUITPY_OS),1)
SRC_PATTERNS += os/%
endif
ifeq ($(CIRCUITPY_PATHLIB),1)
SRC_PATTERNS += pathlib/%
endif
ifeq ($(CIRCUITPY_DUALBANK),1)
SRC_PATTERNS += dualbank/%
endif
Expand Down Expand Up @@ -744,6 +747,8 @@ SRC_SHARED_MODULE_ALL = \
onewireio/__init__.c \
onewireio/OneWire.c \
os/__init__.c \
pathlib/__init__.c \
pathlib/PosixPath.c \
paralleldisplaybus/ParallelBus.c \
qrio/__init__.c \
qrio/QRDecoder.c \
Expand Down
3 changes: 3 additions & 0 deletions py/circuitpy_mpconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ CFLAGS += -DCIRCUITPY_OPT_MAP_LOOKUP_CACHE=$(CIRCUITPY_OPT_MAP_LOOKUP_CACHE)
CIRCUITPY_OS ?= 1
CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS)

CIRCUITPY_PATHLIB ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_PATHLIB=$(CIRCUITPY_PATHLIB)

CIRCUITPY_PEW ?= 0
CFLAGS += -DCIRCUITPY_PEW=$(CIRCUITPY_PEW)

Expand Down
1 change: 1 addition & 0 deletions shared-bindings/os/__init__.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <stdbool.h>

#include "py/objtuple.h"
#include "shared-module/os/__init__.h"

void common_hal_os_chdir(const char *path);
mp_obj_t common_hal_os_getcwd(void);
Expand Down
Loading
Loading