From bf56966cd3b0072e1539887171d05b05ad2cf2dc Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:24:44 +0000 Subject: [PATCH 01/30] stm32l4: Set proper USB and HAL tick interrupt priorities for L433 - Set USB interrupt priority to 1 for STM32L433 - Lower HAL tick interrupt priority to 2 to ensure proper USB operation - Ensures proper interrupt handling for USB functionality Co-Authored-By: bsatrom@blues.com --- ports/stm/boards/cygnet/board.c | 5 ++--- ports/stm/peripherals/stm32l4/clocks.c | 17 +++++++++++++++++ ports/stm/supervisor/usb.c | 5 +++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ports/stm/boards/cygnet/board.c b/ports/stm/boards/cygnet/board.c index f6650fb8f9c33..f70a75324ac53 100644 --- a/ports/stm/boards/cygnet/board.c +++ b/ports/stm/boards/cygnet/board.c @@ -56,9 +56,8 @@ void board_init(void) { // enable the debugger while sleeping. Todo move somewhere more central (kind of generally useful in a debug build) SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); - // Set tick interrupt priority, default HAL value is intentionally invalid - // Without this, USB does not function. - HAL_InitTick((1UL << __NVIC_PRIO_BITS) - 1UL); + // Set tick interrupt priority lower than USB to ensure proper operation + HAL_InitTick(2); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitTypeDef GPIO_InitStruct; diff --git a/ports/stm/peripherals/stm32l4/clocks.c b/ports/stm/peripherals/stm32l4/clocks.c index d4cf3312efe14..b562687235d44 100644 --- a/ports/stm/peripherals/stm32l4/clocks.c +++ b/ports/stm/peripherals/stm32l4/clocks.c @@ -88,6 +88,23 @@ void stm32_peripherals_clocks_init(void) { HAL_CHECK(HAL_RCC_OscConfig(&RCC_OscInitStruct)); + #ifdef STM32L433xx + /* Enable CRS clock */ + __HAL_RCC_CRS_CLK_ENABLE(); + + /* Configure CRS */ + RCC_CRSInitTypeDef RCC_CRSInitStruct = {0}; + RCC_CRSInitStruct.Prescaler = RCC_CRS_SYNC_DIV1; + RCC_CRSInitStruct.Source = RCC_CRS_SYNC_SOURCE_USB; + RCC_CRSInitStruct.Polarity = RCC_CRS_SYNC_POLARITY_RISING; + RCC_CRSInitStruct.ReloadValue = __HAL_RCC_CRS_RELOADVALUE_CALCULATE(48000000, 1000); + RCC_CRSInitStruct.ErrorLimitValue = 34; + RCC_CRSInitStruct.HSI48CalibrationValue = 32; + + /* Start automatic synchronization */ + HAL_RCCEx_CRSConfig(&RCC_CRSInitStruct); + #endif + #ifdef STM32L4R5xx /* Enable MSI Auto-calibration through LSE */ HAL_RCCEx_EnableMSIPLLMode(); diff --git a/ports/stm/supervisor/usb.c b/ports/stm/supervisor/usb.c index 86acdc49b34e6..20802a9a137b9 100644 --- a/ports/stm/supervisor/usb.c +++ b/ports/stm/supervisor/usb.c @@ -46,6 +46,11 @@ static void init_usb_vbus_sense(void) { } void init_usb_hardware(void) { + #ifdef STM32L433xx + /* Set USB interrupt priority */ + HAL_NVIC_SetPriority(USB_IRQn, 1, 0); + HAL_NVIC_EnableIRQ(USB_IRQn); + #endif /* Enable USB power on Pwrctrl CR2 register */ #ifdef PWR_CR2_USV From d754c51418092e65fc1dedf7a740141fc9acfd5d Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:49:24 +0000 Subject: [PATCH 02/30] stm32l4: Add USB suspend/resume power management for STM32L433 Implements board-level power management hooks for USB suspend/resume on the STM32L433-based Cygnet board. This includes: - USB interrupt priority configuration - Power management implementation for suspend/resume - GPIO clock management during low power states - System clock reconfiguration after wake from STOP mode Part of the USB functionality improvements for the Cygnet board. Co-Authored-By: bsatrom@blues.com --- ports/stm/boards/cygnet/board.c | 32 +++++++++++++++++++++++++ ports/stm/boards/cygnet/board.h | 4 ++++ ports/stm/supervisor/usb.c | 42 +++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/ports/stm/boards/cygnet/board.c b/ports/stm/boards/cygnet/board.c index f70a75324ac53..5ac520bc32a28 100644 --- a/ports/stm/boards/cygnet/board.c +++ b/ports/stm/boards/cygnet/board.c @@ -16,6 +16,10 @@ #include "shared-bindings/digitalio/DriveMode.h" #include "board.h" +// Forward declarations for USB suspend/resume hooks +void board_usb_suspend_hook(void); +void board_usb_resume_hook(void); + digitalio_digitalinout_obj_t power_pin = { .base.type = &digitalio_digitalinout_type }; digitalio_digitalinout_obj_t discharge_pin = { .base.type = &digitalio_digitalinout_type }; @@ -75,4 +79,32 @@ void reset_board(void) { initialize_discharge_pin(); } +void board_usb_suspend_hook(void) { + // Disable unused peripherals to reduce power consumption + __HAL_RCC_GPIOA_CLK_DISABLE(); + __HAL_RCC_GPIOB_CLK_DISABLE(); + __HAL_RCC_GPIOH_CLK_DISABLE(); + + // Enter Stop 1 mode with regulator in low-power mode + HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI); +} + +void board_usb_resume_hook(void) { + // Re-enable GPIO clocks + __HAL_RCC_GPIOA_CLK_ENABLE(); + __HAL_RCC_GPIOB_CLK_ENABLE(); + __HAL_RCC_GPIOH_CLK_ENABLE(); + + // Reconfigure system clock after waking from STOP mode + SystemClock_Config(); + + // Re-initialize GPIO pins + GPIO_InitTypeDef GPIO_InitStruct; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_LOW; + GPIO_InitStruct.Pin = GPIO_PIN_8; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); +} + // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/cygnet/board.h b/ports/stm/boards/cygnet/board.h index ce199359ba496..54297146cdab0 100644 --- a/ports/stm/boards/cygnet/board.h +++ b/ports/stm/boards/cygnet/board.h @@ -10,3 +10,7 @@ extern digitalio_digitalinout_obj_t power_pin; extern digitalio_digitalinout_obj_t discharge_pin; + +// USB power management hooks +void board_usb_suspend_hook(void); +void board_usb_resume_hook(void); diff --git a/ports/stm/supervisor/usb.c b/ports/stm/supervisor/usb.c index 20802a9a137b9..face4cfd86b70 100644 --- a/ports/stm/supervisor/usb.c +++ b/ports/stm/supervisor/usb.c @@ -13,6 +13,34 @@ #include "common-hal/microcontroller/Pin.h" +#ifdef STM32L433xx +static void enter_low_power_mode(void) { + // Enable low-power mode in USB peripheral + USB->CNTR |= USB_CNTR_LPMODE; + + // Enter STOP mode with regulator in low-power mode + __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); + HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); +} + +static void exit_low_power_mode(void) { + // Disable low-power mode in USB peripheral + USB->CNTR &= ~USB_CNTR_LPMODE; + + // System will automatically exit STOP mode on interrupt + // Reconfigure the system clock if needed + SystemClock_Config(); +} + +void board_usb_suspend_hook(void) { + enter_low_power_mode(); +} + +void board_usb_resume_hook(void) { + exit_low_power_mode(); +} +#endif + static void init_usb_vbus_sense(void) { #if (BOARD_NO_VBUS_SENSE) @@ -50,6 +78,10 @@ void init_usb_hardware(void) { /* Set USB interrupt priority */ HAL_NVIC_SetPriority(USB_IRQn, 1, 0); HAL_NVIC_EnableIRQ(USB_IRQn); + + /* Enable wakeup interrupt for USB resume */ + HAL_NVIC_EnableIRQ(USB_WKUP_IRQn); + HAL_NVIC_SetPriority(USB_WKUP_IRQn, 1, 0); #endif /* Enable USB power on Pwrctrl CR2 register */ @@ -137,3 +169,13 @@ void init_usb_hardware(void) { void OTG_FS_IRQHandler(void) { usb_irq_handler(0); } + +#ifdef STM32L433xx +void USB_WKUP_IRQHandler(void) { + // Clear wakeup flag + __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); + + // Handle USB wakeup + board_usb_resume_hook(); +} +#endif From 7ef832cd21635f094b864a8d0c7024b33415f71a Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:55:27 +0000 Subject: [PATCH 03/30] Update TinyUSB submodule to include STM32L433 power management Co-Authored-By: bsatrom@blues.com --- lib/tinyusb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tinyusb b/lib/tinyusb index 5217cee5de4cd..1cbf810ad1a96 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 5217cee5de4cd555018da90f9f1bcc87fb1c1d3a +Subproject commit 1cbf810ad1a96c3a13e40771529307023249feef From f0bb1678b509b36e01d76bc5c154357653386116 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 17:39:14 +0000 Subject: [PATCH 04/30] style: Fix trailing whitespace in usb.c Co-Authored-By: bsatrom@blues.com --- ports/stm/supervisor/usb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/stm/supervisor/usb.c b/ports/stm/supervisor/usb.c index face4cfd86b70..56055e1875461 100644 --- a/ports/stm/supervisor/usb.c +++ b/ports/stm/supervisor/usb.c @@ -17,7 +17,7 @@ static void enter_low_power_mode(void) { // Enable low-power mode in USB peripheral USB->CNTR |= USB_CNTR_LPMODE; - + // Enter STOP mode with regulator in low-power mode __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); @@ -26,7 +26,7 @@ static void enter_low_power_mode(void) { static void exit_low_power_mode(void) { // Disable low-power mode in USB peripheral USB->CNTR &= ~USB_CNTR_LPMODE; - + // System will automatically exit STOP mode on interrupt // Reconfigure the system clock if needed SystemClock_Config(); @@ -78,7 +78,7 @@ void init_usb_hardware(void) { /* Set USB interrupt priority */ HAL_NVIC_SetPriority(USB_IRQn, 1, 0); HAL_NVIC_EnableIRQ(USB_IRQn); - + /* Enable wakeup interrupt for USB resume */ HAL_NVIC_EnableIRQ(USB_WKUP_IRQn); HAL_NVIC_SetPriority(USB_WKUP_IRQn, 1, 0); @@ -174,7 +174,7 @@ void OTG_FS_IRQHandler(void) { void USB_WKUP_IRQHandler(void) { // Clear wakeup flag __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); - + // Handle USB wakeup board_usb_resume_hook(); } From e0fc2464b42ec64b71d3367ef2a4edc6a3424a12 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 17:48:23 +0000 Subject: [PATCH 05/30] ci: Retrigger checks Co-Authored-By: bsatrom@blues.com From 5214d550db57f0fa2fd1534b3fb4b613ffb16437 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 17:52:09 +0000 Subject: [PATCH 06/30] ci: Improve error handling for workflow information in ci_changes_per_commit.py Co-Authored-By: bsatrom@blues.com --- tools/ci_changes_per_commit.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/ci_changes_per_commit.py b/tools/ci_changes_per_commit.py index 6cbd475fa95b7..b23d7c6de003b 100644 --- a/tools/ci_changes_per_commit.py +++ b/tools/ci_changes_per_commit.py @@ -152,15 +152,17 @@ def get_commit_depth_and_check_suite(query_commits): commit_depth += 1 commit = commit["commit"] commit_sha = commit["oid"] - check_suites = commit["checkSuites"] - if check_suites["totalCount"] > 0: - for check_suite in check_suites["nodes"]: - if check_suite["workflowRun"]["workflow"]["name"] == "Build CI": + check_suites = commit.get("checkSuites", {}) + if check_suites.get("totalCount", 0) > 0: + for check_suite in check_suites.get("nodes", []): + workflow_run = check_suite.get("workflowRun", {}) + workflow = workflow_run.get("workflow", {}) + if workflow and workflow.get("name") == "Build CI": return [ {"sha": commit_sha, "depth": commit_depth}, ( check_suite["id"] - if check_suite["conclusion"] != "SUCCESS" + if check_suite.get("conclusion") != "SUCCESS" else None ), ] From 676714a2ee2f9fa06d7d06fc9628fb2e73ec31c6 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 18:37:07 +0000 Subject: [PATCH 07/30] style: Fix indentation and docstring formatting Co-Authored-By: bsatrom@blues.com --- ports/stm/peripherals/periph.h | 10 +++++----- ports/stm/peripherals/pins.h | 8 ++++---- ports/stm/supervisor/internal_flash.h | 2 +- shared-bindings/epaperdisplay/__init__.c | 4 +--- shared-bindings/fourwire/__init__.c | 4 +--- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/ports/stm/peripherals/periph.h b/ports/stm/peripherals/periph.h index 4960125d90f12..d6eb245f8b154 100644 --- a/ports/stm/peripherals/periph.h +++ b/ports/stm/peripherals/periph.h @@ -21,11 +21,11 @@ typedef struct { } mcu_periph_obj_t; #define PERIPH(index, alt, p_pin) \ - { \ - .periph_index = index, \ - .altfn_index = alt, \ - .pin = p_pin, \ - } + { \ + .periph_index = index, \ + .altfn_index = alt, \ + .pin = p_pin, \ + } // Timer Peripheral diff --git a/ports/stm/peripherals/pins.h b/ports/stm/peripherals/pins.h index c91879939552e..ef2a1ace510e5 100644 --- a/ports/stm/peripherals/pins.h +++ b/ports/stm/peripherals/pins.h @@ -32,12 +32,12 @@ typedef struct { // but all 3 ADCs will share the same input number per pin. // F4 family has 3 ADC max, 24 channels max. #define ADC_INPUT(mask, number) \ - .adc_unit = mask, \ - .adc_channel = number, + .adc_unit = mask, \ + .adc_channel = number, #define NO_ADC \ - .adc_unit = 0x00, \ - .adc_channel = 0x1f + .adc_unit = 0x00, \ + .adc_channel = 0x1f extern const mp_obj_type_t mcu_pin_type; diff --git a/ports/stm/supervisor/internal_flash.h b/ports/stm/supervisor/internal_flash.h index 0ecfcbf12a0be..a21764b44a0c9 100644 --- a/ports/stm/supervisor/internal_flash.h +++ b/ports/stm/supervisor/internal_flash.h @@ -98,4 +98,4 @@ #define STM32_FLASH_OFFSET 0x8000000 // All STM32 chips map to this flash location #define INTERNAL_FLASH_SYSTICK_MASK (0x1ff) // 512ms -#define INTERNAL_FLASH_IDLE_TICK(tick) (((tick)&INTERNAL_FLASH_SYSTICK_MASK) == 2) +#define INTERNAL_FLASH_IDLE_TICK(tick) (((tick) & INTERNAL_FLASH_SYSTICK_MASK) == 2) diff --git a/shared-bindings/epaperdisplay/__init__.c b/shared-bindings/epaperdisplay/__init__.c index 1b18212a35a39..eff31cb01b309 100644 --- a/shared-bindings/epaperdisplay/__init__.c +++ b/shared-bindings/epaperdisplay/__init__.c @@ -13,9 +13,7 @@ #include "shared-bindings/epaperdisplay/__init__.h" #include "shared-bindings/epaperdisplay/EPaperDisplay.h" -//| """Displays a `displayio` object tree on an e-paper display -//| -//| """ +//| """Displays a `displayio` object tree on an e-paper display""" static const mp_rom_map_elem_t epaperdisplay_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_displayio) }, diff --git a/shared-bindings/fourwire/__init__.c b/shared-bindings/fourwire/__init__.c index 34542db97a7e1..659d9482cb57b 100644 --- a/shared-bindings/fourwire/__init__.c +++ b/shared-bindings/fourwire/__init__.c @@ -13,9 +13,7 @@ #include "shared-bindings/fourwire/__init__.h" #include "shared-bindings/fourwire/FourWire.h" -//| """Connects to a BusDisplay over a four wire bus -//| -//| """ +//| """Connects to a BusDisplay over a four wire bus""" static const mp_rom_map_elem_t fourwire_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_fourwire) }, From 5a7c658a67b9b3df774ddefd62857e7dfea294ed Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 18:44:11 +0000 Subject: [PATCH 08/30] ci: Retrigger workflow Co-Authored-By: bsatrom@blues.com From 934b74ece11e8e1bb713de6afb60b50ea959e9b8 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 20:20:59 +0000 Subject: [PATCH 09/30] Fix code formatting issues in docstrings and indentation Co-Authored-By: bsatrom@blues.com --- ports/stm/peripherals/periph.h | 12 ++++++------ ports/stm/peripherals/pins.h | 12 ++++++------ shared-bindings/gifio/__init__.c | 3 +-- shared-bindings/i2cdisplaybus/__init__.c | 4 +--- shared-bindings/onewireio/__init__.c | 3 ++- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/ports/stm/peripherals/periph.h b/ports/stm/peripherals/periph.h index d6eb245f8b154..571247964d141 100644 --- a/ports/stm/peripherals/periph.h +++ b/ports/stm/peripherals/periph.h @@ -37,12 +37,12 @@ typedef struct { } mcu_tim_pin_obj_t; #define TIM(index, alt, channel, tim_pin) \ - { \ - .tim_index = index - 1, \ - .altfn_index = alt, \ - .channel_index = channel - 1, \ - .pin = tim_pin, \ - } + { \ + .tim_index = index - 1, \ + .altfn_index = alt, \ + .channel_index = channel - 1, \ + .pin = tim_pin, \ + } // F4 Series // Access Lines diff --git a/ports/stm/peripherals/pins.h b/ports/stm/peripherals/pins.h index ef2a1ace510e5..3fffd70423702 100644 --- a/ports/stm/peripherals/pins.h +++ b/ports/stm/peripherals/pins.h @@ -44,12 +44,12 @@ extern const mp_obj_type_t mcu_pin_type; // STM32 can have up to 9 ports, each restricted to 16 pins // We split the pin/port evenly, in contrast to nrf. #define PIN(p_port, p_number, p_adc) \ - { \ - { &mcu_pin_type }, \ - .port = p_port, \ - .number = p_number, \ - p_adc \ - } + { \ + { &mcu_pin_type }, \ + .port = p_port, \ + .number = p_number, \ + p_adc \ + } // Use illegal pin value to mark unassigned pins. #define NO_PIN 0xff diff --git a/shared-bindings/gifio/__init__.c b/shared-bindings/gifio/__init__.c index 057d18ce82d47..a8a09dc08d89a 100644 --- a/shared-bindings/gifio/__init__.c +++ b/shared-bindings/gifio/__init__.c @@ -10,8 +10,7 @@ #include "shared-bindings/gifio/OnDiskGif.h" #include "shared-bindings/util.h" -//| """Access GIF-format images -//| """ +//| """Access GIF-format images""" static const mp_rom_map_elem_t gifio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gifio) }, { MP_OBJ_NEW_QSTR(MP_QSTR_GifWriter), MP_ROM_PTR(&gifio_gifwriter_type)}, diff --git a/shared-bindings/i2cdisplaybus/__init__.c b/shared-bindings/i2cdisplaybus/__init__.c index 45be89668f028..dc25571758307 100644 --- a/shared-bindings/i2cdisplaybus/__init__.c +++ b/shared-bindings/i2cdisplaybus/__init__.c @@ -13,9 +13,7 @@ #include "shared-bindings/i2cdisplaybus/__init__.h" #include "shared-bindings/i2cdisplaybus/I2CDisplayBus.h" -//| """Communicates to a display IC over I2C -//| -//| """ +//| """Communicates to a display IC over I2C""" static const mp_rom_map_elem_t i2cdisplaybus_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_i2cdisplaybus) }, diff --git a/shared-bindings/onewireio/__init__.c b/shared-bindings/onewireio/__init__.c index bce56326b1ad9..3a1a1e285afe5 100644 --- a/shared-bindings/onewireio/__init__.c +++ b/shared-bindings/onewireio/__init__.c @@ -17,7 +17,8 @@ //| """Low-level bit primitives for Maxim (formerly Dallas Semi) one-wire protocol. //| -//| Protocol definition is here: https://www.analog.com/en/technical-articles/1wire-communication-through-software.html""" +//| Protocol definition is here: https://www.analog.com/en/technical-articles/1wire-communication-through-software.html +//| """ static const mp_rom_map_elem_t onewireio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_onewireio) }, From 99bd0118db4f08a62c1fa0a956f1d1145a54d150 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 20:28:28 +0000 Subject: [PATCH 10/30] style: Fix docstring indentation in decode_backtrace.py Co-Authored-By: bsatrom@blues.com --- ports/espressif/tools/decode_backtrace.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/espressif/tools/decode_backtrace.py b/ports/espressif/tools/decode_backtrace.py index 6d2772d39f77b..024e636207ec8 100644 --- a/ports/espressif/tools/decode_backtrace.py +++ b/ports/espressif/tools/decode_backtrace.py @@ -1,10 +1,10 @@ """Simple script that translates "Backtrace:" lines from the ESP output to files - and line numbers. +and line numbers. - Run with: python3 tools/decode_backtrace.py +Run with: python3 tools/decode_backtrace.py - Enter the backtrace line at the "? " prompt. CTRL-C to exit the script. - """ +Enter the backtrace line at the "? " prompt. CTRL-C to exit the script. +""" import subprocess import sys From 3b16a75c230799c0b97ef5fbda7c8c371045ab24 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 20:32:53 +0000 Subject: [PATCH 11/30] style: Fix docstring formatting and whitespace in shared bindings Co-Authored-By: bsatrom@blues.com --- ports/espressif/tools/decode_backtrace.py | 3 +-- shared-bindings/epaperdisplay/__init__.c | 3 ++- shared-bindings/fourwire/__init__.c | 3 ++- shared-bindings/gifio/__init__.c | 4 +++- shared-bindings/i2cdisplaybus/__init__.c | 3 ++- shared-bindings/onewireio/__init__.c | 6 +++--- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ports/espressif/tools/decode_backtrace.py b/ports/espressif/tools/decode_backtrace.py index 024e636207ec8..1c23af225c542 100644 --- a/ports/espressif/tools/decode_backtrace.py +++ b/ports/espressif/tools/decode_backtrace.py @@ -3,8 +3,7 @@ Run with: python3 tools/decode_backtrace.py -Enter the backtrace line at the "? " prompt. CTRL-C to exit the script. -""" +Enter the backtrace line at the "? " prompt. CTRL-C to exit the script.""" import subprocess import sys diff --git a/shared-bindings/epaperdisplay/__init__.c b/shared-bindings/epaperdisplay/__init__.c index eff31cb01b309..5423fac7b64d4 100644 --- a/shared-bindings/epaperdisplay/__init__.c +++ b/shared-bindings/epaperdisplay/__init__.c @@ -14,12 +14,13 @@ #include "shared-bindings/epaperdisplay/EPaperDisplay.h" //| """Displays a `displayio` object tree on an e-paper display""" +//| static const mp_rom_map_elem_t epaperdisplay_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_displayio) }, - { MP_ROM_QSTR(MP_QSTR_EPaperDisplay), MP_ROM_PTR(&epaperdisplay_epaperdisplay_type) }, }; + static MP_DEFINE_CONST_DICT(epaperdisplay_module_globals, epaperdisplay_module_globals_table); const mp_obj_module_t epaperdisplay_module = { diff --git a/shared-bindings/fourwire/__init__.c b/shared-bindings/fourwire/__init__.c index 659d9482cb57b..52b527d3a82a4 100644 --- a/shared-bindings/fourwire/__init__.c +++ b/shared-bindings/fourwire/__init__.c @@ -14,12 +14,13 @@ #include "shared-bindings/fourwire/FourWire.h" //| """Connects to a BusDisplay over a four wire bus""" +//| static const mp_rom_map_elem_t fourwire_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_fourwire) }, - { MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&fourwire_fourwire_type) }, }; + static MP_DEFINE_CONST_DICT(fourwire_module_globals, fourwire_module_globals_table); const mp_obj_module_t fourwire_module = { diff --git a/shared-bindings/gifio/__init__.c b/shared-bindings/gifio/__init__.c index a8a09dc08d89a..ce6bee2c1d9d7 100644 --- a/shared-bindings/gifio/__init__.c +++ b/shared-bindings/gifio/__init__.c @@ -11,9 +11,11 @@ #include "shared-bindings/util.h" //| """Access GIF-format images""" +//| + static const mp_rom_map_elem_t gifio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gifio) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_GifWriter), MP_ROM_PTR(&gifio_gifwriter_type)}, + { MP_OBJ_NEW_QSTR(MP_QSTR_GifWriter), MP_ROM_PTR(&gifio_gifwriter_type) }, { MP_ROM_QSTR(MP_QSTR_OnDiskGif), MP_ROM_PTR(&gifio_ondiskgif_type) }, }; diff --git a/shared-bindings/i2cdisplaybus/__init__.c b/shared-bindings/i2cdisplaybus/__init__.c index dc25571758307..2702692c598eb 100644 --- a/shared-bindings/i2cdisplaybus/__init__.c +++ b/shared-bindings/i2cdisplaybus/__init__.c @@ -14,12 +14,13 @@ #include "shared-bindings/i2cdisplaybus/I2CDisplayBus.h" //| """Communicates to a display IC over I2C""" +//| static const mp_rom_map_elem_t i2cdisplaybus_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_i2cdisplaybus) }, - { MP_ROM_QSTR(MP_QSTR_I2CDisplayBus), MP_ROM_PTR(&i2cdisplaybus_i2cdisplaybus_type) }, }; + static MP_DEFINE_CONST_DICT(i2cdisplaybus_module_globals, i2cdisplaybus_module_globals_table); const mp_obj_module_t i2cdisplaybus_module = { diff --git a/shared-bindings/onewireio/__init__.c b/shared-bindings/onewireio/__init__.c index 3a1a1e285afe5..5786f23c15305 100644 --- a/shared-bindings/onewireio/__init__.c +++ b/shared-bindings/onewireio/__init__.c @@ -17,12 +17,12 @@ //| """Low-level bit primitives for Maxim (formerly Dallas Semi) one-wire protocol. //| -//| Protocol definition is here: https://www.analog.com/en/technical-articles/1wire-communication-through-software.html -//| """ +//| Protocol definition is here: https://www.analog.com/en/technical-articles/1wire-communication-through-software.html""" +//| static const mp_rom_map_elem_t onewireio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_onewireio) }, - { MP_ROM_QSTR(MP_QSTR_OneWire), MP_ROM_PTR(&onewireio_onewire_type) }, + { MP_ROM_QSTR(MP_QSTR_OneWire), MP_ROM_PTR(&onewireio_onewire_type) }, }; static MP_DEFINE_CONST_DICT(onewireio_module_globals, onewireio_module_globals_table); From c4063d7e8fe21be9f087553955ac7032cea5db72 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 20:44:49 +0000 Subject: [PATCH 12/30] ci: Retrigger workflow after stuck runs Co-Authored-By: bsatrom@blues.com From 8d5fab22cd060c6db1887d5d9dab320d99a824f3 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 21:08:42 +0000 Subject: [PATCH 13/30] Fix formatting issues in docstrings and indentation Co-Authored-By: bsatrom@blues.com --- ports/espressif/tools/update_sdkconfig.py | 2 +- shared-bindings/onewireio/__init__.c | 3 ++- tools/cortex-m-fault-gdb.py | 2 +- tools/gdb-stack-size.py | 2 +- tools/stack-loc-to-pc.py | 9 +++++---- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index c1e7ebd349c23..74447de76caec 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -1,5 +1,5 @@ """This script updates the sdkconfigs based on the menuconfig results in a given - build.""" +build.""" import pathlib import click diff --git a/shared-bindings/onewireio/__init__.c b/shared-bindings/onewireio/__init__.c index 5786f23c15305..095854bda79be 100644 --- a/shared-bindings/onewireio/__init__.c +++ b/shared-bindings/onewireio/__init__.c @@ -17,7 +17,8 @@ //| """Low-level bit primitives for Maxim (formerly Dallas Semi) one-wire protocol. //| -//| Protocol definition is here: https://www.analog.com/en/technical-articles/1wire-communication-through-software.html""" +//| Protocol definition is here: https://www.analog.com/en/technical-articles/1wire-communication-through-software.html +//| """ //| static const mp_rom_map_elem_t onewireio_module_globals_table[] = { diff --git a/tools/cortex-m-fault-gdb.py b/tools/cortex-m-fault-gdb.py index 8de754ed26056..500ba9c0cb7bb 100644 --- a/tools/cortex-m-fault-gdb.py +++ b/tools/cortex-m-fault-gdb.py @@ -1,5 +1,5 @@ """Source this file into gdb `source ../../tools/cortex-m-fault-gdb.py` then run - `cortex-m-fault` to print basic info about the fault registers.""" +`cortex-m-fault` to print basic info about the fault registers.""" SCS = 0xE000E000 SCB = SCS + 0x0D00 diff --git a/tools/gdb-stack-size.py b/tools/gdb-stack-size.py index 4d3fc9fe08aa1..6feabdd38164c 100644 --- a/tools/gdb-stack-size.py +++ b/tools/gdb-stack-size.py @@ -1,5 +1,5 @@ """Source this file into gdb `source ../../tools/gdb-stack-size.py` then run - `stack-size` to print a backtrace with each frame size next to it.""" +`stack-size` to print a backtrace with each frame size next to it.""" class StackSize(gdb.Command): diff --git a/tools/stack-loc-to-pc.py b/tools/stack-loc-to-pc.py index a1ce788f2b652..0a92750216cbf 100644 --- a/tools/stack-loc-to-pc.py +++ b/tools/stack-loc-to-pc.py @@ -1,10 +1,11 @@ """Prints the pcs that access each stack location in a function. Useful for finding - infrequently used stack space. +infrequently used stack space. - Pipe in disassembly like so: +Pipe in disassembly like so: - arm-none-eabi-objdump --disassemble=mp_execute_bytecode build-metro_m0_express/firmware.elf | python ../../tools/stack-loc-to-pc.py - """ +arm-none-eabi-objdump --disassemble=mp_execute_bytecode build-metro_m0_express/firmware.elf | python ../../tools/stack-loc-to-pc.py + +""" import sys import re From 8d91b3798a3051470f77dd18af917bad4364c9bd Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:15:19 +0000 Subject: [PATCH 14/30] ci: Fix error handling for None workflow_run in ci_changes_per_commit.py Co-Authored-By: bsatrom@blues.com --- tools/ci_changes_per_commit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/ci_changes_per_commit.py b/tools/ci_changes_per_commit.py index b23d7c6de003b..c17285716b498 100644 --- a/tools/ci_changes_per_commit.py +++ b/tools/ci_changes_per_commit.py @@ -155,9 +155,10 @@ def get_commit_depth_and_check_suite(query_commits): check_suites = commit.get("checkSuites", {}) if check_suites.get("totalCount", 0) > 0: for check_suite in check_suites.get("nodes", []): - workflow_run = check_suite.get("workflowRun", {}) - workflow = workflow_run.get("workflow", {}) - if workflow and workflow.get("name") == "Build CI": + workflow_run = check_suite.get("workflowRun") + if workflow_run is not None: + workflow = workflow_run.get("workflow") + if workflow is not None and workflow.get("name") == "Build CI": return [ {"sha": commit_sha, "depth": commit_depth}, ( From d573cfc179ccf2e09bca148820311d86da5e9a7a Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:28:42 +0000 Subject: [PATCH 15/30] style: Fix error handling and formatting in stack-loc-to-pc.py Co-Authored-By: bsatrom@blues.com --- tools/stack-loc-to-pc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/stack-loc-to-pc.py b/tools/stack-loc-to-pc.py index 0a92750216cbf..341d46b6bd3f9 100644 --- a/tools/stack-loc-to-pc.py +++ b/tools/stack-loc-to-pc.py @@ -4,7 +4,6 @@ Pipe in disassembly like so: arm-none-eabi-objdump --disassemble=mp_execute_bytecode build-metro_m0_express/firmware.elf | python ../../tools/stack-loc-to-pc.py - """ import sys @@ -16,11 +15,12 @@ for line in sys.stdin: if "sp" in line: m = offset.search(line) - o = int(m.groups()[0]) - pc = line.split(":")[0] - if o not in offsets: - offsets[o] = [] - offsets[o].append(pc.strip()) + if m: + o = int(m.groups()[0]) + pc = line.split(":")[0].strip() + if o not in offsets: + offsets[o] = [] + offsets[o].append(pc) print("Offset", "Size", "PCs", sep="\t") last_o = 0 From 23438ad313ba091ac93c82a971db59fc67f33cb7 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:29:53 +0000 Subject: [PATCH 16/30] style: Add newlines after docstrings in utility scripts Co-Authored-By: bsatrom@blues.com --- ports/espressif/tools/update_sdkconfig.py | 2 ++ tools/cortex-m-fault-gdb.py | 2 ++ tools/gdb-stack-size.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index 74447de76caec..f23785a8d984c 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -1,6 +1,8 @@ """This script updates the sdkconfigs based on the menuconfig results in a given build.""" + + import pathlib import click import copy diff --git a/tools/cortex-m-fault-gdb.py b/tools/cortex-m-fault-gdb.py index 500ba9c0cb7bb..715428ce9076e 100644 --- a/tools/cortex-m-fault-gdb.py +++ b/tools/cortex-m-fault-gdb.py @@ -1,6 +1,8 @@ """Source this file into gdb `source ../../tools/cortex-m-fault-gdb.py` then run `cortex-m-fault` to print basic info about the fault registers.""" + + SCS = 0xE000E000 SCB = SCS + 0x0D00 CPUID = SCB + 0x000 # (R/ ) CPUID Base Register */ diff --git a/tools/gdb-stack-size.py b/tools/gdb-stack-size.py index 6feabdd38164c..2b3a252b8c01f 100644 --- a/tools/gdb-stack-size.py +++ b/tools/gdb-stack-size.py @@ -2,6 +2,8 @@ `stack-size` to print a backtrace with each frame size next to it.""" + + class StackSize(gdb.Command): def __init__(self): super(StackSize, self).__init__("stack-size", gdb.COMMAND_USER) From 6e5962bee963723a231a906edefff9bf3e09cc71 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:37:33 +0000 Subject: [PATCH 17/30] style: Fix formatting in onewireio/__init__.c Co-Authored-By: bsatrom@blues.com --- shared-bindings/onewireio/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/onewireio/__init__.c b/shared-bindings/onewireio/__init__.c index 095854bda79be..2c61015c6b40a 100644 --- a/shared-bindings/onewireio/__init__.c +++ b/shared-bindings/onewireio/__init__.c @@ -23,7 +23,7 @@ static const mp_rom_map_elem_t onewireio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_onewireio) }, - { MP_ROM_QSTR(MP_QSTR_OneWire), MP_ROM_PTR(&onewireio_onewire_type) }, + { MP_ROM_QSTR(MP_QSTR_OneWire), MP_ROM_PTR(&onewireio_onewire_type) } }; static MP_DEFINE_CONST_DICT(onewireio_module_globals, onewireio_module_globals_table); From ac3a6d522430769936d58e68437872a4e71e6241 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:37:59 +0000 Subject: [PATCH 18/30] style: Fix formatting in epaperdisplay/__init__.c Co-Authored-By: bsatrom@blues.com --- shared-bindings/epaperdisplay/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/epaperdisplay/__init__.c b/shared-bindings/epaperdisplay/__init__.c index 5423fac7b64d4..5e4313d56d566 100644 --- a/shared-bindings/epaperdisplay/__init__.c +++ b/shared-bindings/epaperdisplay/__init__.c @@ -18,7 +18,7 @@ static const mp_rom_map_elem_t epaperdisplay_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_displayio) }, - { MP_ROM_QSTR(MP_QSTR_EPaperDisplay), MP_ROM_PTR(&epaperdisplay_epaperdisplay_type) }, + { MP_ROM_QSTR(MP_QSTR_EPaperDisplay), MP_ROM_PTR(&epaperdisplay_epaperdisplay_type) } }; static MP_DEFINE_CONST_DICT(epaperdisplay_module_globals, epaperdisplay_module_globals_table); From 0f843e87542cd77219abdd3157b308f07f6a3476 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:38:27 +0000 Subject: [PATCH 19/30] style: Fix formatting in fourwire/__init__.c Co-Authored-By: bsatrom@blues.com --- shared-bindings/fourwire/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/fourwire/__init__.c b/shared-bindings/fourwire/__init__.c index 52b527d3a82a4..186df6457a861 100644 --- a/shared-bindings/fourwire/__init__.c +++ b/shared-bindings/fourwire/__init__.c @@ -18,7 +18,7 @@ static const mp_rom_map_elem_t fourwire_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_fourwire) }, - { MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&fourwire_fourwire_type) }, + { MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&fourwire_fourwire_type) } }; static MP_DEFINE_CONST_DICT(fourwire_module_globals, fourwire_module_globals_table); From a8528c8e7a9c769e7b15d4adb9ba81cf141efa92 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:38:52 +0000 Subject: [PATCH 20/30] style: Fix formatting in i2cdisplaybus/__init__.c Co-Authored-By: bsatrom@blues.com --- shared-bindings/i2cdisplaybus/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/i2cdisplaybus/__init__.c b/shared-bindings/i2cdisplaybus/__init__.c index 2702692c598eb..b6ddf8154134c 100644 --- a/shared-bindings/i2cdisplaybus/__init__.c +++ b/shared-bindings/i2cdisplaybus/__init__.c @@ -18,7 +18,7 @@ static const mp_rom_map_elem_t i2cdisplaybus_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_i2cdisplaybus) }, - { MP_ROM_QSTR(MP_QSTR_I2CDisplayBus), MP_ROM_PTR(&i2cdisplaybus_i2cdisplaybus_type) }, + { MP_ROM_QSTR(MP_QSTR_I2CDisplayBus), MP_ROM_PTR(&i2cdisplaybus_i2cdisplaybus_type) } }; static MP_DEFINE_CONST_DICT(i2cdisplaybus_module_globals, i2cdisplaybus_module_globals_table); From 2e720b4d225db821ccad445750cada668e24690b Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:39:18 +0000 Subject: [PATCH 21/30] style: Fix formatting in gifio/__init__.c Co-Authored-By: bsatrom@blues.com --- shared-bindings/gifio/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/gifio/__init__.c b/shared-bindings/gifio/__init__.c index ce6bee2c1d9d7..7c77041309fff 100644 --- a/shared-bindings/gifio/__init__.c +++ b/shared-bindings/gifio/__init__.c @@ -16,7 +16,7 @@ static const mp_rom_map_elem_t gifio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gifio) }, { MP_OBJ_NEW_QSTR(MP_QSTR_GifWriter), MP_ROM_PTR(&gifio_gifwriter_type) }, - { MP_ROM_QSTR(MP_QSTR_OnDiskGif), MP_ROM_PTR(&gifio_ondiskgif_type) }, + { MP_ROM_QSTR(MP_QSTR_OnDiskGif), MP_ROM_PTR(&gifio_ondiskgif_type) } }; static MP_DEFINE_CONST_DICT(gifio_module_globals, gifio_module_globals_table); From 665924de1f8c5550601f6144ce7f5c6084f26ab4 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:39:42 +0000 Subject: [PATCH 22/30] style: Improve formatting in ci_changes_per_commit.py Co-Authored-By: bsatrom@blues.com --- tools/ci_changes_per_commit.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/ci_changes_per_commit.py b/tools/ci_changes_per_commit.py index c17285716b498..902f8d6270db3 100644 --- a/tools/ci_changes_per_commit.py +++ b/tools/ci_changes_per_commit.py @@ -161,11 +161,7 @@ def get_commit_depth_and_check_suite(query_commits): if workflow is not None and workflow.get("name") == "Build CI": return [ {"sha": commit_sha, "depth": commit_depth}, - ( - check_suite["id"] - if check_suite.get("conclusion") != "SUCCESS" - else None - ), + (check_suite["id"] if check_suite.get("conclusion") != "SUCCESS" else None), ] if not query_commits.paginate(commits["pageInfo"], "beforeCommit"): return [None, None] From 84c2fd933283551701452c6ff2647bbcac361d3d Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:41:06 +0000 Subject: [PATCH 23/30] style: Fix formatting in GDB script docstrings Co-Authored-By: bsatrom@blues.com --- tools/cortex-m-fault-gdb.py | 1 - tools/gdb-stack-size.py | 1 - 2 files changed, 2 deletions(-) diff --git a/tools/cortex-m-fault-gdb.py b/tools/cortex-m-fault-gdb.py index 715428ce9076e..30108d37bb4ff 100644 --- a/tools/cortex-m-fault-gdb.py +++ b/tools/cortex-m-fault-gdb.py @@ -2,7 +2,6 @@ `cortex-m-fault` to print basic info about the fault registers.""" - SCS = 0xE000E000 SCB = SCS + 0x0D00 CPUID = SCB + 0x000 # (R/ ) CPUID Base Register */ diff --git a/tools/gdb-stack-size.py b/tools/gdb-stack-size.py index 2b3a252b8c01f..48e1fae687f15 100644 --- a/tools/gdb-stack-size.py +++ b/tools/gdb-stack-size.py @@ -3,7 +3,6 @@ - class StackSize(gdb.Command): def __init__(self): super(StackSize, self).__init__("stack-size", gdb.COMMAND_USER) From 3e44c88d0d987bd091bb8b7dcb12fc628d272b43 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:44:17 +0000 Subject: [PATCH 24/30] ci: Fix indentation in ci_changes_per_commit.py Co-Authored-By: bsatrom@blues.com --- tools/ci_changes_per_commit.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/ci_changes_per_commit.py b/tools/ci_changes_per_commit.py index 902f8d6270db3..e922d8c03336d 100644 --- a/tools/ci_changes_per_commit.py +++ b/tools/ci_changes_per_commit.py @@ -159,10 +159,10 @@ def get_commit_depth_and_check_suite(query_commits): if workflow_run is not None: workflow = workflow_run.get("workflow") if workflow is not None and workflow.get("name") == "Build CI": - return [ - {"sha": commit_sha, "depth": commit_depth}, - (check_suite["id"] if check_suite.get("conclusion") != "SUCCESS" else None), - ] + return [ + {"sha": commit_sha, "depth": commit_depth}, + (check_suite["id"] if check_suite.get("conclusion") != "SUCCESS" else None), + ] if not query_commits.paginate(commits["pageInfo"], "beforeCommit"): return [None, None] From 901ad8498131f13c4ae0f9b817b0873ce07a042f Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:57:58 +0000 Subject: [PATCH 25/30] ci: Trigger CI checks Co-Authored-By: bsatrom@blues.com From 7e65ca441f3a89a2365bf50daeb1c43d9629b8e3 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 00:54:55 +0000 Subject: [PATCH 26/30] style: Convert tabs to spaces in Makefiles Co-Authored-By: bsatrom@blues.com --- Makefile | 128 ++++++++++++++++++++++----------------------- mpy-cross/Makefile | 14 ++--- 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/Makefile b/Makefile index 30966918c3651..14b05033adc67 100644 --- a/Makefile +++ b/Makefile @@ -45,90 +45,90 @@ TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/espress # Each must be preceded by "-path"; if any wildcards, enclose in quotes. # Separate by "-o" (Find's "or" operand) TRANSLATE_SOURCES_EXC = -path "ports/*/build-*" \ - -o -path "ports/*/build" \ - -o -path ports/atmel-samd/asf4 \ - -o -path ports/cxd56/spresense-exported-sdk \ - -o -path ports/espressif/esp-idf \ - -o -path ports/mimxrt10xx/sdk \ - -o -path ports/raspberrypi/sdk \ - -o -path ports/stm/st_driver \ - -o -path lib/tinyusb \ - -o -path lib/lwip \ - -o -path extmod/ulab/circuitpython \ - -o -path extmod/ulab/micropython \ + -o -path "ports/*/build" \ + -o -path ports/atmel-samd/asf4 \ + -o -path ports/cxd56/spresense-exported-sdk \ + -o -path ports/espressif/esp-idf \ + -o -path ports/mimxrt10xx/sdk \ + -o -path ports/raspberrypi/sdk \ + -o -path ports/stm/st_driver \ + -o -path lib/tinyusb \ + -o -path lib/lwip \ + -o -path extmod/ulab/circuitpython \ + -o -path extmod/ulab/micropython \ .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext stubs help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - @echo " fetch-all-submodules to fetch submodules for all ports" - @echo " remove-all-submodules remove all submodules, including files and .git/ data" + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " fetch-all-submodules to fetch submodules for all ports" + @echo " remove-all-submodules remove all submodules, including files and .git/ data" clean: - rm -rf $(BUILDDIR)/* - rm -rf autoapi - rm -rf $(STUBDIR) $(DISTDIR) *.egg-info + rm -rf $(BUILDDIR)/* + rm -rf autoapi + rm -rf $(STUBDIR) $(DISTDIR) *.egg-info html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MicroPython.qhcp" - @echo "To view the help file:" + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MicroPython.qhcp" + @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MicroPython.qhc" devhelp: diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile index 9962e9bcbb246..5963b2cf2de7e 100644 --- a/mpy-cross/Makefile +++ b/mpy-cross/Makefile @@ -50,17 +50,17 @@ LDFLAGS += $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA) # source files # CIRCUITPY-CHANGE: extra files SRC_C = \ - main.c \ - gccollect.c \ - shared/runtime/gchelper_generic.c \ - supervisor/stub/safe_mode.c \ - supervisor/stub/stack.c \ - supervisor/shared/translate/translate.c + main.c \ + gccollect.c \ + shared/runtime/gchelper_generic.c \ + supervisor/stub/safe_mode.c \ + supervisor/stub/stack.c \ + supervisor/shared/translate/translate.c # Add fmode when compiling with mingw gcc COMPILER_TARGET := $(shell $(CC) -dumpmachine) ifneq (,$(findstring mingw,$(COMPILER_TARGET))) - SRC_C += windows-fmode.c + SRC_C += windows-fmode.c endif OBJ = $(PY_CORE_O) From f203a92cd4b23546cc054bec093b98dfdf15bb6e Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 00:57:33 +0000 Subject: [PATCH 27/30] style: Convert tabs to spaces in crypto-algorithms Co-Authored-By: bsatrom@blues.com --- lib/crypto-algorithms/sha256.c | 216 ++++++++++++++++----------------- lib/crypto-algorithms/sha256.h | 8 +- 2 files changed, 112 insertions(+), 112 deletions(-) diff --git a/lib/crypto-algorithms/sha256.c b/lib/crypto-algorithms/sha256.c index 1d9484586b97d..2c2ea4696bb3f 100644 --- a/lib/crypto-algorithms/sha256.c +++ b/lib/crypto-algorithms/sha256.c @@ -32,129 +32,129 @@ /**************************** VARIABLES *****************************/ static const WORD k[64] = { - 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, - 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174, - 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da, - 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967, - 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85, - 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070, - 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3, - 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 + 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, + 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174, + 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da, + 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967, + 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85, + 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070, + 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3, + 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 }; /*********************** FUNCTION DEFINITIONS ***********************/ static void sha256_transform(CRYAL_SHA256_CTX *ctx, const BYTE data[]) { - WORD a, b, c, d, e, f, g, h, i, j, t1, t2, m[64]; - - for (i = 0, j = 0; i < 16; ++i, j += 4) - m[i] = ((uint32_t)data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]); - for ( ; i < 64; ++i) - m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16]; - - a = ctx->state[0]; - b = ctx->state[1]; - c = ctx->state[2]; - d = ctx->state[3]; - e = ctx->state[4]; - f = ctx->state[5]; - g = ctx->state[6]; - h = ctx->state[7]; - - for (i = 0; i < 64; ++i) { - t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i]; - t2 = EP0(a) + MAJ(a,b,c); - h = g; - g = f; - f = e; - e = d + t1; - d = c; - c = b; - b = a; - a = t1 + t2; - } - - ctx->state[0] += a; - ctx->state[1] += b; - ctx->state[2] += c; - ctx->state[3] += d; - ctx->state[4] += e; - ctx->state[5] += f; - ctx->state[6] += g; - ctx->state[7] += h; + WORD a, b, c, d, e, f, g, h, i, j, t1, t2, m[64]; + + for (i = 0, j = 0; i < 16; ++i, j += 4) + m[i] = ((uint32_t)data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]); + for ( ; i < 64; ++i) + m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16]; + + a = ctx->state[0]; + b = ctx->state[1]; + c = ctx->state[2]; + d = ctx->state[3]; + e = ctx->state[4]; + f = ctx->state[5]; + g = ctx->state[6]; + h = ctx->state[7]; + + for (i = 0; i < 64; ++i) { + t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i]; + t2 = EP0(a) + MAJ(a,b,c); + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + } + + ctx->state[0] += a; + ctx->state[1] += b; + ctx->state[2] += c; + ctx->state[3] += d; + ctx->state[4] += e; + ctx->state[5] += f; + ctx->state[6] += g; + ctx->state[7] += h; } void sha256_init(CRYAL_SHA256_CTX *ctx) { - ctx->datalen = 0; - ctx->bitlen = 0; - ctx->state[0] = 0x6a09e667; - ctx->state[1] = 0xbb67ae85; - ctx->state[2] = 0x3c6ef372; - ctx->state[3] = 0xa54ff53a; - ctx->state[4] = 0x510e527f; - ctx->state[5] = 0x9b05688c; - ctx->state[6] = 0x1f83d9ab; - ctx->state[7] = 0x5be0cd19; + ctx->datalen = 0; + ctx->bitlen = 0; + ctx->state[0] = 0x6a09e667; + ctx->state[1] = 0xbb67ae85; + ctx->state[2] = 0x3c6ef372; + ctx->state[3] = 0xa54ff53a; + ctx->state[4] = 0x510e527f; + ctx->state[5] = 0x9b05688c; + ctx->state[6] = 0x1f83d9ab; + ctx->state[7] = 0x5be0cd19; } void sha256_update(CRYAL_SHA256_CTX *ctx, const BYTE data[], size_t len) { - WORD i; - - for (i = 0; i < len; ++i) { - ctx->data[ctx->datalen] = data[i]; - ctx->datalen++; - if (ctx->datalen == 64) { - sha256_transform(ctx, ctx->data); - ctx->bitlen += 512; - ctx->datalen = 0; - } - } + WORD i; + + for (i = 0; i < len; ++i) { + ctx->data[ctx->datalen] = data[i]; + ctx->datalen++; + if (ctx->datalen == 64) { + sha256_transform(ctx, ctx->data); + ctx->bitlen += 512; + ctx->datalen = 0; + } + } } void sha256_final(CRYAL_SHA256_CTX *ctx, BYTE hash[]) { - WORD i; - - i = ctx->datalen; - - // Pad whatever data is left in the buffer. - if (ctx->datalen < 56) { - ctx->data[i++] = 0x80; - while (i < 56) - ctx->data[i++] = 0x00; - } - else { - ctx->data[i++] = 0x80; - while (i < 64) - ctx->data[i++] = 0x00; - sha256_transform(ctx, ctx->data); - memset(ctx->data, 0, 56); - } - - // Append to the padding the total message's length in bits and transform. - ctx->bitlen += ctx->datalen * 8; - ctx->data[63] = ctx->bitlen; - ctx->data[62] = ctx->bitlen >> 8; - ctx->data[61] = ctx->bitlen >> 16; - ctx->data[60] = ctx->bitlen >> 24; - ctx->data[59] = ctx->bitlen >> 32; - ctx->data[58] = ctx->bitlen >> 40; - ctx->data[57] = ctx->bitlen >> 48; - ctx->data[56] = ctx->bitlen >> 56; - sha256_transform(ctx, ctx->data); - - // Since this implementation uses little endian byte ordering and SHA uses big endian, - // reverse all the bytes when copying the final state to the output hash. - for (i = 0; i < 4; ++i) { - hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff; - hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff; - hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff; - hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff; - hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff; - hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff; - hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff; - hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff; - } + WORD i; + + i = ctx->datalen; + + // Pad whatever data is left in the buffer. + if (ctx->datalen < 56) { + ctx->data[i++] = 0x80; + while (i < 56) + ctx->data[i++] = 0x00; + } + else { + ctx->data[i++] = 0x80; + while (i < 64) + ctx->data[i++] = 0x00; + sha256_transform(ctx, ctx->data); + memset(ctx->data, 0, 56); + } + + // Append to the padding the total message's length in bits and transform. + ctx->bitlen += ctx->datalen * 8; + ctx->data[63] = ctx->bitlen; + ctx->data[62] = ctx->bitlen >> 8; + ctx->data[61] = ctx->bitlen >> 16; + ctx->data[60] = ctx->bitlen >> 24; + ctx->data[59] = ctx->bitlen >> 32; + ctx->data[58] = ctx->bitlen >> 40; + ctx->data[57] = ctx->bitlen >> 48; + ctx->data[56] = ctx->bitlen >> 56; + sha256_transform(ctx, ctx->data); + + // Since this implementation uses little endian byte ordering and SHA uses big endian, + // reverse all the bytes when copying the final state to the output hash. + for (i = 0; i < 4; ++i) { + hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff; + hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff; + hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff; + hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff; + hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff; + hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff; + hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff; + hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff; + } } diff --git a/lib/crypto-algorithms/sha256.h b/lib/crypto-algorithms/sha256.h index 9c19472ea292f..366d17e10a044 100644 --- a/lib/crypto-algorithms/sha256.h +++ b/lib/crypto-algorithms/sha256.h @@ -21,10 +21,10 @@ typedef unsigned char BYTE; // 8-bit byte typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines typedef struct { - BYTE data[64]; - WORD datalen; - unsigned long long bitlen; - WORD state[8]; + BYTE data[64]; + WORD datalen; + unsigned long long bitlen; + WORD state[8]; } CRYAL_SHA256_CTX; /*********************** FUNCTION DECLARATIONS **********************/ From 8985c017ac632924cb90c00fa584fb5503c4f9ae Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 01:19:06 +0000 Subject: [PATCH 28/30] style: Fix formatting in various files Co-Authored-By: bsatrom@blues.com --- Makefile | 178 +++++++++++----------- ports/espressif/tools/update_sdkconfig.py | 2 - tools/ci_changes_per_commit.py | 6 +- tools/cortex-m-fault-gdb.py | 1 - tools/gdb-stack-size.py | 1 - 5 files changed, 94 insertions(+), 94 deletions(-) diff --git a/Makefile b/Makefile index 14b05033adc67..f3c7dbf96047c 100644 --- a/Makefile +++ b/Makefile @@ -129,108 +129,108 @@ qthelp: ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MicroPython.qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MicroPython.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MicroPython.qhc" devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/MicroPython" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MicroPython" - @echo "# devhelp" + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/MicroPython" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MicroPython" + @echo "# devhelp" epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." # seems to be malfunctioning latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." # seems to be malfunctioning latexpdfja: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." # seems to be malfunctioning text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." # seems to be malfunctioning man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." info: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." xml: - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." # phony target so we always run .PHONY: all-source all-source: -TRANSLATE_CHECK_SUBMODULES=if ! [ -f extmod/ulab/README.md ]; then python tools/ci_fetch_deps.py translate; fi -TRANSLATE_COMMAND=find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -x locale/synthetic.pot -f- -L C -s --add-location=file --keyword=MP_ERROR_TEXT -o - | sed -e '/"POT-Creation-Date: /d' +TRANSLATE_CHECK_SUBMODULES = if ! [ -f extmod/ulab/README.md ]; then python tools/ci_fetch_deps.py translate; fi +TRANSLATE_COMMAND = find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -x locale/synthetic.pot -f- -L C -s --add-location=file --keyword=MP_ERROR_TEXT -o - | sed -e '/"POT-Creation-Date: /d' locale/circuitpython.pot: all-source - $(TRANSLATE_CHECK_SUBMODULES) - $(TRANSLATE_COMMAND) > $@ + $(TRANSLATE_CHECK_SUBMODULES) + $(TRANSLATE_COMMAND) > $@ # Historically, `make translate` updated the .pot file and ran msgmerge. # However, this was a frequent source of merge conflicts. Weblate can perform @@ -245,47 +245,47 @@ translate: locale/circuitpython.pot # needed we preserve a rule to do it. .PHONY: msgmerge msgmerge: - for po in $(shell ls locale/*.po); do msgmerge -U $$po -s --no-fuzzy-matching --add-location=file locale/circuitpython.pot; done + for po in $(shell ls locale/*.po); do msgmerge -U $$po -s --no-fuzzy-matching --add-location=file locale/circuitpython.pot; done merge-translate: - git merge HEAD 1>&2 2> /dev/null; test $$? -eq 128 - rm locale/*~ || true - git checkout --theirs -- locale/* - make translate + git merge HEAD 1>&2 2> /dev/null; test $$? -eq 128 + rm locale/*~ || true + git checkout --theirs -- locale/* + make translate .PHONY: check-translate check-translate: - $(TRANSLATE_CHECK_SUBMODULES) - $(TRANSLATE_COMMAND) > locale/circuitpython.pot.tmp - $(PYTHON) tools/check_translations.py locale/circuitpython.pot.tmp locale/circuitpython.pot; status=$$?; rm -f locale/circuitpython.pot.tmp; exit $$status + $(TRANSLATE_CHECK_SUBMODULES) + $(TRANSLATE_COMMAND) > locale/circuitpython.pot.tmp + $(PYTHON) tools/check_translations.py locale/circuitpython.pot.tmp locale/circuitpython.pot; status=$$?; rm -f locale/circuitpython.pot.tmp; exit $$status .PHONY: stubs stubs: - @rm -rf circuitpython-stubs - @mkdir circuitpython-stubs - @$(PYTHON) tools/extract_pyi.py shared-bindings/ $(STUBDIR) - @$(PYTHON) tools/extract_pyi.py extmod/ulab/code/ $(STUBDIR)/ulab - @$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR) - @$(PYTHON) tools/extract_pyi.py ports/espressif/bindings $(STUBDIR) - @$(PYTHON) tools/extract_pyi.py ports/raspberrypi/bindings $(STUBDIR) - @cp setup.py-stubs circuitpython-stubs/setup.py - @cp README.rst-stubs circuitpython-stubs/README.rst - @cp MANIFEST.in-stubs circuitpython-stubs/MANIFEST.in - @$(PYTHON) tools/board_stubs/build_board_specific_stubs/board_stub_builder.py - @cp -r tools/board_stubs/circuitpython_setboard circuitpython-stubs/circuitpython_setboard - @$(PYTHON) -m build circuitpython-stubs - @touch circuitpython-stubs/board/__init__.py - @touch circuitpython-stubs/board_definitions/__init__.py + @rm -rf circuitpython-stubs + @mkdir circuitpython-stubs + @$(PYTHON) tools/extract_pyi.py shared-bindings/ $(STUBDIR) + @$(PYTHON) tools/extract_pyi.py extmod/ulab/code/ $(STUBDIR)/ulab + @$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR) + @$(PYTHON) tools/extract_pyi.py ports/espressif/bindings $(STUBDIR) + @$(PYTHON) tools/extract_pyi.py ports/raspberrypi/bindings $(STUBDIR) + @cp setup.py-stubs circuitpython-stubs/setup.py + @cp README.rst-stubs circuitpython-stubs/README.rst + @cp MANIFEST.in-stubs circuitpython-stubs/MANIFEST.in + @$(PYTHON) tools/board_stubs/build_board_specific_stubs/board_stub_builder.py + @cp -r tools/board_stubs/circuitpython_setboard circuitpython-stubs/circuitpython_setboard + @$(PYTHON) -m build circuitpython-stubs + @touch circuitpython-stubs/board/__init__.py + @touch circuitpython-stubs/board_definitions/__init__.py .PHONY: check-stubs check-stubs: stubs - @(cd $(STUBDIR) && set -- */__init__.pyi && mypy "$${@%/*}") - @tools/test-stubs.sh + @(cd $(STUBDIR) && set -- */__init__.pyi && mypy "$${@%/*}") + @tools/test-stubs.sh .PHONY: update-frozen-libraries update-frozen-libraries: - @echo "Updating all frozen libraries to latest tagged version." - cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done + @echo "Updating all frozen libraries to latest tagged version." + cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done one-of-each: samd21 litex mimxrt10xx nordic stm diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index f23785a8d984c..74447de76caec 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -1,8 +1,6 @@ """This script updates the sdkconfigs based on the menuconfig results in a given build.""" - - import pathlib import click import copy diff --git a/tools/ci_changes_per_commit.py b/tools/ci_changes_per_commit.py index e922d8c03336d..53e254832d819 100644 --- a/tools/ci_changes_per_commit.py +++ b/tools/ci_changes_per_commit.py @@ -161,7 +161,11 @@ def get_commit_depth_and_check_suite(query_commits): if workflow is not None and workflow.get("name") == "Build CI": return [ {"sha": commit_sha, "depth": commit_depth}, - (check_suite["id"] if check_suite.get("conclusion") != "SUCCESS" else None), + ( + check_suite["id"] + if check_suite.get("conclusion") != "SUCCESS" + else None + ), ] if not query_commits.paginate(commits["pageInfo"], "beforeCommit"): return [None, None] diff --git a/tools/cortex-m-fault-gdb.py b/tools/cortex-m-fault-gdb.py index 30108d37bb4ff..500ba9c0cb7bb 100644 --- a/tools/cortex-m-fault-gdb.py +++ b/tools/cortex-m-fault-gdb.py @@ -1,7 +1,6 @@ """Source this file into gdb `source ../../tools/cortex-m-fault-gdb.py` then run `cortex-m-fault` to print basic info about the fault registers.""" - SCS = 0xE000E000 SCB = SCS + 0x0D00 CPUID = SCB + 0x000 # (R/ ) CPUID Base Register */ diff --git a/tools/gdb-stack-size.py b/tools/gdb-stack-size.py index 48e1fae687f15..6feabdd38164c 100644 --- a/tools/gdb-stack-size.py +++ b/tools/gdb-stack-size.py @@ -2,7 +2,6 @@ `stack-size` to print a backtrace with each frame size next to it.""" - class StackSize(gdb.Command): def __init__(self): super(StackSize, self).__init__("stack-size", gdb.COMMAND_USER) From da1cb195719a8db6577a5a8d6064527b3c558493 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 02:05:08 +0000 Subject: [PATCH 29/30] style: Fix formatting in Makefile and update translations Co-Authored-By: bsatrom@blues.com --- Makefile | 270 +++++++++++++++++++-------------------- lib/libm/kf_rem_pio2.c | 194 ++++++++++++++-------------- lib/libm/wf_tgamma.c | 50 ++++---- lib/libm_dbl/atan2.c | 22 ++-- lib/libm_dbl/ceil.c | 36 +++--- lib/libm_dbl/sin.c | 30 ++--- lib/tjpgd/src/tjpgd.c | 43 +++---- lib/tjpgd/src/tjpgd.h | 78 +++++------ locale/circuitpython.pot | 9 +- 9 files changed, 367 insertions(+), 365 deletions(-) diff --git a/Makefile b/Makefile index f3c7dbf96047c..cf6bb47fba6a2 100644 --- a/Makefile +++ b/Makefile @@ -55,172 +55,172 @@ TRANSLATE_SOURCES_EXC = -path "ports/*/build-*" \ -o -path lib/tinyusb \ -o -path lib/lwip \ -o -path extmod/ulab/circuitpython \ - -o -path extmod/ulab/micropython \ + -o -path extmod/ulab/micropython .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext stubs help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - @echo " fetch-all-submodules to fetch submodules for all ports" - @echo " remove-all-submodules remove all submodules, including files and .git/ data" + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " fetch-all-submodules to fetch submodules for all ports" + @echo " remove-all-submodules remove all submodules, including files and .git/ data" clean: - rm -rf $(BUILDDIR)/* - rm -rf autoapi - rm -rf $(STUBDIR) $(DISTDIR) *.egg-info + rm -rf $(BUILDDIR)/* + rm -rf autoapi + rm -rf $(STUBDIR) $(DISTDIR) *.egg-info html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MicroPython.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MicroPython.qhc" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MicroPython.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MicroPython.qhc" devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/MicroPython" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MicroPython" - @echo "# devhelp" + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/MicroPython" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MicroPython" + @echo "# devhelp" epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." # seems to be malfunctioning latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." # seems to be malfunctioning latexpdfja: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." # seems to be malfunctioning text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." # seems to be malfunctioning man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." xml: - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." # phony target so we always run .PHONY: all-source @@ -229,8 +229,8 @@ all-source: TRANSLATE_CHECK_SUBMODULES = if ! [ -f extmod/ulab/README.md ]; then python tools/ci_fetch_deps.py translate; fi TRANSLATE_COMMAND = find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -x locale/synthetic.pot -f- -L C -s --add-location=file --keyword=MP_ERROR_TEXT -o - | sed -e '/"POT-Creation-Date: /d' locale/circuitpython.pot: all-source - $(TRANSLATE_CHECK_SUBMODULES) - $(TRANSLATE_COMMAND) > $@ + $(TRANSLATE_CHECK_SUBMODULES) + $(TRANSLATE_COMMAND) > $@ # Historically, `make translate` updated the .pot file and ran msgmerge. # However, this was a frequent source of merge conflicts. Weblate can perform @@ -245,47 +245,47 @@ translate: locale/circuitpython.pot # needed we preserve a rule to do it. .PHONY: msgmerge msgmerge: - for po in $(shell ls locale/*.po); do msgmerge -U $$po -s --no-fuzzy-matching --add-location=file locale/circuitpython.pot; done + for po in $(shell ls locale/*.po); do msgmerge -U $$po -s --no-fuzzy-matching --add-location=file locale/circuitpython.pot; done merge-translate: - git merge HEAD 1>&2 2> /dev/null; test $$? -eq 128 - rm locale/*~ || true - git checkout --theirs -- locale/* - make translate + git merge HEAD 1>&2 2> /dev/null; test $$? -eq 128 + rm locale/*~ || true + git checkout --theirs -- locale/* + make translate .PHONY: check-translate check-translate: - $(TRANSLATE_CHECK_SUBMODULES) - $(TRANSLATE_COMMAND) > locale/circuitpython.pot.tmp - $(PYTHON) tools/check_translations.py locale/circuitpython.pot.tmp locale/circuitpython.pot; status=$$?; rm -f locale/circuitpython.pot.tmp; exit $$status + $(TRANSLATE_CHECK_SUBMODULES) + $(TRANSLATE_COMMAND) > locale/circuitpython.pot.tmp + $(PYTHON) tools/check_translations.py locale/circuitpython.pot.tmp locale/circuitpython.pot; status=$$?; rm -f locale/circuitpython.pot.tmp; exit $$status .PHONY: stubs stubs: - @rm -rf circuitpython-stubs - @mkdir circuitpython-stubs - @$(PYTHON) tools/extract_pyi.py shared-bindings/ $(STUBDIR) - @$(PYTHON) tools/extract_pyi.py extmod/ulab/code/ $(STUBDIR)/ulab - @$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR) - @$(PYTHON) tools/extract_pyi.py ports/espressif/bindings $(STUBDIR) - @$(PYTHON) tools/extract_pyi.py ports/raspberrypi/bindings $(STUBDIR) - @cp setup.py-stubs circuitpython-stubs/setup.py - @cp README.rst-stubs circuitpython-stubs/README.rst - @cp MANIFEST.in-stubs circuitpython-stubs/MANIFEST.in - @$(PYTHON) tools/board_stubs/build_board_specific_stubs/board_stub_builder.py - @cp -r tools/board_stubs/circuitpython_setboard circuitpython-stubs/circuitpython_setboard - @$(PYTHON) -m build circuitpython-stubs - @touch circuitpython-stubs/board/__init__.py - @touch circuitpython-stubs/board_definitions/__init__.py + @rm -rf circuitpython-stubs + @mkdir circuitpython-stubs + @$(PYTHON) tools/extract_pyi.py shared-bindings/ $(STUBDIR) + @$(PYTHON) tools/extract_pyi.py extmod/ulab/code/ $(STUBDIR)/ulab + @$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR) + @$(PYTHON) tools/extract_pyi.py ports/espressif/bindings $(STUBDIR) + @$(PYTHON) tools/extract_pyi.py ports/raspberrypi/bindings $(STUBDIR) + @cp setup.py-stubs circuitpython-stubs/setup.py + @cp README.rst-stubs circuitpython-stubs/README.rst + @cp MANIFEST.in-stubs circuitpython-stubs/MANIFEST.in + @$(PYTHON) tools/board_stubs/build_board_specific_stubs/board_stub_builder.py + @cp -r tools/board_stubs/circuitpython_setboard circuitpython-stubs/circuitpython_setboard + @$(PYTHON) -m build circuitpython-stubs + @touch circuitpython-stubs/board/__init__.py + @touch circuitpython-stubs/board_definitions/__init__.py .PHONY: check-stubs check-stubs: stubs - @(cd $(STUBDIR) && set -- */__init__.pyi && mypy "$${@%/*}") - @tools/test-stubs.sh + @(cd $(STUBDIR) && set -- */__init__.pyi && mypy "$${@%/*}") + @tools/test-stubs.sh .PHONY: update-frozen-libraries update-frozen-libraries: - @echo "Updating all frozen libraries to latest tagged version." - cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done + @echo "Updating all frozen libraries to latest tagged version." + cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done one-of-each: samd21 litex mimxrt10xx nordic stm diff --git a/lib/libm/kf_rem_pio2.c b/lib/libm/kf_rem_pio2.c index cce9eb1ba343d..c31e40242ec86 100644 --- a/lib/libm/kf_rem_pio2.c +++ b/lib/libm/kf_rem_pio2.c @@ -62,80 +62,80 @@ two8 = 2.5600000000e+02f, /* 0x43800000 */ twon8 = 3.9062500000e-03f; /* 0x3b800000 */ #ifdef __STDC__ - int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __uint8_t *ipio2) + int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __uint8_t *ipio2) #else - int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2) - float x[], y[]; int e0,nx,prec; __uint8_t ipio2[]; + int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2) + float x[], y[]; int e0,nx,prec; __uint8_t ipio2[]; #endif { - __int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; - float z,fw,f[20],fq[20],q[20]; + __int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; + float z,fw,f[20],fq[20],q[20]; /* initialize jk*/ - jk = init_jk[prec]; - jp = jk; + jk = init_jk[prec]; + jp = jk; /* determine jx,jv,q0, note that 3>q0 */ - jx = nx-1; - jv = (e0-3)/8; if(jv<0) jv=0; - q0 = e0-8*(jv+1); + jx = nx-1; + jv = (e0-3)/8; if(jv<0) jv=0; + q0 = e0-8*(jv+1); /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ - j = jv-jx; m = jx+jk; - for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (float) ipio2[j]; + j = jv-jx; m = jx+jk; + for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (float) ipio2[j]; /* compute q[0],q[1],...q[jk] */ - for (i=0;i<=jk;i++) { - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; - q[i] = fw; - } + for (i=0;i<=jk;i++) { + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } - jz = jk; + jz = jk; recompute: /* distill q[] into iq[] reversingly */ - for(i=0,j=jz,z=q[jz];j>0;i++,j--) { - fw = (float)((__int32_t)(twon8* z)); - iq[i] = (__int32_t)(z-two8*fw); - z = q[j-1]+fw; - } + for(i=0,j=jz,z=q[jz];j>0;i++,j--) { + fw = (float)((__int32_t)(twon8* z)); + iq[i] = (__int32_t)(z-two8*fw); + z = q[j-1]+fw; + } /* compute n */ - z = scalbnf(z,(int)q0); /* actual value of z */ - z -= (float)8.0*floorf(z*(float)0.125); /* trim off integer >= 8 */ - n = (__int32_t) z; - z -= (float)n; - ih = 0; - if(q0>0) { /* need iq[jz-1] to determine n */ - i = (iq[jz-1]>>(8-q0)); n += i; - iq[jz-1] -= i<<(8-q0); - ih = iq[jz-1]>>(7-q0); - } - else if(q0==0) ih = iq[jz-1]>>8; - else if(z>=(float)0.5) ih=2; - - if(ih>0) { /* q > 0.5 */ - n += 1; carry = 0; - for(i=0;i0) { /* rare case: chance is 1 in 12 */ - switch(q0) { - case 1: - iq[jz-1] &= 0x7f; break; - case 2: - iq[jz-1] &= 0x3f; break; - } - } - if(ih==2) { - z = one - z; - if(carry!=0) z -= scalbnf(one,(int)q0); - } - } + z = scalbnf(z,(int)q0); /* actual value of z */ + z -= (float)8.0*floorf(z*(float)0.125); /* trim off integer >= 8 */ + n = (__int32_t) z; + z -= (float)n; + ih = 0; + if(q0>0) { /* need iq[jz-1] to determine n */ + i = (iq[jz-1]>>(8-q0)); n += i; + iq[jz-1] -= i<<(8-q0); + ih = iq[jz-1]>>(7-q0); + } + else if(q0==0) ih = iq[jz-1]>>8; + else if(z>=(float)0.5) ih=2; + + if(ih>0) { /* q > 0.5 */ + n += 1; carry = 0; + for(i=0;i0) { /* rare case: chance is 1 in 12 */ + switch(q0) { + case 1: + iq[jz-1] &= 0x7f; break; + case 2: + iq[jz-1] &= 0x3f; break; + } + } + if(ih==2) { + z = one - z; + if(carry!=0) z -= scalbnf(one,(int)q0); + } + } /* check if recomputation is needed */ #pragma GCC diagnostic push @@ -176,49 +176,49 @@ twon8 = 3.9062500000e-03f; /* 0x3b800000 */ /* convert integer "bit" chunk to floating-point value */ fw = scalbnf(one,(int)q0); - for(i=jz;i>=0;i--) { - q[i] = fw*(float)iq[i]; fw*=twon8; - } + for(i=jz;i>=0;i--) { + q[i] = fw*(float)iq[i]; fw*=twon8; + } /* compute PIo2[0,...,jp]*q[jz,...,0] */ - for(i=jz;i>=0;i--) { - for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; - fq[jz-i] = fw; - } + for(i=jz;i>=0;i--) { + for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; + fq[jz-i] = fw; + } /* compress fq[] into y[] */ - switch(prec) { - case 0: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - break; - case 1: - case 2: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - fw = fq[0]-fw; - for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; - break; - case 3: /* painful */ - for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; - if(ih==0) { - y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; - } else { - y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; - } + switch(prec) { + case 0: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + break; + case 1: + case 2: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + fw = fq[0]-fw; + for (i=1;i<=jz;i++) fw += fq[i]; + y[1] = (ih==0)? fw: -fw; + break; + case 3: /* painful */ + for (i=jz;i>0;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (i=jz;i>1;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + if(ih==0) { + y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; + } else { + y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; + } } return n&7; } diff --git a/lib/libm/wf_tgamma.c b/lib/libm/wf_tgamma.c index 3ff05f331d099..edf20afd85829 100644 --- a/lib/libm/wf_tgamma.c +++ b/lib/libm/wf_tgamma.c @@ -27,47 +27,47 @@ #define _IEEE_LIBM 1 #ifdef __STDC__ - float tgammaf(float x) + float tgammaf(float x) #else - float tgammaf(x) - float x; + float tgammaf(x) + float x; #endif { float y; - int local_signgam; - if (!isfinite(x)) { - /* special cases: tgammaf(nan)=nan, tgammaf(inf)=inf, tgammaf(-inf)=nan */ - return x + INFINITY; - } - y = expf(__ieee754_lgammaf_r(x,&local_signgam)); - if (local_signgam < 0) y = -y; + int local_signgam; + if (!isfinite(x)) { + /* special cases: tgammaf(nan)=nan, tgammaf(inf)=inf, tgammaf(-inf)=nan */ + return x + INFINITY; + } + y = expf(__ieee754_lgammaf_r(x,&local_signgam)); + if (local_signgam < 0) y = -y; #ifdef _IEEE_LIBM - return y; + return y; #else - if(_LIB_VERSION == _IEEE_) return y; + if(_LIB_VERSION == _IEEE_) return y; - if(!finitef(y)&&finitef(x)) { - if(floorf(x)==x&&x<=(float)0.0) - /* tgammaf pole */ - return (float)__kernel_standard((double)x,(double)x,141); - else - /* tgammaf overflow */ - return (float)__kernel_standard((double)x,(double)x,140); - } - return y; + if(!finitef(y)&&finitef(x)) { + if(floorf(x)==x&&x<=(float)0.0) + /* tgammaf pole */ + return (float)__kernel_standard((double)x,(double)x,141); + else + /* tgammaf overflow */ + return (float)__kernel_standard((double)x,(double)x,140); + } + return y; #endif } #ifdef _DOUBLE_IS_32BITS #ifdef __STDC__ - double tgamma(double x) + double tgamma(double x) #else - double tgamma(x) - double x; + double tgamma(x) + double x; #endif { - return (double) tgammaf((float) x); + return (double) tgammaf((float) x); } #endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/lib/libm_dbl/atan2.c b/lib/libm_dbl/atan2.c index 91378b977a25e..be35e72cbaffd 100644 --- a/lib/libm_dbl/atan2.c +++ b/lib/libm_dbl/atan2.c @@ -45,18 +45,18 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ double atan2(double y, double x) { - double z; - uint32_t m,lx,ly,ix,iy; + double z; + uint32_t m,lx,ly,ix,iy; - if (isnan(x) || isnan(y)) - return x+y; - EXTRACT_WORDS(ix, lx, x); - EXTRACT_WORDS(iy, ly, y); - if (((ix-0x3ff00000) | lx) == 0) /* x = 1.0 */ - return atan(y); - m = ((iy>>31)&1) | ((ix>>30)&2); /* 2*sign(x)+sign(y) */ - ix = ix & 0x7fffffff; - iy = iy & 0x7fffffff; + if (isnan(x) || isnan(y)) + return x+y; + EXTRACT_WORDS(ix, lx, x); + EXTRACT_WORDS(iy, ly, y); + if (((ix-0x3ff00000) | lx) == 0) /* x = 1.0 */ + return atan(y); + m = ((iy>>31)&1) | ((ix>>30)&2); /* 2*sign(x)+sign(y) */ + ix = ix & 0x7fffffff; + iy = iy & 0x7fffffff; /* when y = 0 */ if ((iy|ly) == 0) { diff --git a/lib/libm_dbl/ceil.c b/lib/libm_dbl/ceil.c index b13e6f2d63689..8bd8fa89102d5 100644 --- a/lib/libm_dbl/ceil.c +++ b/lib/libm_dbl/ceil.c @@ -9,23 +9,23 @@ static const double_t toint = 1/EPS; double ceil(double x) { - union {double f; uint64_t i;} u = {x}; - int e = u.i >> 52 & 0x7ff; - double_t y; + union {double f; uint64_t i;} u = {x}; + int e = u.i >> 52 & 0x7ff; + double_t y; - if (e >= 0x3ff+52 || x == 0) - return x; - /* y = int(x) - x, where int(x) is an integer neighbor of x */ - if (u.i >> 63) - y = x - toint + toint - x; - else - y = x + toint - toint - x; - /* special case because of non-nearest rounding modes */ - if (e <= 0x3ff-1) { - FORCE_EVAL(y); - return u.i >> 63 ? -0.0 : 1; - } - if (y < 0) - return x + y + 1; - return x + y; + if (e >= 0x3ff+52 || x == 0) + return x; + /* y = int(x) - x, where int(x) is an integer neighbor of x */ + if (u.i >> 63) + y = x - toint + toint - x; + else + y = x + toint - toint - x; + /* special case because of non-nearest rounding modes */ + if (e <= 0x3ff-1) { + FORCE_EVAL(y); + return u.i >> 63 ? -0.0 : 1; + } + if (y < 0) + return x + y + 1; + return x + y; } diff --git a/lib/libm_dbl/sin.c b/lib/libm_dbl/sin.c index 055e215bc866d..8991645d4e63f 100644 --- a/lib/libm_dbl/sin.c +++ b/lib/libm_dbl/sin.c @@ -44,23 +44,23 @@ double sin(double x) { - double y[2]; - uint32_t ix; - unsigned n; + double y[2]; + uint32_t ix; + unsigned n; - /* High word of x. */ - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; + /* High word of x. */ + GET_HIGH_WORD(ix, x); + ix &= 0x7fffffff; - /* |x| ~< pi/4 */ - if (ix <= 0x3fe921fb) { - if (ix < 0x3e500000) { /* |x| < 2**-26 */ - /* raise inexact if x != 0 and underflow if subnormal*/ - FORCE_EVAL(ix < 0x00100000 ? x/0x1p120f : x+0x1p120f); - return x; - } - return __sin(x, 0.0, 0); - } + /* |x| ~< pi/4 */ + if (ix <= 0x3fe921fb) { + if (ix < 0x3e500000) { /* |x| < 2**-26 */ + /* raise inexact if x != 0 and underflow if subnormal*/ + FORCE_EVAL(ix < 0x00100000 ? x/0x1p120f : x+0x1p120f); + return x; + } + return __sin(x, 0.0, 0); + } /* sin(Inf or NaN) is NaN */ if (ix >= 0x7ff00000) diff --git a/lib/tjpgd/src/tjpgd.c b/lib/tjpgd/src/tjpgd.c index 968a6e23d9101..32927e4a8fa33 100644 --- a/lib/tjpgd/src/tjpgd.c +++ b/lib/tjpgd/src/tjpgd.c @@ -116,9 +116,9 @@ static const uint8_t Clip8[1024] = { static uint8_t BYTECLIP (int val) { - if (val < 0) return 0; - if (val > 255) return 255; - return (uint8_t)val; + if (val < 0) return 0; + if (val > 255) return 255; + return (uint8_t)val; } #endif @@ -129,23 +129,22 @@ static uint8_t BYTECLIP (int val) /* Allocate a memory block from memory pool */ /*-----------------------------------------------------------------------*/ -static void* alloc_pool ( /* Pointer to allocated memory block (NULL:no memory available) */ - JDEC* jd, /* Pointer to the decompressor object */ - size_t ndata /* Number of bytes to allocate */ +static void* alloc_pool ( /* Pointer to allocated memory block (NULL:no memory available) */ + JDEC* jd, /* Pointer to the decompressor object */ + size_t ndata /* Number of bytes to allocate */ ) { - char *rp = 0; + char *rp = 0; + ndata = (ndata + 3) & ~3; /* Align block size to the word boundary */ - ndata = (ndata + 3) & ~3; /* Align block size to the word boundary */ + if (jd->sz_pool >= ndata) { + jd->sz_pool -= ndata; + rp = (char*)jd->pool; /* Get start of available memory pool */ + jd->pool = (void*)(rp + ndata); /* Allocate requierd bytes */ + } - if (jd->sz_pool >= ndata) { - jd->sz_pool -= ndata; - rp = (char*)jd->pool; /* Get start of available memory pool */ - jd->pool = (void*)(rp + ndata); /* Allocate requierd bytes */ - } - - return (void*)rp; /* Return allocated memory block (NULL:no memory to allocate) */ + return (void*)rp; /* Return allocated memory block (NULL:no memory to allocate) */ } @@ -155,15 +154,15 @@ static void* alloc_pool ( /* Pointer to allocated memory block (NULL:no memory a /* Create de-quantization and prescaling tables with a DQT segment */ /*-----------------------------------------------------------------------*/ -static JRESULT create_qt_tbl ( /* 0:OK, !0:Failed */ - JDEC* jd, /* Pointer to the decompressor object */ - const uint8_t* data, /* Pointer to the quantizer tables */ - size_t ndata /* Size of input data */ +static JRESULT create_qt_tbl ( /* 0:OK, !0:Failed */ + JDEC* jd, /* Pointer to the decompressor object */ + const uint8_t* data, /* Pointer to the quantizer tables */ + size_t ndata /* Size of input data */ ) { - unsigned int i, zi; - uint8_t d; - int32_t *pb; + unsigned int i, zi; + uint8_t d; + int32_t *pb; while (ndata) { /* Process all tables in the segment */ diff --git a/lib/tjpgd/src/tjpgd.h b/lib/tjpgd/src/tjpgd.h index 4983ac7271a8e..a1cd2fb23c787 100644 --- a/lib/tjpgd/src/tjpgd.h +++ b/lib/tjpgd/src/tjpgd.h @@ -30,25 +30,25 @@ typedef uint8_t jd_yuv_t; /* Error code */ typedef enum { - JDR_OK = 0, /* 0: Succeeded */ - JDR_INTR, /* 1: Interrupted by output function */ - JDR_INP, /* 2: Device error or wrong termination of input stream */ - JDR_MEM1, /* 3: Insufficient memory pool for the image */ - JDR_MEM2, /* 4: Insufficient stream input buffer */ - JDR_PAR, /* 5: Parameter error */ - JDR_FMT1, /* 6: Data format error (may be broken data) */ - JDR_FMT2, /* 7: Right format but not supported */ - JDR_FMT3 /* 8: Not supported JPEG standard */ + JDR_OK = 0, /* 0: Succeeded */ + JDR_INTR, /* 1: Interrupted by output function */ + JDR_INP, /* 2: Device error or wrong termination of input stream */ + JDR_MEM1, /* 3: Insufficient memory pool for the image */ + JDR_MEM2, /* 4: Insufficient stream input buffer */ + JDR_PAR, /* 5: Parameter error */ + JDR_FMT1, /* 6: Data format error (may be broken data) */ + JDR_FMT2, /* 7: Right format but not supported */ + JDR_FMT3 /* 8: Not supported JPEG standard */ } JRESULT; /* Rectangular region in the output image */ typedef struct { - uint16_t left; /* Left end */ - uint16_t right; /* Right end */ - uint16_t top; /* Top end */ - uint16_t bottom; /* Bottom end */ + uint16_t left; /* Left end */ + uint16_t right; /* Right end */ + uint16_t top; /* Top end */ + uint16_t bottom; /* Bottom end */ } JRECT; @@ -56,36 +56,36 @@ typedef struct { /* Decompressor object structure */ typedef struct JDEC JDEC; struct JDEC { - size_t dctr; /* Number of bytes available in the input buffer */ - uint8_t* dptr; /* Current data read ptr */ - uint8_t* inbuf; /* Bit stream input buffer */ - uint8_t dbit; /* Number of bits availavble in wreg or reading bit mask */ - uint8_t scale; /* Output scaling ratio */ - uint8_t msx, msy; /* MCU size in unit of block (width, height) */ - uint8_t qtid[3]; /* Quantization table ID of each component, Y, Cb, Cr */ - uint8_t ncomp; /* Number of color components 1:grayscale, 3:color */ - int16_t dcv[3]; /* Previous DC element of each component */ - uint16_t nrst; /* Restart inverval */ - uint16_t width, height; /* Size of the input image (pixel) */ - uint8_t* huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */ - uint16_t* huffcode[2][2]; /* Huffman code word tables [id][dcac] */ - uint8_t* huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */ - int32_t* qttbl[4]; /* Dequantizer tables [id] */ + size_t dctr; /* Number of bytes available in the input buffer */ + uint8_t* dptr; /* Current data read ptr */ + uint8_t* inbuf; /* Bit stream input buffer */ + uint8_t dbit; /* Number of bits availavble in wreg or reading bit mask */ + uint8_t scale; /* Output scaling ratio */ + uint8_t msx, msy; /* MCU size in unit of block (width, height) */ + uint8_t qtid[3]; /* Quantization table ID of each component, Y, Cb, Cr */ + uint8_t ncomp; /* Number of color components 1:grayscale, 3:color */ + int16_t dcv[3]; /* Previous DC element of each component */ + uint16_t nrst; /* Restart inverval */ + uint16_t width, height; /* Size of the input image (pixel) */ + uint8_t* huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */ + uint16_t* huffcode[2][2]; /* Huffman code word tables [id][dcac] */ + uint8_t* huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */ + int32_t* qttbl[4]; /* Dequantizer tables [id] */ #if JD_FASTDECODE >= 1 - uint32_t wreg; /* Working shift register */ - uint8_t marker; /* Detected marker (0:None) */ + uint32_t wreg; /* Working shift register */ + uint8_t marker; /* Detected marker (0:None) */ #if JD_FASTDECODE == 2 - uint8_t longofs[2][2]; /* Table offset of long code [id][dcac] */ - uint16_t* hufflut_ac[2]; /* Fast huffman decode tables for AC short code [id] */ - uint8_t* hufflut_dc[2]; /* Fast huffman decode tables for DC short code [id] */ + uint8_t longofs[2][2]; /* Table offset of long code [id][dcac] */ + uint16_t* hufflut_ac[2]; /* Fast huffman decode tables for AC short code [id] */ + uint8_t* hufflut_dc[2]; /* Fast huffman decode tables for DC short code [id] */ #endif #endif - void* workbuf; /* Working buffer for IDCT and RGB output */ - jd_yuv_t* mcubuf; /* Working buffer for the MCU */ - void* pool; /* Pointer to available memory pool */ - size_t sz_pool; /* Size of momory pool (bytes available) */ - size_t (*infunc)(JDEC*, uint8_t*, size_t); /* Pointer to jpeg stream input function */ - void* device; /* Pointer to I/O device identifiler for the session */ + void* workbuf; /* Working buffer for IDCT and RGB output */ + jd_yuv_t* mcubuf; /* Working buffer for the MCU */ + void* pool; /* Pointer to available memory pool */ + size_t sz_pool; /* Size of momory pool (bytes available) */ + size_t (*infunc)(JDEC*, uint8_t*, size_t); /* Pointer to jpeg stream input function */ + void* device; /* Pointer to I/O device identifiler for the session */ }; diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index a6acb8a644fb3..d878812ec928f 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1274,6 +1274,7 @@ msgid "Invalid socket for TLS" msgstr "" #: ports/espressif/common-hal/espidf/__init__.c +#: ports/nordic/common-hal/_bleio/__init__.c msgid "Invalid state" msgstr "" @@ -1970,7 +1971,8 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: shared-module/audiodelays/Echo.c shared-module/audiomixer/MixerVoice.c +#: shared-module/audiodelays/Echo.c shared-module/audiofilters/Filter.c +#: shared-module/audiomixer/MixerVoice.c msgid "The sample's %q does not match" msgstr "" @@ -2504,7 +2506,8 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/audiodelays/Echo.c shared-bindings/audiomixer/Mixer.c +#: shared-bindings/audiodelays/Echo.c shared-bindings/audiofilters/Filter.c +#: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "" @@ -2585,7 +2588,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" From 5e55d8616c40ec0bb6b7a179f788a975b0176b08 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 05:40:38 +0000 Subject: [PATCH 30/30] ci: Trigger CI checks Co-Authored-By: bsatrom@blues.com