Merge pull request #1987 from openmv/nlr_cleanup

micropython: Add MICROPY_NLR_JUMP_HOOK.
This commit is contained in:
Ibrahim Abdelkader 2023-10-25 10:41:53 +03:00 committed by GitHub
commit dd8e82fa95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 4 deletions

View File

@ -66,6 +66,7 @@ DISPLAY_DIR=drivers/display
LIBPDM_DIR=lib/libpdm
TENSORFLOW_DIR=lib/libtf
OMV_BOARD_CONFIG_DIR=$(TOP_DIR)/$(OMV_DIR)/boards/$(TARGET)/
OMV_PORT_DIR=$(TOP_DIR)/$(OMV_DIR)/ports/$(PORT)
MP_BOARD_CONFIG_DIR=$(TOP_DIR)/$(MICROPY_DIR)/ports/$(PORT)/boards/$(TARGET)/
OMV_LIB_DIR=$(TOP_DIR)/../scripts/libraries
FROZEN_MANIFEST=$(OMV_BOARD_CONFIG_DIR)/manifest.py
@ -195,9 +196,10 @@ endif
MPY_PENDSV_ENTRIES := $(shell echo $(MPY_PENDSV_ENTRIES) | tr -d '[:space:]')
MPY_CFLAGS += -DMICROPY_BOARD_PENDSV_ENTRIES="$(MPY_PENDSV_ENTRIES)"
MPY_CFLAGS += -DMP_CONFIGFILE=\<$(OMV_PORT_DIR)/omv_mpconfigport.h\>
# Include the port Makefile.
include $(OMV_DIR)/ports/$(PORT)/omv_portconfig.mk
include $(OMV_PORT_DIR)/omv_portconfig.mk
clean:
$(RM) -fr $(BUILD)

@ -1 +1 @@
Subproject commit 1f7bd319255924f2d17c40912c61b069503115e2
Subproject commit 7f615a4a0f11e640dac20b8bc748385b4f5f67f3

View File

@ -56,8 +56,8 @@ void fb_alloc_mark() {
// Check if allocation overwrites the framebuffer pixels
if (new_pointer < framebuffer_get_buffers_end()) {
nlr_raise_for_fb_alloc_mark(mp_obj_new_exception_msg(&mp_type_MemoryError,
MP_ERROR_TEXT("Out of fast frame buffer stack memory")));
nlr_jump(MP_OBJ_TO_PTR(mp_obj_new_exception_msg(&mp_type_MemoryError,
MP_ERROR_TEXT("Out of fast frame buffer stack memory"))));
}
// fb_alloc does not allow regions which are a size of 0 to be alloced,

View File

@ -0,0 +1,7 @@
#include <mpconfigport.h>
#define MICROPY_NLR_RAISE_HOOK \
do { \
extern void fb_alloc_free_till_mark(); \
fb_alloc_free_till_mark(); \
} while (0);

View File

@ -0,0 +1,7 @@
#include <mpconfigport.h>
#define MICROPY_NLR_RAISE_HOOK \
do { \
extern void fb_alloc_free_till_mark(); \
fb_alloc_free_till_mark(); \
} while (0);

View File

@ -0,0 +1,7 @@
#include <mpconfigport.h>
#define MICROPY_NLR_RAISE_HOOK \
do { \
extern void fb_alloc_free_till_mark(); \
fb_alloc_free_till_mark(); \
} while (0);

View File

@ -0,0 +1,7 @@
#include <mpconfigport.h>
#define MICROPY_NLR_RAISE_HOOK \
do { \
extern void fb_alloc_free_till_mark(); \
fb_alloc_free_till_mark(); \
} while (0);