mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
ports/nrf: Switch to mp_utils to initialize GC/Stack.
This commit is contained in:
parent
df3e885d6b
commit
4dd63ce6e0
@ -90,7 +90,7 @@
|
|||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "omv_i2c.h"
|
#include "omv_i2c.h"
|
||||||
#include "sensor.h"
|
#include "sensor.h"
|
||||||
#include "boot_utils.h"
|
#include "mp_utils.h"
|
||||||
|
|
||||||
uint32_t HAL_GetHalVersion() {
|
uint32_t HAL_GetHalVersion() {
|
||||||
// Hard-coded because it's not defined in SDK
|
// Hard-coded because it's not defined in SDK
|
||||||
@ -137,13 +137,8 @@ soft_reset:
|
|||||||
led_init();
|
led_init();
|
||||||
led_state(1, 1); // MICROPY_HW_LED_1 aka MICROPY_HW_LED_RED
|
led_state(1, 1); // MICROPY_HW_LED_1 aka MICROPY_HW_LED_RED
|
||||||
|
|
||||||
mp_stack_set_top(&_ram_end);
|
// Initialize the stack and GC memory.
|
||||||
// Stack limit should be less than real stack size, so we have a chance
|
mp_init_gc_stack(&_heap_end, &_ram_end, &_heap_start, &_heap_end, 400);
|
||||||
// to recover from limit hit. (Limit is measured in bytes.)
|
|
||||||
mp_stack_set_limit((char *) &_ram_end - (char *) &_heap_end - 400);
|
|
||||||
|
|
||||||
// GC init
|
|
||||||
gc_init(&_heap_start, &_heap_end);
|
|
||||||
|
|
||||||
machine_init();
|
machine_init();
|
||||||
mp_init();
|
mp_init();
|
||||||
@ -275,11 +270,11 @@ soft_reset:
|
|||||||
|
|
||||||
#if MICROPY_VFS || MICROPY_MBFS || MICROPY_MODULE_FROZEN
|
#if MICROPY_VFS || MICROPY_MBFS || MICROPY_MODULE_FROZEN
|
||||||
// Run boot.py script.
|
// Run boot.py script.
|
||||||
bool interrupted = bootutils_exec_bootscript("boot.py", true, false);
|
bool interrupted = mp_exec_bootscript("boot.py", true, false);
|
||||||
|
|
||||||
// Run main.py script on first soft-reset.
|
// Run main.py script on first soft-reset.
|
||||||
if (first_soft_reset && !interrupted && mp_vfs_import_stat("main.py")) {
|
if (first_soft_reset && !interrupted && mp_vfs_import_stat("main.py")) {
|
||||||
bootutils_exec_bootscript("main.py", true, false);
|
mp_exec_bootscript("main.py", true, false);
|
||||||
goto soft_reset_exit;
|
goto soft_reset_exit;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -8,7 +8,7 @@ SD_DIR = $(TOP_DIR)/drivers/nrf
|
|||||||
CFLAGS += -std=gnu99 -Wall -Werror -Warray-bounds -mthumb -nostartfiles -fdata-sections -ffunction-sections
|
CFLAGS += -std=gnu99 -Wall -Werror -Warray-bounds -mthumb -nostartfiles -fdata-sections -ffunction-sections
|
||||||
CFLAGS += -D$(MCU) -D$(CFLAGS_MCU) -DARM_NN_TRUNCATE -D__FPU_PRESENT=1 -D__VFP_FP__ -D$(TARGET)\
|
CFLAGS += -D$(MCU) -D$(CFLAGS_MCU) -DARM_NN_TRUNCATE -D__FPU_PRESENT=1 -D__VFP_FP__ -D$(TARGET)\
|
||||||
-fsingle-precision-constant -Wdouble-promotion -mcpu=$(CPU) -mtune=$(CPU) -mfpu=$(FPU) -mfloat-abi=hard\
|
-fsingle-precision-constant -Wdouble-promotion -mcpu=$(CPU) -mtune=$(CPU) -mfpu=$(FPU) -mfloat-abi=hard\
|
||||||
-DCMSIS_MCU_H=$(CMSIS_MCU_H)
|
-DCMSIS_MCU_H=$(CMSIS_MCU_H) -DMP_PORT_NO_SOFTTIMER
|
||||||
CFLAGS += $(OMV_BOARD_EXTRA_CFLAGS)
|
CFLAGS += $(OMV_BOARD_EXTRA_CFLAGS)
|
||||||
|
|
||||||
# Disable LTO and set the SD
|
# Disable LTO and set the SD
|
||||||
@ -110,7 +110,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/common/, \
|
|||||||
usbdbg.o \
|
usbdbg.o \
|
||||||
tinyusb_debug.o \
|
tinyusb_debug.o \
|
||||||
file_utils.o \
|
file_utils.o \
|
||||||
boot_utils.o \
|
mp_utils.o \
|
||||||
sensor_utils.o \
|
sensor_utils.o \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user