diff --git a/CMakeLists.txt b/CMakeLists.txt index a91368267..b2fed34d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,15 +3,13 @@ if (CONFIG_ARDUINO_API) string(REPLACE "__" "_" NORMALIZED_BOARD_TARGET "${NORMALIZED_BOARD_TARGET}") - if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/variants/${BOARD}) + # Find variant directory and check for variant.h + # If board-specific variant.h exists, use it; otherwise fall back to default + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/variants/${BOARD}/variant.h) set(variant_dir variants/${BOARD}) - elseif (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/variants/${NORMALIZED_BOARD_TARGET}) + elseif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/variants/${NORMALIZED_BOARD_TARGET}/variant.h) set(variant_dir variants/${NORMALIZED_BOARD_TARGET}) else() - message(WARNING - "Variant dir not found: variants/${BOARD}, variants/${NORMALIZED_BOARD_TARGET}\n" - "Your board is currently not supported. To use it you must create a DTS overlay." - ) set(variant_dir variants/default) endif() diff --git a/documentation/variants.md b/documentation/variants.md index 5f985280d..24ffd151c 100644 --- a/documentation/variants.md +++ b/documentation/variants.md @@ -27,7 +27,7 @@ target board. To add board support: needs to be added it needs to be done in the `variants/` folder. Add a folder inside of the variants folder that matches the name of your board. 2. Add an overlay file file that match the name of the board. -3. Add a `variant.h` file. +3. Add a `variant.h` file. (if required only) An example of this structure is shown below. @@ -35,7 +35,7 @@ An example of this structure is shown below. variants/ ├── arduino_nano_33_ble │   ├── arduino_nano_33_ble.overlay -│   ├── variant.h +│   ├── variant.h (optional) ``` It is possible to apply the overlay outside of the `variants` folder. In that case `cmake` will show a warning and a default empty `variant.h` file will be used. The `zephyr,user` section will still need to be defined somewhere in your project, as described in the [Guide to Writing Overlays section](#guide-to-writing-overlays). @@ -187,7 +187,7 @@ One example of a change that you may find useful is mapping additional pins. For example, the LEDs on the nRF52840 are not connected to any of the Arduino header pins. To define a built-in LED for this board, a 22nd pin definition was added. -Your pinmap header file must be added to the variant.h file by adding three +Your pinmap header file can optionally be added to the variant.h file by adding three lines using this format: ```c diff --git a/variants/arduino_mkrzero/variant.h b/variants/arduino_mkrzero/variant.h deleted file mode 100644 index 06cab2dae..000000000 --- a/variants/arduino_mkrzero/variant.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * Copyright (c) 2022 Dhruva Gole - * - * SPDX-License-Identifier: Apache-2.0 - */ diff --git a/variants/nrf52840dk_nrf52840/variant.h b/variants/nrf52840dk_nrf52840/variant.h deleted file mode 100644 index dd35da076..000000000 --- a/variants/nrf52840dk_nrf52840/variant.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * Copyright (c) 2022 Mike Szczys - * - * SPDX-License-Identifier: Apache-2.0 - */ diff --git a/variants/pocketbeagle_2_am6254_a53/variant.h b/variants/pocketbeagle_2_am6254_a53/variant.h deleted file mode 100644 index 31e6d5243..000000000 --- a/variants/pocketbeagle_2_am6254_a53/variant.h +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2025 Ayush Singh - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once diff --git a/variants/rpi_pico/variant.h b/variants/rpi_pico/variant.h deleted file mode 100644 index 597ceefab..000000000 --- a/variants/rpi_pico/variant.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * Copyright (c) 2024 TOKITA Hiroshi - * - * SPDX-License-Identifier: Apache-2.0 - */