From 5b256e980f6dae62a835574eed638b341c75e0ca Mon Sep 17 00:00:00 2001 From: Khalil Estell Date: Sun, 5 Apr 2026 11:50:55 -0700 Subject: [PATCH] Add CI plus cmake spam --- .github/workflows/ci.yml | 75 +++++++++++++++++++ README.md | 43 +++++++++++ board-headers/micromod/conanfile.py | 32 ++++++-- .../micromod/libhal_rp2350_micromod.h | 32 ++++++-- pico-sdk/conanfile.py | 49 ++++++++---- picotool/conanfile.py | 58 ++++++++------ pioasm/conanfile.py | 66 +++++++++------- profiles/macos-build | 2 + profiles/rp2350 | 6 -- test_package/CMakeFiles/cmake.check_cache | 1 + test_package/{run.sh => build.sh} | 3 - test_package/conanfile.py | 7 +- test_package/configure.sh | 3 - test_package/deactivate.sh | 7 -- test_package/main.cpp | 31 ++++---- 15 files changed, 301 insertions(+), 114 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 README.md create mode 100644 profiles/macos-build create mode 100644 test_package/CMakeFiles/cmake.check_cache rename test_package/{run.sh => build.sh} (85%) mode change 100644 => 100755 delete mode 100644 test_package/deactivate.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0bea2b3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +# Copyright 2026 Khalil Estell and the libhal contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 🏗️ Build pioasm, picosdk, picotool + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + strategy: + matrix: + os: [ubuntu-24.04, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - run: pipx install conan>=2.23.0 + - run: conan config install https://github.com/libhal/conan-config2.git + - run: conan hal setup + + # Build picosdk 2.2.0 + + - run: conan create pioasm --version=2.2.0 -pr:a hal/tc/llvm -b missing + - run: conan create pico-sdk --version=2.2.0 + + - if: ${{ startsWith(matrix.os, 'macos') }} + run: conan create picotool -b missing --version=2.2.0 -pr:a hal/tc/llvm -pr:a profiles/macos-build + + - if: ${{ startsWith(matrix.os, 'ubuntu') }} + run: sudo -E $(which conan) create picotool -b missing --version=2.2.0 -pr:a hal/tc/llvm -c tools.system.package_manager:mode=install + + - if: ${{ startsWith(matrix.os, 'windows') }} + run: conan create picotool -b missing --version=2.2.0 -pr:a hal/tc/llvm + + - name: 📡 Sign into JFrog Artifactory + env: + PASSWORD: ${{ secrets.JFROG_LIBHAL_TRUNK_ID_TOKEN }} + JFROG_USER: ${{ secrets.JFROG_LIBHAL_TRUNK_ID_TOKEN_USER }} + run: conan remote login -p $PASSWORD libhal $JFROG_USER + + # Upload Packages + + - if: ${{ startsWith(github.ref, 'refs/tags/') }} + run: conan upload "libusb/*" --confirm -r=libhal + + - if: ${{ startsWith(github.ref, 'refs/tags/') }} + run: conan upload "mbedlts/*" --confirm -r=libhal + + - if: ${{ startsWith(github.ref, 'refs/tags/') }} + run: conan upload "pioasm/*" --confirm -r=libhal + + - if: ${{ startsWith(github.ref, 'refs/tags/') }} + run: conan upload "pico-sdk/*" --confirm -r=libhal + + - if: ${{ startsWith(github.ref, 'refs/tags/') }} + run: conan upload "picotool/*" --confirm -r=libhal diff --git a/README.md b/README.md new file mode 100644 index 0000000..be0aecb --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Pico Packages + +These are conan packages for the Pico SDK for the Raspberry Pi Pico family of +microcontrollers. + +## CI Deployed Packages + +### Tool Packages + +### OS Tools + +For Mac and Linux + +- libusb: + - 1.0.26 + +> [!WARNING] +> Windows development is currently not supported + +### PicoSDK Packages + +Versions: + +- 2.1.1 +- 2.2.0 + +Packages contained: + +- pioasm +- picotool/pioasm/pico-sdk: + +## Building the Packages + +First build the tool packages needed for picosdk to build PIO assembly code + +```bash +conan create pioasm --version=2.2.0 -pr:a hal/tc/llvm -b missing +conan create piosdk --version=2.2.0 +conan create picotool --version=2.2.0 -pr:a hal/tc/llvm -b missing +``` + +For macOS add `-pr:a profiles/macos-build` in order to ensure that the LLVM +toolchain gets its sysroot set. diff --git a/board-headers/micromod/conanfile.py b/board-headers/micromod/conanfile.py index 6d5319f..c3513a9 100644 --- a/board-headers/micromod/conanfile.py +++ b/board-headers/micromod/conanfile.py @@ -1,6 +1,29 @@ +# MIT License +# +# Copyright (c) 2025 Shin Umeda +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from conan import ConanFile from conan.tools.files import copy + class MicromodHeader(ConanFile): name = "rp-board-header-rp2350-micromod" package_type = "header-library" @@ -16,16 +39,15 @@ class MicromodHeader(ConanFile): default_options = {} exports_sources = "*.h" - def package(self): copy(self, "*", self.export_sources_folder, self.package_folder) - + def package_info(self): - self.buildenv_info.append("PICO_BOARD_HEADER_DIRS", self.package_folder, separator=";") + self.buildenv_info.append("PICO_BOARD_HEADER_DIRS", + self.package_folder, separator=";") self.cpp_info.includedirs = [] # no actual include directories - self.cpp_info.libdirs = [] # nothing is being built + self.cpp_info.libdirs = [] # nothing is being built def package_id(self): self.info.settings.clear() - diff --git a/board-headers/micromod/libhal_rp2350_micromod.h b/board-headers/micromod/libhal_rp2350_micromod.h index f81e61c..f66f48d 100644 --- a/board-headers/micromod/libhal_rp2350_micromod.h +++ b/board-headers/micromod/libhal_rp2350_micromod.h @@ -1,9 +1,26 @@ -/* +/** + * MIT License + * * Copyright (c) 2025 Shin Umeda - * - * - * - * */ + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef _rp2350_micromod_h #define _rp2350_micromod_h @@ -57,15 +74,14 @@ pico_board_cmake_set(PICO_PLATFORM, rp2350) #define PICO_FLASH_SPI_CLKDIV 2 #endif -pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (16 * 1024 * 1024)) + 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) + pico_board_cmake_set_default(PICO_RP2350_A2_SUPPORTED, 1) #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif - #endif diff --git a/pico-sdk/conanfile.py b/pico-sdk/conanfile.py index 9186ad5..c58d118 100644 --- a/pico-sdk/conanfile.py +++ b/pico-sdk/conanfile.py @@ -1,40 +1,61 @@ +# MIT License +# +# Copyright (c) 2025 Shin Umeda +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from conan import ConanFile from conan.tools.files import get, patch, copy, chdir -from os.path import join +from pathlib import Path + class PicoSDK(ConanFile): name = "picosdk" package_type = "static-library" - - # Optional metadata license = "BSD-3" author = " " - url = "https://github.com/DolphinGui/pico-sdk-libhal" + url = "https://github.com/libhal/pico-packages" description = "The Raspberry Pi Pico C/C++ SDK repackaged for conan" topics = ("Embedded", "Raspberry Pi Pico", "ARM") - settings = "os", "compiler", "build_type", "arch" options = {} default_options = {} - exports_sources = "patches/*" - + def source(self): strip = not self.version.startswith('2.1') - get(self, **self.conan_data["sources"][self.version]["sdk"], strip_root = strip) - patch_file = join(self.export_sources_folder, f"patches/{self.version}-psdk.patch") - patch(self, patch_file=patch_file) + get(self, **self.conan_data["sources"] + [self.version]["sdk"], strip_root=strip) + EXPORT_SOURCE = Path(self.export_sources_folder) + PATCH_FILE = EXPORT_SOURCE / "patches" / f"{self.version}-psdk.patch" + patch(self, patch_file=str(PATCH_FILE)) with chdir(self, "lib"): - get(self, **self.conan_data["sources"][self.version]["tinyusb"], destination = "tinyusb", strip_root = strip) + get(self, **self.conan_data["sources"][self.version] + ["tinyusb"], destination="tinyusb", strip_root=strip) def package(self): copy(self, "*", self.export_sources_folder, self.package_folder) - + def package_info(self): self.buildenv_info.define("PICO_SDK_PATH", self.package_folder) self.cpp_info.includedirs = [] # no actual include directories - self.cpp_info.libdirs = [] # nothing is being built + self.cpp_info.libdirs = [] # nothing is being built def package_id(self): self.info.settings.clear() - diff --git a/picotool/conanfile.py b/picotool/conanfile.py index d6323a4..ef3fa00 100644 --- a/picotool/conanfile.py +++ b/picotool/conanfile.py @@ -1,36 +1,49 @@ +# MIT License +# +# Copyright (c) 2025 Shin Umeda +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.files import get, patch, chdir -from os.path import join +from pathlib import Path class Picotool(ConanFile): name = "picotool" package_type = "application" - license = "BSD-3" author = " " - url = "https://github.com/DolphinGui/pico-sdk-libhal" + url = "https://github.com/libhal/pico-packages" description = "The Raspberry Pi Picotool repackaged for conan" topics = ("Embedded", "Raspberry Pi Pico", "ARM") - settings = "os", "compiler", "build_type", "arch" - exports_sources = "patches/*" - def config_options(self): - pass - - def configure(self): - pass - def requirements(self): - # The version of mbedtls pico uses is so - # ancient it CMake removed support for it. - self.output.error(f"{ self.conan_data["dependencies"][self.version]}") - for dep, version in self.conan_data["dependencies"][self.version].items(): + DEPENDENCIES_VERSION = self.conan_data["dependencies"][self.version] + self.output.error(f"{DEPENDENCIES_VERSION}") + for dep, version in DEPENDENCIES_VERSION.items(): self.requires(f"{dep}/{version}") - self.requires("libusb/1.0.26") + + self.requires("libusb/1.0.29") self.requires(f"picosdk/{self.version}") def layout(self): @@ -48,13 +61,13 @@ def source(self): destination="picotool", strip_root=strip, ) - patch_file = join( - self.export_sources_folder, f"patches/{self.version}-ptool.patch" - ) + EXPORT_SOURCE = Path(self.export_sources_folder) + PATCH_NAME = f"{self.version}-ptool.patch" + PATCH_FILE = EXPORT_SOURCE / "patches" / PATCH_NAME patch( self, - patch_file=patch_file, - base_path=join(self.export_sources_folder, "picotool"), + patch_file=str(PATCH_FILE), + base_path=EXPORT_SOURCE / "picotool", ) def generate(self): @@ -71,6 +84,3 @@ def build(self): def package(self): cmake = CMake(self) cmake.install() - - def package_info(self): - pass diff --git a/pioasm/conanfile.py b/pioasm/conanfile.py index c7516a8..edf8286 100644 --- a/pioasm/conanfile.py +++ b/pioasm/conanfile.py @@ -1,49 +1,61 @@ +# MIT License +# +# Copyright (c) 2025 Shin Umeda +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.files import get, patch, chdir, rmdir -import os import shutil +from pathlib import Path + class PioASM(ConanFile): name = "pioasm" package_type = "application" - - # Optional metadata license = "BSD-3" author = " " - url = "https://github.com/DolphinGui/pico-sdk-libhal" + url = "https://github.com/libhal/pico-packages" description = "The Raspberry Pi Pico Pio Assembler repackaged for conan" topics = ("Embedded", "Raspberry Pi Pico", "ARM") - settings = "os", "compiler", "build_type", "arch" - exports_sources = "patches/*" - # apparently kind of optional? May or may not be interested in - # regenerating the lexer, but let's not for now - # def requirements(self): - # self.requires("bison/3.8.2") - # self.requires("flex/2.6.4") - - def config_options(self): - pass - - def configure(self): - pass + def build_requirements(self): + self.tool_requires("cmake/[^4.0.0]") def layout(self): cmake_layout(self) - + def source(self): - get(self, **self.conan_data["sources"][self.version], destination = 'sdkroot', strip_root = not self.version.startswith('2.1')) - patch_file = os.path.join(self.export_sources_folder, f"patches/{self.version}-pioasm.patch") - patch(self, patch_file=patch_file, base_path = './sdkroot') - with chdir(self, "./sdkroot/tools/pioasm"): - destination = self.source_folder - files_list = os.listdir('.') - for files in files_list: - shutil.move(files, destination) - rmdir(self, 'sdkroot') + get(self, **self.conan_data["sources"][self.version], + destination='sdkroot', strip_root=not self.version.startswith('2.1')) + EXPORT_SOURCE = Path(self.export_sources_folder) + PATCH_FILE = EXPORT_SOURCE / "patches" / f"{self.version}-pioasm.patch" + SDKROOT = Path('sdkroot') + patch(self, patch_file=str(PATCH_FILE), base_path=SDKROOT) + with chdir(self, SDKROOT / "tools" / "pioasm"): + DESTINATION = self.source_folder + for files in Path('.').iterdir(): + shutil.move(str(files), DESTINATION) + rmdir(self, SDKROOT) def generate(self): deps = CMakeDeps(self) diff --git a/profiles/macos-build b/profiles/macos-build new file mode 100644 index 0000000..cde3b0c --- /dev/null +++ b/profiles/macos-build @@ -0,0 +1,2 @@ +[conf] +tools.build:sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk diff --git a/profiles/rp2350 b/profiles/rp2350 index abcab05..f2f1183 100644 --- a/profiles/rp2350 +++ b/profiles/rp2350 @@ -6,9 +6,3 @@ build_type=RelWithDebInfo [options] *:platform=rp2350-arm-s -[buildenv] -CC=arm-none-eabi-gcc -CXX=arm-none-eabi-g++ -LD=arm-none-eabi-ld -[conf] -tools.cmake.cmaketoolchain:generator=Ninja diff --git a/test_package/CMakeFiles/cmake.check_cache b/test_package/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/test_package/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/test_package/run.sh b/test_package/build.sh old mode 100644 new mode 100755 similarity index 85% rename from test_package/run.sh rename to test_package/build.sh index f621c08..9728e9a --- a/test_package/run.sh +++ b/test_package/build.sh @@ -1,6 +1,3 @@ -#!/usr/bin/sh - set -ex conan build . -pr:h=../profiles/rp2350 -pr:h=arm-gcc-12.3 -nr --build=missing -of build - diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 3da280a..b57cbaf 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -2,18 +2,19 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain + class CompressorRecipe(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "VirtualBuildEnv" def requirements(self): self.requires("picosdk/2.2.0") - self.requires("micromod-header/1.0.0") + self.requires("rp-board-header-rp2350-micromod/1.0.0") def build_requirements(self): self.tool_requires("pioasm/2.2.0") self.tool_requires("picotool/2.2.0") - + def generate(self): tc = CMakeToolchain(self) tc.generate() @@ -29,5 +30,5 @@ def build(self): # it still doesn't work. I can't explain why. "PICO_BOARD": "rp2350_micromod", } - cmake.configure(variables = defs) + cmake.configure(variables=defs) cmake.build() diff --git a/test_package/configure.sh b/test_package/configure.sh index c9473c2..9e43596 100644 --- a/test_package/configure.sh +++ b/test_package/configure.sh @@ -3,6 +3,3 @@ set -ex conan install . -pr:h=../profiles/rp2350 -pr:h=arm-gcc-12.3 --build=missing -of build - - - diff --git a/test_package/deactivate.sh b/test_package/deactivate.sh deleted file mode 100644 index f88c7d1..0000000 --- a/test_package/deactivate.sh +++ /dev/null @@ -1,7 +0,0 @@ -# This file should be sourced - -if [ -e build/deactivate_conanbuild.sh ] -then -source build/deactivate_conanbuild.sh -fi - diff --git a/test_package/main.cpp b/test_package/main.cpp index fcfffca..a5caf1a 100644 --- a/test_package/main.cpp +++ b/test_package/main.cpp @@ -1,18 +1,21 @@ +#include + #include "hardware/gpio.h" -#include "pico/time.h" #include "pico/stdio.h" -#include +#include "pico/time.h" -int main(){ - gpio_set_function(46, gpio_function_t::GPIO_FUNC_SIO); - gpio_set_dir(46, GPIO_OUT); - stdio_init_all(); - while(true){ - gpio_put(46, true); - printf("On!\n"); - sleep_ms(500); - gpio_put(46, false); - printf("Off!\n"); - sleep_ms(500); - } +int +main() +{ + gpio_set_function(46, gpio_function_t::GPIO_FUNC_SIO); + gpio_set_dir(46, GPIO_OUT); + stdio_init_all(); + while (true) { + gpio_put(46, true); + printf("On!\n"); + sleep_ms(500); + gpio_put(46, false); + printf("Off!\n"); + sleep_ms(500); + } }