Skip to content

Commit 32d86c3

Browse files
authored
Merge pull request #7580 from adafruit/8.0.x
Merge 8.0.x up to main
2 parents 48077da + 1af2b6a commit 32d86c3

File tree

11 files changed

+61
-18
lines changed

11 files changed

+61
-18
lines changed

ports/cxd56/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Bootloader information:
7575

7676
* You have to accept the End User License Agreement to be able to download and use the Spresense bootloader binary.
7777

78-
Download the spresense binaries zip archive from: [Spresense firmware v2-3-000](https://developer.sony.com/file/download/download-spresense-firmware-v2-3-000)
78+
Download the spresense binaries zip archive from: [Spresense firmware v2-4-000](https://developer.sony.com/file/download/download-spresense-firmware-v2-4-000)
7979

8080
Extract spresense binaries in your PC to ports/spresense/spresense-exported-sdk/firmware/
8181

ports/cxd56/common-hal/camera/Camera.c

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ typedef struct {
4747
uint16_t height;
4848
} image_size_t;
4949

50-
STATIC const image_size_t image_size_table[] = {
50+
STATIC const image_size_t isx012_image_size_table[] = {
5151
{ VIDEO_HSIZE_QVGA, VIDEO_VSIZE_QVGA },
5252
{ VIDEO_HSIZE_VGA, VIDEO_VSIZE_VGA },
5353
{ VIDEO_HSIZE_HD, VIDEO_VSIZE_HD },
@@ -57,12 +57,40 @@ STATIC const image_size_t image_size_table[] = {
5757
{ VIDEO_HSIZE_5M, VIDEO_VSIZE_5M },
5858
};
5959

60+
STATIC const image_size_t isx019_image_size_table[] = {
61+
{ VIDEO_HSIZE_QVGA, VIDEO_VSIZE_QVGA },
62+
{ VIDEO_HSIZE_VGA, VIDEO_VSIZE_VGA },
63+
{ VIDEO_HSIZE_HD, VIDEO_VSIZE_HD },
64+
{ VIDEO_HSIZE_QUADVGA, VIDEO_VSIZE_QUADVGA },
65+
};
66+
67+
static const char *get_imgsensor_name() {
68+
static struct v4l2_capability cap;
69+
70+
ioctl(camera_dev.fd, VIDIOC_QUERYCAP, (unsigned long)&cap);
71+
72+
return (const char *)cap.driver;
73+
}
74+
6075
static bool camera_check_width_and_height(uint16_t width, uint16_t height) {
61-
for (int i = 0; i < MP_ARRAY_SIZE(image_size_table); i++) {
62-
if (image_size_table[i].width == width && image_size_table[i].height == height) {
63-
return true;
76+
const char *sensor;
77+
78+
sensor = get_imgsensor_name();
79+
80+
if (strncmp(sensor, "ISX012", strlen("ISX012")) == 0) {
81+
for (int i = 0; i < MP_ARRAY_SIZE(isx012_image_size_table); i++) {
82+
if (isx012_image_size_table[i].width == width && isx012_image_size_table[i].height == height) {
83+
return true;
84+
}
85+
}
86+
} else if (strncmp(sensor, "ISX019", strlen("ISX019"))) {
87+
for (int i = 0; i < MP_ARRAY_SIZE(isx019_image_size_table); i++) {
88+
if (isx019_image_size_table[i].width == width && isx019_image_size_table[i].height == height) {
89+
return true;
90+
}
6491
}
6592
}
93+
6694
return false;
6795
}
6896

ports/cxd56/configs/circuitpython/defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,5 @@ CONFIG_USEC_PER_TICK=1000
113113
CONFIG_USERMAIN_STACKSIZE=8192
114114
CONFIG_USER_ENTRYPOINT="spresense_main"
115115
CONFIG_VIDEO_ISX012=y
116+
CONFIG_VIDEO_ISX019=y
116117
CONFIG_VIDEO_STREAM=y

ports/cxd56/spresense-exported-sdk

ports/cxd56/supervisor/port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ bool port_has_fixed_stack(void) {
111111
uint32_t *port_stack_get_limit(void) {
112112
struct tcb_s *rtcb = this_task();
113113

114-
return rtcb->adj_stack_ptr - (uint32_t)rtcb->adj_stack_size;
114+
return rtcb->stack_base_ptr;
115115
}
116116

117117
uint32_t *port_stack_get_top(void) {
118118
struct tcb_s *rtcb = this_task();
119119

120-
return rtcb->adj_stack_ptr;
120+
return rtcb->stack_base_ptr + (uint32_t)rtcb->adj_stack_size;
121121
}
122122

123123
uint32_t *port_heap_get_bottom(void) {

ports/raspberrypi/common-hal/rp2pio/StateMachine.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,11 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self,
289289
}
290290
pio_gpio_init(self->pio, pin_number);
291291
}
292+
293+
// Use lowest drive level for all State Machine outputs. (#7515
294+
// workaround). Remove if/when Pin objects get a drive_strength
295+
// property and use that value instead.
296+
gpio_set_drive_strength(pin_number, GPIO_DRIVE_STRENGTH_2MA);
292297
}
293298

294299
pio_sm_config c = {0, 0, 0};

py/objexcept.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kin
155155
mp_obj_tuple_print(print, MP_OBJ_FROM_PTR(o->args), kind);
156156
}
157157

158+
void mp_obj_exception_initialize0(mp_obj_exception_t *o_exc, const mp_obj_type_t *type) {
159+
o_exc->base.type = type;
160+
o_exc->args = (mp_obj_tuple_t *)&mp_const_empty_tuple_obj;
161+
mp_obj_exception_clear_traceback(o_exc);
162+
}
163+
158164
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) {
159165
mp_arg_check_num(n_args, n_kw, 0, MP_OBJ_FUN_ARGS_MAX, false);
160166

@@ -583,6 +589,12 @@ void mp_obj_exception_clear_traceback(mp_obj_t self_in) {
583589
// just set the traceback to the empty traceback object
584590
// we don't want to call any memory management functions here
585591
self->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
592+
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
593+
self->cause = 0;
594+
self->context = 0;
595+
self->suppress_context = false;
596+
self->marked = false;
597+
#endif
586598
}
587599

588600
void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block) {

py/objexcept.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ typedef struct _mp_obj_exception_t {
4343

4444
void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
4545
void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
46+
void mp_obj_exception_initialize0(mp_obj_exception_t *o_exc, const mp_obj_type_t *type);
4647
mp_obj_exception_t *mp_obj_exception_get_native(mp_obj_t self_in);
4748

4849
#define MP_DEFINE_EXCEPTION(exc_name, base_name) \

py/objgenerator.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@
4040
// Instance of GeneratorExit exception - needed by generator.close()
4141
#if MICROPY_CONST_GENERATOREXIT_OBJ
4242
const
43+
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};
4344
#else
4445
static
46+
mp_obj_exception_t mp_static_GeneratorExit_obj;
4547
#endif
46-
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};
4748

4849
/******************************************************************************/
4950
/* generator wrapper */
@@ -370,9 +371,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(gen_instance_throw_obj, 2, 4, gen_ins
370371
static mp_obj_t generatorexit(void) {
371372
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
372373
MP_STATIC_ASSERT(!MICROPY_CONST_GENERATOREXIT_OBJ);
373-
mp_static_GeneratorExit_obj.context = NULL;
374-
mp_static_GeneratorExit_obj.cause = NULL;
375-
mp_static_GeneratorExit_obj.suppress_context = false;
374+
mp_obj_exception_initialize0(&mp_static_GeneratorExit_obj, &mp_type_GeneratorExit);
376375
#endif
377376
return MP_OBJ_FROM_PTR(&mp_static_GeneratorExit_obj);
378377
}

py/runtime.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,10 @@ void mp_init(void) {
7878

7979
#if MICROPY_KBD_EXCEPTION
8080
// initialise the exception object for raising KeyboardInterrupt
81-
MP_STATE_VM(mp_kbd_exception).base.type = &mp_type_KeyboardInterrupt;
82-
MP_STATE_VM(mp_kbd_exception).args = (mp_obj_tuple_t *)&mp_const_empty_tuple_obj;
83-
MP_STATE_VM(mp_kbd_exception).traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
81+
mp_obj_exception_initialize0(&MP_STATE_VM(mp_kbd_exception), &mp_type_KeyboardInterrupt);
8482
#endif
8583

86-
MP_STATE_VM(mp_reload_exception).base.type = &mp_type_ReloadException;
87-
MP_STATE_VM(mp_reload_exception).args = (mp_obj_tuple_t *)&mp_const_empty_tuple_obj;
88-
MP_STATE_VM(mp_reload_exception).traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
84+
mp_obj_exception_initialize0(&MP_STATE_VM(mp_reload_exception), &mp_type_ReloadException);
8985

9086
// call port specific initialization if any
9187
#ifdef MICROPY_PORT_INIT_FUNC

0 commit comments

Comments
 (0)