ronantakizawa/codereview-bench huggingface dataset:
Repository: raspberrypi/pico-sdk
File: src/boards/include/boards/datanoisetv_rp2350_dsp.h (C/C++)

Code before:

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif

// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (16 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif

#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif

// --- I2S ---
#ifndef PICO_AUDIO_I2S_DATA_PIN
#define PICO_AUDIO_I2S_DATA_PIN 16
#endif
#ifndef PICO_AUDIO_I2S_CLOCK_PIN_BASE
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE 17
#endif

#include "boards/pico.h"

#endif


Review comment (suggestion):
a) I suspect this should be "boards/pico2.h"
b) what does this `#include` actually gain you that you haven't already defined? (just asking out of curiosity)

Code after:
 /*
 * Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
//
//------------------------------------------------------------------------------------------
// Board definition for the DatanoiseTV RP2350 DSP Board
//
// This header may be included by other board headers as "boards/datanoisetv_rp2350_dsp.h"

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_DATANOISETV_RP2350_DSP_H
#define _BOARDS_DATANOISETV_RP2350_DSP_H

// For board detection
#define DATANOISETV_RP2350_DSP

// --- RP2350 VARIANT ---
#define PICO_RP2350A 1

// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C       0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN   24 
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN   25
#endif

// -- FLASH --
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif

// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif

#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif

// --- I2S ---
#ifndef PICO_AUDIO_I2S_DATA_PIN
#define PICO_AUDIO_I2S_DATA_PIN 16
#endif
#ifndef PICO_AUDIO_I2S_CLOCK_PIN_BASE
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE 17
#endif

#endif
Repository: raspberrypi/pico-sdk
File: src/rp2_common/pico_cyw43_driver/cyw43_firmware.py (Python)

Code before:
#!/usr/bin/env python3
#
# Copyright (c) 2024 Raspberry Pi (Trading) Ltd.
#
# SPDX-License-Identifier: BSD-3-Clause

import sys

with open(sys.argv[1], "r") as f:
    data = f.read()
    lines = data.split(";")
    for line in lines[1].split("\n"):
        if "#define CYW43_WIFI_FW_LEN" in line:
            cyw43_wifi_fw_len = int(line.split(")")[0].split("(")[-1])
        if "#define CYW43_CLM_LEN" in line:
            cyw43_clm_len = int(line.split(")")[0].split("(")[-1])
    data = lines[0]
    bits = data.split(",")
    bits[0] = bits[0].split("{")[-1]
    bits[-1] = bits[-1].split("}")[0]
    for i in range(len(bits)):
        bits[i] = bits[i].strip()
        bits[i] = bits[i].strip(',')
        bits[i] = int(bits[i], base=0)
    print(f"Start {bits[4]}, end {bits[-1]}, num {len(bits)}")
    print(bits[:10])

print(f"Wifi {cyw43_wifi_fw_len}, clm {cyw43_clm_len}")

data = (
    cyw43_wifi_fw_len.to_bytes(4, 'little', signed=True) +
    cyw43_clm_len.to_bytes(4, 'little', signed=True) +
    bytearray(bits)
)

with open(sys.argv[2], "w") as f:

Review comment (suggestion):
As you'e splitting by `;` rather than `\n`, I guess this is actually `statements` rather than `lines`? :wink: 

Code after:
#!/usr/bin/env python3
#
# Copyright (c) 2024 Raspberry Pi (Trading) Ltd.
#
# SPDX-License-Identifier: BSD-3-Clause

import sys
import re

assert len(sys.argv) == 3

cyw43_wifi_fw_len = -1
cyw43_clm_len = -1

with open(sys.argv[1], "r") as f:
    data = f.read()
    statements = data.split(";")
    for line in statements[1].split("\n"):
        if "#define CYW43_WIFI_FW_LEN" in line:
            matches = re.search(r"#define\s+\S+\s+\((\S+)\)", line)
            cyw43_wifi_fw_len = int(matches[1])
        elif "#define CYW43_CLM_LEN" in line:
            matches = re.search(r"#define\s+\S+\s+\((\S+)\)", line)
            cyw43_clm_len = int(matches[1])
        if cyw43_wifi_fw_len > 0 and cyw43_clm_len > 0:
            break
    data = statements[0]
    bits = data.split(",")
    bits[0] = bits[0].split("{")[-1]
    bits[-1] = bits[-1].split("}")[0]
    for i in range(len(bits)):
        bits[i] = bits[i].strip()
        bits[i] = bits[i].strip(',')
        bits[i] = int(bits[i], base=0)

data = (
Repository: raspberrypi/pico-sdk
File: test/pico_time_test/pico_time_test.c (C)

Code before:
    struct tm tm = { 0 };
    struct tm tm_check = { 0 };

    tm.tm_sec = 55;
    tm.tm_min = 36;
    tm.tm_hour = 20;
    tm.tm_mday = 21;
    tm.tm_mon = 10;
    tm.tm_year = 124;
    tm.tm_wday = 4;
    tm.tm_yday = 325;
    tm.tm_isdst = 0;
    hard_assert(aon_timer_start_calendar(&tm));
    hard_assert(aon_timer_get_time_calendar(&tm_check));

    PICOTEST_CHECK(tm.tm_sec == tm_check.tm_sec || tm.tm_sec == tm_check.tm_sec - 1, "failed to get seconds");
    PICOTEST_CHECK(tm.tm_min == tm_check.tm_min, "failed to get minutes");
    PICOTEST_CHECK(tm.tm_hour == tm_check.tm_hour, "failed to get hour");
    PICOTEST_CHECK(tm.tm_mday == tm_check.tm_mday, "failed to get day");
    PICOTEST_CHECK(tm.tm_mon == tm_check.tm_mon, "failed to get month");
    PICOTEST_CHECK(tm.tm_year == tm_check.tm_year, "failed to get year");

    aon_timer_stop();
    PICOTEST_END_SECTION();
#endif
}


Review comment (suggestion):
I know that this test will probably take _much_ less than 5 seconds to run, but given that the checking-code below is checking for `tm_sec` rollover but **isn't** checking for `tm_min` rollover, perhaps it makes sense to set the `tm_sec` to something like `15` rather than `55` ? :wink: 

Code after:
    hard_assert(timer_hw->armed == 0); // check destroying the pool unarms its timer
    set_sys_clock_hz(SYS_CLK_HZ, true);
    setup_default_uart();
#endif

    PICOTEST_END_SECTION();
    return 0;
}

static int issue_2186_test(void) {
    PICOTEST_START_SECTION("Issue #2186 defect - ta_wakes_up_on_or_before");

    hard_assert(best_effort_wfe_or_timeout(get_absolute_time() - 1));
    hard_assert(best_effort_wfe_or_timeout(get_absolute_time() - 1)); // this will lockup without the fix - wfe which never happens

    PICOTEST_END_SECTION();
    return 0;
}

static int issue_2148_test(void) {
#if HAS_RP2040_RTC
    PICOTEST_START_SECTION("Issue #2148 defect - get time after rtc start");
    struct tm tm = { 0 };
    struct tm tm_check = { 0 };

    tm.tm_sec = 55;
    tm.tm_min = 36;
    tm.tm_hour = 20;
    tm.tm_mday = 21;
    tm.tm_mon = 10;
    tm.tm_year = 124;
    tm.tm_wday = 4;
    tm.tm_yday = 325;
    tm.tm_isdst = 0;
    hard_assert(aon_timer_start_calendar(&tm));
    hard_assert(aon_timer_get_time_calendar(&tm_check));

    PICOTEST_CHECK(tm.tm_sec == tm_check.tm_sec || tm.tm_sec == tm_check.tm_sec - 1, "failed to get seconds");
    PICOTEST_CHECK(tm.tm_min == tm_check.tm_min, "failed to get minutes");
    PICOTEST_CHECK(tm.tm_hour == tm_check.tm_hour, "failed to get hour");
    PICOTEST_CHECK(tm.tm_mday == tm_check.tm_mday, "failed to get day");
    PICOTEST_CHECK(tm.tm_mon == tm_check.tm_mon, "failed to get month");
    PICOTEST_CHECK(tm.tm_year == tm_check.tm_year, "failed to get year");

    aon_timer_stop();
    PICOTEST_END_SECTION();
#endif
    return 0;
}
Repository: raspberrypi/pico-sdk
File: src/boards/include/boards/sparkfun_iotredboard_rp2350.h (C/C++)

Code before:
/*
 * Copyright (c) 2024 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// Board definition for the SparkFun RP2350 Thing Plus
//
// This header may be included by other board headers as "boards/sparkfun_thingplus_rp2350.h"

// pico_cmake_set PICO_PLATFORM=rp2350
// pico_cmake_set PICO_CYW43_SUPPORTED = 1

#ifndef _BOARDS_SPARKFUN_IOTREDBOARD_RP2350_H
#define _BOARDS_SPARKFUN_IOTREDBOARD_RP2350_H

// For board detection
#define SPARKFUN_IOTREDBOARD_RP2350

// --- RP2350 VARIANT ---
#define PICO_RP2350B 1
#define PICO_RP2350A 0

// --- BOARD SPECIFIC ---
#define SPARKFUN_IOTREDBOARD_RP2350_USER_SW_PIN 39
#define SPARKFUN_IOTREDBOARD_RP2350_PSRAM_CS_PIN 47


// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif

// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 25
#endif

#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN 3

Review comment (suggestion):
No need for `#define PICO_RP2350B 1` - that's already implied by `#define PICO_RP2350A 0`. See #2290 

Code after:
/*
 * Copyright (c) 2024 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// Board definition for the SparkFun IoT RedBoard - RP2350
//
// This header may be included by other board headers as "boards/sparkfun_iotredboard_rp2350.h"

// pico_cmake_set PICO_PLATFORM=rp2350
// pico_cmake_set PICO_CYW43_SUPPORTED = 1

#ifndef _BOARDS_SPARKFUN_IOTREDBOARD_RP2350_H
#define _BOARDS_SPARKFUN_IOTREDBOARD_RP2350_H

// For board detection
#define SPARKFUN_IOTREDBOARD_RP2350

// --- RP2350 VARIANT ---
#define PICO_RP2350A 0 // 1 for RP2350A, 0 for RP2350B

// --- BOARD SPECIFIC ---
#define SPARKFUN_IOTREDBOARD_RP2350_USER_SW_PIN 39
#define SPARKFUN_IOTREDBOARD_RP2350_PSRAM_CS_PIN 47


// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif

// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 25
#endif

#ifndef PICO_DEFAULT_WS2812_PIN
#define PICO_DEFAULT_WS2812_PIN 3
#endif
Repository: raspberrypi/pico-sdk
File: src/boards/include/boards/adafruit_fruit_jam.h (C/C++)

Code before:
#define PICO_SD_CLK_PIN ADAFRUIT_FRUIT_JAM_SDIO_CLOCK_PIN
#endif

#ifndef PICO_SD_CMD_PIN
#define PICO_SD_CMD_PIN ADAFRUIT_FRUIT_JAM_SDIO_COMMAND_PIN
#endif

#ifndef PICO_SD_DAT0_PIN
#define PICO_SD_DAT0_PIN ADAFRUIT_FRUIT_JAM_SDIO_DATA0_PIN
#endif

#ifndef PICO_SD_DAT_PIN_INCREMENT
#define PICO_SD_DAT_PIN_INCREMENT 1
#endif

#ifndef PICO_SD_DAT_PIN_COUNT
#define PICO_SD_DAT_PIN_COUNT 4
#endif

// --- I2S AUDIO (for pico-extras/src/rp2_common/pico_audio_i2s/)

#ifndef PICO_AUDIO_I2S_DATA_PIN
#define PICO_AUDIO_I2S_DATA_PIN
#endif
#ifndef PICO_AUDIO_I2S_CLOCK_PIN_BASE
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE VGABOARD_I2S_BCK_PIN
#endif

#ifndef PICO_AUDIO_PWM_L_PIN
#define PICO_AUDIO_PWM_L_PIN VGABOARD_PWM_L_PIN
#endif

#ifndef PICO_AUDIO_PWM_R_PIN
#define PICO_AUDIO_PWM_R_PIN VGABOARD_PWM_R_PIN
#endif

// --- PIO USB ---
#define PICO_DEFAULT_PIO_USB_DP_PIN ADAFRUIT_FRUIT_JAM_USB_HOST_DATA_PLUS_PIN

// --- FLASH ---
// Winbond W25Q128 (16MB) flash
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif

pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (16 * 1024 * 1024))
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif

Review comment (suggestion):
I'm not sure why you're referring to `VGABOARD_` here, I was expecting you to use some of your `ADAFRUIT_FRUIT_JAM_I2S_` defines? :confused:  (but perhaps I've misunderstood the capabilities of your board?)

Code after:
#define PICO_SD_CLK_PIN ADAFRUIT_FRUIT_JAM_SDIO_CLOCK_PIN
#endif

#ifndef PICO_SD_CMD_PIN
#define PICO_SD_CMD_PIN ADAFRUIT_FRUIT_JAM_SDIO_COMMAND_PIN
#endif

#ifndef PICO_SD_DAT0_PIN
#define PICO_SD_DAT0_PIN ADAFRUIT_FRUIT_JAM_SDIO_DATA0_PIN
#endif

#ifndef PICO_SD_DAT_PIN_INCREMENT
#define PICO_SD_DAT_PIN_INCREMENT 1
#endif

#ifndef PICO_SD_DAT_PIN_COUNT
#define PICO_SD_DAT_PIN_COUNT 4
#endif

// --- I2S AUDIO (for pico-extras/src/rp2_common/pico_audio_i2s/)

#ifndef PICO_AUDIO_I2S_DATA_PIN
#define PICO_AUDIO_I2S_DATA_PIN ADAFRUIT_FRUIT_JAM_I2S_DIN_PIN
#endif

#ifndef PICO_AUDIO_I2S_CLOCK_PIN_BASE
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE ADAFRUIT_FRUIT_JAM_I2S_BCLK_PIN
#endif

// --- PIO USB ---
#define PICO_DEFAULT_PIO_USB_DP_PIN ADAFRUIT_FRUIT_JAM_USB_HOST_DATA_PLUS_PIN

// --- FLASH ---
// Winbond W25Q128 (16MB) flash
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif

pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (16 * 1024 * 1024))
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif

pico_board_cmake_set_default(PICO_RP2350_A2_SUPPORTED, 1)
#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif

#endif
Repository: raspberrypi/pico-sdk
File: src/boards/include/boards/waveshare_rp2350_usb_a.h (C/C++)

Code before:
#define PICO_DEFAULT_I2C_SDA_PIN 6
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 7
#endif

// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 2
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 3
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 4
#endif
#ifndef PICO_DEFAULT_SPI_CSN_PIN
#define PICO_DEFAULT_SPI_CSN_PIN 5
#endif

// --- PIO USB ---
#ifndef PICO_DEFAULT_PIO_USB_DP_PIN
#define PICO_DEFAULT_PIO_USB_DP_PIN 12
#endif

// --- FLASH ---
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 3
#endif

pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (2 * 1024 * 1024))
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
#endif

// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads)
#define PICO_SMPS_MODE_PIN 23

pico_board_cmake_set_default(PICO_RP2350_A2_SUPPORTED, 1)
#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif

#endif


Review comment (suggestion):
There's no SDK support for this, so IMHO prefixing it with `PICO_DEFAULT_` is a bit misleading. Perhaps `WAVESHARE_RP2350_USB_A_USB_DP_PIN` would be better?
Also, if you're defining the `USB_DP_PIN`, would it make sense to also define the `USB_DM_PIN` ??

EDIT: I also just removed the `PIO` from my suggested define-name,  because the `PIO` part is a software-detail, and IMHO the board-headers in the SDK should just describe the raw hardware.

Code after:
#define PICO_DEFAULT_I2C_SDA_PIN 6
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 7
#endif

// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 2
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 3
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 4
#endif
#ifndef PICO_DEFAULT_SPI_CSN_PIN
#define PICO_DEFAULT_SPI_CSN_PIN 5
#endif

// --- PIO USB ---
#ifndef WAVESHARE_RP2350_USB_A_USB_DP_PIN
#define WAVESHARE_RP2350_USB_A_USB_DP_PIN 12
#endif
#ifndef WAVESHARE_RP2350_USB_A_USB_DM_PIN
#define WAVESHARE_RP2350_USB_A_USB_DM_PIN 13
#endif
#define PICO_DEFAULT_PIO_USB_DP_PIN WAVESHARE_RP2350_USB_A_USB_DP_PIN

// --- FLASH ---
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 3
#endif

pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (2 * 1024 * 1024))
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
#endif

// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads)
#define PICO_SMPS_MODE_PIN 23

pico_board_cmake_set_default(PICO_RP2350_A2_SUPPORTED, 1)
#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif
Repository: raspberrypi/pico-sdk
File: src/rp2_common/pico_crt0/crt0.S (Assembly)

Code before:
/*
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "pico.h"
#include "pico/asm_helper.S"

#include "pico/platform/cpu_regs.h"

#include "hardware/regs/addressmap.h"
#include "hardware/regs/sio.h"
#include "pico/binary_info/defs.h"
#include "boot/picobin.h"
#include "pico/bootrom.h"

// PICO_CONFIG: PICO_CRT0_NEAR_CALLS, Whether calls from crt0 into the binary are near (<16M away) - ignored for PICO_COPY_TO_RAM, default=9, type=bool, group=pico_crt0
#ifndef PICO_CRT0_NEAR_CALLS
#define PICO_CRT0_NEAR_CALLS 0
#endif

#ifdef NDEBUG
#ifndef COLLAPSE_IRQS
#define COLLAPSE_IRQS
#endif
#endif

pico_default_asm_setup

#ifdef PICO_NO_STORED_VECTOR_TABLE
#warning PICO_NO_STORED_VECTOR_TABLE is no longer used. PICO_MINIMAL_STORED_VECTOR_TABLE is not identical but usually serves the same purpose
#endif

.section .vectors, "ax"
.align 2

.global __vectors, __VECTOR_TABLE, __vectors_end
__VECTOR_TABLE:
__vectors:
.word __StackTop
.word _reset_handler


Review comment (suggestion):
```suggestion
// PICO_CONFIG: PICO_CRT0_NEAR_CALLS, Whether calls from crt0 into the binary are near (<16M away) - ignored for PICO_COPY_TO_RAM, default=0, type=bool, group=pico_crt0
```

Code after:
/*
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "pico.h"
#include "pico/asm_helper.S"

#include "pico/platform/cpu_regs.h"

#include "hardware/regs/addressmap.h"
#include "hardware/regs/sio.h"
#include "pico/binary_info/defs.h"
#include "boot/picobin.h"
#include "pico/bootrom.h"

// PICO_CONFIG: PICO_CRT0_NEAR_CALLS, Whether calls from crt0 into the binary are near (<16M away) - ignored for PICO_COPY_TO_RAM, default=0, type=bool, group=pico_crt0
#ifndef PICO_CRT0_NEAR_CALLS
#define PICO_CRT0_NEAR_CALLS 0
#endif

#ifdef NDEBUG
#ifndef COLLAPSE_IRQS
#define COLLAPSE_IRQS
#endif
#endif

pico_default_asm_setup

#ifdef PICO_NO_STORED_VECTOR_TABLE
#warning PICO_NO_STORED_VECTOR_TABLE is no longer used. PICO_MINIMAL_STORED_VECTOR_TABLE is not identical but usually serves the same purpose
#endif

.section .vectors, "ax"
.align 2

.global __vectors, __VECTOR_TABLE, __vectors_end
__VECTOR_TABLE:
__vectors:
.word __StackTop
.word _reset_handler
Repository: raspberrypi/pico-sdk
File: src/boards/include/boards/wiznet_w5100s_evb_pico2.h (C/C++)

Code before:
/*
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_WIZNET_W5100S_EVB_PICO2_H
#define _BOARDS_WIZNET_W5100S_EVB_PICO2_H

// For board detection
#define WIZNET_W5100S_EVB_PICO2

// --- BOARD SPECIFIC ---
#ifndef W5100S_EVB_PICO2_INTN_PIN
#define W5100S_EVB_PICO2_INTN_PIN 21
#endif

#ifndef W5100S_EVB_PICO2_RSTN_PIN
#define W5100S_EVB_PICO2_RSTN_PIN 20
#endif

#ifndef W5100S_EVB_PICO2_A0_PIN
#define W5100S_EVB_PICO2_A0_PIN 26
#endif
#ifndef W5100S_EVB_PICO2_A1_PIN
#define W5100S_EVB_PICO2_A1_PIN 27
#endif
#ifndef W5100S_EVB_PICO2_A2_PIN
#define W5100S_EVB_PICO2_A2_PIN 28
#endif

Review comment (suggestion):
The syntax of these cmake-specific lines have changed - see https://github.com/raspberrypi/pico-sdk/pull/2397 and https://github.com/raspberrypi/pico-sdk/blob/develop/src/boards/include/boards/wiznet_w5100s_evb_pico.h

Code after:
/*
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

#ifndef _BOARDS_WIZNET_W5100S_EVB_PICO2_H
#define _BOARDS_WIZNET_W5100S_EVB_PICO2_H

pico_board_cmake_set(PICO_PLATFORM, rp2350)

// For board detection
#define WIZNET_W5100S_EVB_PICO2

// --- RP2350 VARIANT ---
#define PICO_RP2350A 1

// --- BOARD SPECIFIC ---
#ifndef W5100S_EVB_PICO2_INTN_PIN
#define W5100S_EVB_PICO2_INTN_PIN 21
#endif

#ifndef W5100S_EVB_PICO2_RSTN_PIN
#define W5100S_EVB_PICO2_RSTN_PIN 20
#endif

#ifndef W5100S_EVB_PICO2_A0_PIN
#define W5100S_EVB_PICO2_A0_PIN 26
#endif
#ifndef W5100S_EVB_PICO2_A1_PIN
#define W5100S_EVB_PICO2_A1_PIN 27
#endif
Repository: raspberrypi/pico-sdk
File: src/rp2_common/pico_cyw43_driver/cybt_shared_bus/cybt_logging.h (C/C++)

Code before:
/*
 * Copyright (c) 2025 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef CYBT_LOGGING_H
#define CYBT_LOGGING_H

// Error messages only enabled in debug by default
#ifndef NDEBUG
#define CYBT_ERROR_ENABLED 1
#else
#define CYBT_ERROR_ENABLED 0
#endif

// Info messages only enabled in debug by default
#ifndef NDEBUG
#define CYBT_INFO_ENABLED 1
#else
#define CYBT_INFO_ENABLED 0
#endif

// Debug messages disabled by default
#define CYBT_DEBUG_ENABLED 0

#if CYBT_DEBUG_ENABLED || CYBT_ERROR_ENABLED
#include <stdio.h>
#endif

#if CYBT_ERROR_ENABLED
#define cybt_error CYW43_WARN
#else
#define cybt_error(...)
#endif

#if CYBT_INFO_ENABLED

Review comment (suggestion):
should be guarded by `#ifndef CYBT_ERROR_ENABLED` or it isn't a default!

Code after:
/*
 * Copyright (c) 2025 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef CYBT_LOGGING_H
#define CYBT_LOGGING_H

// Error messages only enabled in debug by default
#ifndef CYBT_ERROR_ENABLED
#ifndef NDEBUG
#define CYBT_ERROR_ENABLED 1
#else
#define CYBT_ERROR_ENABLED 0
#endif
#endif

// Info messages only enabled in debug by default
#ifndef CYBT_INFO_ENABLED
#ifndef NDEBUG
#define CYBT_INFO_ENABLED 1
#else
#define CYBT_INFO_ENABLED 0
#endif
#endif

// Debug messages disabled by default
#ifndef CYBT_DEBUG_ENABLED
#define CYBT_DEBUG_ENABLED 0
#endif

#ifndef cybt_error
#if CYBT_ERROR_ENABLED
#define cybt_error CYW43_WARN
#else
#define cybt_error(...)