diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90ebde9062..6f260117ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -400,7 +400,7 @@ jobs: id: idf-cache with: path: ${{ github.workspace }}/.idf_tools - key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-20210923 + key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-20220404 - name: Clone IDF submodules run: | (cd $IDF_PATH && git submodule update --init) diff --git a/ports/nrf/common-hal/pwmio/PWMOut.c b/ports/nrf/common-hal/pwmio/PWMOut.c index 76c8c4e6d4..27c0b79b5a 100644 --- a/ports/nrf/common-hal/pwmio/PWMOut.c +++ b/ports/nrf/common-hal/pwmio/PWMOut.c @@ -108,6 +108,7 @@ STATIC void reset_single_pwmout(uint8_t i) { for (int ch = 0; ch < CHANNELS_PER_PWM; ch++) { pwm_seq[i][ch] = (1 << 15); // polarity = 0 + pwm->PSEL.OUT[ch] = 0xFFFFFFFF; // disconnnect from I/O } } diff --git a/ports/raspberrypi/common-hal/busio/UART.c b/ports/raspberrypi/common-hal/busio/UART.c index 0e25c57297..9fd5ad3168 100644 --- a/ports/raspberrypi/common-hal/busio/UART.c +++ b/ports/raspberrypi/common-hal/busio/UART.c @@ -85,7 +85,7 @@ static void shared_callback(busio_uart_obj_t *self) { _copy_into_ringbuf(&self->ringbuf, self->uart); // We always clear the interrupt so it doesn't continue to fire because we // may not have read everything available. - uart_get_hw(self->uart)->icr = UART_UARTICR_RXIC_BITS; + uart_get_hw(self->uart)->icr = UART_UARTICR_RXIC_BITS | UART_UARTICR_RTIC_BITS; } static void uart0_callback(void) { diff --git a/py/ringbuf.c b/py/ringbuf.c index 72e164946a..fe47b50068 100644 --- a/py/ringbuf.c +++ b/py/ringbuf.c @@ -28,7 +28,6 @@ #include "ringbuf.h" bool ringbuf_init(ringbuf_t *r, uint8_t *buf, size_t capacity) { - r->heap = false; r->buf = buf; r->size = capacity; r->iget = r->iput = 0; @@ -40,7 +39,6 @@ bool ringbuf_init(ringbuf_t *r, uint8_t *buf, size_t capacity) { // size of the buffer is one greater than that, due to how the buffer // handles empty and full statuses. bool ringbuf_alloc(ringbuf_t *r, size_t capacity, bool long_lived) { - r->heap = true; r->buf = gc_alloc(capacity + 1, false, long_lived); r->size = capacity + 1; r->iget = r->iput = 0; @@ -48,9 +46,8 @@ bool ringbuf_alloc(ringbuf_t *r, size_t capacity, bool long_lived) { } void ringbuf_free(ringbuf_t *r) { - if (r->heap) { - gc_free(r->buf); - } + // Free buf by letting gc take care of it. If the VM has finished already, + // this will be safe. r->buf = (uint8_t *)NULL; r->size = 0; ringbuf_clear(r); diff --git a/py/ringbuf.h b/py/ringbuf.h index 8f7e7b1760..d868eff1e4 100644 --- a/py/ringbuf.h +++ b/py/ringbuf.h @@ -37,7 +37,6 @@ typedef struct _ringbuf_t { uint32_t size; uint32_t iget; uint32_t iput; - bool heap; } ringbuf_t; // Note that the capacity of the buffer is N-1! diff --git a/py/vm.c b/py/vm.c index 63eb7f46d9..8cb01d3552 100644 --- a/py/vm.c +++ b/py/vm.c @@ -739,8 +739,8 @@ unwind_jump:; obj = mp_getiter(obj, iter_buf); if (obj != MP_OBJ_FROM_PTR(iter_buf)) { // Iterator didn't use the stack so indicate that with MP_OBJ_NULL. - sp[-MP_OBJ_ITER_BUF_NSLOTS + 1] = MP_OBJ_NULL; - sp[-MP_OBJ_ITER_BUF_NSLOTS + 2] = obj; + *(sp - MP_OBJ_ITER_BUF_NSLOTS + 1) = MP_OBJ_NULL; + *(sp - MP_OBJ_ITER_BUF_NSLOTS + 2) = obj; } DISPATCH(); } @@ -751,8 +751,8 @@ unwind_jump:; DECODE_ULABEL; // the jump offset if iteration finishes; for labels are always forward code_state->sp = sp; mp_obj_t obj; - if (sp[-MP_OBJ_ITER_BUF_NSLOTS + 1] == MP_OBJ_NULL) { - obj = sp[-MP_OBJ_ITER_BUF_NSLOTS + 2]; + if (*(sp - MP_OBJ_ITER_BUF_NSLOTS + 1) == MP_OBJ_NULL) { + obj = *(sp - MP_OBJ_ITER_BUF_NSLOTS + 2); } else { obj = MP_OBJ_FROM_PTR(&sp[-MP_OBJ_ITER_BUF_NSLOTS + 1]); } diff --git a/requirements-dev.txt b/requirements-dev.txt index 9c574567f7..67835dad3d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,10 +4,12 @@ huffman # For nvm.toml cascadetoml jinja2 -typer +# Undo this pin when click and typer are again compatible. +typer==0.4.0 sh -click +# Undo this pin when click and typer are again compatible. +click==8.0.4 cpp-coveralls requests requests-cache diff --git a/shared-module/audiomp3/MP3Decoder.c b/shared-module/audiomp3/MP3Decoder.c index 2d45313814..d0aecc18bd 100644 --- a/shared-module/audiomp3/MP3Decoder.c +++ b/shared-module/audiomp3/MP3Decoder.c @@ -364,7 +364,7 @@ audioio_get_buffer_result_t audiomp3_mp3file_get_buffer(audiomp3_mp3file_obj_t * } self->samples_decoded += *buffer_length / sizeof(int16_t); - return GET_BUFFER_MORE_DATA; + return mp3file_find_sync_word(self) ? GET_BUFFER_MORE_DATA : GET_BUFFER_DONE; } void audiomp3_mp3file_get_buffer_structure(audiomp3_mp3file_obj_t *self, bool single_channel_output,