Merge pull request #7580 from adafruit/8.0.x

Merge 8.0.x up to main
This commit is contained in:
MicroDev 2023-02-15 09:16:51 +05:30 committed by GitHub
commit 32d86c3ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 61 additions and 18 deletions

View File

@ -75,7 +75,7 @@ Bootloader information:
* You have to accept the End User License Agreement to be able to download and use the Spresense bootloader binary. * You have to accept the End User License Agreement to be able to download and use the Spresense bootloader binary.
Download the spresense binaries zip archive from: [Spresense firmware v2-3-000](https://developer.sony.com/file/download/download-spresense-firmware-v2-3-000) Download the spresense binaries zip archive from: [Spresense firmware v2-4-000](https://developer.sony.com/file/download/download-spresense-firmware-v2-4-000)
Extract spresense binaries in your PC to ports/spresense/spresense-exported-sdk/firmware/ Extract spresense binaries in your PC to ports/spresense/spresense-exported-sdk/firmware/

View File

@ -47,7 +47,7 @@ typedef struct {
uint16_t height; uint16_t height;
} image_size_t; } image_size_t;
STATIC const image_size_t image_size_table[] = { STATIC const image_size_t isx012_image_size_table[] = {
{ VIDEO_HSIZE_QVGA, VIDEO_VSIZE_QVGA }, { VIDEO_HSIZE_QVGA, VIDEO_VSIZE_QVGA },
{ VIDEO_HSIZE_VGA, VIDEO_VSIZE_VGA }, { VIDEO_HSIZE_VGA, VIDEO_VSIZE_VGA },
{ VIDEO_HSIZE_HD, VIDEO_VSIZE_HD }, { VIDEO_HSIZE_HD, VIDEO_VSIZE_HD },
@ -57,12 +57,40 @@ STATIC const image_size_t image_size_table[] = {
{ VIDEO_HSIZE_5M, VIDEO_VSIZE_5M }, { VIDEO_HSIZE_5M, VIDEO_VSIZE_5M },
}; };
STATIC const image_size_t isx019_image_size_table[] = {
{ VIDEO_HSIZE_QVGA, VIDEO_VSIZE_QVGA },
{ VIDEO_HSIZE_VGA, VIDEO_VSIZE_VGA },
{ VIDEO_HSIZE_HD, VIDEO_VSIZE_HD },
{ VIDEO_HSIZE_QUADVGA, VIDEO_VSIZE_QUADVGA },
};
static const char *get_imgsensor_name() {
static struct v4l2_capability cap;
ioctl(camera_dev.fd, VIDIOC_QUERYCAP, (unsigned long)&cap);
return (const char *)cap.driver;
}
static bool camera_check_width_and_height(uint16_t width, uint16_t height) { static bool camera_check_width_and_height(uint16_t width, uint16_t height) {
for (int i = 0; i < MP_ARRAY_SIZE(image_size_table); i++) { const char *sensor;
if (image_size_table[i].width == width && image_size_table[i].height == height) {
return true; sensor = get_imgsensor_name();
if (strncmp(sensor, "ISX012", strlen("ISX012")) == 0) {
for (int i = 0; i < MP_ARRAY_SIZE(isx012_image_size_table); i++) {
if (isx012_image_size_table[i].width == width && isx012_image_size_table[i].height == height) {
return true;
}
}
} else if (strncmp(sensor, "ISX019", strlen("ISX019"))) {
for (int i = 0; i < MP_ARRAY_SIZE(isx019_image_size_table); i++) {
if (isx019_image_size_table[i].width == width && isx019_image_size_table[i].height == height) {
return true;
}
} }
} }
return false; return false;
} }

View File

@ -113,4 +113,5 @@ CONFIG_USEC_PER_TICK=1000
CONFIG_USERMAIN_STACKSIZE=8192 CONFIG_USERMAIN_STACKSIZE=8192
CONFIG_USER_ENTRYPOINT="spresense_main" CONFIG_USER_ENTRYPOINT="spresense_main"
CONFIG_VIDEO_ISX012=y CONFIG_VIDEO_ISX012=y
CONFIG_VIDEO_ISX019=y
CONFIG_VIDEO_STREAM=y CONFIG_VIDEO_STREAM=y

@ -1 +1 @@
Subproject commit 6a148be8497704d4afb5d14c175a12a592813fac Subproject commit 4f902ca3ffeb327e6c325940ef5133eda588c2e4

View File

@ -111,13 +111,13 @@ bool port_has_fixed_stack(void) {
uint32_t *port_stack_get_limit(void) { uint32_t *port_stack_get_limit(void) {
struct tcb_s *rtcb = this_task(); struct tcb_s *rtcb = this_task();
return rtcb->adj_stack_ptr - (uint32_t)rtcb->adj_stack_size; return rtcb->stack_base_ptr;
} }
uint32_t *port_stack_get_top(void) { uint32_t *port_stack_get_top(void) {
struct tcb_s *rtcb = this_task(); struct tcb_s *rtcb = this_task();
return rtcb->adj_stack_ptr; return rtcb->stack_base_ptr + (uint32_t)rtcb->adj_stack_size;
} }
uint32_t *port_heap_get_bottom(void) { uint32_t *port_heap_get_bottom(void) {

View File

@ -289,6 +289,11 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self,
} }
pio_gpio_init(self->pio, pin_number); pio_gpio_init(self->pio, pin_number);
} }
// Use lowest drive level for all State Machine outputs. (#7515
// workaround). Remove if/when Pin objects get a drive_strength
// property and use that value instead.
gpio_set_drive_strength(pin_number, GPIO_DRIVE_STRENGTH_2MA);
} }
pio_sm_config c = {0, 0, 0}; pio_sm_config c = {0, 0, 0};

View File

@ -155,6 +155,12 @@ void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kin
mp_obj_tuple_print(print, MP_OBJ_FROM_PTR(o->args), kind); mp_obj_tuple_print(print, MP_OBJ_FROM_PTR(o->args), kind);
} }
void mp_obj_exception_initialize0(mp_obj_exception_t *o_exc, const mp_obj_type_t *type) {
o_exc->base.type = type;
o_exc->args = (mp_obj_tuple_t *)&mp_const_empty_tuple_obj;
mp_obj_exception_clear_traceback(o_exc);
}
mp_obj_t mp_obj_exception_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_obj_t mp_obj_exception_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, MP_OBJ_FUN_ARGS_MAX, false); mp_arg_check_num(n_args, n_kw, 0, MP_OBJ_FUN_ARGS_MAX, false);
@ -583,6 +589,12 @@ void mp_obj_exception_clear_traceback(mp_obj_t self_in) {
// just set the traceback to the empty traceback object // just set the traceback to the empty traceback object
// we don't want to call any memory management functions here // we don't want to call any memory management functions here
self->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj; self->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
self->cause = 0;
self->context = 0;
self->suppress_context = false;
self->marked = false;
#endif
} }
void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block) { void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block) {

View File

@ -43,6 +43,7 @@ typedef struct _mp_obj_exception_t {
void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind); void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest); void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
void mp_obj_exception_initialize0(mp_obj_exception_t *o_exc, const mp_obj_type_t *type);
mp_obj_exception_t *mp_obj_exception_get_native(mp_obj_t self_in); mp_obj_exception_t *mp_obj_exception_get_native(mp_obj_t self_in);
#define MP_DEFINE_EXCEPTION(exc_name, base_name) \ #define MP_DEFINE_EXCEPTION(exc_name, base_name) \

View File

@ -40,10 +40,11 @@
// Instance of GeneratorExit exception - needed by generator.close() // Instance of GeneratorExit exception - needed by generator.close()
#if MICROPY_CONST_GENERATOREXIT_OBJ #if MICROPY_CONST_GENERATOREXIT_OBJ
const const
mp_obj_exception_t mp_static_GeneratorExit_obj = {{&mp_type_GeneratorExit}, (mp_obj_tuple_t *)&mp_const_empty_tuple_obj, (mp_obj_traceback_t *)&mp_const_empty_traceback_obj};
#else #else
static static
mp_obj_exception_t mp_static_GeneratorExit_obj;
#endif #endif
mp_obj_exception_t mp_static_GeneratorExit_obj = {{&mp_type_GeneratorExit}, (mp_obj_tuple_t *)&mp_const_empty_tuple_obj, (mp_obj_traceback_t *)&mp_const_empty_traceback_obj};
/******************************************************************************/ /******************************************************************************/
/* generator wrapper */ /* generator wrapper */
@ -370,9 +371,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(gen_instance_throw_obj, 2, 4, gen_ins
static mp_obj_t generatorexit(void) { static mp_obj_t generatorexit(void) {
#if MICROPY_CPYTHON_EXCEPTION_CHAIN #if MICROPY_CPYTHON_EXCEPTION_CHAIN
MP_STATIC_ASSERT(!MICROPY_CONST_GENERATOREXIT_OBJ); MP_STATIC_ASSERT(!MICROPY_CONST_GENERATOREXIT_OBJ);
mp_static_GeneratorExit_obj.context = NULL; mp_obj_exception_initialize0(&mp_static_GeneratorExit_obj, &mp_type_GeneratorExit);
mp_static_GeneratorExit_obj.cause = NULL;
mp_static_GeneratorExit_obj.suppress_context = false;
#endif #endif
return MP_OBJ_FROM_PTR(&mp_static_GeneratorExit_obj); return MP_OBJ_FROM_PTR(&mp_static_GeneratorExit_obj);
} }

View File

@ -78,14 +78,10 @@ void mp_init(void) {
#if MICROPY_KBD_EXCEPTION #if MICROPY_KBD_EXCEPTION
// initialise the exception object for raising KeyboardInterrupt // initialise the exception object for raising KeyboardInterrupt
MP_STATE_VM(mp_kbd_exception).base.type = &mp_type_KeyboardInterrupt; mp_obj_exception_initialize0(&MP_STATE_VM(mp_kbd_exception), &mp_type_KeyboardInterrupt);
MP_STATE_VM(mp_kbd_exception).args = (mp_obj_tuple_t *)&mp_const_empty_tuple_obj;
MP_STATE_VM(mp_kbd_exception).traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
#endif #endif
MP_STATE_VM(mp_reload_exception).base.type = &mp_type_ReloadException; mp_obj_exception_initialize0(&MP_STATE_VM(mp_reload_exception), &mp_type_ReloadException);
MP_STATE_VM(mp_reload_exception).args = (mp_obj_tuple_t *)&mp_const_empty_tuple_obj;
MP_STATE_VM(mp_reload_exception).traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
// call port specific initialization if any // call port specific initialization if any
#ifdef MICROPY_PORT_INIT_FUNC #ifdef MICROPY_PORT_INIT_FUNC

View File

@ -54,6 +54,7 @@ void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t *self,
// Probe the bus to see if a device acknowledges the given address. // Probe the bus to see if a device acknowledges the given address.
if (!common_hal_busio_i2c_probe(i2c, device_address)) { if (!common_hal_busio_i2c_probe(i2c, device_address)) {
self->base.type = &mp_type_NoneType; self->base.type = &mp_type_NoneType;
common_hal_displayio_i2cdisplay_deinit(self);
mp_raise_ValueError_varg(translate("Unable to find I2C Display at %x"), device_address); mp_raise_ValueError_varg(translate("Unable to find I2C Display at %x"), device_address);
} }