Skip to content

Commit 5f6420d

Browse files
authored
Merge branch 'main' into banglejs2
2 parents b781261 + fd3c691 commit 5f6420d

File tree

15 files changed

+101
-28
lines changed

15 files changed

+101
-28
lines changed

.github/workflows/build-boards.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ on:
66
platform:
77
required: true
88
type: string
9-
109
boards:
1110
required: true
1211
type: string
13-
1412
cp-version:
1513
required: true
1614
type: string
15+
secrets:
16+
AWS_ACCESS_KEY_ID:
17+
required: false
18+
AWS_SECRET_ACCESS_KEY:
19+
required: false
1720

1821
jobs:
1922
build:

.github/workflows/build-mpy-cross.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
cp-version:
77
required: true
88
type: string
9+
secrets:
10+
AWS_ACCESS_KEY_ID:
11+
required: false
12+
AWS_SECRET_ACCESS_KEY:
13+
required: false
914

1015
jobs:
1116
build:

.github/workflows/build.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,14 @@ jobs:
9797
with:
9898
cp-version: ${{ needs.scheduler.outputs.cp-version }}
9999

100-
101100
mpy-cross:
102101
needs: scheduler
103102
if: needs.scheduler.outputs.build-boards == 'True'
104103
uses: ./.github/workflows/build-mpy-cross.yml
104+
secrets: inherit
105105
with:
106106
cp-version: ${{ needs.scheduler.outputs.cp-version }}
107107

108-
109108
mpy-cross-mac:
110109
runs-on: macos-11
111110
needs: scheduler
@@ -153,9 +152,9 @@ jobs:
153152
(github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') ||
154153
(github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
155154
run: |
156-
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross-macos-universal s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-11-${{ env.CP_VERSION }}-universal --no-progress --region us-east-1
157-
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross-arm64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-11-${{ env.CP_VERSION }}-arm64 --no-progress --region us-east-1
158-
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-11-${{ env.CP_VERSION }}-x64 --no-progress --region us-east-1
155+
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross-macos-universal s3://adafruit-circuit-python/bin/mpy-cross/macos-11/mpy-cross-macos-11-${{ env.CP_VERSION }}-universal --no-progress --region us-east-1
156+
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross-arm64 s3://adafruit-circuit-python/bin/mpy-cross/macos-11/mpy-cross-macos-11-${{ env.CP_VERSION }}-arm64 --no-progress --region us-east-1
157+
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/macos-11/mpy-cross-macos-11-${{ env.CP_VERSION }}-x64 --no-progress --region us-east-1
159158
env:
160159
AWS_PAGER: ''
161160
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -202,6 +201,11 @@ jobs:
202201
with:
203202
name: docs
204203
path: _build/latex
204+
- name: Zip stubs
205+
if: >-
206+
(github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') ||
207+
(github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
208+
run: zip -9r circuitpython-stubs.zip circuitpython-stubs
205209
- name: Upload to S3
206210
uses: ./.github/actions/upload_aws
207211
with:
@@ -219,31 +223,31 @@ jobs:
219223
[ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi"
220224
[ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/*
221225
222-
223226
aarch:
224227
needs: [scheduler, mpy-cross, tests]
225228
if: ${{ needs.scheduler.outputs.boards-aarch != '[]' }}
226229
uses: ./.github/workflows/build-boards.yml
230+
secrets: inherit
227231
with:
228232
platform: aarch
229233
boards: ${{ needs.scheduler.outputs.boards-aarch }}
230234
cp-version: ${{ needs.scheduler.outputs.cp-version }}
231235

232-
233236
arm:
234237
needs: [scheduler, mpy-cross, tests]
235238
if: ${{ needs.scheduler.outputs.boards-arm != '[]' }}
236239
uses: ./.github/workflows/build-boards.yml
240+
secrets: inherit
237241
with:
238242
platform: arm
239243
boards: ${{ needs.scheduler.outputs.boards-arm }}
240244
cp-version: ${{ needs.scheduler.outputs.cp-version }}
241245

242-
243246
esp:
244247
needs: [scheduler, mpy-cross, tests]
245248
if: ${{ needs.scheduler.outputs.boards-esp != '[]' }}
246249
uses: ./.github/workflows/build-boards.yml
250+
secrets: inherit
247251
with:
248252
platform: esp
249253
boards: ${{ needs.scheduler.outputs.boards-esp }}
@@ -253,6 +257,7 @@ jobs:
253257
needs: [scheduler, mpy-cross, tests]
254258
if: ${{ needs.scheduler.outputs.boards-nrf != '[]' }}
255259
uses: ./.github/workflows/build-boards.yml
260+
secrets: inherit
256261
with:
257262
platform: nrf
258263
boards: ${{ needs.scheduler.outputs.boards-nrf }}
@@ -262,6 +267,7 @@ jobs:
262267
needs: [scheduler, mpy-cross, tests]
263268
if: ${{ needs.scheduler.outputs.boards-riscv != '[]' }}
264269
uses: ./.github/workflows/build-boards.yml
270+
secrets: inherit
265271
with:
266272
platform: riscv
267273
boards: ${{ needs.scheduler.outputs.boards-riscv }}
@@ -271,6 +277,7 @@ jobs:
271277
needs: [scheduler, mpy-cross, tests]
272278
if: ${{ needs.scheduler.outputs.boards-rpi != '[]' }}
273279
uses: ./.github/workflows/build-boards.yml
280+
secrets: inherit
274281
with:
275282
platform: arm
276283
boards: ${{ needs.scheduler.outputs.boards-rpi }}

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/busio/UART.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,3 +339,18 @@ bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) {
339339
}
340340
return uart_is_writable(self->uart);
341341
}
342+
343+
STATIC void pin_never_reset(uint8_t pin) {
344+
if (pin != NO_PIN) {
345+
never_reset_pin_number(pin);
346+
}
347+
}
348+
349+
void common_hal_busio_uart_never_reset(busio_uart_obj_t *self) {
350+
never_reset_uart(self->uart_id);
351+
pin_never_reset(self->tx_pin);
352+
pin_never_reset(self->rx_pin);
353+
pin_never_reset(self->cts_pin);
354+
pin_never_reset(self->rs485_dir_pin);
355+
pin_never_reset(self->rts_pin);
356+
}

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

shared-module/displayio/I2CDisplay.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t *self,
5454
// Probe the bus to see if a device acknowledges the given address.
5555
if (!common_hal_busio_i2c_probe(i2c, device_address)) {
5656
self->base.type = &mp_type_NoneType;
57+
common_hal_displayio_i2cdisplay_deinit(self);
5758
mp_raise_ValueError_varg(translate("Unable to find I2C Display at %x"), device_address);
5859
}
5960

0 commit comments

Comments
 (0)