Skip to content

Commit

Permalink
More board header checks (#1814)
Browse files Browse the repository at this point in the history
* Modify check_board_header.py to work with both RP2040- and RP2350-based boards

* Tweaks to the board-header files so that they pass check_board_header.py

* Update tools/check_board_header.py
so that it handles pico_cmake_set_default the same way as cmake/generic_board.cmake does
  • Loading branch information
lurch authored Aug 20, 2024
1 parent 1bdd006 commit 9a41722
Show file tree
Hide file tree
Showing 29 changed files with 617 additions and 166 deletions.
2 changes: 2 additions & 0 deletions src/boards/include/boards/amethyst_fpga.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

// FIXME delete this file before release (board file for Amethyst FPGA platform)

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_AMETHYST_FPGA_H
#define _BOARDS_AMETHYST_FPGA_H

Expand Down
18 changes: 8 additions & 10 deletions src/boards/include/boards/defcon32_badge.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

// NOTE: since there is no UART on the badge, you should probably pass:
// -DPICO_BOARD=defcon32_badge -DPICO_STDIO_USB=1 -DPICO_STDIO_UART+0
// when building to set up stdio over USB CDC by default
#define PICO_DEFAULT_UART 0
#define PICO_DEFAULT_UART_TX_PIN 30
#define PICO_DEFAULT_UART_RX_PIN 31

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_DEFCON32_BADGE_H
Expand Down Expand Up @@ -56,6 +49,11 @@
#define DEFCON32_BADGE_IR_RX_PIN 27
#define DEFCON32_BADGE_IR_TX_PIN 28

// --- UART ---
// NOTE: since there is no UART on the badge, you should probably pass:
// -DPICO_BOARD=defcon32_badge -DPICO_STDIO_USB=1 -DPICO_STDIO_UART=0
// when building to set up stdio over USB CDC by default

// --- LED ---
// no PICO_DEFAULT_LED_PIN
#ifndef PICO_DEFAULT_WS2812_PIN
Expand All @@ -75,16 +73,16 @@

// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#define PICO_DEFAULT_SPI 1
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN DEFCON32_BADGE_SPI_CK_PIN
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN DEFCON32_BADGE_SPI_MISO_PIN
#define PICO_DEFAULT_SPI_TX_PIN DEFCON32_BADGE_SPI_MOSI_PIN
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN DEFCON32_BADGE_SPI_MOSI_PIN
#define PICO_DEFAULT_SPI_RX_PIN DEFCON32_BADGE_SPI_MISO_PIN
#endif
// multiple devices, so this doesn't make much sense
// no PICO_DEFAULT_SPI_CSN_PIN
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_24.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_24
#define _BOARDS_GEN4_RP2350_24
#ifndef _BOARDS_GEN4_RP2350_24_H
#define _BOARDS_GEN4_RP2350_24_H

// For board detection
#define GEN4_RP2350_24
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_24ct.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_24CT
#define _BOARDS_GEN4_RP2350_24CT
#ifndef _BOARDS_GEN4_RP2350_24CT_H
#define _BOARDS_GEN4_RP2350_24CT_H

// For board detection
#define GEN4_RP2350_24CT // CLB variants are exactly the same in operation
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_24t.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_24T
#define _BOARDS_GEN4_RP2350_24T
#ifndef _BOARDS_GEN4_RP2350_24T_H
#define _BOARDS_GEN4_RP2350_24T_H

// For board detection
#define GEN4_RP2350_24T
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_28.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_28
#define _BOARDS_GEN4_RP2350_28
#ifndef _BOARDS_GEN4_RP2350_28_H
#define _BOARDS_GEN4_RP2350_28_H

// For board detection
#define GEN4_RP2350_28
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_28ct.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_28CT
#define _BOARDS_GEN4_RP2350_28CT
#ifndef _BOARDS_GEN4_RP2350_28CT_H
#define _BOARDS_GEN4_RP2350_28CT_H

// For board detection
#define GEN4_RP2350_28CT // CLB variants are exactly the same in operation
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_28t.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_28T
#define _BOARDS_GEN4_RP2350_28T
#ifndef _BOARDS_GEN4_RP2350_28T_H
#define _BOARDS_GEN4_RP2350_28T_H

// For board detection
#define GEN4_RP2350_28T
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_32
#define _BOARDS_GEN4_RP2350_32
#ifndef _BOARDS_GEN4_RP2350_32_H
#define _BOARDS_GEN4_RP2350_32_H

// For board detection
#define GEN4_RP2350_32
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_32ct.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_32CT
#define _BOARDS_GEN4_RP2350_32CT
#ifndef _BOARDS_GEN4_RP2350_32CT_H
#define _BOARDS_GEN4_RP2350_32CT_H

// For board detection
#define GEN4_RP2350_32CT // CLB variants are exactly the same in operation
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_32t.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_32T
#define _BOARDS_GEN4_RP2350_32T
#ifndef _BOARDS_GEN4_RP2350_32T_H
#define _BOARDS_GEN4_RP2350_32T_H

// For board detection
#define GEN4_RP2350_32T
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_35.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_35
#define _BOARDS_GEN4_RP2350_35
#ifndef _BOARDS_GEN4_RP2350_35_H
#define _BOARDS_GEN4_RP2350_35_H

// For board detection
#define GEN4_RP2350_35
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_35ct.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_35CT
#define _BOARDS_GEN4_RP2350_35CT
#ifndef _BOARDS_GEN4_RP2350_35CT_H
#define _BOARDS_GEN4_RP2350_35CT_H

// For board detection
#define GEN4_RP2350_35CT // CLB variants are exactly the same in operation
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/gen4_rp2350_35t.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_GEN4_RP2350_35T
#define _BOARDS_GEN4_RP2350_35T
#ifndef _BOARDS_GEN4_RP2350_35T_H
#define _BOARDS_GEN4_RP2350_35T_H

// For board detection
#define GEN4_RP2350_35T
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/hellbender_2350A_devboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

#ifndef _BOARDS_HB_2350A_H
#define _BOARDS_HB_2350A_H
#ifndef _BOARDS_HELLBENDER_2350A_DEVBOARD_H
#define _BOARDS_HELLBENDER_2350A_DEVBOARD_H

// pico_cmake_set PICO_PLATFORM=rp2350

Expand Down
8 changes: 2 additions & 6 deletions src/boards/include/boards/ilabs_challenger_rp2350_bconnect.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_CHALLENGER_RP2350_BCONNECT_H
#define _BOARDS_CHALLENGER_RP2350_BCONNECT_H
#ifndef _BOARDS_ILABS_CHALLENGER_RP2350_BCONNECT_H
#define _BOARDS_ILABS_CHALLENGER_RP2350_BCONNECT_H

// For board detection
#define ILABS_CHALLENGER_RP2350_BCONNECT
Expand Down Expand Up @@ -83,10 +83,6 @@
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif

#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 1
#endif

#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif
Expand Down
8 changes: 2 additions & 6 deletions src/boards/include/boards/ilabs_challenger_rp2350_wifi_ble.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_CHALLENGER_RP2350_WIFI_BLE_H
#define _BOARDS_CHALLENGER_RP2350_WIFI_BLE_H
#ifndef _BOARDS_ILABS_CHALLENGER_RP2350_WIFI_BLE_H
#define _BOARDS_ILABS_CHALLENGER_RP2350_WIFI_BLE_H

// For board detection
#define ILABS_CHALLENGER_RP2350_WIFI_BLE
Expand Down Expand Up @@ -80,10 +80,6 @@
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif

#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 1
#endif

#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/boards/include/boards/phyx_rick_tny_rp2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#define PICO_DEFAULT_I2C 1
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 6
Expand Down
2 changes: 1 addition & 1 deletion src/boards/include/boards/pico2.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

// This header may be included by other board headers as "boards/pico.h"
// This header may be included by other board headers as "boards/pico2.h"

// pico_cmake_set PICO_PLATFORM=rp2350

Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/pimoroni_plasma2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN TINY2350_LED_G_PIN
#define PICO_DEFAULT_LED_PIN PLASMA2350_LED_G_PIN
#endif
// no PICO_DEFAULT_WS2812_PIN

Expand All @@ -82,7 +82,7 @@

// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#define PICO_DEFAULT_SPI 1
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN SPICE_NETLIGHT_SCK_PIN
Expand Down
4 changes: 2 additions & 2 deletions src/boards/include/boards/pimoroni_tiny2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
#define PICO_FLASH_SPI_CLKDIV 2
#endif

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

#ifndef PICO_RP2350_A2_SUPPORTED
Expand Down
4 changes: 0 additions & 4 deletions src/boards/include/boards/solderparty_rp2350_stamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif

#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 1
#endif

#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif
Expand Down
4 changes: 0 additions & 4 deletions src/boards/include/boards/solderparty_rp2350_stamp_xl.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif

#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 1
#endif

#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define _BOARDS_SWITCHSCIENCE_PICOSSCI2_CONTA_BASE_H

// For board detection
#define SWITCHSCIENCE_PICOSSCI2_CONTA_BASE_H
#define SWITCHSCIENCE_PICOSSCI2_CONTA_BASE

// --- RP2350 VARIANT ---
#define PICO_RP2350A 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define _BOARDS_SWITCHSCIENCE_PICOSSCI2_RP2350_BREAKOUT_H

// For board detection
#define SWITCHSCIENCE_PICOSSCI2_RP2350_BREAKOUT_H
#define SWITCHSCIENCE_PICOSSCI2_RP2350_BREAKOUT

// --- RP2350 VARIANT ---
#define PICO_RP2350A 1
Expand Down
2 changes: 1 addition & 1 deletion src/boards/include/boards/switchscience_picossci2_tiny.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define _BOARDS_SWITCHSCIENCE_PICOSSCI2_TINY_H

// For board detection
#define SWITCHSCIENCE_PICOSSCI2_TINY_H
#define SWITCHSCIENCE_PICOSSCI2_TINY

// --- RP2350 VARIANT ---
#define PICO_RP2350A 1
Expand Down
Loading

0 comments on commit 9a41722

Please sign in to comment.