mirror of
https://codeberg.org/libreboot/pico-sdk.git
synced 2025-07-04 16:27:03 +00:00
Compare commits
417 commits
Author | SHA1 | Date | |
---|---|---|---|
|
95ea6acad1 | ||
|
beb2449622 | ||
|
2a1e1af6af | ||
|
b7e255d18d | ||
|
58e253ce04 | ||
|
5f607a9829 | ||
|
a6ae2e6e4a | ||
|
3c39eecea3 | ||
|
65d118c342 | ||
|
39a7f97116 | ||
|
3dce58f21b | ||
|
2692d9a4cb | ||
|
338f99ff1c | ||
|
08ea1d89a9 | ||
|
7b07b0b6a1 | ||
|
9762b00c13 | ||
|
6bb44dd07d | ||
|
5a98889434 | ||
|
6bb3ccf822 | ||
|
8970241772 | ||
|
36fefb5f30 | ||
|
90bfb532a7 | ||
|
31c1be5d5c | ||
|
f3459a45d4 | ||
|
e17a82d291 | ||
|
105a2b89d5 | ||
|
6bf5d9bf7d | ||
|
9a2b75e26e | ||
|
74db3c2d86 | ||
|
d3080e777f | ||
|
54d4f3a8f7 | ||
|
46283dd00f | ||
|
06a244b2b5 | ||
|
c2118cc005 | ||
|
08bf6a7faa | ||
|
2a4dbd9b7c | ||
|
c4b55f6346 | ||
|
e99c43b670 | ||
|
482dd59b5e | ||
|
b122c42989 | ||
|
363302f780 | ||
|
35fcc34747 | ||
|
5f6c432806 | ||
|
89691ed879 | ||
|
11e7801ba4 | ||
|
37e42578b0 | ||
|
8d1378dcd2 | ||
|
fe018f92ab | ||
|
7ceca315f1 | ||
|
d6e3fa06f1 | ||
|
d0db3780fd | ||
|
0f847db371 | ||
|
1b64cac8d6 | ||
|
06b7c1cf9e | ||
|
f9eb48bd91 | ||
|
09a9379ea9 | ||
|
c7e562604e | ||
|
68778b1135 | ||
|
4726a56d24 | ||
|
f642b763be | ||
|
5c6fece28a | ||
|
750bfaeed3 | ||
|
4196f2c17e | ||
|
1aa049f14b | ||
|
2331e6f203 | ||
|
809a423fb0 | ||
|
6587f5cc9a | ||
|
11961b97e4 | ||
|
ca0c0db979 | ||
|
e48a2e158c | ||
|
d649c6c77a | ||
|
bd130eddff | ||
|
8905de509f | ||
|
37c6b24b1b | ||
|
50322234b7 | ||
|
98c114a8ee | ||
|
37085889b0 | ||
|
91dfbd01e8 | ||
|
66c7f0f607 | ||
|
07d6dc1315 | ||
|
03a82f3d2f | ||
|
fa91723371 | ||
|
c675dfeaa5 | ||
|
761bb1dba0 | ||
|
bd5523cc64 | ||
|
cf8301f3e6 | ||
|
e2e0fd51c3 | ||
|
075e829cd9 | ||
|
ff373b33dc | ||
|
78533ec119 | ||
|
20cf7119f4 | ||
|
66335f1dc7 | ||
|
8c08f2b8ff | ||
|
0e5ef0f40f | ||
|
a0f828fb16 | ||
|
9f56a47dca | ||
|
d08f36cd1c | ||
|
780817a8c7 | ||
|
af2f42613e | ||
|
6500c59d70 | ||
|
42e234f8f3 | ||
|
0ed2840306 | ||
|
ec0037b508 | ||
|
f12ac1c2c1 | ||
|
0f38151002 | ||
|
398ac2baf9 | ||
|
b49d4ec949 | ||
|
3a79149d2c | ||
|
dfb573818f | ||
|
f13306c8a7 | ||
|
b3cadb7de2 | ||
|
d957c738db | ||
|
b98970f71e | ||
|
3bc866395c | ||
|
3cb21c8134 | ||
|
d886df6eb0 | ||
|
876f331033 | ||
|
ff5401f3b2 | ||
|
91864a0d6e | ||
|
2d60604b6e | ||
|
4bbf701b4b | ||
|
a2a4c2041e | ||
|
dd4aacbd1c | ||
|
d639292fea | ||
|
a700b7784b | ||
|
a46addba7b | ||
|
bc598fff27 | ||
|
7d5d9276a8 | ||
|
aa8cf17732 | ||
|
7dc10d7aad | ||
|
9b16c797b4 | ||
|
598ba01ec8 | ||
|
4cb5c1ccf1 | ||
|
4a272778cd | ||
|
eba6adb4e1 | ||
|
19d5f4c0d7 | ||
|
eaaa4a5ab3 | ||
|
fa88c125b8 | ||
|
9a41722dd3 | ||
|
1bdd006c8d | ||
|
7be79e8abe | ||
|
789ea75c63 | ||
|
e930bf3261 | ||
|
9430469e18 | ||
|
fab47c8071 | ||
|
8886f272a9 | ||
|
cd71c8953e | ||
|
62df126ad5 | ||
|
b271208071 | ||
|
7a0f1f03dd | ||
|
a6f21b6e10 | ||
|
e049f5063f | ||
|
a2642f93a4 | ||
|
424e21ec07 | ||
|
8177366292 | ||
|
f4a691a2c7 | ||
|
efe2103f9b | ||
|
45984e276f | ||
|
b3bf690d0a | ||
|
9f85f25640 | ||
|
6624098756 | ||
|
41b4d3adb4 | ||
|
7c5b426a0f | ||
|
af9b47c668 | ||
|
b45632b06e | ||
|
5ec40711f4 | ||
|
6328fffc71 | ||
|
7f37af837b | ||
|
0996a9e354 | ||
|
c93c3f49ec | ||
|
b1abf96cec | ||
|
01dec6fb6f | ||
|
86aab81c47 | ||
|
74b9ea4d46 | ||
|
778221ba99 | ||
|
73e719691d | ||
|
8b0146c142 | ||
|
f5b7a9135b | ||
|
9290bdde58 | ||
|
2de70c79c2 | ||
|
f5fea7f09b | ||
|
5d36c90331 | ||
|
5118b4aae8 | ||
|
cea8211834 | ||
|
5be87f1e22 | ||
|
0e5cef3ffa | ||
|
333974fd6c | ||
|
a567349aae | ||
|
f193ed6bc9 | ||
|
c526ec1c3d | ||
|
6ff3e4fab2 | ||
|
0dc17e5149 | ||
|
a391f641b6 | ||
|
a456964c19 | ||
|
3ee062318f | ||
|
79977dbc4a | ||
|
e84eedff32 | ||
|
115eae7c66 | ||
|
abce1d427c | ||
|
23dec9d38c | ||
|
f81537d9e0 | ||
|
a6c65b426d | ||
|
dcc2241a16 | ||
|
3f41d7d2ee | ||
|
7d238ea2cc | ||
|
0d56f52b7b | ||
|
f1f3bd6bf6 | ||
|
5941969380 | ||
|
ac8f277e5a | ||
|
fcd5333f6b | ||
|
a0f4cd4096 | ||
|
b27f13b83b | ||
|
0c65e1d755 | ||
|
c9cce7a312 | ||
|
f1c6fc8b6d | ||
|
62bb486f2a | ||
|
8353cb61e3 | ||
|
4d19007607 | ||
|
73dce4e540 | ||
|
6bb38a87fa | ||
|
ff2e2028ea | ||
|
46bddd6b54 | ||
|
3274cc8aec | ||
|
d7bbadb291 | ||
|
9f45e3c905 | ||
|
9ff8a98df6 | ||
|
538b901290 | ||
|
e5e30b40fd | ||
|
01804acb0a | ||
|
4e3951df26 | ||
|
7dcb984214 | ||
|
7ed83dd2d3 | ||
|
d92e26afca | ||
|
21cf892b77 | ||
|
8787bc9b4d | ||
|
263a6680aa | ||
|
8262a08af3 | ||
|
8e169346a9 | ||
|
f85d67961c | ||
|
81b3200df4 | ||
|
fbb0783eb5 | ||
|
88fa39165e | ||
|
6a7db34ff6 | ||
|
9f9936140c | ||
|
8ecc5ababa | ||
|
f316272a80 | ||
|
bb460d076f | ||
|
0be7fb8045 | ||
|
3352ccf5de | ||
|
7119978e92 | ||
|
0423d7a257 | ||
|
c0a615e99c | ||
|
ab766096e5 | ||
|
1b81fcc704 | ||
|
f3ebd62d51 | ||
|
d315a04661 | ||
|
f28bbfd4ec | ||
|
8188adf98b | ||
|
5d47872cb4 | ||
|
6a221e023d | ||
|
3b44b0d177 | ||
|
8e89e955fc | ||
|
c026314e17 | ||
|
b0a6f244f3 | ||
|
c7211db2b3 | ||
|
826efbc524 | ||
|
5ee4c1c3ee | ||
|
8dbc6f20a3 | ||
|
c34d3d5602 | ||
|
affbb31a8c | ||
|
8888fd7998 | ||
|
4515719909 | ||
|
1d9f1873d5 | ||
|
8ebb83ccaa | ||
|
ab4f23c7ee | ||
|
7070d230c0 | ||
|
257959bc07 | ||
|
62201a83e2 | ||
|
e87f11bd2b | ||
|
a42564b4b4 | ||
|
cb0ac5bd1a | ||
|
be4c80d355 | ||
|
4000c9f414 | ||
|
2bfa90ccbb | ||
|
cd54c3297d | ||
|
7f7232541a | ||
|
dca773f36b | ||
|
0b285af452 | ||
|
1ac90374e3 | ||
|
bc7d9ce95a | ||
|
18479e0300 | ||
|
67b0a11d3e | ||
|
d9c88c6306 | ||
|
b1d4ba570e | ||
|
777cd52e21 | ||
|
d172067f47 | ||
|
37c8e9f0b2 | ||
|
1331c47c9e | ||
|
c2af4e8bf4 | ||
|
d30b97ab79 | ||
|
226374a364 | ||
|
e763cb8e99 | ||
|
79d0eb472d | ||
|
f396d05f82 | ||
|
4ba5ad34cb | ||
|
5abb4eb911 | ||
|
0121007c85 | ||
|
6d336e04be | ||
|
2ccab115de | ||
|
c8ccefb972 | ||
|
0d207f4878 | ||
|
d07abf3ac0 | ||
|
756c4f24a4 | ||
|
f54ca1a42e | ||
|
8c8006d457 | ||
|
18b97fcba0 | ||
|
66bd4d8aab | ||
|
5eff1726c2 | ||
|
cc169ddd68 | ||
|
5b467997b2 | ||
|
7ef7ec8491 | ||
|
ab18927533 | ||
|
a916761e7d | ||
|
795d021ca6 | ||
|
74b6c1ccc3 | ||
|
7e305a70b0 | ||
|
c05c97d338 | ||
|
fff2c6b467 | ||
|
31780aed2c | ||
|
0e4e25a343 | ||
|
d717fe239a | ||
|
0b0931a9a2 | ||
|
5984849594 | ||
|
c852a65ecc | ||
|
2a9c59925a | ||
|
1552324a64 | ||
|
1bd9de95de | ||
|
45d2dc4c95 | ||
|
729c7f4326 | ||
|
36ba9e64bc | ||
|
fefb6b6d1e | ||
|
b70f984f2a | ||
|
67af83f069 | ||
|
b979395c5e | ||
|
78d7a2522f | ||
|
260df95e44 | ||
|
b8bd8ac702 | ||
|
60016e2cf2 | ||
|
9a5eae111b | ||
|
0cfeec253a | ||
|
248fc72f96 | ||
|
a540ca905a | ||
|
c578422528 | ||
|
177b0303dd | ||
|
a66ba7a942 | ||
|
8b8778c59b | ||
|
aaf0828250 | ||
|
021a1b6bad | ||
|
2e45d8ec65 | ||
|
885bd922cf | ||
|
05c3f22879 | ||
|
4215d4a793 | ||
|
35787255af | ||
|
13a171a971 | ||
|
73dcbec837 | ||
|
88bc4f974c | ||
|
99ee33ad25 | ||
|
419eb739c2 | ||
|
488bd66eb3 | ||
|
605e21ae6f | ||
|
0b52603667 | ||
|
56594e75af | ||
|
616e120558 | ||
|
0ef07e5215 | ||
|
887c0b8443 | ||
|
6cc9394c5c | ||
|
586850e66f | ||
|
5258ee640b | ||
|
e4da37cf0c | ||
|
a88baafc16 | ||
|
6d15974e96 | ||
|
e50e107d91 | ||
|
16ab2b21ba | ||
|
b0294d6bf4 | ||
|
3bd7a829db | ||
|
2d4e3baa82 | ||
|
587ac803c5 | ||
|
e22807bc2e | ||
|
8c6963d7ed | ||
|
719d5e41a2 | ||
|
8e014e6b5d | ||
|
c4f37b2e44 | ||
|
6f1fc56833 | ||
|
24bb3627cf | ||
|
3ed9e2fb1e | ||
|
98aba25e64 | ||
|
849cdf8a30 | ||
|
5e9eb27ac2 | ||
|
a4ec3c4848 | ||
|
189d377be2 | ||
|
07e5caf341 | ||
|
0041f4b7fd | ||
|
89bce613ae | ||
|
0d872ea409 | ||
|
830e867211 | ||
|
00780f0de9 | ||
|
80cde7276d | ||
|
a33a11ea16 | ||
|
2dfaa1ab4c | ||
|
150be75aa4 | ||
|
2ebba462ac | ||
|
fe7849d645 | ||
|
49d7d9edfb | ||
|
17c759b6e9 | ||
|
de8f857de4 | ||
|
0fa3e7247d | ||
|
d1e7294dab |
1084 changed files with 377809 additions and 67922 deletions
4
.bazelignore
Normal file
4
.bazelignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Don't accidentally pick up external CMake deps with Bazel build files.
|
||||
build
|
||||
# Don't treat submodules as part of this project.
|
||||
lib
|
6
.bazelrc
Normal file
6
.bazelrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Silence all C/C++ warnings in external code.
|
||||
common --per_file_copt=external/.*@-w
|
||||
common --host_per_file_copt=external/.*@-w
|
||||
|
||||
# Produce useful output when the build fails.
|
||||
common --verbose_failures
|
1
.bazelversion
Normal file
1
.bazelversion
Normal file
|
@ -0,0 +1 @@
|
|||
7.2.1
|
75
.github/workflows/bazel_build.yml
vendored
Normal file
75
.github/workflows/bazel_build.yml
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
name: Bazel presubmit checks
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
bazel-build-check:
|
||||
strategy:
|
||||
matrix:
|
||||
# TODO: Windows is currently broken.
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get Bazel
|
||||
uses: bazel-contrib/setup-bazel@0.9.0
|
||||
with:
|
||||
# Avoid downloading Bazel every time.
|
||||
bazelisk-cache: true
|
||||
# Store build cache per workflow.
|
||||
disk-cache: ${{ github.workflow }}
|
||||
# Share repository cache between workflows.
|
||||
repository-cache: true
|
||||
# Only needed to drive the presbumit scripts.
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Fetch latest Picotool
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: raspberrypi/picotool
|
||||
ref: develop
|
||||
fetch-depth: 0
|
||||
path: lib/picotool
|
||||
- name: Full Bazel build with develop Picotool
|
||||
run: python3 tools/run_all_bazel_checks.py --program=build --picotool-dir=lib/picotool
|
||||
# Checks that the current BCR-requested version of Picotool builds.
|
||||
- name: Bazel Picotool backwards compatibility
|
||||
run: bazel build @picotool//:picotool
|
||||
other-bazel-checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get Bazel
|
||||
uses: bazel-contrib/setup-bazel@0.9.0
|
||||
with:
|
||||
# Avoid downloading Bazel every time.
|
||||
bazelisk-cache: true
|
||||
# Store build cache per workflow.
|
||||
disk-cache: ${{ github.workflow }}
|
||||
# Share repository cache between workflows.
|
||||
repository-cache: true
|
||||
# Only needed to drive the presbumit scripts.
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Fetch latest Picotool
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: raspberrypi/picotool
|
||||
ref: develop
|
||||
fetch-depth: 0
|
||||
path: lib/picotool
|
||||
- name: Other Bazel checks
|
||||
run: python3 tools/run_all_bazel_checks.py --program=other --picotool-dir=lib/picotool
|
7
.github/workflows/choco_packages.config
vendored
Normal file
7
.github/workflows/choco_packages.config
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="gcc-arm-embedded" version="10.2.1" />
|
||||
<package id="cmake" version="3.31.0" installArguments="ADD_CMAKE_TO_PATH=System" />
|
||||
<package id="mingw" version="12.2.0" />
|
||||
<package id="ninja" version="1.11.1" />
|
||||
</packages>
|
19
.github/workflows/cmake.yml
vendored
19
.github/workflows/cmake.yml
vendored
|
@ -1,5 +1,9 @@
|
|||
name: CMake
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'iar/**'
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
|
@ -7,7 +11,8 @@ env:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository_owner == 'raspberrypi'
|
||||
# cannot specify filter for pull_request in on: above, so do it here
|
||||
if: github.repository_owner == 'raspberrypi' && (github.event_name != 'pull_request' || !startsWith(github.head_ref, 'iar/'))
|
||||
runs-on: [self-hosted, Linux, X64]
|
||||
|
||||
steps:
|
||||
|
@ -18,7 +23,7 @@ jobs:
|
|||
mkdir -p "${{ github.workspace }}"
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init
|
||||
|
@ -36,14 +41,10 @@ jobs:
|
|||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
|
||||
- name: Get core count
|
||||
id: core_count
|
||||
run : cat /proc/cpuinfo | grep processor | wc -l
|
||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPICO_SDK_TESTS_ENABLED=1
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: bash
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: cmake --build . --config $BUILD_TYPE --parallel ${{steps.core_count.outputs.output}}
|
||||
run: cmake --build . --config $BUILD_TYPE --parallel $(nproc)
|
||||
|
|
44
.github/workflows/macOS.yml
vendored
Normal file
44
.github/workflows/macOS.yml
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
name: Build on macOS
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'develop'
|
||||
- 'master'
|
||||
- 'test_workflow'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
run: |
|
||||
echo "Cleaning up previous run"
|
||||
rm -rf "${{ github.workspace }}"
|
||||
mkdir -p "${{ github.workspace }}"
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew install cmake
|
||||
brew install --cask gcc-arm-embedded
|
||||
|
||||
- name: Build Project
|
||||
# bash required otherwise this mysteriously (no error) fails at "Generating cyw43_bus_pio_spi.pio.h"
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Unix Makefiles" -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_BOARD=pico_w
|
||||
cmake --build .
|
||||
|
||||
- name: Build Native
|
||||
# bash required otherwise this mysteriously (no error) fails at "Generating cyw43_bus_pio_spi.pio.h"
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build_native
|
||||
cd build_native
|
||||
cmake .. -G "Unix Makefiles" -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_PLATFORM=host
|
||||
cmake --build .
|
157
.github/workflows/multi-gcc.yml
vendored
Normal file
157
.github/workflows/multi-gcc.yml
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
|
||||
name: Multi GCC
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'test_workflow'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository_owner == 'raspberrypi'
|
||||
runs-on: [self-hosted, Linux, X64]
|
||||
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
run: |
|
||||
echo "Cleaning up previous run"
|
||||
rm -rf "${{ github.workspace }}"
|
||||
mkdir -p "${{ github.workspace }}"
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init
|
||||
|
||||
- name: GCC 6.2.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-6_2-2016q4 -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 6.2.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-6_2-2016q4 -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 6.3.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-6-2017-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 6.3.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-6-2017-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 7.2.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-7-2017-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 7.2.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-7-2017-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 7.3.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-7-2018-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 7.3.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-7-2018-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 8.2.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-8-2018-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 8.2.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-8-2018-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 8.3.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-8-2019-q3-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 8.3.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-8-2019-q3-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 9.2.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-9-2019-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 9.2.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-9-2019-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 9.3.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-9-2020-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 9.3.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-9-2020-q2-update -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 10.2.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-10-2020-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 10.2.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-10-2020-q4-major -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 10.3.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-10.3-2021.10 -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 10.3.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-none-eabi-10.3-2021.10 -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 11.2.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 11.2.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 11.3.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 11.3.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 12.2.1 Debug
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_TOOLCHAIN_PATH=/opt/arm/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
||||
- name: GCC 12.2.1 Release
|
||||
if: always()
|
||||
shell: bash
|
||||
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_TOOLCHAIN_PATH=/opt/arm/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
|
||||
|
72
.github/workflows/scripts/generate_multi_gcc_workflow.py
vendored
Executable file
72
.github/workflows/scripts/generate_multi_gcc_workflow.py
vendored
Executable file
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
from collections import OrderedDict
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
toolchain_dir = "/opt/arm"
|
||||
toolchains = os.listdir(toolchain_dir)
|
||||
|
||||
gcc_versions = OrderedDict()
|
||||
|
||||
for toolchain in toolchains:
|
||||
fullpath = os.path.join(toolchain_dir, toolchain)
|
||||
gcc_path = os.path.join(fullpath, "bin/arm-none-eabi-gcc")
|
||||
version = subprocess.run([gcc_path, "--version"], capture_output=True)
|
||||
stdout = version.stdout.decode('utf-8')
|
||||
stderr = version.stderr.decode('utf-8')
|
||||
assert(len(stderr) == 0)
|
||||
# Version should be on first line
|
||||
version_line = stdout.split("\n")[0]
|
||||
m = re.search("(\d+\.\d+\.\d+)", version_line)
|
||||
assert(m is not None)
|
||||
version = m.group(1)
|
||||
|
||||
if version in gcc_versions:
|
||||
raise Exception("Already have version {} in versions current path {}, this path {}".format(version, gcc_versions[version], fullpath))
|
||||
|
||||
gcc_versions[version] = fullpath
|
||||
|
||||
# Sort by major version
|
||||
gcc_versions_sorted = OrderedDict(sorted(gcc_versions.items(), key=lambda item: int(item[0].replace(".", ""))))
|
||||
|
||||
|
||||
# Create output
|
||||
output = '''
|
||||
name: Multi GCC
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'test_workflow'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository_owner == 'raspberrypi'
|
||||
runs-on: [self-hosted, Linux, X64]
|
||||
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
run: |
|
||||
echo "Cleaning up previous run"
|
||||
rm -rf "${{ github.workspace }}"
|
||||
mkdir -p "${{ github.workspace }}"
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init
|
||||
'''
|
||||
|
||||
for gcc_version, toolchain_path in gcc_versions_sorted.items():
|
||||
for build_type in ["Debug", "Release"]:
|
||||
output += "\n"
|
||||
output += " - name: GCC {} {}\n".format(gcc_version, build_type)
|
||||
output += " if: always()\n"
|
||||
output += " shell: bash\n"
|
||||
output += " run: cd ${{{{github.workspace}}}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE={} -DPICO_TOOLCHAIN_PATH={} -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)\n".format(build_type, toolchain_path)
|
||||
|
||||
print(output)
|
32
.github/workflows/windows.yml
vendored
Normal file
32
.github/workflows/windows.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: Build on Windows
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'develop'
|
||||
- 'master'
|
||||
- 'test_workflow'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Cleaning up previous run"
|
||||
rm -rf "${{ github.workspace }}/pico-sdk"
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init
|
||||
- name: Install dependencies
|
||||
run: choco install .github/workflows/choco_packages.config
|
||||
|
||||
- name: Build Project
|
||||
shell: pwsh
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G Ninja -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_BOARD=pico_w
|
||||
cmake --build .
|
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,5 +1,13 @@
|
|||
.idea
|
||||
.vscode
|
||||
cmake-*
|
||||
.cache
|
||||
.DS_Store
|
||||
build
|
||||
build-*
|
||||
|
||||
bazel-*
|
||||
|
||||
# Ignore until https://github.com/bazelbuild/bazel/issues/20369 is fixed.
|
||||
MODULE.bazel.lock
|
||||
__pycache__/
|
||||
|
|
6
.gitmodules
vendored
6
.gitmodules
vendored
|
@ -7,3 +7,9 @@
|
|||
[submodule "lib/lwip"]
|
||||
path = lib/lwip
|
||||
url = https://github.com/lwip-tcpip/lwip.git
|
||||
[submodule "lib/mbedtls"]
|
||||
path = lib/mbedtls
|
||||
url = https://github.com/Mbed-TLS/mbedtls.git
|
||||
[submodule "lib/btstack"]
|
||||
path = lib/btstack
|
||||
url = https://github.com/bluekitchen/btstack.git
|
||||
|
|
0
BUILD.bazel
Normal file
0
BUILD.bazel
Normal file
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.13)
|
||||
cmake_minimum_required(VERSION 3.13...3.27)
|
||||
|
||||
# Note: this CMakeLists.txt can be used as a top-level CMakeLists.txt for the SDK itself. For all other uses
|
||||
# it is included as a subdirectory via the pico_sdk_init() method provided by pico_sdk_init.cmake
|
||||
|
@ -9,6 +9,18 @@ if (NOT TARGET _pico_sdk_inclusion_marker)
|
|||
|
||||
project(pico_sdk C CXX ASM)
|
||||
|
||||
string(REGEX MATCH "Clang" PICO_C_COMPILER_IS_CLANG "${CMAKE_C_COMPILER_ID}")
|
||||
string(REGEX MATCH "GNU" PICO_C_COMPILER_IS_GNU "${CMAKE_C_COMPILER_ID}")
|
||||
string(REGEX MATCH "IAR" PICO_C_COMPILER_IS_IAR "${CMAKE_C_COMPILER_ID}")
|
||||
pico_register_common_scope_var(PICO_C_COMPILER_IS_CLANG)
|
||||
pico_register_common_scope_var(PICO_C_COMPILER_IS_GNU)
|
||||
pico_register_common_scope_var(PICO_C_COMPILER_IS_IAR)
|
||||
pico_register_common_scope_var(PICO_SDK_VERSION_MAJOR)
|
||||
pico_register_common_scope_var(PICO_SDK_VERSION_MINOR)
|
||||
pico_register_common_scope_var(PICO_SDK_VERSION_REVISION)
|
||||
pico_register_common_scope_var(PICO_SDK_VERSION_PRE_RELEASE_ID)
|
||||
pico_register_common_scope_var(PICO_SDK_VERSION_STRING)
|
||||
|
||||
message("Build type is ${CMAKE_BUILD_TYPE}")
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
if (PICO_DEOPTIMIZED_DEBUG)
|
||||
|
@ -31,6 +43,9 @@ if (NOT TARGET _pico_sdk_inclusion_marker)
|
|||
add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS)
|
||||
add_sub_list_files(PICO_SDK_PRE_LIST_FILES)
|
||||
|
||||
# needed by certain functions
|
||||
set(PICO_TOOLS_DIR "${CMAKE_CURRENT_LIST_DIR}/tools" CACHE INTERNAL "")
|
||||
|
||||
add_subdirectory(tools)
|
||||
add_subdirectory(src)
|
||||
|
||||
|
@ -54,4 +69,3 @@ if (NOT TARGET _pico_sdk_inclusion_marker)
|
|||
pico_promote_common_scope_vars()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ We use GitHub to host code, track [issues](https://github.com/raspberrypi/pico-s
|
|||
|
||||
In order to contribute new or updated code, you must first create a GitHub account and fork the original repository to your own account. You can make changes, save them in your repository, then [make a pull request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) against this repository. The pull request will appear [in the repository](https://github.com/raspberrypi/pico-sdk/pulls) where it can be assessed by the maintainers, and if appropriate, merged with the official repository.
|
||||
|
||||
**NOTE:** Development takes place on the `develop` branch in this repository. Please open your https://github.com/raspberrypi/pico-sdk/pulls[pull request] (PR) against the [`develop`](https://github.com/raspberrypi/pico-sdk/tree/develop) branch, pull requests against the `master` branch will automatically CI fail checks and will not be accepted. You will be asked to rebase your PR against `develop` and if you do not do so, your PR will be closed.
|
||||
**NOTE:** Development takes place on the `develop` branch in this repository. Please open your [pull request](https://github.com/raspberrypi/pico-sdk/pulls) (PR) against the [`develop`](https://github.com/raspberrypi/pico-sdk/tree/develop) branch, pull requests against the `master` branch will automatically CI fail checks and will not be accepted. You will be asked to rebase your PR against `develop` and if you do not do so, your PR will be closed.
|
||||
|
||||
While we are happy to take contributions, big or small, changes in the SDK may have knock-on effects in other places so it is possible that apparently benign pull requests that make seemingly small changes could be refused.
|
||||
|
||||
|
@ -22,4 +22,4 @@ If you are contributing new or updated code please match the existing code style
|
|||
|
||||
### Licensing
|
||||
|
||||
Code in this repository is lisensed under the [BSD-3 License](LICENSE.TXT). By contributing content to this repository you are agreeing to place your contributions under this licence.
|
||||
Code in this repository is licensed under the [BSD-3 License](LICENSE.TXT). By contributing content to this repository you are agreeing to place your contributions under this license.
|
||||
|
|
150
MODULE.bazel
Normal file
150
MODULE.bazel
Normal file
|
@ -0,0 +1,150 @@
|
|||
module(
|
||||
name = "pico-sdk",
|
||||
version = "2.1.0",
|
||||
)
|
||||
|
||||
bazel_dep(name = "platforms", version = "0.0.9")
|
||||
bazel_dep(name = "bazel_skylib", version = "1.6.1")
|
||||
bazel_dep(name = "rules_python", version = "0.36.0")
|
||||
bazel_dep(name = "picotool", version = "2.1.0")
|
||||
bazel_dep(name = "rules_cc", version = "0.0.10")
|
||||
|
||||
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
http_archive(
|
||||
name = "arm_gcc_linux-aarch64",
|
||||
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
|
||||
sha256 = "8fd8b4a0a8d44ab2e195ccfbeef42223dfb3ede29d80f14dcf2183c34b8d199a",
|
||||
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-aarch64-arm-none-eabi",
|
||||
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-aarch64-arm-none-eabi.tar.xz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "arm_gcc_linux-x86_64",
|
||||
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
|
||||
sha256 = "6cd1bbc1d9ae57312bcd169ae283153a9572bd6a8e4eeae2fedfbc33b115fdbb",
|
||||
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi",
|
||||
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "arm_gcc_win-x86_64",
|
||||
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
|
||||
sha256 = "51d933f00578aa28016c5e3c84f94403274ea7915539f8e56c13e2196437d18f",
|
||||
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi",
|
||||
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-eabi.zip",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "arm_gcc_mac-x86_64",
|
||||
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
|
||||
sha256 = "075faa4f3e8eb45e59144858202351a28706f54a6ec17eedd88c9fb9412372cc",
|
||||
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-darwin-x86_64-arm-none-eabi",
|
||||
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.tar.xz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "arm_gcc_mac-aarch64",
|
||||
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
|
||||
sha256 = "39c44f8af42695b7b871df42e346c09fee670ea8dfc11f17083e296ea2b0d279",
|
||||
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-darwin-arm64-arm-none-eabi",
|
||||
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-arm64-arm-none-eabi.tar.xz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "clang_linux-x86_64",
|
||||
build_file = "//bazel/toolchain:clang.BUILD",
|
||||
sha256 = "6c599d1aba568236064c340d7813324849896d5a4e2f3fd8225a8c31bfcbf884",
|
||||
type = "zip",
|
||||
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/linux-amd64/+/git_revision:2b0a708f41dd6291ee744704d43febc975e3d026",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "clang_win-x86_64",
|
||||
build_file = "//bazel/toolchain:clang.BUILD",
|
||||
sha256 = "f49ba4123ee3958f2b47289d017a5b3f1ca01f82dd7a2168c45412c18101fd13",
|
||||
type = "zip",
|
||||
# Windows doesn't like `:` in the produced filename, so replace it with `%3A`.
|
||||
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/windows-amd64/+/git_revision:2b0a708f41dd6291ee744704d43febc975e3d026".replace("git_revision:", "git_revision%3A"),
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "clang_mac-x86_64",
|
||||
build_file = "//bazel/toolchain:clang.BUILD",
|
||||
sha256 = "d3516f2eb4c12d17ae77ee84c9226fbea581d4fb806910ceac4717d5adfcf748",
|
||||
type = "zip",
|
||||
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-amd64/+/git_revision:2b0a708f41dd6291ee744704d43febc975e3d026",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "clang_mac-aarch64",
|
||||
build_file = "//bazel/toolchain:clang.BUILD",
|
||||
sha256 = "68e551f41c7e9473063b09819f6ab8ec6e7e53677f4078189656cb14dc52984b",
|
||||
type = "zip",
|
||||
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-arm64/+/git_revision:2b0a708f41dd6291ee744704d43febc975e3d026",
|
||||
)
|
||||
|
||||
new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
|
||||
|
||||
# TODO: Provide tinyusb as a proper Bazel module.
|
||||
new_git_repository(
|
||||
name = "tinyusb",
|
||||
build_file = "//src/rp2_common/tinyusb:tinyusb.BUILD",
|
||||
commit = "5217cee5de4cd555018da90f9f1bcc87fb1c1d3a", # keep-in-sync-with-submodule: lib/tinyusb
|
||||
remote = "https://github.com/hathach/tinyusb.git",
|
||||
)
|
||||
|
||||
# TODO: Provide btstack as a proper Bazel module.
|
||||
new_git_repository(
|
||||
name = "btstack",
|
||||
build_file = "//src/rp2_common/pico_btstack:btstack.BUILD",
|
||||
commit = "2b49e57bd1fae85ac32ac1f41cdb7c794de335f6", # keep-in-sync-with-submodule: lib/btstack
|
||||
remote = "https://github.com/bluekitchen/btstack.git",
|
||||
)
|
||||
|
||||
# TODO: Provide cyw43-driver as a proper Bazel module.
|
||||
new_git_repository(
|
||||
name = "cyw43-driver",
|
||||
build_file = "//src/rp2_common/pico_cyw43_driver:cyw43-driver.BUILD",
|
||||
commit = "cf924bb04c8984675ca0fc2178f082e404e048c3", # keep-in-sync-with-submodule: lib/cyw43-driver
|
||||
remote = "https://github.com/georgerobotics/cyw43-driver.git",
|
||||
)
|
||||
|
||||
# TODO: Provide lwip as a proper Bazel module.
|
||||
new_git_repository(
|
||||
name = "lwip",
|
||||
build_file = "//src/rp2_common/pico_lwip:lwip.BUILD",
|
||||
commit = "0a0452b2c39bdd91e252aef045c115f88f6ca773", # keep-in-sync-with-submodule: lib/lwip
|
||||
remote = "https://github.com/lwip-tcpip/lwip.git",
|
||||
)
|
||||
|
||||
register_toolchains(
|
||||
"//bazel/toolchain:linux-aarch64-rp2040",
|
||||
"//bazel/toolchain:linux-aarch64-rp2350",
|
||||
"//bazel/toolchain:linux-x86_64-rp2040",
|
||||
"//bazel/toolchain:linux-x86_64-rp2350",
|
||||
"//bazel/toolchain:win-x86_64-rp2040",
|
||||
"//bazel/toolchain:win-x86_64-rp2350",
|
||||
"//bazel/toolchain:mac-x86_64-rp2040",
|
||||
"//bazel/toolchain:mac-x86_64-rp2350",
|
||||
"//bazel/toolchain:mac-aarch64-rp2040",
|
||||
"//bazel/toolchain:mac-aarch64-rp2350",
|
||||
# Require users to opt-in to the Pico SDK's toolchains.
|
||||
dev_dependency = True,
|
||||
)
|
||||
|
||||
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
|
||||
python.toolchain(
|
||||
configure_coverage_tool = True,
|
||||
python_version = "3.9",
|
||||
)
|
||||
|
||||
use_repo(python, "pythons_hub")
|
||||
register_toolchains(
|
||||
"@pythons_hub//:all",
|
||||
dev_dependency = True,
|
||||
)
|
||||
register_toolchains(
|
||||
"@rules_python//python/runtime_env_toolchains:all",
|
||||
dev_dependency = True,
|
||||
)
|
67
README.md
67
README.md
|
@ -1,28 +1,31 @@
|
|||
# Raspberry Pi Pico SDK
|
||||
|
||||
The Raspberry Pi Pico SDK (henceforth the SDK) provides the headers, libraries and build system
|
||||
necessary to write programs for the RP2040-based devices such as the Raspberry Pi Pico
|
||||
necessary to write programs for the RP-series microcontroller-based devices such as the Raspberry Pi Pico or Raspberry Pi Pico 2
|
||||
in C, C++ or assembly language.
|
||||
|
||||
The SDK is designed to provide an API and programming environment that is familiar both to non-embedded C developers and embedded C developers alike.
|
||||
A single program runs on the device at a time and starts with a conventional `main()` method. Standard C/C++ libraries are supported along with
|
||||
C level libraries/APIs for accessing all of the RP2040's hardware include PIO (Programmable IO).
|
||||
C-level libraries/APIs for accessing all of the RP-series microcontroller's hardware including PIO (Programmable IO).
|
||||
|
||||
Additionally the SDK provides higher level libraries for dealing with timers, synchronization, USB (TinyUSB) and multi-core programming
|
||||
along with various utilities.
|
||||
Additionally, the SDK provides higher level libraries for dealing with timers, synchronization, Wi-Fi and Bluetooth networking, USB and multicore programming. These libraries should be comprehensive enough that your application code rarely, if at all, needs to access hardware registers directly. However, if you do need or prefer to access the raw hardware registers, you will also find complete and fully-commented register definition headers in the SDK. There's no need to look up addresses in the datasheet.
|
||||
|
||||
The SDK can be used to build anything from simple applications, to fully fledged runtime environments such as MicroPython, to low level software
|
||||
such as RP2040's on-chip bootrom itself.
|
||||
The SDK can be used to build anything from simple applications, fully-fledged runtime environments such as MicroPython, to low level software
|
||||
such as the RP-series microcontroller's on-chip bootrom itself.
|
||||
|
||||
The design goal for entire SDK is to be simple but powerful.
|
||||
|
||||
Additional libraries/APIs that are not yet ready for inclusion in the SDK can be found in [pico-extras](https://github.com/raspberrypi/pico-extras).
|
||||
|
||||
# Documentation
|
||||
|
||||
See [Getting Started with the Raspberry Pi Pico](https://rptl.io/pico-get-started) for information on how to setup your
|
||||
hardware, IDE/environment and for how to build and debug software for the Raspberry Pi Pico
|
||||
and other RP2040-based devices.
|
||||
See [Getting Started with the Raspberry Pi Pico-Series](https://rptl.io/pico-get-started) for information on how to setup your
|
||||
hardware, IDE/environment and how to build and debug software for the Raspberry Pi Pico and other RP-series microcontroller based devices.
|
||||
|
||||
See [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk) to learn more about programming using the
|
||||
See [Connecting to the Internet with Raspberry Pi Pico W](https://rptl.io/picow-connect) to learn more about writing
|
||||
applications for your Raspberry Pi Pico W that connect to the internet.
|
||||
|
||||
See [Raspberry Pi Pico-Series C/C++ SDK](https://rptl.io/pico-c-sdk) to learn more about programming using the
|
||||
SDK, to explore more advanced features, and for complete PDF-based API documentation.
|
||||
|
||||
See [Online Raspberry Pi Pico SDK API docs](https://rptl.io/pico-doxygen) for HTML-based API documentation.
|
||||
|
@ -31,14 +34,26 @@ See [Online Raspberry Pi Pico SDK API docs](https://rptl.io/pico-doxygen) for HT
|
|||
|
||||
See [pico-examples](https://github.com/raspberrypi/pico-examples) for example code you can build.
|
||||
|
||||
# Getting the latest SDK code
|
||||
|
||||
The [master](https://github.com/raspberrypi/pico-sdk/tree/master/) branch of `pico-sdk` on GitHub contains the
|
||||
_latest stable release_ of the SDK. If you need or want to test upcoming features, you can try the
|
||||
[develop](https://github.com/raspberrypi/pico-sdk/tree/develop/) branch instead.
|
||||
|
||||
# Quick-start your own project
|
||||
|
||||
These instructions are extremely terse, and Linux-based only. For detailed steps,
|
||||
instructions for other platforms, and just in general, we recommend you see [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk)
|
||||
## Using Visual Studio Code
|
||||
|
||||
1. Install CMake (at least version 3.13), and GCC cross compiler
|
||||
You can install the [Raspberry Pi Pico Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=raspberry-pi.raspberry-pi-pico) in VS Code.
|
||||
|
||||
## Unix command line
|
||||
|
||||
These instructions are extremely terse, and Linux-based only. For detailed steps,
|
||||
instructions for other platforms, and just in general, we recommend you see [Raspberry Pi Pico-Series C/C++ SDK](https://rptl.io/pico-c-sdk)
|
||||
|
||||
1. Install CMake (at least version 3.13), python 3, a native compiler, and a GCC cross compiler
|
||||
```
|
||||
sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
|
||||
sudo apt install cmake python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
|
||||
```
|
||||
1. Set up your project to point to use the Raspberry Pi Pico SDK
|
||||
|
||||
|
@ -50,7 +65,7 @@ instructions for other platforms, and just in general, we recommend you see [Ras
|
|||
3. Setup a `CMakeLists.txt` like:
|
||||
|
||||
```cmake
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
cmake_minimum_required(VERSION 3.13...3.27)
|
||||
|
||||
# initialize the SDK based on PICO_SDK_PATH
|
||||
# note: this must happen before project()
|
||||
|
@ -70,7 +85,7 @@ instructions for other platforms, and just in general, we recommend you see [Ras
|
|||
1. Setup a `CMakeLists.txt` like:
|
||||
|
||||
```cmake
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
cmake_minimum_required(VERSION 3.13...3.27)
|
||||
|
||||
# initialize pico-sdk from submodule
|
||||
# note: this must happen before project()
|
||||
|
@ -128,7 +143,7 @@ instructions for other platforms, and just in general, we recommend you see [Ras
|
|||
# rest of your project
|
||||
|
||||
```
|
||||
1. Write your code (see [pico-examples](https://github.com/raspberrypi/pico-examples) or the [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk) documentation for more information)
|
||||
1. Write your code (see [pico-examples](https://github.com/raspberrypi/pico-examples) or the [Raspberry Pi Pico-Series C/C++ SDK](https://rptl.io/pico-c-sdk) documentation for more information)
|
||||
|
||||
About the simplest you can do is a single source file (e.g. hello_world.c)
|
||||
|
||||
|
@ -137,7 +152,7 @@ instructions for other platforms, and just in general, we recommend you see [Ras
|
|||
#include "pico/stdlib.h"
|
||||
|
||||
int main() {
|
||||
setup_default_uart();
|
||||
stdio_init_all();
|
||||
printf("Hello, world!\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -159,7 +174,6 @@ instructions for other platforms, and just in general, we recommend you see [Ras
|
|||
Note this example uses the default UART for _stdout_;
|
||||
if you want to use the default USB see the [hello-usb](https://github.com/raspberrypi/pico-examples/tree/master/hello_world/usb) example.
|
||||
|
||||
|
||||
1. Setup a CMake build directory.
|
||||
For example, if not using an IDE:
|
||||
```
|
||||
|
@ -168,9 +182,22 @@ instructions for other platforms, and just in general, we recommend you see [Ras
|
|||
$ cmake ..
|
||||
```
|
||||
|
||||
When building for a board other than the Raspberry Pi Pico, you should pass `-DPICO_BOARD=board_name` to the `cmake` command above, e.g. `cmake -DPICO_BOARD=pico2 ..` or `cmake -DPICO_BOARD=pico_w ..` to configure the SDK and build options accordingly for that particular board.
|
||||
|
||||
Specifying `PICO_BOARD=<booardname>` sets up various compiler defines (e.g. default pin numbers for UART and other hardware) and in certain
|
||||
cases also enables the use of additional libraries (e.g. wireless support when building for `PICO_BOARD=pico_w`) which cannot
|
||||
be built without a board which provides the requisite hardware functionality.
|
||||
|
||||
For a list of boards defined in the SDK itself, look in [this directory](src/boards/include/boards) which has a
|
||||
header for each named board.
|
||||
|
||||
1. Make your target from the build directory you created.
|
||||
```sh
|
||||
$ make hello_world
|
||||
```
|
||||
|
||||
1. You now have `hello_world.elf` to load via a debugger, or `hello_world.uf2` that can be installed and run on your Raspberry Pi Pico via drag and drop.
|
||||
1. You now have `hello_world.elf` to load via a debugger, or `hello_world.uf2` that can be installed and run on your Raspberry Pi Pico-series device via drag and drop.
|
||||
|
||||
# RISC-V support on RP2350
|
||||
|
||||
See [Raspberry Pi Pico-series C/C++ SDK](https://rptl.io/pico-c-sdk) for information on setting up a build environment for RISC-V on RP2350.
|
||||
|
|
0
WORKSPACE
Normal file
0
WORKSPACE
Normal file
63
bazel/BUILD.bazel
Normal file
63
bazel/BUILD.bazel
Normal file
|
@ -0,0 +1,63 @@
|
|||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
py_binary(
|
||||
name = "generate_version_header",
|
||||
srcs = ["generate_version_header.py"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
# This isn't actually generated, it just uses the same name
|
||||
# to make it show up easier in searches.
|
||||
#
|
||||
# Rather than generating lists of headers to match CMake, the Bazel build
|
||||
# opts to have a static header that transitively include two known headers.
|
||||
# By default, empty header files are included, and users/platforms are expected
|
||||
# to specify an appropriate `cc_library` to replace them.
|
||||
#
|
||||
# You tell bazel which `cc_library` provides the respective headers by
|
||||
# configuring these `label_flag`s:
|
||||
#
|
||||
# # Specify the library that provides "pico_config_extra_headers.h"
|
||||
# --@pico-sdk//bazel/config:PICO_CONFIG_EXTRA_HEADER=//my_proj:my_custom_headers
|
||||
#
|
||||
# # Specify the library that provides "pico_config_platform_headers.h"
|
||||
# --@pico-sdk//bazel/config:PICO_CONFIG_PLATFORM_HEADER=//my_proj:my_custom_platform_headers
|
||||
cc_library(
|
||||
name = "generate_config_header",
|
||||
hdrs = ["include/pico/config_autogen.h"],
|
||||
includes = ["include"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//bazel/config:PICO_CONFIG_EXTRA_HEADER",
|
||||
"//bazel/config:PICO_CONFIG_PLATFORM_HEADER",
|
||||
],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "empty_extra_headers_file",
|
||||
outs = ["generated_extra_include/pico_config_extra_headers.h"],
|
||||
cmd = "echo > $@",
|
||||
cmd_bat = "copy NUL $@",
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "no_extra_headers",
|
||||
hdrs = ["generated_extra_include/pico_config_extra_headers.h"],
|
||||
includes = ["generated_extra_include"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
# An empty stub, useful for label_flag flags that need to point to a library,
|
||||
# but for some purposes the library needs to be a no-op.
|
||||
cc_library(
|
||||
name = "empty_cc_lib",
|
||||
)
|
||||
|
||||
# A library incompatible with everything. Use to mark an invalid configuration.
|
||||
cc_library(
|
||||
name = "incompatible_cc_lib",
|
||||
target_compatible_with = ["@platforms//:incompatible"],
|
||||
)
|
115
bazel/README.md
Normal file
115
bazel/README.md
Normal file
|
@ -0,0 +1,115 @@
|
|||
# Bazel build
|
||||
|
||||
## Using the Pico SDK in a Bazel project.
|
||||
|
||||
### Add pico-sdk as a dependency
|
||||
First, in your `MODULE.bazel` file, add a dependency on the Pico SDK and
|
||||
`rules_cc`:
|
||||
```python
|
||||
bazel_dep(name = "pico-sdk", version = "2.1.0")
|
||||
```
|
||||
|
||||
### Register toolchains
|
||||
These toolchains tell Bazel how to compile for ARM cores. Add the following
|
||||
to the `MODULE.bazel` for your project:
|
||||
```python
|
||||
register_toolchains(
|
||||
"@pico-sdk//bazel/toolchain:linux-x86_64-rp2040",
|
||||
"@pico-sdk//bazel/toolchain:linux-x86_64-rp2350",
|
||||
"@pico-sdk//bazel/toolchain:win-x86_64-rp2040",
|
||||
"@pico-sdk//bazel/toolchain:win-x86_64-rp2350",
|
||||
"@pico-sdk//bazel/toolchain:mac-x86_64-rp2040",
|
||||
"@pico-sdk//bazel/toolchain:mac-x86_64-rp2350",
|
||||
"@pico-sdk//bazel/toolchain:mac-aarch64-rp2040",
|
||||
"@pico-sdk//bazel/toolchain:mac-aarch64-rp2350",
|
||||
)
|
||||
```
|
||||
|
||||
### Ready to build!
|
||||
You're now ready to start building Pico Projects in Bazel! When building,
|
||||
don't forget to specify `--platforms` so Bazel knows you're targeting the
|
||||
Raspberry Pi Pico:
|
||||
```console
|
||||
$ bazelisk build --platforms=@pico-sdk//bazel/platform:rp2040 //...
|
||||
```
|
||||
|
||||
## SDK configuration
|
||||
An exhaustive list of build system configuration options is available in
|
||||
`//bazel/config:BUILD.bazel`.
|
||||
|
||||
### Selecting a different board
|
||||
A different board can be selected specifying `--@pico-sdk//bazel/config:PICO_BOARD`:
|
||||
```console
|
||||
$ bazelisk build --platforms=//bazel/platform:rp2040 --@pico-sdk//bazel/config:PICO_BOARD=pico_w //...
|
||||
```
|
||||
|
||||
If you have a bespoke board definition, you can configure the Pico SDK to use it
|
||||
by pointing `--@pico-sdk//bazel/config:PICO_CONFIG_HEADER` to a `cc_library`
|
||||
that defines `PICO_BOARD` and either a `PICO_CONFIG_HEADER` define or a
|
||||
`pico/config_autogen.h` header. Make sure any required `includes`, `hdrs`, and
|
||||
`deps` are also provided.
|
||||
|
||||
## Generating UF2 firmware images
|
||||
Creation of UF2 images can be done as explicit build steps on a per-binary
|
||||
rule basis, or through an aspect. Running a wildcard build with the
|
||||
`pico_uf2_aspect` enabled is the easiest way to create a UF2 for every ELF
|
||||
firmware image.
|
||||
|
||||
```console
|
||||
$ bazelisk build --platforms=@pico-sdk//bazel/platform:rp2040 \
|
||||
--aspects @pico-sdk//tools:uf2_aspect.bzl%pico_uf2_aspect \
|
||||
--output_groups=+pico_uf2_files \
|
||||
//...
|
||||
```
|
||||
|
||||
## Building the Pico SDK itself
|
||||
|
||||
### First time setup
|
||||
You'll need Bazel (v7.0.0 or higher) or Bazelisk (a self-updating Bazel
|
||||
launcher) to build the Pico SDK.
|
||||
|
||||
We strongly recommend you set up
|
||||
[Bazelisk](https://bazel.build/install/bazelisk).
|
||||
|
||||
You will also need a working compiler configured if you wish to build Picotool
|
||||
or pioasm.
|
||||
|
||||
* Linux: `sudo apt-get install build-essential` or similar.
|
||||
* macOS: `xcode-select --install`
|
||||
* Windows: [Install MSVC](https://visualstudio.microsoft.com/vs/features/cplusplus/)
|
||||
|
||||
### Building
|
||||
To build all of the Pico SDK, run the following command:
|
||||
```console
|
||||
$ bazelisk build --platforms=//bazel/platform:rp2040 //...
|
||||
```
|
||||
|
||||
## Known issues and limitations
|
||||
The Bazel build for the Pico SDK is relatively new, but most features and
|
||||
configuration options available in the CMake build are also available in Bazel.
|
||||
You are welcome and encouraged to file issues for any problems and limitations
|
||||
you encounter along the way.
|
||||
|
||||
Currently, the following features are not supported:
|
||||
|
||||
* Pico W wireless libraries work, but may not have complete feature parity with
|
||||
the CMake build.
|
||||
* Bazel does not yet provide RISC-V support for Pico 2/RP2350.
|
||||
* The pioasm parser cannot be built from source via Bazel.
|
||||
* Windows MSVC wildcard build (`bazel build //...`) does not work when targeting
|
||||
host.
|
||||
|
||||
## Contributing
|
||||
When making changes to the Bazel build, please run the Bazel validation script
|
||||
to ensure all supported configurations build properly:
|
||||
|
||||
```console
|
||||
$ ./tools/run_all_bazel_checks.py
|
||||
```
|
||||
|
||||
If you need to check against a local version of Picotool, you can run the script
|
||||
with `--picotool-dir`:
|
||||
|
||||
```console
|
||||
$ ./tools/run_all_bazel_checks.py --picotool-dir=/path/to/picotool
|
||||
```
|
290
bazel/config/BUILD.bazel
Normal file
290
bazel/config/BUILD.bazel
Normal file
|
@ -0,0 +1,290 @@
|
|||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "int_flag", "string_flag")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_TOOLCHAIN, The toolchain to use, type=string, default=gcc, group=build
|
||||
string_flag(
|
||||
name = "PICO_TOOLCHAIN",
|
||||
build_setting_default = "gcc",
|
||||
values = [
|
||||
"gcc",
|
||||
"clang",
|
||||
],
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_BOARD, Board name being built for, type=string, default=pico or pico2, group=build, docref=cmake-platform-board-config
|
||||
string_flag(
|
||||
name = "PICO_BOARD",
|
||||
build_setting_default = "pico",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_BARE_METAL, Flag to exclude anything except base headers from the build, type=bool, default=0, group=build
|
||||
bool_flag(
|
||||
name = "PICO_BARE_METAL",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_NO_GC_SECTIONS, Disable `-ffunction-sections` `-fdata-sections` and `--gc-sections`, type=bool, default=0, advanced=true, group=pico_standard_link
|
||||
bool_flag(
|
||||
name = "PICO_NO_GC_SECTIONS",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_DEFAULT_BOOT_STAGE2_FILE, Boot stage 2 file to use; this should point to a filegroup with the .S file to use, type=string, group=build
|
||||
label_flag(
|
||||
name = "PICO_DEFAULT_BOOT_STAGE2_FILE",
|
||||
build_setting_default = "//src/rp2_common:build_selected_boot2",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_DEFAULT_BOOT_STAGE2, Simpler alternative to specifying PICO_DEFAULT_BOOT_STAGE2_FILE where the latter is set to src/rp2_common/boot_stage2/{PICO_DEFAULT_BOOT_STAGE2}.S, type=string, default=compile_time_choice, group=build
|
||||
string_flag(
|
||||
name = "PICO_DEFAULT_BOOT_STAGE2",
|
||||
build_setting_default = "compile_time_choice",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_BOOT_STAGE2_LINK_IMAGE, [Bazel only] The final boot_stage2 image target to link in. Use this to fully override/replace boot_stage2, default=@pico-sdk//src/rp2_common:boot_stage2, group=build
|
||||
label_flag(
|
||||
name = "PICO_BOOT_STAGE2_LINK_IMAGE",
|
||||
build_setting_default = "//src/rp2_common:boot_stage2",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_CXX_ENABLE_EXCEPTIONS, Enable CXX exception handling, type=bool, default=0, group=pico_cxx_options
|
||||
bool_flag(
|
||||
name = "PICO_CXX_ENABLE_EXCEPTIONS",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_CXX_ENABLE_RTTI, Enable CXX rtti, type=bool, default=0, group=pico_cxx_options
|
||||
bool_flag(
|
||||
name = "PICO_CXX_ENABLE_RTTI",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_CXX_ENABLE_CXA_ATEXIT, Enable cxa-atexit, type=bool, default=0, group=pico_cxx_options
|
||||
bool_flag(
|
||||
name = "PICO_CXX_ENABLE_CXA_ATEXIT",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_STDIO_UART, Option to globally enable stdio UART for all targets by default, type=bool, default=1, group=pico_stdlib
|
||||
bool_flag(
|
||||
name = "PICO_STDIO_UART",
|
||||
build_setting_default = True,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_DEFAULT_UART_BAUD_RATE, Define the default UART baudrate, type=int, max=921600, default=115200, group=hardware_uart
|
||||
int_flag(
|
||||
name = "PICO_DEFAULT_UART_BAUD_RATE",
|
||||
build_setting_default = 115200,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_STDIO_USB, Option to globally enable stdio USB for all targets by default, type=bool, default=0, group=pico_stdlib
|
||||
bool_flag(
|
||||
name = "PICO_STDIO_USB",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_STDIO_SEMIHOSTING, Option to globally enable stdio semi-hosting for all targets by default, type=bool, default=0, group=pico_stdlib
|
||||
bool_flag(
|
||||
name = "PICO_STDIO_SEMIHOSTING",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_STDIO_RTT, Option to globally enable stdio RTT for all targets by default, type=bool, default=0, group=pico_stdlib
|
||||
bool_flag(
|
||||
name = "PICO_STDIO_RTT",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_MULTICORE_ENABLED, OPTION: Enable multicore handling, type=bool, default=1, group=pico_stdlib
|
||||
bool_flag(
|
||||
name = "PICO_MULTICORE_ENABLED",
|
||||
build_setting_default = True,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_DEFAULT_DOUBLE_IMPL, The default implementation for pico_double to link. auto selects an appropriate default for the current platform. rp2040 is only supported on the rp2040. dcp is only supported on rp2350, type=string, default=auto, group=build
|
||||
string_flag(
|
||||
name = "PICO_DEFAULT_DOUBLE_IMPL",
|
||||
build_setting_default = "auto",
|
||||
values = [
|
||||
"auto",
|
||||
"compiler",
|
||||
"dcp",
|
||||
"rp2040",
|
||||
"none",
|
||||
],
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_DEFAULT_FLOAT_IMPL, The default implementation for pico_float to link. auto selects an appropriate default for the current platform. rp2040 is only supported on the rp2040. vfp and dcp are only supported on rp2350, type=string, default=auto, group=build
|
||||
string_flag(
|
||||
name = "PICO_DEFAULT_FLOAT_IMPL",
|
||||
build_setting_default = "auto",
|
||||
values = [
|
||||
"auto",
|
||||
"compiler",
|
||||
"dcp",
|
||||
"rp2040",
|
||||
"vfp",
|
||||
"none",
|
||||
],
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_DEFAULT_DIVIDER_IMPL, The default implementation for pico_divider to link. hardware uses accelerated divide instructions while compiler allows the compiler to decide how to handle divide instructions. auto uses the platform default (hardware on RP2040 and compiler on RP2350), type=string, default=auto, group=build
|
||||
string_flag(
|
||||
name = "PICO_DEFAULT_DIVIDER_IMPL",
|
||||
build_setting_default = "auto",
|
||||
values = [
|
||||
"auto",
|
||||
"hardware",
|
||||
"compiler",
|
||||
],
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_DEFAULT_PRINTF_IMPL, The default implementation for pico_printf to link. compiler lets the compiler control printf behavior while pico provides a pico-specific implementation, type=string, default=double, group=build
|
||||
string_flag(
|
||||
name = "PICO_DEFAULT_PRINTF_IMPL",
|
||||
build_setting_default = "pico",
|
||||
values = [
|
||||
"pico",
|
||||
"compiler",
|
||||
"none",
|
||||
],
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_ASYNC_CONTEXT_IMPL, The default implementation for pico_async_context to link, type=string, default=threadsafe_background, group=build
|
||||
string_flag(
|
||||
name = "PICO_ASYNC_CONTEXT_IMPL",
|
||||
build_setting_default = "threadsafe_background",
|
||||
values = [
|
||||
"poll",
|
||||
"threadsafe_background",
|
||||
"freertos",
|
||||
],
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_BINARY_INFO_ENABLED, Whether to include binary info in final firmware, type=bool, default=1, group=pico_stdlib
|
||||
bool_flag(
|
||||
name = "PICO_BINARY_INFO_ENABLED",
|
||||
build_setting_default = True,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_CMSIS_PATH, Label of a cc_ibrary providing CMSIS core, type=string, default="included stub CORE only impl", group=build
|
||||
label_flag(
|
||||
name = "PICO_CMSIS_PATH",
|
||||
build_setting_default = "//src/rp2_common/cmsis:cmsis_core",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_USE_DEFAULT_MAX_PAGE_SIZE, Don't shrink linker max page to 4096, type=bool, default=0, advanced=true, group=pico_standard_link
|
||||
bool_flag(
|
||||
name = "PICO_USE_DEFAULT_MAX_PAGE_SIZE",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS, Maximum number of milliseconds to wait during initialization for a CDC connection from the host (negative means indefinite) during initialization, type=int, default=0, group=pico_stdio_usb
|
||||
int_flag(
|
||||
name = "PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS",
|
||||
build_setting_default = 0,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_TINYUSB_LIB, [Bazel only] The library that provides TinyUSB, default=@tinyusb//:tinyusb, group=build
|
||||
label_flag(
|
||||
name = "PICO_TINYUSB_LIB",
|
||||
build_setting_default = "@tinyusb//:tinyusb",
|
||||
)
|
||||
|
||||
# TODO: Bazel build for mbedtls at @mbedtls//:mbedtls.
|
||||
# PICO_BAZEL_CONFIG: PICO_MBEDTLS_LIB, [Bazel only] The library that provides mbedtls, default=@mbedtls//:mbedtls, group=build
|
||||
label_flag(
|
||||
name = "PICO_MBEDTLS_LIB",
|
||||
build_setting_default = "//bazel:incompatible_cc_lib",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_DEFAULT_BINARY_INFO, [Bazel only] The library that provides custom_pico_binary_info to link into all binaries, default=//src/rp2_common/pico_standard_binary_info:default_binary_info, group=pico_standard_link
|
||||
label_flag(
|
||||
name = "PICO_DEFAULT_BINARY_INFO",
|
||||
build_setting_default = "//src/rp2_common/pico_standard_binary_info:default_binary_info",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_BAZEL_BUILD_TYPE, The type of build (e.g. Debug or Release) to embed in binary info, type=string, default=pico, group=build
|
||||
string_flag(
|
||||
name = "PICO_BAZEL_BUILD_TYPE",
|
||||
build_setting_default = "Debug",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_DEFAULT_LINKER_SCRIPT, [Bazel only] The library that provides a linker script to link into all binaries, default=//src/rp2_common/pico_crt0:default_linker_script, group=pico_standard_link
|
||||
label_flag(
|
||||
name = "PICO_DEFAULT_LINKER_SCRIPT",
|
||||
build_setting_default = "//src/rp2_common/pico_crt0:default_linker_script",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_NO_TARGET_NAME, Don't define PICO_TARGET_NAME, type=bool, default=0, group=build
|
||||
bool_flag(
|
||||
name = "PICO_NO_TARGET_NAME",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_CONFIG_EXTRA_HEADER, [Bazel only] The cc_library that provides "pico_config_extra_headers.h", default=//bazel:no_extra_headers, group=pico_base
|
||||
label_flag(
|
||||
name = "PICO_CONFIG_EXTRA_HEADER",
|
||||
build_setting_default = "//bazel:no_extra_headers",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_CONFIG_PLATFORM_HEADER, [Bazel only] The cc_library that provides "pico_config_platform_headers.h" and defines PICO_BOARD, default=//src/common/pico_base_headers:default_platform_headers, group=pico_base
|
||||
label_flag(
|
||||
name = "PICO_CONFIG_PLATFORM_HEADER",
|
||||
build_setting_default = "//src/boards:default",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_CONFIG_HEADER, [Bazel only] The cc_library that defines PICO_CONFIG_HEADER or pico/config_autogen.h and other SDK critical defines (overrides PICO_BOARD setting), default=//bazel:generate_config_header, group=pico_base
|
||||
label_flag(
|
||||
name = "PICO_CONFIG_HEADER",
|
||||
build_setting_default = "//bazel:generate_config_header",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_CLIB, [Bazel only] The flavor of libc porting layer to use. auto infers the correct value to use from PICO_TOOLCHAIN, group=pico_standard_link
|
||||
string_flag(
|
||||
name = "PICO_CLIB",
|
||||
build_setting_default = "auto",
|
||||
values = [
|
||||
"auto",
|
||||
"llvm_libc",
|
||||
"newlib",
|
||||
"picolibc",
|
||||
],
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_BTSTACK_CONFIG, [Bazel only] The cc_library that provides btstack_config.h, default=//bazel:empty_cc_lib, group=wireless
|
||||
label_flag(
|
||||
name = "PICO_BTSTACK_CONFIG",
|
||||
build_setting_default = "//bazel:empty_cc_lib",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_BT_ENABLE_BLE, [Bazel only] Whether or not to link in BLE portions of the btstack as part of //src/rp2_common/pico_btstack. Also defines ENABLE_BLE=1, type=bool, default=False, group=wireless
|
||||
bool_flag(
|
||||
name = "PICO_BT_ENABLE_BLE",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_BT_ENABLE_CLASSIC, [Bazel only] Whether or not to link in classic BT portions of the btstack as part of //src/rp2_common/pico_btstack. Also defines ENABLE_CLASSIC=1, type=bool, default=False, group=wireless
|
||||
bool_flag(
|
||||
name = "PICO_BT_ENABLE_CLASSIC",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_BT_ENABLE_MESH, [Bazel only] Whether or not to link in mesh BT portions of the btstack as part of //src/rp2_common/pico_btstack. Also defines ENABLE_MESH=1, type=bool, default=False, group=wireless
|
||||
bool_flag(
|
||||
name = "PICO_BT_ENABLE_MESH",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_LWIP_CONFIG, [Bazel only] The cc_library that provides lwipopts.h, default=//bazel:empty_cc_lib, group=wireless
|
||||
label_flag(
|
||||
name = "PICO_LWIP_CONFIG",
|
||||
build_setting_default = "//bazel:empty_cc_lib",
|
||||
)
|
||||
|
||||
# PICO_BAZEL_CONFIG: PICO_FREERTOS_LIB, [Bazel only] The cc_library that provides FreeRTOS, default=//bazel:empty_cc_lib, group=wireless
|
||||
label_flag(
|
||||
name = "PICO_FREERTOS_LIB",
|
||||
build_setting_default = "//bazel:empty_cc_lib",
|
||||
)
|
254
bazel/constraint/BUILD.bazel
Normal file
254
bazel/constraint/BUILD.bazel
Normal file
|
@ -0,0 +1,254 @@
|
|||
load("//bazel/util:label_flag_matches.bzl", "label_flag_matches")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
# This constraint represents the dimension that guides the Pico SDK build. This
|
||||
# constraint will only ever enumerate specific MCUs (and the host), and does NOT
|
||||
# cover the differences from board-to-board.
|
||||
constraint_setting(
|
||||
name = "sdk_target",
|
||||
default_constraint_value = "host",
|
||||
)
|
||||
|
||||
# This constraint value is used to guide the host build.
|
||||
constraint_value(
|
||||
name = "host",
|
||||
constraint_setting = ":sdk_target",
|
||||
)
|
||||
|
||||
# This constraint value is used to guide parts of the build that are specific
|
||||
# to the rp2040.
|
||||
constraint_value(
|
||||
name = "rp2040",
|
||||
constraint_setting = ":sdk_target",
|
||||
)
|
||||
|
||||
# This constraint value is used to guide parts of the build that are specific
|
||||
# to the rp2350.
|
||||
constraint_value(
|
||||
name = "rp2350",
|
||||
constraint_setting = ":sdk_target",
|
||||
)
|
||||
|
||||
constraint_setting(
|
||||
name = "wireless_support",
|
||||
default_constraint_value = "no_wireless",
|
||||
)
|
||||
|
||||
constraint_value(
|
||||
name = "no_wireless",
|
||||
constraint_setting = ":wireless_support",
|
||||
)
|
||||
|
||||
constraint_value(
|
||||
name = "cyw43_wireless",
|
||||
constraint_setting = ":wireless_support",
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "is_pico_w",
|
||||
flag_values = {"//bazel/config:PICO_BOARD": "pico_w"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "is_pico2_w",
|
||||
flag_values = {"//bazel/config:PICO_BOARD": "pico2_w"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_toolchain_clang_enabled",
|
||||
flag_values = {"//bazel/config:PICO_TOOLCHAIN": "clang"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_toolchain_gcc_enabled",
|
||||
flag_values = {"//bazel/config:PICO_TOOLCHAIN": "gcc"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_baremetal_enabled",
|
||||
flag_values = {"//bazel/config:PICO_BARE_METAL": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_no_gc_sections_enabled",
|
||||
flag_values = {"//bazel/config:PICO_NO_GC_SECTIONS": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_cxx_enable_exceptions_enabled",
|
||||
flag_values = {"//bazel/config:PICO_CXX_ENABLE_EXCEPTIONS": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_cxx_enable_rtti_enabled",
|
||||
flag_values = {"//bazel/config:PICO_CXX_ENABLE_RTTI": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_cxx_enable_cxa_atexit_enabled",
|
||||
flag_values = {"//bazel/config:PICO_CXX_ENABLE_RTTI": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_stdio_uart_enabled",
|
||||
flag_values = {"//bazel/config:PICO_STDIO_UART": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_stdio_usb_enabled",
|
||||
flag_values = {"//bazel/config:PICO_STDIO_USB": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_stdio_semihosting_enabled",
|
||||
flag_values = {"//bazel/config:PICO_STDIO_SEMIHOSTING": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_stdio_rtt_enabled",
|
||||
flag_values = {"//bazel/config:PICO_STDIO_RTT": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_multicore_enabled",
|
||||
flag_values = {"//bazel/config:PICO_MULTICORE_ENABLED": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_float_auto_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_FLOAT_IMPL": "auto"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_float_compiler_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_FLOAT_IMPL": "compiler"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_float_dcp_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_FLOAT_IMPL": "dcp"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_float_rp2040_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_FLOAT_IMPL": "rp2040"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_float_vfp_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_FLOAT_IMPL": "vfp"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_double_auto_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_DOUBLE_IMPL": "auto"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_double_compiler_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_DOUBLE_IMPL": "compiler"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_double_dcp_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_DOUBLE_IMPL": "dcp"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_double_rp2040_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_DOUBLE_IMPL": "rp2040"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_divider_hardware_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_DIVIDER_IMPL": "hardware"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_divider_auto_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_DIVIDER_IMPL": "auto"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_printf_pico_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_PRINTF_IMPL": "pico"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_printf_compiler_enabled",
|
||||
flag_values = {"//bazel/config:PICO_DEFAULT_PRINTF_IMPL": "compiler"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_async_context_poll_enabled",
|
||||
flag_values = {"//bazel/config:PICO_ASYNC_CONTEXT_IMPL": "poll"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_async_context_threadsafe_background_enabled",
|
||||
flag_values = {"//bazel/config:PICO_ASYNC_CONTEXT_IMPL": "threadsafe_background"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_async_context_freertos_enabled",
|
||||
flag_values = {"//bazel/config:PICO_ASYNC_CONTEXT_IMPL": "freertos"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_use_default_max_page_size_enabled",
|
||||
flag_values = {"//bazel/config:PICO_USE_DEFAULT_MAX_PAGE_SIZE": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_no_target_name_enabled",
|
||||
flag_values = {"//bazel/config:PICO_NO_TARGET_NAME": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_clib_llvm_libc_enabled",
|
||||
flag_values = {"//bazel/config:PICO_CLIB": "llvm_libc"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_clib_newlib_enabled",
|
||||
flag_values = {"//bazel/config:PICO_CLIB": "newlib"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_clib_picolibc_enabled",
|
||||
flag_values = {"//bazel/config:PICO_CLIB": "picolibc"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_bt_enable_ble_enabled",
|
||||
flag_values = {"//bazel/config:PICO_BT_ENABLE_BLE": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_bt_enable_classic_enabled",
|
||||
flag_values = {"//bazel/config:PICO_BT_ENABLE_CLASSIC": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "pico_bt_enable_mesh_enabled",
|
||||
flag_values = {"//bazel/config:PICO_BT_ENABLE_MESH": "True"},
|
||||
)
|
||||
|
||||
label_flag_matches(
|
||||
name = "pico_lwip_config_unset",
|
||||
flag = "//bazel/config:PICO_LWIP_CONFIG",
|
||||
value = "//bazel:empty_cc_lib",
|
||||
)
|
||||
|
||||
label_flag_matches(
|
||||
name = "pico_btstack_config_unset",
|
||||
flag = "//bazel/config:PICO_BTSTACK_CONFIG",
|
||||
value = "//bazel:empty_cc_lib",
|
||||
)
|
||||
|
||||
label_flag_matches(
|
||||
name = "pico_freertos_unset",
|
||||
flag = "//bazel/config:PICO_FREERTOS_LIB",
|
||||
value = "//bazel:empty_cc_lib",
|
||||
)
|
117
bazel/defs.bzl
Normal file
117
bazel/defs.bzl
Normal file
|
@ -0,0 +1,117 @@
|
|||
load("@bazel_skylib//rules:write_file.bzl", "write_file")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
def _pico_generate_pio_header_impl(ctx):
|
||||
generated_headers = []
|
||||
for f in ctx.files.srcs:
|
||||
out = ctx.actions.declare_file(
|
||||
"{}_pio_generated/{}.h".format(ctx.label.name, f.basename),
|
||||
)
|
||||
generated_headers.append(out)
|
||||
ctx.actions.run(
|
||||
executable = ctx.executable._pioasm_tool,
|
||||
arguments = [
|
||||
"-o",
|
||||
"c-sdk",
|
||||
f.path,
|
||||
out.path,
|
||||
],
|
||||
inputs = [f],
|
||||
outputs = [out],
|
||||
)
|
||||
|
||||
cc_ctx = cc_common.create_compilation_context(
|
||||
headers = depset(direct = generated_headers),
|
||||
includes = depset(direct = [generated_headers[0].dirname]),
|
||||
)
|
||||
return [
|
||||
DefaultInfo(files = depset(direct = generated_headers)),
|
||||
CcInfo(compilation_context = cc_ctx),
|
||||
]
|
||||
|
||||
pico_generate_pio_header = rule(
|
||||
implementation = _pico_generate_pio_header_impl,
|
||||
doc = """Generates a .h header file for each listed pio source.
|
||||
|
||||
Each source file listed in `srcs` will be available as `[pio file name].h` on
|
||||
the include path if you depend on this rule from a `cc_library`.
|
||||
|
||||
pico_generate_pio_header(
|
||||
name = "my_fun_pio",
|
||||
srcs = ["my_fun_pio.pio"],
|
||||
)
|
||||
|
||||
# This library can #include "my_fun_pio.pio.h".
|
||||
cc_library(
|
||||
name = "libfoo",
|
||||
deps = [":my_fun_pio"],
|
||||
srcs = ["libfoo.c"],
|
||||
)
|
||||
""",
|
||||
attrs = {
|
||||
"srcs": attr.label_list(mandatory = True, allow_files = True),
|
||||
"_pioasm_tool": attr.label(
|
||||
default = "@pico-sdk//tools/pioasm:pioasm",
|
||||
cfg = "exec",
|
||||
executable = True,
|
||||
),
|
||||
},
|
||||
provides = [CcInfo],
|
||||
)
|
||||
|
||||
# Because the syntax for target_compatible_with when used with config_setting
|
||||
# rules is both confusing and verbose, provide some helpers that make it much
|
||||
# easier and clearer to express compatibility.
|
||||
#
|
||||
# Context: https://github.com/bazelbuild/bazel/issues/12614
|
||||
|
||||
def compatible_with_config(config_label):
|
||||
"""Expresses compatibility with a config_setting."""
|
||||
return select({
|
||||
config_label: [],
|
||||
"//conditions:default": ["@platforms//:incompatible"],
|
||||
})
|
||||
|
||||
def incompatible_with_config(config_label):
|
||||
"""Expresses incompatibility with a config_setting."""
|
||||
return select({
|
||||
config_label: ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
})
|
||||
|
||||
def compatible_with_rp2():
|
||||
"""Expresses a rule is compatible with the rp2 family."""
|
||||
return incompatible_with_config("//bazel/constraint:host")
|
||||
|
||||
def compatible_with_pico_w():
|
||||
"""Expresses a rule is compatible a Pico W."""
|
||||
return select({
|
||||
"@pico-sdk//bazel/constraint:cyw43_wireless": [],
|
||||
"@pico-sdk//bazel/constraint:is_pico_w": [],
|
||||
"@pico-sdk//bazel/constraint:is_pico2_w": [],
|
||||
"//conditions:default": ["@platforms//:incompatible"],
|
||||
})
|
||||
|
||||
def pico_board_config(name, platform_includes, **kwargs):
|
||||
"""A helper macro for declaring a Pico board to use with PICO_CONFIG_HEADER.
|
||||
|
||||
This generates pico_config_platform_headers.h using the list of
|
||||
includes provided in `platform_includes`, and the final artifact is
|
||||
a cc_library that you can configure //bazel/config:PICO_CONFIG_HEADER to
|
||||
point to.
|
||||
"""
|
||||
_hdr_dir = "{}_generated_includes".format(name)
|
||||
_hdr_path = "{}/pico_config_platform_headers.h".format(_hdr_dir)
|
||||
write_file(
|
||||
name = "{}_platform_headers_file".format(name),
|
||||
out = _hdr_path,
|
||||
content = ['#include "{}"'.format(inc) for inc in platform_includes],
|
||||
)
|
||||
kwargs.setdefault("hdrs", [])
|
||||
kwargs["hdrs"].append(_hdr_path)
|
||||
kwargs.setdefault("includes", [])
|
||||
kwargs["includes"].append(_hdr_dir)
|
||||
cc_library(
|
||||
name = name,
|
||||
**kwargs
|
||||
)
|
58
bazel/generate_version_header.py
Normal file
58
bazel/generate_version_header.py
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Generate a version header for the Bazel build.
|
||||
|
||||
Splits a semantic version string into major, minor, and patch and uses the
|
||||
provided template to produce a working version header.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def _parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description=__doc__,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--version-string",
|
||||
required=True,
|
||||
help="SDK version string",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--template",
|
||||
type=argparse.FileType("r"),
|
||||
required=True,
|
||||
help="Path to version.h.in",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o",
|
||||
"--output",
|
||||
type=argparse.FileType("wb"),
|
||||
default=sys.stdout.buffer,
|
||||
help="Output file path. Defaults to stdout.",
|
||||
)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
_EXPANSION_REGEX = re.compile(r"(?:\$\{)([a-zA-Z]\w*)(?:\})")
|
||||
|
||||
|
||||
def generate_version_header(version_string, template, output):
|
||||
version_parts = version_string.split('.')
|
||||
defines = {
|
||||
"PICO_SDK_VERSION_MAJOR": version_parts[0],
|
||||
"PICO_SDK_VERSION_MINOR": version_parts[1],
|
||||
"PICO_SDK_VERSION_REVISION": version_parts[2].split('-')[0],
|
||||
"PICO_SDK_VERSION_STRING": version_string,
|
||||
}
|
||||
output.write(
|
||||
_EXPANSION_REGEX.sub(
|
||||
lambda val: str(defines.get(val.group(1))),
|
||||
template.read(),
|
||||
).encode()
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(generate_version_header(**vars(_parse_args())))
|
12
bazel/include/pico/config_autogen.h
Normal file
12
bazel/include/pico/config_autogen.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Rather than auto-generating as part of the build, this header
|
||||
// is checked in directly.
|
||||
//
|
||||
// You can change what is included by configuring these `label_flag`s:
|
||||
// --@pico-sdk//bazel/config:PICO_CONFIG_EXTRA_HEADER=//my_proj:my_custom_headers
|
||||
// --@pico-sdk//bazel/config:PICO_CONFIG_PLATFORM_HEADER=//my_proj:my_custom_headers
|
||||
|
||||
// This header must be provided by //bazel/config:PICO_CONFIG_EXTRA_HEADER:
|
||||
#include "pico_config_extra_headers.h"
|
||||
|
||||
// This header must be provided by //bazel/config:PICO_CONFIG_PLATFORM_HEADER:
|
||||
#include "pico_config_platform_headers.h"
|
59
bazel/pico_btstack_make_gatt_header.bzl
Normal file
59
bazel/pico_btstack_make_gatt_header.bzl
Normal file
|
@ -0,0 +1,59 @@
|
|||
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cpp_toolchain", "use_cc_toolchain")
|
||||
|
||||
def _pico_btstack_make_gatt_header_impl(ctx):
|
||||
cc_toolchain = find_cpp_toolchain(ctx)
|
||||
feature_configuration = cc_common.configure_features(
|
||||
ctx = ctx,
|
||||
cc_toolchain = cc_toolchain,
|
||||
requested_features = ctx.features,
|
||||
unsupported_features = ctx.disabled_features,
|
||||
)
|
||||
|
||||
out = ctx.actions.declare_file(
|
||||
"{}_gatt_generated/{}.h".format(ctx.label.name, ctx.file.src.basename.removesuffix(".gatt")),
|
||||
)
|
||||
|
||||
ctx.actions.run(
|
||||
executable = ctx.executable._make_gat_header_tool,
|
||||
arguments = [
|
||||
ctx.file.src.path,
|
||||
out.path,
|
||||
"-I",
|
||||
ctx.file._btstack_hdr.dirname,
|
||||
] + [
|
||||
|
||||
],
|
||||
inputs = [
|
||||
ctx.file.src,
|
||||
ctx.file._btstack_hdr,
|
||||
],
|
||||
outputs = [out],
|
||||
)
|
||||
|
||||
cc_ctx = cc_common.create_compilation_context(
|
||||
headers = depset(direct = [out]),
|
||||
includes = depset(direct = [out.dirname]),
|
||||
)
|
||||
|
||||
return [
|
||||
DefaultInfo(files = depset(direct = [out])),
|
||||
CcInfo(compilation_context = cc_ctx)
|
||||
]
|
||||
|
||||
pico_btstack_make_gatt_header = rule(
|
||||
implementation = _pico_btstack_make_gatt_header_impl,
|
||||
attrs = {
|
||||
"src": attr.label(mandatory = True, allow_single_file = True),
|
||||
"_btstack_hdr": attr.label(
|
||||
default = "@btstack//:src/bluetooth_gatt.h",
|
||||
allow_single_file = True,
|
||||
),
|
||||
"_make_gat_header_tool": attr.label(
|
||||
default = "@btstack//:compile_gatt",
|
||||
cfg = "exec",
|
||||
executable = True,
|
||||
),
|
||||
},
|
||||
fragments = ["cpp"],
|
||||
toolchains = use_cc_toolchain(),
|
||||
)
|
17
bazel/platform/BUILD.bazel
Normal file
17
bazel/platform/BUILD.bazel
Normal file
|
@ -0,0 +1,17 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
platform(
|
||||
name = "rp2040",
|
||||
constraint_values = [
|
||||
"@pico-sdk//bazel/constraint:rp2040",
|
||||
"@platforms//cpu:armv6-m",
|
||||
],
|
||||
)
|
||||
|
||||
platform(
|
||||
name = "rp2350",
|
||||
constraint_values = [
|
||||
"@pico-sdk//bazel/constraint:rp2350",
|
||||
"@platforms//cpu:armv8-m",
|
||||
],
|
||||
)
|
291
bazel/toolchain/BUILD.bazel
Normal file
291
bazel/toolchain/BUILD.bazel
Normal file
|
@ -0,0 +1,291 @@
|
|||
load("@rules_cc//cc/toolchains:args.bzl", "cc_args")
|
||||
load("@rules_cc//cc/toolchains:args_list.bzl", "cc_args_list")
|
||||
load("@rules_cc//cc/toolchains:feature.bzl", "cc_feature")
|
||||
load("@rules_cc//cc/toolchains:toolchain.bzl", "cc_toolchain")
|
||||
load("configurable_feature.bzl", "configurable_toolchain_feature")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
cc_args(
|
||||
name = "armv6m-none-eabi",
|
||||
actions = [
|
||||
"@rules_cc//cc/toolchains/actions:compile_actions",
|
||||
"@rules_cc//cc/toolchains/actions:link_actions",
|
||||
],
|
||||
args = ["--target=armv6m-none-eabi"],
|
||||
)
|
||||
|
||||
cc_args(
|
||||
name = "armv8m.main-none-eabi",
|
||||
actions = [
|
||||
"@rules_cc//cc/toolchains/actions:compile_actions",
|
||||
"@rules_cc//cc/toolchains/actions:link_actions",
|
||||
],
|
||||
args = ["--target=armv8m.main-none-eabi"],
|
||||
)
|
||||
|
||||
cc_args(
|
||||
name = "cortex-m0",
|
||||
actions = [
|
||||
"@rules_cc//cc/toolchains/actions:compile_actions",
|
||||
"@rules_cc//cc/toolchains/actions:link_actions",
|
||||
],
|
||||
args = [
|
||||
"-mcpu=cortex-m0plus",
|
||||
"-mthumb",
|
||||
],
|
||||
)
|
||||
|
||||
cc_args(
|
||||
name = "cortex-m33",
|
||||
actions = [
|
||||
"@rules_cc//cc/toolchains/actions:compile_actions",
|
||||
"@rules_cc//cc/toolchains/actions:link_actions",
|
||||
],
|
||||
args = [
|
||||
"-mcpu=cortex-m33",
|
||||
"-march=armv8-m.main+fp+dsp",
|
||||
"-mfloat-abi=softfp",
|
||||
"-mthumb",
|
||||
"-mcmse",
|
||||
],
|
||||
)
|
||||
|
||||
# :no_canonical_system_headers and :no_canonical_prefixes both prevent built-in
|
||||
# compiler include directories from resolving to absolute paths. Prefer to use
|
||||
# :bazel_no_absolute_paths, since it correctly guides based on the current
|
||||
# compiler type.
|
||||
cc_args(
|
||||
name = "no_canonical_system_headers",
|
||||
actions = ["@rules_cc//cc/toolchains/actions:compile_actions"],
|
||||
args = ["-fno-canonical-system-headers"],
|
||||
)
|
||||
|
||||
cc_args(
|
||||
name = "no_canonical_prefixes",
|
||||
actions = ["@rules_cc//cc/toolchains/actions:compile_actions"],
|
||||
args = ["-no-canonical-prefixes"],
|
||||
)
|
||||
|
||||
cc_args_list(
|
||||
name = "bazel_no_absolute_paths",
|
||||
args = select({
|
||||
"//bazel/constraint:pico_toolchain_clang_enabled": [],
|
||||
"//conditions:default": [":no_canonical_system_headers"],
|
||||
}) + [":no_canonical_prefixes"],
|
||||
)
|
||||
|
||||
cc_args(
|
||||
name = "llvm-libc_args",
|
||||
actions = ["@rules_cc//cc/toolchains/actions:link_actions"],
|
||||
args = [
|
||||
"-nostdlib++",
|
||||
"-nostartfiles",
|
||||
"-Wl,-lc++",
|
||||
],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
cc_args(
|
||||
name = "opt_debug_args",
|
||||
actions = [
|
||||
"@rules_cc//cc/toolchains/actions:compile_actions",
|
||||
"@rules_cc//cc/toolchains/actions:link_actions",
|
||||
],
|
||||
args = [
|
||||
"-Og", # TODO: Make this configurable.
|
||||
"-g3",
|
||||
],
|
||||
)
|
||||
|
||||
configurable_toolchain_feature(
|
||||
name = "gc_sections",
|
||||
copts = [
|
||||
"-ffunction-sections",
|
||||
"-fdata-sections",
|
||||
],
|
||||
linkopts = ["-Wl,--gc-sections"],
|
||||
)
|
||||
|
||||
configurable_toolchain_feature(
|
||||
name = "cxx_no_exceptions",
|
||||
cxxopts = [
|
||||
"-fno-exceptions",
|
||||
"-fno-unwind-tables",
|
||||
],
|
||||
)
|
||||
|
||||
configurable_toolchain_feature(
|
||||
name = "cxx_no_rtti",
|
||||
cxxopts = ["-fno-rtti"],
|
||||
)
|
||||
|
||||
configurable_toolchain_feature(
|
||||
name = "cxx_no_cxa_atexit",
|
||||
cxxopts = ["-fno-use-cxa-atexit"],
|
||||
)
|
||||
|
||||
configurable_toolchain_feature(
|
||||
name = "override_max_page_size",
|
||||
linkopts = ["-Wl,-z,max-page-size=4096"],
|
||||
)
|
||||
|
||||
# TODO: Make this shim unnecessary.
|
||||
cc_args_list(
|
||||
name = "all_opt_debug_args",
|
||||
args = [":opt_debug_args"],
|
||||
)
|
||||
|
||||
cc_feature(
|
||||
name = "override_debug",
|
||||
args = [":all_opt_debug_args"],
|
||||
overrides = "@rules_cc//cc/toolchains/features:dbg",
|
||||
)
|
||||
|
||||
HOSTS = (
|
||||
("linux", "x86_64"),
|
||||
("linux", "aarch64"),
|
||||
("win", "x86_64"),
|
||||
("mac", "x86_64"),
|
||||
("mac", "aarch64"),
|
||||
)
|
||||
|
||||
_HOST_OS_CONSTRAINTS = {
|
||||
"linux": "@platforms//os:linux",
|
||||
"win": "@platforms//os:windows",
|
||||
"mac": "@platforms//os:macos",
|
||||
}
|
||||
|
||||
_HOST_CPU_CONSTRAINTS = {
|
||||
"x86_64": "@platforms//cpu:x86_64",
|
||||
"aarch64": "@platforms//cpu:aarch64",
|
||||
}
|
||||
|
||||
[cc_toolchain(
|
||||
name = "arm_gcc_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
|
||||
tool_map = "@arm_gcc_{}-{}//:all_tools".format(host_os, host_cpu),
|
||||
args = select({
|
||||
"//bazel/constraint:rp2040": [":cortex-m0"],
|
||||
"//bazel/constraint:rp2350": [":cortex-m33"],
|
||||
"//conditions:default": [],
|
||||
}) + [
|
||||
":bazel_no_absolute_paths",
|
||||
],
|
||||
exec_compatible_with = [
|
||||
_HOST_CPU_CONSTRAINTS[host_cpu],
|
||||
_HOST_OS_CONSTRAINTS[host_os],
|
||||
],
|
||||
tags = ["manual"], # Don't try to build this in wildcard builds.
|
||||
known_features = [
|
||||
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
|
||||
"@pico-sdk//bazel/toolchain:override_debug",
|
||||
"@pico-sdk//bazel/toolchain:gc_sections",
|
||||
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
|
||||
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
|
||||
"@pico-sdk//bazel/toolchain:cxx_no_cxa_atexit",
|
||||
"@pico-sdk//bazel/toolchain:override_max_page_size",
|
||||
],
|
||||
enabled_features = [
|
||||
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
|
||||
"@pico-sdk//bazel/toolchain:override_debug",
|
||||
] + select({
|
||||
"//bazel/constraint:pico_no_gc_sections_enabled": [],
|
||||
"//conditions:default": [":gc_sections"],
|
||||
}) + select({
|
||||
"//bazel/constraint:pico_cxx_enable_exceptions_enabled": [],
|
||||
"//conditions:default": [":cxx_no_exceptions"],
|
||||
}) + select({
|
||||
"//bazel/constraint:pico_cxx_enable_rtti_enabled": [],
|
||||
"//conditions:default": [":cxx_no_rtti"],
|
||||
}) + select({
|
||||
"//bazel/constraint:pico_cxx_enable_cxa_atexit_enabled": [],
|
||||
"//conditions:default": [":cxx_no_cxa_atexit"],
|
||||
}) + select({
|
||||
"//bazel/constraint:pico_use_default_max_page_size_enabled": [],
|
||||
"//conditions:default": [":override_max_page_size"],
|
||||
}),
|
||||
) for host_os, host_cpu in HOSTS]
|
||||
|
||||
[cc_toolchain(
|
||||
name = "clang_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
|
||||
tool_map = "@clang_{}-{}//:all_tools".format(host_os, host_cpu),
|
||||
args = select({
|
||||
"//bazel/constraint:rp2040": [
|
||||
":armv6m-none-eabi",
|
||||
":cortex-m0",
|
||||
],
|
||||
"//bazel/constraint:rp2350": [
|
||||
":armv8m.main-none-eabi",
|
||||
":cortex-m33",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + [
|
||||
":bazel_no_absolute_paths",
|
||||
":llvm-libc_args",
|
||||
],
|
||||
exec_compatible_with = [
|
||||
_HOST_CPU_CONSTRAINTS[host_cpu],
|
||||
_HOST_OS_CONSTRAINTS[host_os],
|
||||
],
|
||||
tags = ["manual"], # Don't try to build this in wildcard builds.
|
||||
known_features = [
|
||||
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
|
||||
"@pico-sdk//bazel/toolchain:override_debug",
|
||||
"@pico-sdk//bazel/toolchain:gc_sections",
|
||||
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
|
||||
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
|
||||
"@pico-sdk//bazel/toolchain:cxx_no_cxa_atexit",
|
||||
"@pico-sdk//bazel/toolchain:override_max_page_size",
|
||||
],
|
||||
enabled_features = [
|
||||
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
|
||||
"@pico-sdk//bazel/toolchain:override_debug",
|
||||
] + select({
|
||||
"//bazel/constraint:pico_no_gc_sections_enabled": [],
|
||||
"//conditions:default": [":gc_sections"],
|
||||
}) + select({
|
||||
"//bazel/constraint:pico_cxx_enable_exceptions_enabled": [],
|
||||
"//conditions:default": [":cxx_no_exceptions"],
|
||||
}) + select({
|
||||
"//bazel/constraint:pico_cxx_enable_rtti_enabled": [],
|
||||
"//conditions:default": [":cxx_no_rtti"],
|
||||
}) + select({
|
||||
"//bazel/constraint:pico_cxx_enable_cxa_atexit_enabled": [],
|
||||
"//conditions:default": [":cxx_no_cxa_atexit"],
|
||||
}) + select({
|
||||
"//bazel/constraint:pico_use_default_max_page_size_enabled": [],
|
||||
"//conditions:default": [":override_max_page_size"],
|
||||
}),
|
||||
) for host_os, host_cpu in HOSTS]
|
||||
|
||||
[toolchain(
|
||||
name = "{}-{}-rp2040".format(host_os, host_cpu),
|
||||
exec_compatible_with = [
|
||||
_HOST_CPU_CONSTRAINTS[host_cpu],
|
||||
_HOST_OS_CONSTRAINTS[host_os],
|
||||
],
|
||||
target_compatible_with = [
|
||||
"@pico-sdk//bazel/constraint:rp2040",
|
||||
],
|
||||
toolchain = select({
|
||||
"//bazel/constraint:pico_toolchain_clang_enabled": "clang_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
|
||||
"//conditions:default": ":arm_gcc_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
|
||||
}),
|
||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
||||
) for host_os, host_cpu in HOSTS]
|
||||
|
||||
[toolchain(
|
||||
name = "{}-{}-rp2350".format(host_os, host_cpu),
|
||||
exec_compatible_with = [
|
||||
_HOST_CPU_CONSTRAINTS[host_cpu],
|
||||
_HOST_OS_CONSTRAINTS[host_os],
|
||||
],
|
||||
target_compatible_with = [
|
||||
"@pico-sdk//bazel/constraint:rp2350",
|
||||
],
|
||||
toolchain = select({
|
||||
"//bazel/constraint:pico_toolchain_clang_enabled": "clang_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
|
||||
"//conditions:default": ":arm_gcc_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
|
||||
}),
|
||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
||||
) for host_os, host_cpu in HOSTS]
|
152
bazel/toolchain/clang.BUILD
Normal file
152
bazel/toolchain/clang.BUILD
Normal file
|
@ -0,0 +1,152 @@
|
|||
load("@bazel_skylib//rules/directory:directory.bzl", "directory")
|
||||
load("@bazel_skylib//rules/directory:subdirectory.bzl", "subdirectory")
|
||||
load("@rules_cc//cc/toolchains:tool.bzl", "cc_tool")
|
||||
load("@rules_cc//cc/toolchains:tool_map.bzl", "cc_tool_map")
|
||||
load("@rules_cc//cc/toolchains:args.bzl", "cc_args")
|
||||
load("@rules_cc//cc/toolchains:args_list.bzl", "cc_args_list")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
# Directory-based rules in this toolchain only referece things in
|
||||
# lib/ or include/ subdirectories.
|
||||
directory(
|
||||
name = "toolchain_root",
|
||||
srcs = glob([
|
||||
"lib/**",
|
||||
"include/**",
|
||||
]),
|
||||
)
|
||||
|
||||
cc_tool_map(
|
||||
name = "all_tools",
|
||||
tools = {
|
||||
"@rules_cc//cc/toolchains/actions:assembly_actions": ":asm",
|
||||
"@rules_cc//cc/toolchains/actions:c_compile": ":clang",
|
||||
"@rules_cc//cc/toolchains/actions:cpp_compile_actions": ":clang++",
|
||||
"@rules_cc//cc/toolchains/actions:link_actions": ":lld",
|
||||
"@rules_cc//cc/toolchains/actions:objcopy_embed_data": ":llvm-objcopy",
|
||||
"@rules_cc//cc/toolchains/actions:strip": ":llvm-strip",
|
||||
"@rules_cc//cc/toolchains/actions:ar_actions": ":llvm-ar",
|
||||
},
|
||||
)
|
||||
|
||||
# TODO: https://github.com/bazelbuild/rules_cc/issues/235 - Workaround until
|
||||
# Bazel has a more robust way to implement `cc_tool_map`.
|
||||
alias(
|
||||
name = "asm",
|
||||
actual = ":clang",
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "clang",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/clang.exe",
|
||||
"//conditions:default": "//:bin/clang",
|
||||
}),
|
||||
data = glob([
|
||||
"bin/llvm",
|
||||
"lib/clang/*/include/**",
|
||||
"include/armv*-unknown-none-eabi/**",
|
||||
]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "clang++",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/clang++.exe",
|
||||
"//conditions:default": "//:bin/clang++",
|
||||
}),
|
||||
data = glob([
|
||||
"bin/llvm",
|
||||
"lib/clang/*/include/**",
|
||||
"include/armv*-unknown-none-eabi/**",
|
||||
"include/c++/v1/**",
|
||||
]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "lld",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/clang++.exe",
|
||||
"//conditions:default": "//:bin/clang++",
|
||||
}),
|
||||
data = glob([
|
||||
"bin/llvm",
|
||||
"bin/lld*",
|
||||
"bin/ld*",
|
||||
"lib/**/*.a",
|
||||
"lib/**/*.so*",
|
||||
"lib/**/*.o",
|
||||
"lib/armv*-unknown-none-eabi/**",
|
||||
"lib/clang/*/lib/armv*-unknown-none-eabi/**",
|
||||
]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "llvm-ar",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/llvm-ar.exe",
|
||||
"//conditions:default": "//:bin/llvm-ar",
|
||||
}),
|
||||
data = glob(["bin/llvm"]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "llvm-libtool-darwin",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/llvm-libtool-darwin.exe",
|
||||
"//conditions:default": "//:bin/llvm-libtool-darwin",
|
||||
}),
|
||||
data = glob(["bin/llvm"]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "llvm-objcopy",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/llvm-objcopy.exe",
|
||||
"//conditions:default": "//:bin/llvm-objcopy",
|
||||
}),
|
||||
data = glob(["bin/llvm"]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "llvm-objdump",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/llvm-objdump.exe",
|
||||
"//conditions:default": "//:bin/llvm-objdump",
|
||||
}),
|
||||
data = glob(["bin/llvm"]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "llvm-cov",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/llvm-cov.exe",
|
||||
"//conditions:default": "//:bin/llvm-cov",
|
||||
}),
|
||||
data = glob(["bin/llvm"]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "llvm-strip",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/llvm-strip.exe",
|
||||
"//conditions:default": "//:bin/llvm-strip",
|
||||
}),
|
||||
data = glob(["bin/llvm"]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "clang-tidy",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/clang-tidy.exe",
|
||||
"//conditions:default": "//:bin/clang-tidy",
|
||||
}),
|
||||
data = glob([
|
||||
"bin/llvm",
|
||||
"include/**",
|
||||
"lib/clang/**/include/**",
|
||||
]),
|
||||
)
|
42
bazel/toolchain/configurable_feature.bzl
Normal file
42
bazel/toolchain/configurable_feature.bzl
Normal file
|
@ -0,0 +1,42 @@
|
|||
load("@rules_cc//cc/toolchains:args.bzl", "cc_args")
|
||||
load("@rules_cc//cc/toolchains:args_list.bzl", "cc_args_list")
|
||||
load("@rules_cc//cc/toolchains:feature.bzl", "cc_feature")
|
||||
|
||||
def configurable_toolchain_feature(name, copts = [], cxxopts = [], linkopts = []):
|
||||
|
||||
all_args = []
|
||||
|
||||
if copts:
|
||||
cc_args(
|
||||
name = name + "_cc_args",
|
||||
actions = ["@rules_cc//cc/toolchains/actions:compile_actions"],
|
||||
args = copts,
|
||||
)
|
||||
all_args.append(name + "_cc_args")
|
||||
|
||||
if cxxopts:
|
||||
cc_args(
|
||||
name = name + "_cxx_args",
|
||||
actions = ["@rules_cc//cc/toolchains/actions:cpp_compile_actions"],
|
||||
args = cxxopts,
|
||||
)
|
||||
all_args.append(name + "_cxx_args")
|
||||
|
||||
if linkopts:
|
||||
cc_args(
|
||||
name = name + "_link_args",
|
||||
actions = ["@rules_cc//cc/toolchains/actions:link_actions"],
|
||||
args = linkopts,
|
||||
)
|
||||
all_args.append(name + "_link_args")
|
||||
|
||||
cc_args_list(
|
||||
name = name + "_args",
|
||||
args = all_args,
|
||||
)
|
||||
|
||||
cc_feature(
|
||||
name = name,
|
||||
feature_name = name,
|
||||
args = [":{}_args".format(name)],
|
||||
)
|
131
bazel/toolchain/gcc_arm_none_eabi.BUILD
Normal file
131
bazel/toolchain/gcc_arm_none_eabi.BUILD
Normal file
|
@ -0,0 +1,131 @@
|
|||
load("@bazel_skylib//rules/directory:directory.bzl", "directory")
|
||||
load("@bazel_skylib//rules/directory:subdirectory.bzl", "subdirectory")
|
||||
load("@rules_cc//cc/toolchains:tool.bzl", "cc_tool")
|
||||
load("@rules_cc//cc/toolchains:tool_map.bzl", "cc_tool_map")
|
||||
load("@rules_cc//cc/toolchains:args.bzl", "cc_args")
|
||||
load("@rules_cc//cc/toolchains:args_list.bzl", "cc_args_list")
|
||||
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
cc_tool_map(
|
||||
name = "all_tools",
|
||||
tools = {
|
||||
"@rules_cc//cc/toolchains/actions:assembly_actions": ":asm",
|
||||
"@rules_cc//cc/toolchains/actions:c_compile": ":arm-none-eabi-gcc",
|
||||
"@rules_cc//cc/toolchains/actions:cpp_compile_actions": ":arm-none-eabi-g++",
|
||||
"@rules_cc//cc/toolchains/actions:link_actions": ":arm-none-eabi-ld",
|
||||
"@rules_cc//cc/toolchains/actions:objcopy_embed_data": ":arm-none-eabi-objcopy",
|
||||
"@rules_cc//cc/toolchains/actions:strip": ":arm-none-eabi-strip",
|
||||
"@rules_cc//cc/toolchains/actions:ar_actions": ":arm-none-eabi-ar",
|
||||
},
|
||||
)
|
||||
|
||||
# TODO: https://github.com/bazelbuild/rules_cc/issues/235 - Workaround until
|
||||
# Bazel has a more robust way to implement `cc_tool_map`.
|
||||
alias(
|
||||
name = "asm",
|
||||
actual = ":arm-none-eabi-gcc",
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "arm-none-eabi-ar",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/arm-none-eabi-ar.exe",
|
||||
"//conditions:default": "//:bin/arm-none-eabi-ar",
|
||||
}),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "arm-none-eabi-g++",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/arm-none-eabi-g++.exe",
|
||||
"//conditions:default": "//:bin/arm-none-eabi-g++",
|
||||
}),
|
||||
data = glob([
|
||||
"**/*.spec",
|
||||
"**/*.specs",
|
||||
"arm-none-eabi/include/**",
|
||||
"lib/gcc/arm-none-eabi/*/include/**",
|
||||
"lib/gcc/arm-none-eabi/*/include-fixed/**",
|
||||
"libexec/**",
|
||||
]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "arm-none-eabi-gcc",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/arm-none-eabi-gcc.exe",
|
||||
"//conditions:default": "//:bin/arm-none-eabi-gcc",
|
||||
}),
|
||||
data = glob([
|
||||
"**/*.spec",
|
||||
"**/*.specs",
|
||||
"arm-none-eabi/include/**",
|
||||
"lib/gcc/arm-none-eabi/*/include/**",
|
||||
"lib/gcc/arm-none-eabi/*/include-fixed/**",
|
||||
"libexec/**",
|
||||
]) +
|
||||
# The assembler needs to be explicitly added. Note that the path is
|
||||
# intentionally different here as `as` is called from arm-none-eabi-gcc.
|
||||
# `arm-none-eabi-as` will not suffice for this context.
|
||||
select({
|
||||
"@platforms//os:windows": ["//:arm-none-eabi/bin/as.exe"],
|
||||
"//conditions:default": ["//:arm-none-eabi/bin/as"],
|
||||
}),
|
||||
)
|
||||
|
||||
# This tool is actually just g++ under the hood, but this specifies a
|
||||
# different set of data files to pull into the sandbox at runtime.
|
||||
cc_tool(
|
||||
name = "arm-none-eabi-ld",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/arm-none-eabi-g++.exe",
|
||||
"//conditions:default": "//:bin/arm-none-eabi-g++",
|
||||
}),
|
||||
data = glob([
|
||||
"**/*.a",
|
||||
"**/*.ld",
|
||||
"**/*.o",
|
||||
"**/*.spec",
|
||||
"**/*.specs",
|
||||
"**/*.so",
|
||||
"libexec/**",
|
||||
]),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "arm-none-eabi-objcopy",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/arm-none-eabi-objcopy.exe",
|
||||
"//conditions:default": "//:bin/arm-none-eabi-objcopy",
|
||||
}),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "arm-none-eabi-strip",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/arm-none-eabi-strip.exe",
|
||||
"//conditions:default": "//:bin/arm-none-eabi-strip",
|
||||
}),
|
||||
)
|
||||
|
||||
cc_tool(
|
||||
name = "arm-none-eabi-objdump",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/arm-none-eabi-objdump.exe",
|
||||
"//conditions:default": "//:bin/arm-none-eabi-objdump",
|
||||
}),
|
||||
)
|
||||
|
||||
# There is not yet a well-known action type for objdump.
|
||||
|
||||
cc_tool(
|
||||
name = "arm-none-eabi-gcov",
|
||||
src = select({
|
||||
"@platforms//os:windows": "//:bin/arm-none-eabi-gcov.exe",
|
||||
"//conditions:default": "//:bin/arm-none-eabi-gcov",
|
||||
}),
|
||||
)
|
||||
|
||||
# There is not yet a well-known action type for gcov.
|
46
bazel/toolchain/objcopy.bzl
Normal file
46
bazel/toolchain/objcopy.bzl
Normal file
|
@ -0,0 +1,46 @@
|
|||
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "OBJ_COPY_ACTION_NAME")
|
||||
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cpp_toolchain", "use_cc_toolchain")
|
||||
|
||||
def _objcopy_to_bin_impl(ctx):
|
||||
cc_toolchain = find_cpp_toolchain(ctx)
|
||||
feature_configuration = cc_common.configure_features(
|
||||
ctx = ctx,
|
||||
cc_toolchain = cc_toolchain,
|
||||
requested_features = ctx.features,
|
||||
unsupported_features = ctx.disabled_features,
|
||||
)
|
||||
objcopy_tool_path = cc_common.get_tool_for_action(
|
||||
feature_configuration = feature_configuration,
|
||||
action_name = OBJ_COPY_ACTION_NAME,
|
||||
)
|
||||
|
||||
ctx.actions.run(
|
||||
inputs = depset(
|
||||
direct = [ctx.file.src],
|
||||
transitive = [cc_toolchain.all_files],
|
||||
),
|
||||
executable = objcopy_tool_path,
|
||||
outputs = [ctx.outputs.out],
|
||||
arguments = [
|
||||
ctx.file.src.path,
|
||||
"-Obinary",
|
||||
ctx.outputs.out.path,
|
||||
],
|
||||
)
|
||||
|
||||
objcopy_to_bin = rule(
|
||||
implementation = _objcopy_to_bin_impl,
|
||||
attrs = {
|
||||
"src": attr.label(
|
||||
allow_single_file = True,
|
||||
mandatory = True,
|
||||
doc = "File to use as input to objcopy command",
|
||||
),
|
||||
"out": attr.output(
|
||||
mandatory = True,
|
||||
doc = "Destination file for objcopy command",
|
||||
),
|
||||
},
|
||||
fragments = ["cpp"],
|
||||
toolchains = use_cc_toolchain(),
|
||||
)
|
1
bazel/util/BUILD.bazel
Normal file
1
bazel/util/BUILD.bazel
Normal file
|
@ -0,0 +1 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
37
bazel/util/label_flag_matches.bzl
Normal file
37
bazel/util/label_flag_matches.bzl
Normal file
|
@ -0,0 +1,37 @@
|
|||
"""A wrapper that enables a `config_setting` matcher for label_flag flags."""
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
|
||||
|
||||
def _match_label_flag_impl(ctx):
|
||||
matches = str(ctx.attr.expected_value.label) == str(ctx.attr.flag.label)
|
||||
return [
|
||||
config_common.FeatureFlagInfo(value = str(matches)),
|
||||
BuildSettingInfo(value = matches),
|
||||
]
|
||||
|
||||
_match_label_flag = rule(
|
||||
implementation = _match_label_flag_impl,
|
||||
attrs = {
|
||||
"expected_value": attr.label(
|
||||
mandatory = True,
|
||||
doc = "The expected flag value",
|
||||
),
|
||||
"flag": attr.label(
|
||||
mandatory = True,
|
||||
doc = "The flag to extract a value from",
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
def label_flag_matches(*, name, flag, value):
|
||||
_match_label_flag(
|
||||
name = name + "._impl",
|
||||
expected_value = native.package_relative_label(value),
|
||||
flag = flag,
|
||||
)
|
||||
|
||||
native.config_setting(
|
||||
name = name,
|
||||
flag_values = {":{}".format(name + "._impl"): "True"},
|
||||
)
|
38
bazel/util/multiple_choice_flag.bzl
Normal file
38
bazel/util/multiple_choice_flag.bzl
Normal file
|
@ -0,0 +1,38 @@
|
|||
def declare_flag_choices(flag, choices):
|
||||
"""Declares a `config_setting` for each known choice for the provided flag.
|
||||
|
||||
The name of each config setting uses the name of the `config_setting` is:
|
||||
[flag label name]_[choice]
|
||||
|
||||
This can be used with select_choice() to map `config_setting`s to values.
|
||||
|
||||
Args:
|
||||
flag: The flag that guides the declared `config_setting`s.
|
||||
pkg: The package that declare_flag_choices() was declared in.
|
||||
choice_map: A mapping of distinct choices to
|
||||
"""
|
||||
flag_name = flag.split(":")[1]
|
||||
[
|
||||
native.config_setting(
|
||||
name = "{}_{}".format(flag_name, choice),
|
||||
flag_values = {flag: choice},
|
||||
)
|
||||
for choice in choices
|
||||
]
|
||||
|
||||
def flag_choice(flag, pkg, choice_map):
|
||||
"""Creates a `select()` based on choices declared by `declare_choices()`.
|
||||
|
||||
Args:
|
||||
flag: The flag that guides the select.
|
||||
pkg: The package that `declare_flag_choices()` was called in.
|
||||
choice_map: A mapping of distinct choices to the final intended value.
|
||||
"""
|
||||
return {
|
||||
"{}:{}_{}".format(
|
||||
pkg.split(":")[0],
|
||||
flag.split(":")[1],
|
||||
choice,
|
||||
): val
|
||||
for choice, val in choice_map.items()
|
||||
}
|
43
bazel/util/sdk_define.bzl
Normal file
43
bazel/util/sdk_define.bzl
Normal file
|
@ -0,0 +1,43 @@
|
|||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
|
||||
def _pico_sdk_define_impl(ctx):
|
||||
val = ctx.attr.from_flag[BuildSettingInfo].value
|
||||
|
||||
if type(val) == "string":
|
||||
# Strings need quotes.
|
||||
val = "\"{}\"".format(val)
|
||||
elif type(val) == "bool":
|
||||
# Convert bools to 0 or 1.
|
||||
val = 1 if val else 0
|
||||
cc_ctx = cc_common.create_compilation_context(
|
||||
defines = depset(
|
||||
direct = ["{}={}".format(ctx.attr.define_name, val)],
|
||||
),
|
||||
)
|
||||
return [CcInfo(compilation_context = cc_ctx)]
|
||||
|
||||
pico_sdk_define = rule(
|
||||
implementation = _pico_sdk_define_impl,
|
||||
doc = """A simple rule that offers a skylib flag as a define.
|
||||
|
||||
These can be listed in the `deps` attribute of a `cc_library` to get access
|
||||
to the value of a define.
|
||||
|
||||
Example:
|
||||
|
||||
bool_flag(
|
||||
name = "my_flag",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
pico_sdk_define(
|
||||
name = "flag_define",
|
||||
define_name = "MY_FLAG_DEFINE",
|
||||
from_flag = ":my_flag",
|
||||
)
|
||||
""",
|
||||
attrs = {
|
||||
"define_name": attr.string(mandatory = True),
|
||||
"from_flag": attr.label(mandatory = True),
|
||||
},
|
||||
)
|
167
bazel/util/transition.bzl
Normal file
167
bazel/util/transition.bzl
Normal file
|
@ -0,0 +1,167 @@
|
|||
def _normalize_flag_value(val):
|
||||
"""Converts flag values to transition-safe primitives."""
|
||||
if type(val) == "label":
|
||||
return str(val)
|
||||
return val
|
||||
|
||||
def declare_transtion(attrs, flag_overrides = None, append_to_flags = None, executable = True):
|
||||
"""A helper that drastically simplifies declaration of a transition.
|
||||
|
||||
A transition in Bazel is a way to force changes to the way the build is
|
||||
evaluated for all dependencies of a given rule.
|
||||
|
||||
Imagine the following simple dependency graph:
|
||||
|
||||
->: depends on
|
||||
a -> b -> c
|
||||
|
||||
Normally, if you set `defines` on a, they couldn't apply to b or c because
|
||||
they are dependencies of a. There's no way for b or c to know about a's
|
||||
settings, because they don't even know a exists!
|
||||
|
||||
We can fix this via a transition! If we put a transition in front of `a`
|
||||
that sets --copts=-DFOO=42, we're telling Bazel to build a and all of its
|
||||
dependencies under that configuration.
|
||||
|
||||
Note: Flags must be referenced as e.g. `//command_line_option:copt` in
|
||||
transitions.
|
||||
|
||||
`declare_transition()` eliminates the frustrating amount of boilerplate. All
|
||||
you need to do is provide a set of attrs, and then a `flag_overrides`
|
||||
dictionary that tells `declare_transition()` which attrs to pull flag values
|
||||
from. The common `src` attr tells the transition which build rule to apply
|
||||
the transition to.
|
||||
"""
|
||||
|
||||
def _flag_override_impl(settings, attrs):
|
||||
final_overrides = {}
|
||||
if flag_overrides != None:
|
||||
final_overrides = {
|
||||
key: _normalize_flag_value(getattr(attrs, value))
|
||||
for key, value in flag_overrides.items()
|
||||
}
|
||||
if append_to_flags != None:
|
||||
for flag, field in append_to_flags.items():
|
||||
accumulated_flags = final_overrides.get(flag, settings.get(flag, []))
|
||||
accumulated_flags.extend(
|
||||
[str(val) for val in getattr(attrs, field)],
|
||||
)
|
||||
final_overrides[flag] = accumulated_flags
|
||||
return final_overrides
|
||||
|
||||
output_flags = []
|
||||
if flag_overrides != None:
|
||||
output_flags.extend(flag_overrides.keys())
|
||||
if append_to_flags != None:
|
||||
output_flags.extend(append_to_flags.keys())
|
||||
_transition = transition(
|
||||
implementation = _flag_override_impl,
|
||||
inputs = append_to_flags.keys() if append_to_flags != None else [],
|
||||
outputs = output_flags,
|
||||
)
|
||||
|
||||
def _symlink_artifact_impl(ctx):
|
||||
out = ctx.actions.declare_file(ctx.label.name)
|
||||
if executable:
|
||||
ctx.actions.symlink(output = out, target_file = ctx.executable.src)
|
||||
return [DefaultInfo(files = depset([out]), executable = out)]
|
||||
|
||||
ctx.actions.symlink(
|
||||
output = out,
|
||||
target_file = ctx.attr.src[0][DefaultInfo].files.to_list()[0],
|
||||
)
|
||||
return [DefaultInfo(files = depset([out]))]
|
||||
|
||||
return rule(
|
||||
implementation = _symlink_artifact_impl,
|
||||
executable = executable,
|
||||
attrs = {
|
||||
"src": attr.label(
|
||||
cfg = _transition,
|
||||
executable = executable,
|
||||
mandatory = True,
|
||||
),
|
||||
} | attrs,
|
||||
)
|
||||
|
||||
# This transition is applied before building the boot_stage2 image.
|
||||
rp2040_bootloader_binary = declare_transtion(
|
||||
attrs = {
|
||||
"_malloc": attr.label(default = "//bazel:empty_cc_lib"),
|
||||
# This could be shared, but we don't in order to make it clearer that
|
||||
# a transition is in use.
|
||||
"_allowlist_function_transition": attr.label(
|
||||
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
||||
),
|
||||
"_link_extra_libs": attr.label(default = "//bazel:empty_cc_lib"),
|
||||
},
|
||||
flag_overrides = {
|
||||
# We don't want --custom_malloc to ever apply to the bootloader, so
|
||||
# always explicitly override it here.
|
||||
"//command_line_option:custom_malloc": "_malloc",
|
||||
|
||||
# Platforms will commonly depend on bootloader components in every
|
||||
# binary via `link_extra_libs`, so we must drop these deps when
|
||||
# building the bootloader binaries themselves in order to avoid a
|
||||
# circular dependency.
|
||||
"@bazel_tools//tools/cpp:link_extra_libs": "_link_extra_libs",
|
||||
},
|
||||
)
|
||||
|
||||
# This transition sets SDK configuration options required to build test binaries
|
||||
# for the kitchen_sink suite of tests.
|
||||
kitchen_sink_test_binary = declare_transtion(
|
||||
attrs = {
|
||||
"bt_stack_config": attr.label(mandatory = True),
|
||||
"lwip_config": attr.label(mandatory = True),
|
||||
"enable_ble": attr.bool(default = False),
|
||||
"enable_bt_classic": attr.bool(default = False),
|
||||
# This could be shared, but we don't in order to make it clearer that
|
||||
# a transition is in use.
|
||||
"_allowlist_function_transition": attr.label(
|
||||
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
||||
),
|
||||
},
|
||||
flag_overrides = {
|
||||
"@pico-sdk//bazel/config:PICO_BTSTACK_CONFIG": "bt_stack_config",
|
||||
"@pico-sdk//bazel/config:PICO_LWIP_CONFIG": "lwip_config",
|
||||
"@pico-sdk//bazel/config:PICO_BT_ENABLE_BLE": "enable_ble",
|
||||
"@pico-sdk//bazel/config:PICO_BT_ENABLE_CLASSIC": "enable_bt_classic",
|
||||
},
|
||||
)
|
||||
|
||||
# This transition sets SDK configuration options required to build test binaries
|
||||
# for the pico_float_test suite of tests.
|
||||
pico_float_test_binary = declare_transtion(
|
||||
attrs = {
|
||||
"pico_printf_impl": attr.string(),
|
||||
"extra_copts": attr.string_list(),
|
||||
# This could be shared, but we don't in order to make it clearer that
|
||||
# a transition is in use.
|
||||
"_allowlist_function_transition": attr.label(
|
||||
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
||||
),
|
||||
},
|
||||
flag_overrides = {
|
||||
"@pico-sdk//bazel/config:PICO_DEFAULT_PRINTF_IMPL": "pico_printf_impl",
|
||||
},
|
||||
append_to_flags = {
|
||||
"//command_line_option:copt": "extra_copts",
|
||||
},
|
||||
)
|
||||
|
||||
# This is a general purpose transition that applies the listed copt flags to
|
||||
# all transitive dependencies.
|
||||
extra_copts_for_all_deps = declare_transtion(
|
||||
attrs = {
|
||||
"extra_copts": attr.string_list(),
|
||||
# This could be shared, but we don't in order to make it clearer that
|
||||
# a transition is in use.
|
||||
"_allowlist_function_transition": attr.label(
|
||||
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
||||
),
|
||||
},
|
||||
append_to_flags = {
|
||||
"//command_line_option:copt": "extra_copts",
|
||||
},
|
||||
)
|
|
@ -2,3 +2,10 @@
|
|||
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||
set(CMAKE_EXECUTABLE_SUFFIX .elf)
|
||||
|
||||
# include paths to find installed tools
|
||||
if(CMAKE_HOST_WIN32)
|
||||
include(Platform/WindowsPaths)
|
||||
else()
|
||||
include(Platform/UnixPaths)
|
||||
endif()
|
||||
|
|
41
cmake/generic_board.cmake
Normal file
41
cmake/generic_board.cmake
Normal file
|
@ -0,0 +1,41 @@
|
|||
# For boards without their own cmake file, we look for a header file
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_BOARD_HEADER_DIRS, List of directories to look for <PICO_BOARD>.h in. This may be specified the user environment, type=list, group=build
|
||||
if (DEFINED ENV{PICO_BOARD_HEADER_DIRS})
|
||||
set(PICO_BOARD_HEADER_DIRS $ENV{PICO_BOARD_HEADER_DIRS})
|
||||
message("Using PICO_BOARD_HEADER_DIRS from environment ('${PICO_BOARD_HEADER_DIRS}')")
|
||||
endif()
|
||||
set(PICO_BOARD_HEADER_DIRS ${PICO_BOARD_HEADER_DIRS} CACHE STRING "PICO board header directories" FORCE)
|
||||
|
||||
list(APPEND PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}/../src/boards/include/boards)
|
||||
pico_find_in_paths(PICO_BOARD_HEADER_FILE PICO_BOARD_HEADER_DIRS ${PICO_BOARD}.h)
|
||||
|
||||
if (EXISTS ${PICO_BOARD_HEADER_FILE})
|
||||
message("Using board configuration from ${PICO_BOARD_HEADER_FILE}")
|
||||
list(APPEND PICO_CONFIG_HEADER_FILES ${PICO_BOARD_HEADER_FILE})
|
||||
|
||||
# we parse the header file to configure the defaults
|
||||
file(STRINGS ${PICO_BOARD_HEADER_FILE} HEADER_FILE_CONTENTS)
|
||||
|
||||
while(HEADER_FILE_CONTENTS)
|
||||
list(POP_FRONT HEADER_FILE_CONTENTS LINE)
|
||||
if (LINE MATCHES "^[ \t\]*//[ \t\]*pico_cmake_set[ \t\]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t\]*=[ \t\]*(.*)")
|
||||
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
|
||||
endif()
|
||||
if (LINE MATCHES "^[ \t\]*//[ \t\]*pico_cmake_set_default[ \t\]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t\]*=[ \t\]*(.*)")
|
||||
if (NOT DEFINED "${CMAKE_MATCH_1}")
|
||||
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
|
||||
else()
|
||||
list(APPEND PICO_BOARD_CMAKE_OVERRIDES ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
endif()
|
||||
endwhile()
|
||||
else()
|
||||
set(msg "Unable to find definition of board '${PICO_BOARD}' (specified by PICO_BOARD):\n")
|
||||
list(JOIN PICO_BOARD_HEADER_DIRS ", " DIRS)
|
||||
string(CONCAT msg ${msg} " Looked for ${PICO_BOARD}.h in ${DIRS} (additional paths specified by PICO_BOARD_HEADER_DIRS)\n")
|
||||
list(JOIN PICO_BOARD_CMAKE_DIRS ", " DIRS)
|
||||
string(CONCAT msg ${msg} " Looked for ${PICO_BOARD}.cmake in ${DIRS} (additional paths specified by PICO_BOARD_CMAKE_DIRS)")
|
||||
message(FATAL_ERROR ${msg})
|
||||
endif()
|
|
@ -1,21 +1,135 @@
|
|||
# PICO_CMAKE_CONFIG: PICO_PLATFORM, platform to build for e.g. rp2040/host, default=rp2040 or environment value, group=build
|
||||
if (DEFINED ENV{PICO_PLATFORM} AND (NOT PICO_PLATFORM))
|
||||
# PICO_BOARD is the root of config as it can define PICO_PLATFORM and other build vars
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_BOARD, Board name being built for. This may be specified in the user environment, type=string, default=pico or pico2, group=build, docref=cmake-platform-board-config
|
||||
if (DEFINED ENV{PICO_BOARD} AND NOT PICO_BOARD)
|
||||
set(PICO_BOARD $ENV{PICO_BOARD})
|
||||
message("Initializing PICO_BOARD from environment ('${PICO_BOARD}')")
|
||||
endif()
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_PLATFORM, Platform to build for e.g. rp2040/rp2350/rp2350-arm-s/rp2350-riscv/host. This may be specified in the user environment, type=string, default=based on PICO_BOARD or environment value, group=build, docref=cmake-platform-board-config
|
||||
if (DEFINED ENV{PICO_PLATFORM} AND NOT PICO_PLATFORM)
|
||||
set(PICO_PLATFORM $ENV{PICO_PLATFORM})
|
||||
message("Using PICO_PLATFORM from environment ('${PICO_PLATFORM}')")
|
||||
else()
|
||||
message("Initializing PICO_PLATFORM from environment ('${PICO_PLATFORM}')")
|
||||
endif()
|
||||
set(PICO_SAVED_PLATFORM "${PICO_PLATFORM}")
|
||||
|
||||
# If PICO_PLATFORM is specified but not PICO_BOARD, we'll make a stab at defaulting
|
||||
if (NOT PICO_DEFAULT_BOARD_rp2040)
|
||||
set(PICO_DEFAULT_BOARD_rp2040 "pico")
|
||||
endif()
|
||||
if (NOT PICO_DEFAULT_BOARD_rp2350)
|
||||
set(PICO_DEFAULT_BOARD_rp2350 "pico2")
|
||||
endif()
|
||||
if (NOT PICO_DEFAULT_BOARD_rp2350-arm-s)
|
||||
set(PICO_DEFAULT_BOARD_rp2350-arm-s "pico2")
|
||||
endif()
|
||||
if (NOT PICO_DEFAULT_BOARD_rp2350-riscv)
|
||||
set(PICO_DEFAULT_BOARD_rp2350-riscv "pico2")
|
||||
endif()
|
||||
if (NOT PICO_DEFAULT_BOARD_host)
|
||||
set(PICO_DEFAULT_BOARD_host "none")
|
||||
endif()
|
||||
|
||||
if (NOT PICO_DEFAULT_PLATFORM)
|
||||
set(PICO_DEFAULT_PLATFORM "rp2040")
|
||||
endif()
|
||||
|
||||
if (NOT PICO_BOARD)
|
||||
if (NOT PICO_PLATFORM)
|
||||
set(PICO_PLATFORM "rp2040")
|
||||
pico_message("Defaulting PICO_PLATFORM to ${PICO_PLATFORM} since not specified.")
|
||||
else()
|
||||
message("PICO platform is ${PICO_PLATFORM}.")
|
||||
# if we have neither BOARD nor PLATFORM default PLATFORM silently, so we don't end up with a board of "none"
|
||||
# on platform that does have a default board (we want default PLATFORM and BOARD in that case)
|
||||
set(PICO_PLATFORM ${PICO_DEFAULT_PLATFORM})
|
||||
# set PICO_SAVED_PLATFORM so we don't print "Defaulting" again below
|
||||
set(PICO_SAVED_PLATFORM ${PICO_DEFAULT_PLATFORM})
|
||||
pico_message("Defaulting platform (PICO_PLATFORM) to '${PICO_PLATFORM}' since not specified.")
|
||||
endif()
|
||||
endif ()
|
||||
if (PICO_DEFAULT_BOARD_${PICO_PLATFORM})
|
||||
set(PICO_BOARD ${PICO_DEFAULT_BOARD_${PICO_PLATFORM}})
|
||||
else()
|
||||
set(PICO_BOARD "none")
|
||||
endif()
|
||||
pico_message("Defaulting target board (PICO_BOARD) to '${PICO_BOARD}' since not specified.")
|
||||
else()
|
||||
message("Target board (PICO_BOARD) is '${PICO_BOARD}'.")
|
||||
endif()
|
||||
set(PICO_BOARD ${PICO_BOARD} CACHE STRING "PICO target board (e.g. pico, pico2)" FORCE)
|
||||
|
||||
set(PICO_PLATFORM ${PICO_PLATFORM} CACHE STRING "PICO Build platform (e.g. rp2040, host)")
|
||||
# PICO_CMAKE_CONFIG: PICO_BOARD_CMAKE_DIRS, List of directories to look for <PICO_BOARD>.cmake in. This may be specified in the user environment, type=list, group=build
|
||||
if (DEFINED ENV{PICO_BOARD_CMAKE_DIRS})
|
||||
set(PICO_BOARD_CMAKE_DIRS $ENV{PICO_BOARD_CMAKE_DIRS})
|
||||
message("Using PICO_BOARD_CMAKE_DIRS from environment ('${PICO_BOARD_CMAKE_DIRS}')")
|
||||
endif()
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_CMAKE_RELOAD_PLATFORM_FILE, custom CMake file to use to set up the platform environment, default=none, group=build
|
||||
set(PICO_CMAKE_PRELOAD_PLATFORM_FILE "" CACHE INTERNAL "")
|
||||
set(PICO_CMAKE_PRELOAD_PLATFORM_DIR "${CMAKE_CURRENT_LIST_DIR}/preload/platforms" CACHE INTERNAL "")
|
||||
list(APPEND PICO_BOARD_CMAKE_DIRS ${CMAKE_CURRENT_LIST_DIR}/../src/boards)
|
||||
|
||||
pico_find_in_paths(PICO_BOARD_CMAKE_FILE PICO_BOARD_CMAKE_DIRS ${PICO_BOARD}.cmake)
|
||||
if (EXISTS "${PICO_BOARD_CMAKE_FILE}")
|
||||
message("Using CMake board configuration from ${PICO_BOARD_CMAKE_FILE}")
|
||||
include(${PICO_BOARD_CMAKE_FILE} board_config)
|
||||
else()
|
||||
include(generic_board)
|
||||
endif()
|
||||
|
||||
list(APPEND PICO_INCLUDE_DIRS ${PICO_SDK_PATH}/src/boards/include) # so boards/foo.h can be explicitly included
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_DEFAULT_RP2350_PLATFORM, Default actual platform to build for if rp2350 is specified for PICO_PLATFORM e.g. rp2350-arm-s/rp2350-riscv, type=string, default=rp2350-arm-s, group=build
|
||||
if (DEFINED ENV{PICO_DEFAULT_RP2350_PLATFORM} AND NOT PICO_DEFAULT_RP2350_PLATFORM)
|
||||
set(PICO_DEFAULT_RP2350_PLATFORM $ENV{PICO_DEFAULT_RP2350_PLATFORM})
|
||||
endif()
|
||||
if (NOT PICO_DEFAULT_RP2350_PLATFORM)
|
||||
set(PICO_DEFAULT_RP2350_PLATFORM "rp2350-arm-s")
|
||||
endif()
|
||||
|
||||
if (NOT COMMAND pico_expand_pico_platform)
|
||||
function(pico_expand_pico_platform FUNC DO_MESSAGE)
|
||||
if (${FUNC} STREQUAL "rp2350")
|
||||
if (DO_MESSAGE)
|
||||
message("Auto-converting non-specific PICO_PLATFORM='rp2350' to '${PICO_DEFAULT_RP2350_PLATFORM}'")
|
||||
endif()
|
||||
set(${FUNC} "${PICO_DEFAULT_RP2350_PLATFORM}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
if (NOT PICO_PLATFORM)
|
||||
set(PICO_PLATFORM ${PICO_DEFAULT_PLATFORM})
|
||||
pico_message("Defaulting platform (PICO_PLATFORM) to '${PICO_PLATFORM}' since not specified.")
|
||||
else()
|
||||
if (NOT PICO_SAVED_PLATFORM)
|
||||
pico_expand_pico_platform(PICO_PLATFORM 1)
|
||||
pico_message("Defaulting platform (PICO_PLATFORM) to '${PICO_PLATFORM}' based on PICO_BOARD setting.")
|
||||
else()
|
||||
string(REGEX REPLACE "-.*" "" PICO_PLATFORM_PREFIX ${PICO_PLATFORM})
|
||||
string(REGEX REPLACE "-.*" "" PICO_SAVED_PLATFORM_PREFIX ${PICO_SAVED_PLATFORM})
|
||||
if (PICO_PLATFORM_PREFIX STREQUAL PICO_SAVED_PLATFORM_PREFIX)
|
||||
# the PICO_PLATFORM specified based on the board is compatible based on the one we were
|
||||
# already using, so use that
|
||||
pico_expand_pico_platform(PICO_SAVED_PLATFORM 0)
|
||||
set(PICO_PLATFORM ${PICO_SAVED_PLATFORM})
|
||||
message("Pico Platform (PICO_PLATFORM) is '${PICO_PLATFORM}'.")
|
||||
else()
|
||||
message(FATAL_ERROR "PICO_PLATFORM is specified to be '${PICO_SAVED_PLATFORM}', but PICO_BOARD='${PICO_BOARD}' uses \
|
||||
'${PICO_PLATFORM}' which is incompatible. You need to delete the CMake cache or build directory and reconfigure to proceed. \
|
||||
The best practice is to use separate build directories for different platforms.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
unset(PICO_SAVED_PLATFORM)
|
||||
|
||||
if (PICO_PREVIOUS_PLATFORM AND NOT PICO_PREVIOUS_PLATFORM STREQUAL PICO_PLATFORM)
|
||||
message(FATAL_ERROR "PICO_PLATFORM has been modified from '${PICO_SAVED_PLATFORM}' to '${PICO_PLATFORM}.\
|
||||
You need to delete the CMake cache or build directory and reconfigure to proceed.\
|
||||
The best practice is to use separate build directories for different platforms.")
|
||||
endif()
|
||||
set(PICO_PLATFORM ${PICO_PLATFORM} CACHE STRING "PICO Build platform (e.g. rp2040, rp2350, rp2350-riscv, host)" FORCE)
|
||||
set(PICO_PREVIOUS_PLATFORM ${PICO_PLATFORM} CACHE STRING "Saved PICO Build platform (e.g. rp2040, rp2350, rp2350-riscv, host)" INTERNAL)
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_CMAKE_PRELOAD_PLATFORM_FILE, Custom CMake file to use to set up the platform environment, type=string, group=build
|
||||
set(PICO_CMAKE_PRELOAD_PLATFORM_FILE ${PICO_CMAKE_PRELOAD_PLATFORM_FILE} CACHE INTERNAL "")
|
||||
if (NOT PICO_CMAKE_PRELOAD_PLATFORM_DIR)
|
||||
set(PICO_CMAKE_PRELOAD_PLATFORM_DIR "${CMAKE_CURRENT_LIST_DIR}/preload/platforms")
|
||||
endif()
|
||||
set(PICO_CMAKE_PRELOAD_PLATFORM_DIR "${PICO_CMAKE_PRELOAD_PLATFORM_DIR}" CACHE INTERNAL "")
|
||||
|
||||
if (NOT PICO_CMAKE_PRELOAD_PLATFORM_FILE)
|
||||
set(PICO_CMAKE_PRELOAD_PLATFORM_FILE ${PICO_CMAKE_PRELOAD_PLATFORM_DIR}/${PICO_PLATFORM}.cmake CACHE INTERNAL "")
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
# PICO_CMAKE_CONFIG: PICO_TOOLCHAIN_PATH, Path to search for compiler, default=none (i.e. search system paths), group=build
|
||||
# PICO_CMAKE_CONFIG: PICO_TOOLCHAIN_PATH, Path to search for compiler, type=string, default=none (i.e. search system paths), group=build, docref=cmake-toolchain-config
|
||||
set(PICO_TOOLCHAIN_PATH "${PICO_TOOLCHAIN_PATH}" CACHE INTERNAL "")
|
||||
|
||||
# Set a default build type if none was specified
|
||||
set(default_build_type "Release")
|
||||
|
||||
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_PREFIX_PATH)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Defaulting build type to '${default_build_type}' since not specified.")
|
||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build, options are: 'Debug', 'Release', 'MinSizeRel', 'RelWithDebInfo'." FORCE)
|
||||
|
@ -16,28 +18,59 @@ if (CMAKE_BUILD_TYPE STREQUAL "Default")
|
|||
error("Default build type is NOT supported")
|
||||
endif()
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_COMPILER, Optionally specifies a different compiler (other than pico_arm_gcc.cmake) - this is not yet fully supported, default=none, group=build
|
||||
# If PICO_COMPILER is specified, set toolchain file to ${PICO_COMPILER}.cmake.
|
||||
if (DEFINED PICO_COMPILER)
|
||||
if (DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||
get_filename_component(toolchain "${CMAKE_TOOLCHAIN_FILE}" NAME_WE)
|
||||
if (NOT "${PICO_COMPILER}" STREQUAL "${toolchain}")
|
||||
message(WARNING "CMAKE_TOOLCHAIN_FILE is already defined to ${toolchain}.cmake, you\
|
||||
need to delete cache and reconfigure if you want to switch compiler.")
|
||||
endif ()
|
||||
else ()
|
||||
set(toolchain_dir "${CMAKE_CURRENT_LIST_DIR}/preload/toolchains")
|
||||
set(toolchain_file "${toolchain_dir}/${PICO_COMPILER}.cmake")
|
||||
if (EXISTS "${toolchain_file}")
|
||||
set(CMAKE_TOOLCHAIN_FILE "${toolchain_file}" CACHE INTERNAL "")
|
||||
else ()
|
||||
# todo improve message
|
||||
message(FATAL_ERROR "Toolchain file \"${PICO_COMPILER}.cmake\" does not exist, please\
|
||||
select one from \"cmake/toolchains\" folder.")
|
||||
endif ()
|
||||
endif ()
|
||||
message("PICO compiler is ${PICO_COMPILER}")
|
||||
if (NOT (DEFINED PICO_COMPILER OR DEFINED CMAKE_TOOLCHAIN_FILE))
|
||||
if (DEFINED PICO_DEFAULT_COMPILER)
|
||||
pico_message("Defaulting compiler (PICO_COMPILER) to '${PICO_DEFAULT_COMPILER}' since not specified.")
|
||||
set(PICO_COMPILER ${PICO_DEFAULT_COMPILER})
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_COMPILER, Specifies the compiler family to use, type=string, group=build, default=PICO_DEFAULT_COMPILER which is set based on PICO_PLATFORM, docref=cmake-toolchain-config
|
||||
# If PICO_COMPILER is specified, set toolchain file to ${PICO_COMPILER}.cmake.
|
||||
if (DEFINED PICO_COMPILER)
|
||||
# maintain backwards compatibility with RP2040 SDK compilers
|
||||
set(ORIG_PICO_COMPILER "${PICO_COMPILER}")
|
||||
if (PICO_COMPILER STREQUAL "pico_arm_gcc")
|
||||
if (PICO_PLATFORM STREQUAL "rp2040")
|
||||
set(PICO_COMPILER "pico_arm_cortex_m0plus_gcc")
|
||||
elseif(PICO_PLATFORM STREQUAL "rp2350")
|
||||
set(PICO_COMPILER "pico_arm_cortex_m33_gcc")
|
||||
endif()
|
||||
elseif(PICO_COMPILER STREQUAL "pico_arm_clang")
|
||||
if (PICO_PLATFORM STREQUAL "rp2040")
|
||||
set(PICO_COMPILER "pico_arm_cortex_m0plus_clang")
|
||||
elseif(PICO_PLATFORM STREQUAL "rp2350-arm-s")
|
||||
set(PICO_COMPILER "pico_arm_cortex_m33_clang")
|
||||
elseif(PICO_PLATFORM STREQUAL "rp2350-arm-ns")
|
||||
set(PICO_COMPILER "pico_arm_cortex_m33_clang")
|
||||
endif()
|
||||
endif()
|
||||
if (NOT PICO_COMPILER STREQUAL ORIG_PICO_COMPILER)
|
||||
message("Accepting PICO_COMPILER value '${ORIG_PICO_COMPILER}' for compatibility, but using '${PICO_COMPILER}' instead")
|
||||
endif()
|
||||
if (NOT DEFINED PICO_TOOLCHAIN_DIR)
|
||||
set(PICO_TOOLCHAIN_DIR "${CMAKE_CURRENT_LIST_DIR}/preload/toolchains")
|
||||
endif()
|
||||
set(toolchain_file "${PICO_TOOLCHAIN_DIR}/${PICO_COMPILER}.cmake")
|
||||
if (EXISTS "${toolchain_file}")
|
||||
set(CMAKE_TOOLCHAIN_FILE "${toolchain_file}")
|
||||
else ()
|
||||
# todo improve message
|
||||
message(FATAL_ERROR "Toolchain file \"${PICO_COMPILER}.cmake\" does not exist, please\
|
||||
select one from \"cmake/toolchains\" folder.")
|
||||
endif ()
|
||||
message("Configuring toolchain based on PICO_COMPILER '${PICO_COMPILER}'")
|
||||
endif ()
|
||||
|
||||
if (PICO_PREVIOUS_CMAKE_TOOLCHAIN_FILE)
|
||||
if (NOT "${PICO_PREVIOUS_CMAKE_TOOLCHAIN_FILE}" STREQUAL "${CMAKE_TOOLCHAIN_FILE}")
|
||||
message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE was previously defined to ${PICO_PREVIOUS_CMAKE_TOOLCHAIN_FILE}, and now\
|
||||
is being changed to ${CMAKE_TOOLCHAIN_FILE}. You\
|
||||
need to delete the CMake cache and reconfigure if you want to switch compiler.\
|
||||
The best practice is to use separate build directories for different platforms or compilers.")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(PICO_PREVIOUS_CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE} CACHE INTERNAL "Saved CMAKE_TOOLCHAIN_FILE" FORCE)
|
||||
unset(PICO_COMPILER CACHE)
|
||||
|
||||
|
|
3
cmake/preload/platforms/combined-docs.cmake
Normal file
3
cmake/preload/platforms/combined-docs.cmake
Normal file
|
@ -0,0 +1,3 @@
|
|||
set(PICO_DEFAULT_COMPILER "pico_arm_cortex_m33_gcc")
|
||||
set(PICO_CHIP rp2350)
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
if (NOT (DEFINED PICO_COMPILER OR DEFINED CMAKE_TOOLCHAIN_FILE))
|
||||
pico_message("Defaulting PICO platform compiler to pico_arm_gcc since not specified.")
|
||||
set(PICO_COMPILER "pico_arm_gcc")
|
||||
endif ()
|
||||
|
||||
|
||||
|
|
@ -1 +1,2 @@
|
|||
include(${CMAKE_CURRENT_LIST_DIR}/pico/pico.cmake)
|
||||
set(PICO_DEFAULT_COMPILER "pico_arm_cortex_m0plus_gcc")
|
||||
set(PICO_CHIP rp2040)
|
||||
|
|
3
cmake/preload/platforms/rp2350-arm-s.cmake
Normal file
3
cmake/preload/platforms/rp2350-arm-s.cmake
Normal file
|
@ -0,0 +1,3 @@
|
|||
set(PICO_DEFAULT_COMPILER "pico_arm_cortex_m33_gcc")
|
||||
set(PICO_CHIP rp2350)
|
||||
|
3
cmake/preload/platforms/rp2350-riscv.cmake
Normal file
3
cmake/preload/platforms/rp2350-riscv.cmake
Normal file
|
@ -0,0 +1,3 @@
|
|||
set(PICO_DEFAULT_COMPILER "pico_riscv_gcc")
|
||||
set(PICO_CHIP rp2350)
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
# NOTE: THIS IS A WIP ONLY PICO_ARM_GCC IS CURRENTLY SUPPORTED
|
||||
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
|
||||
# i.e. CMake<Lang>Information and whatnot
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake)
|
||||
|
||||
# include our Platform/pico.cmake
|
||||
set(CMAKE_SYSTEM_NAME PICO)
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
|
||||
|
||||
# Find CLANG
|
||||
pico_find_compiler(PICO_COMPILER_CC clang)
|
||||
pico_find_compiler(PICO_COMPILER_CXX clang)
|
||||
#pico_find_compiler(PICO_COMPILER_ASM armasm)
|
||||
set(PICO_COMPILER_ASM "${PICO_COMPILER_CC}" CACHE INTERNAL "")
|
||||
pico_find_compiler(PICO_OBJCOPY llvm-objcopy)
|
||||
pico_find_compiler(PICO_OBJDUMP llvm-objdump)
|
||||
|
||||
# Specify the cross compiler.
|
||||
set(CMAKE_C_COMPILER ${PICO_COMPILER_CC} CACHE FILEPATH "C compiler")
|
||||
set(CMAKE_CXX_COMPILER ${PICO_COMPILER_CXX} CACHE FILEPATH "C++ compiler")
|
||||
set(CMAKE_C_OUTPUT_EXTENSION .o)
|
||||
|
||||
# todo should we be including CMakeASMInformation anyway - i guess that is host side
|
||||
set(CMAKE_ASM_COMPILER ${PICO_COMPILER_ASM} CACHE FILEPATH "ASM compiler")
|
||||
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
set(CMAKE_INCLUDE_FLAG_ASM "-I")
|
||||
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
|
||||
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
|
||||
|
||||
# Disable compiler checks.
|
||||
set(CMAKE_C_COMPILER_FORCED TRUE)
|
||||
set(CMAKE_CXX_COMPILER_FORCED TRUE)
|
||||
|
||||
# Add target system root to cmake find path.
|
||||
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
|
||||
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
|
||||
|
||||
# Look for includes and libraries only in the target system prefix.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
include_directories(/usr/include/newlib)
|
||||
|
||||
# todo move to platform/Generix-xxx
|
||||
set(ARM_CLANG_COMMON_FLAGS " --target=arm-none-eabi -mcpu=cortex-m0plus -mthumb")
|
||||
set(CMAKE_C_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
|
||||
set(CMAKE_ASM_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
|
||||
set(CMAKE_C_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og")
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# NOTE: THIS IS A WIP ONLY PICO_ARM_GCC IS CURRENTLY SUPPORTED
|
||||
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
|
||||
# i.e. CMake<Lang>Information and whatnot
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/util/find_compiler.cmake)
|
||||
|
||||
# include our Platform/PICO.cmake
|
||||
set(CMAKE_SYSTEM_NAME PICO)
|
||||
|
@ -27,10 +27,6 @@ set(CMAKE_INCLUDE_FLAG_ASM "-I")
|
|||
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
|
||||
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
|
||||
|
||||
# Disable compiler checks.
|
||||
set(CMAKE_C_COMPILER_FORCED TRUE)
|
||||
set(CMAKE_CXX_COMPILER_FORCED TRUE)
|
||||
|
||||
# Add target system root to cmake find path.
|
||||
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
|
||||
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
|
||||
|
@ -41,12 +37,5 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# todo move to platform/Generix-xxx
|
||||
set(ARM_CLANG_COMMON_FLAGS " --cpu=Cortex-M0plus")
|
||||
string(APPEND CMAKE_C_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
|
||||
string(APPEND CMAKE_CXX_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
|
||||
string(APPEND CMAKE_ASM_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS}")
|
||||
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og")
|
||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og")
|
||||
|
||||
|
||||
set(ARM_TOOLCHAIN_COMMON_FLAGS " --cpu=Cortex-M0plus")
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/util/set_flags.cmake)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
|
||||
|
||||
# these are all the directories under LLVM embedded toolchain for ARM (newlib or pibolibc) and under llvm_libc
|
||||
set(PICO_CLANG_RUNTIMES armv6m_soft_nofp armv6m-unknown-none-eabi)
|
||||
|
||||
set(PICO_COMMON_LANG_FLAGS "--target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_clang_common.cmake)
|
|
@ -0,0 +1,7 @@
|
|||
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
|
||||
|
||||
set(PICO_DEFAULT_GCC_TRIPLE arm-none-eabi)
|
||||
# on ARM -mcpu should not be mixed with -march
|
||||
set(PICO_COMMON_LANG_FLAGS " -mcpu=cortex-m0plus -mthumb")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_gcc_common.cmake)
|
15
cmake/preload/toolchains/pico_arm_cortex_m23_gcc.cmake
Normal file
15
cmake/preload/toolchains/pico_arm_cortex_m23_gcc.cmake
Normal file
|
@ -0,0 +1,15 @@
|
|||
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
|
||||
# i.e. CMake<Lang>Information and whatnot
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m23)
|
||||
set(PICO_DEFAULT_GCC_TRIPLE arm-none-eabi)
|
||||
|
||||
# todo amy should this be -mfloat-abi=hard?
|
||||
set(PICO_COMMON_LANG_FLAGS " -mcpu=cortex-m23 -mthumb -march=armv8-m.base")
|
||||
# todo probably need a setting here, also do we want `softfp`?
|
||||
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} -mfloat-abi=softfp")
|
||||
if (NOT PICO_NO_CMSE)
|
||||
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} -mcmse")
|
||||
endif()
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_gcc_common.cmake)
|
8
cmake/preload/toolchains/pico_arm_cortex_m33_clang.cmake
Normal file
8
cmake/preload/toolchains/pico_arm_cortex_m33_clang.cmake
Normal file
|
@ -0,0 +1,8 @@
|
|||
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
|
||||
|
||||
# these are all the directories under LLVM embedded toolchain for ARM (newlib or pibolibc) and under llvm_libc
|
||||
set(PICO_CLANG_RUNTIMES armv8m.main_soft_nofp armv8m.main-unknown-none-eabi)
|
||||
|
||||
set(PICO_COMMON_LANG_FLAGS "-mcpu=cortex-m33 --target=armv8m.main-none-eabi -mfloat-abi=softfp -march=armv8m.main+fp+dsp")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_clang_common.cmake)
|
10
cmake/preload/toolchains/pico_arm_cortex_m33_gcc.cmake
Normal file
10
cmake/preload/toolchains/pico_arm_cortex_m33_gcc.cmake
Normal file
|
@ -0,0 +1,10 @@
|
|||
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
|
||||
set(PICO_DEFAULT_GCC_TRIPLE arm-none-eabi)
|
||||
|
||||
set(PICO_COMMON_LANG_FLAGS " -mcpu=cortex-m33 -mthumb -march=armv8-m.main+fp+dsp")
|
||||
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} -mfloat-abi=softfp")
|
||||
if (NOT PICO_NO_CMSE)
|
||||
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} -mcmse")
|
||||
endif()
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_gcc_common.cmake)
|
|
@ -1,67 +0,0 @@
|
|||
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
|
||||
# i.e. CMake<Lang>Information and whatnot
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake)
|
||||
|
||||
# include our Platform/PICO.cmake
|
||||
set(CMAKE_SYSTEM_NAME PICO)
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
|
||||
|
||||
if (NOT PICO_GCC_TRIPLE)
|
||||
if (DEFINED ENV{PICO_GCC_TRIPLE})
|
||||
set(PICO_GCC_TRIPLE $ENV{PICO_GCC_TRIPLE})
|
||||
message("PICO_GCC_TRIPLE set from environment: $ENV{PICO_GCC_TRIPLE}")
|
||||
else()
|
||||
set(PICO_GCC_TRIPLE arm-none-eabi)
|
||||
#pico_message_debug("PICO_GCC_TRIPLE defaulted to arm-none-eabi")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find GCC for ARM.
|
||||
pico_find_compiler(PICO_COMPILER_CC ${PICO_GCC_TRIPLE}-gcc)
|
||||
pico_find_compiler(PICO_COMPILER_CXX ${PICO_GCC_TRIPLE}-g++)
|
||||
set(PICO_COMPILER_ASM "${PICO_COMPILER_CC}" CACHE INTERNAL "")
|
||||
pico_find_compiler(PICO_OBJCOPY ${PICO_GCC_TRIPLE}-objcopy)
|
||||
pico_find_compiler(PICO_OBJDUMP ${PICO_GCC_TRIPLE}-objdump)
|
||||
|
||||
# Specify the cross compiler.
|
||||
set(CMAKE_C_COMPILER ${PICO_COMPILER_CC} CACHE FILEPATH "C compiler")
|
||||
set(CMAKE_CXX_COMPILER ${PICO_COMPILER_CXX} CACHE FILEPATH "C++ compiler")
|
||||
set(CMAKE_C_OUTPUT_EXTENSION .o)
|
||||
|
||||
# todo should we be including CMakeASMInformation anyway - i guess that is host side
|
||||
set(CMAKE_ASM_COMPILER ${PICO_COMPILER_ASM} CACHE FILEPATH "ASM compiler")
|
||||
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
set(CMAKE_INCLUDE_FLAG_ASM "-I")
|
||||
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
|
||||
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
|
||||
|
||||
# Disable compiler checks.
|
||||
set(CMAKE_C_COMPILER_FORCED TRUE)
|
||||
set(CMAKE_CXX_COMPILER_FORCED TRUE)
|
||||
|
||||
# Add target system root to cmake find path.
|
||||
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
|
||||
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
|
||||
|
||||
# Look for includes and libraries only in the target system prefix.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
option(PICO_DEOPTIMIZED_DEBUG "Build debug builds with -O0" 0)
|
||||
|
||||
# todo move to platform/Generix-xxx
|
||||
|
||||
# on ARM -mcpu should not be mixed with -march
|
||||
set(ARM_GCC_COMMON_FLAGS " -mcpu=cortex-m0plus -mthumb")
|
||||
foreach(LANG IN ITEMS C CXX ASM)
|
||||
set(CMAKE_${LANG}_FLAGS_INIT "${ARM_GCC_COMMON_FLAGS}")
|
||||
if (PICO_DEOPTIMIZED_DEBUG)
|
||||
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
|
||||
else()
|
||||
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-Og")
|
||||
endif()
|
||||
set(CMAKE_${LANG}_LINK_FLAGS "-Wl,--build-id=none")
|
||||
endforeach()
|
||||
|
7
cmake/preload/toolchains/pico_riscv_gcc.cmake
Normal file
7
cmake/preload/toolchains/pico_riscv_gcc.cmake
Normal file
|
@ -0,0 +1,7 @@
|
|||
set(CMAKE_SYSTEM_PROCESSOR hazard3)
|
||||
|
||||
set(PICO_DEFAULT_GCC_TRIPLE riscv32-unknown-elf riscv32-corev-elf)
|
||||
|
||||
set(PICO_COMMON_LANG_FLAGS " -march=rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb -mabi=ilp32")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_gcc_common.cmake)
|
10
cmake/preload/toolchains/pico_riscv_gcc_zcb_zcmp.cmake
Normal file
10
cmake/preload/toolchains/pico_riscv_gcc_zcb_zcmp.cmake
Normal file
|
@ -0,0 +1,10 @@
|
|||
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
|
||||
# i.e. CMake<Lang>Information and whatnot
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR hazard3)
|
||||
|
||||
set(PICO_DEFAULT_GCC_TRIPLE riscv32-unknown-elf riscv32-corev-elf)
|
||||
|
||||
set(PICO_COMMON_LANG_FLAGS " -march=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb_zcmp -mabi=ilp32")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_gcc_common.cmake)
|
|
@ -7,10 +7,10 @@ endif ()
|
|||
# Find the compiler executable and store its path in a cache entry ${compiler_path}.
|
||||
# If not found, issue a fatal message and stop processing. PICO_TOOLCHAIN_PATH can be provided from
|
||||
# commandline as additional search path.
|
||||
function(pico_find_compiler compiler_path compiler_exe)
|
||||
function(pico_find_compiler compiler_path compiler_exes)
|
||||
# Search user provided path first.
|
||||
find_program(
|
||||
${compiler_path} ${compiler_exe}
|
||||
${compiler_path} NAMES ${compiler_exes}
|
||||
PATHS ENV PICO_TOOLCHAIN_PATH
|
||||
PATH_SUFFIXES bin
|
||||
NO_DEFAULT_PATH
|
||||
|
@ -21,11 +21,21 @@ function(pico_find_compiler compiler_path compiler_exe)
|
|||
if (DEFINED ENV{PICO_TOOLCHAIN_PATH})
|
||||
message(WARNING "PICO_TOOLCHAIN_PATH specified ($ENV{PICO_TOOLCHAIN_PATH}), but ${compiler_exe} not found there")
|
||||
endif()
|
||||
find_program(${compiler_path} ${compiler_exe})
|
||||
find_program(${compiler_path} NAMES ${compiler_exes})
|
||||
endif ()
|
||||
if ("${${compiler_path}}" STREQUAL "${compiler_path}-NOTFOUND")
|
||||
set(PICO_TOOLCHAIN_PATH "" CACHE PATH "Path to search for compiler.")
|
||||
message(FATAL_ERROR "Compiler '${compiler_exe}' not found, you can specify search path with\
|
||||
list(JOIN compiler_exes " / " compiler_exes)
|
||||
message(FATAL_ERROR "Compiler '${compiler_exes}' not found, you can specify search path with\
|
||||
\"PICO_TOOLCHAIN_PATH\".")
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
# Find the compiler executable and store its path in a cache entry ${compiler_path}.
|
||||
# If not found, issue a fatal message and stop processing. PICO_TOOLCHAIN_PATH can be provided from
|
||||
# commandline as additional search path.
|
||||
function(pico_find_compiler_with_triples compiler_path triples compiler_suffix)
|
||||
list(TRANSFORM triples APPEND "-${compiler_suffix}")
|
||||
pico_find_compiler(${compiler_path} "${triples}")
|
||||
set(${compiler_path} ${${compiler_path}} PARENT_SCOPE)
|
||||
endfunction()
|
97
cmake/preload/toolchains/util/pico_arm_clang_common.cmake
Normal file
97
cmake/preload/toolchains/util/pico_arm_clang_common.cmake
Normal file
|
@ -0,0 +1,97 @@
|
|||
include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake)
|
||||
|
||||
# include our Platform/PICO.cmake
|
||||
set(CMAKE_SYSTEM_NAME PICO)
|
||||
|
||||
# Find Clang
|
||||
pico_find_compiler(PICO_COMPILER_CC clang)
|
||||
pico_find_compiler(PICO_COMPILER_CXX clang++)
|
||||
set(PICO_COMPILER_ASM "${PICO_COMPILER_CC}" CACHE INTERNAL "")
|
||||
pico_find_compiler(PICO_OBJCOPY llvm-objcopy)
|
||||
pico_find_compiler(PICO_OBJDUMP llvm-objdump)
|
||||
|
||||
# Specify the cross compiler.
|
||||
set(CMAKE_C_COMPILER ${PICO_COMPILER_CC} CACHE FILEPATH "C compiler")
|
||||
set(CMAKE_CXX_COMPILER ${PICO_COMPILER_CXX} CACHE FILEPATH "C++ compiler")
|
||||
set(CMAKE_ASM_COMPILER ${PICO_COMPILER_ASM} CACHE FILEPATH "ASM compiler")
|
||||
|
||||
# workaround for projects that don't enable ASM
|
||||
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
set(CMAKE_INCLUDE_FLAG_ASM "-I")
|
||||
|
||||
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
|
||||
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
|
||||
|
||||
foreach(LANG IN ITEMS C CXX ASM)
|
||||
set(CMAKE_${LANG}_OUTPUT_EXTENSION .o)
|
||||
endforeach()
|
||||
|
||||
# Add target system root to cmake find path.
|
||||
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
|
||||
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
|
||||
|
||||
# Look for includes and libraries only in the target system prefix.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# Oz is preferred for Clang (verses CMake default -Os) see also https://gitlab.kitware.com/cmake/cmake/-/issues/22458
|
||||
foreach(LANG IN ITEMS C CXX ASM)
|
||||
set(CMAKE_${LANG}_FLAGS_MINSIZEREL_INIT "-Oz -DNDEBUG")
|
||||
endforeach()
|
||||
|
||||
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES PICO_CLIB)
|
||||
|
||||
foreach(PICO_CLANG_RUNTIME IN LISTS PICO_CLANG_RUNTIMES)
|
||||
# LLVM embedded-toolchain for ARM style
|
||||
find_path(PICO_COMPILER_SYSROOT NAMES include/stdio.h
|
||||
HINTS
|
||||
${PICO_COMPILER_DIR}/../lib/clang-runtimes/arm-none-eabi/${PICO_CLANG_RUNTIME}
|
||||
${PICO_COMPILER_DIR}/../lib/clang-runtimes/${PICO_CLANG_RUNTIME}
|
||||
)
|
||||
|
||||
if (PICO_COMPILER_SYSROOT)
|
||||
if (NOT PICO_CLIB)
|
||||
# this is a bit of a hack; to try to autodetect the C library used:
|
||||
# `picolibc.h` seems to exist on the newer versions of LLVM embedded toolchain for ARM using picolibc whereas
|
||||
# `newlib.h` appears in all versions, so isn't very useful
|
||||
if (EXISTS "${PICO_COMPILER_SYSROOT}/include/picolibc.h")
|
||||
message("Setting default C library to picolibc as LLVM appears to be using it")
|
||||
set(PICO_CLIB "picolibc" CACHE INTERNAL "")
|
||||
endif()
|
||||
endif()
|
||||
break()
|
||||
endif()
|
||||
# llvm_libc style
|
||||
find_path(PICO_COMPILER_SYSROOT NAMES stdio.h
|
||||
HINTS
|
||||
${PICO_COMPILER_DIR}/../include/${PICO_CLANG_RUNTIME}
|
||||
)
|
||||
if (PICO_COMPILER_SYSROOT)
|
||||
if (NOT PICO_CLIB)
|
||||
message("Setting default C library to llvm_libc as LLVM appears to be using it")
|
||||
set(PICO_CLIB "llvm_libc" CACHE INTERNAL "")
|
||||
endif()
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# moving this here as a reminder from pico_standard_link; it was commented out theee, but if ever needed,
|
||||
# it belongs here as part of LINKER_FLAGS_INIT
|
||||
#target_link_options(pico_standard_link INTERFACE "LINKER:-fuse-ld=lld")
|
||||
|
||||
if (PICO_CLIB STREQUAL "llvm_libc")
|
||||
# TODO: Remove -nostdlib++ once we include libc++ in the toolchain.
|
||||
# TODO: Move -nostartfiles to the appropriate library.
|
||||
foreach(TYPE IN ITEMS EXE SHARED MODULE)
|
||||
set(CMAKE_${TYPE}_LINKER_FLAGS_INIT "-nostdlib++ -nostartfiles")
|
||||
endforeach()
|
||||
else()
|
||||
if (NOT PICO_COMPILER_SYSROOT)
|
||||
message(FATAL_ERROR "Could not find an llvm runtime for '${PICO_CLANG_RUNTIME}'")
|
||||
endif()
|
||||
|
||||
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} --sysroot ${PICO_COMPILER_SYSROOT}")
|
||||
endif()
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)
|
57
cmake/preload/toolchains/util/pico_arm_gcc_common.cmake
Normal file
57
cmake/preload/toolchains/util/pico_arm_gcc_common.cmake
Normal file
|
@ -0,0 +1,57 @@
|
|||
include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake)
|
||||
|
||||
# include our Platform/PICO.cmake
|
||||
set(CMAKE_SYSTEM_NAME PICO)
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_GCC_TRIPLE, List of GCC_TRIPLES -- usually only one -- to try when searching for a compiler. This may be specified the user environment, type=int, default=PICO_DEFAULT_GCC_TRIPLE which is set based on PICO_COMPILER, group=pico_base, docref=cmake-toolchain-config
|
||||
if (NOT PICO_GCC_TRIPLE)
|
||||
if (DEFINED ENV{_SAVED_PICO_GCC_TRIPLE})
|
||||
# saved within the same cmake invocation
|
||||
set(PICO_GCC_TRIPLE $ENV{_SAVED_PICO_GCC_TRIPLE})
|
||||
elseif (DEFINED ENV{PICO_GCC_TRIPLE})
|
||||
set(PICO_GCC_TRIPLE $ENV{PICO_GCC_TRIPLE})
|
||||
message("Initializing PICO_GCC_TRIPLE from environment ('${PICO_GCC_TRIPLE}')")
|
||||
elseif(DEFINED PICO_DEFAULT_GCC_TRIPLE)
|
||||
message("Defaulting PICO_GCC_TRIPLE to '${PICO_DEFAULT_GCC_TRIPLE}'")
|
||||
set(PICO_GCC_TRIPLE ${PICO_DEFAULT_GCC_TRIPLE})
|
||||
else()
|
||||
message(FATAL_ERROR "PICO_DEFAULT_GCC_TRIPLE is not defined")
|
||||
endif()
|
||||
endif()
|
||||
set(PICO_GCC_TRIPLE "${PICO_GCC_TRIPLE}" CACHE INTERNAL "")
|
||||
set(ENV{_SAVED_PICO_GCC_TRIPLE} "${PICO_GCC_TRIPLE}")
|
||||
|
||||
# Find GCC
|
||||
pico_find_compiler_with_triples(PICO_COMPILER_CC "${PICO_GCC_TRIPLE}" gcc)
|
||||
pico_find_compiler_with_triples(PICO_COMPILER_CXX "${PICO_GCC_TRIPLE}" g++)
|
||||
set(PICO_COMPILER_ASM "${PICO_COMPILER_CC}" CACHE INTERNAL "")
|
||||
pico_find_compiler_with_triples(PICO_OBJCOPY "${PICO_GCC_TRIPLE}" objcopy)
|
||||
pico_find_compiler_with_triples(PICO_OBJDUMP "${PICO_GCC_TRIPLE}" objdump)
|
||||
|
||||
# Specify the cross compiler.
|
||||
set(CMAKE_C_COMPILER ${PICO_COMPILER_CC} CACHE FILEPATH "C compiler")
|
||||
set(CMAKE_CXX_COMPILER ${PICO_COMPILER_CXX} CACHE FILEPATH "C++ compiler")
|
||||
set(CMAKE_ASM_COMPILER ${PICO_COMPILER_ASM} CACHE FILEPATH "ASM compiler")
|
||||
|
||||
# workaround for projects that don't enable ASM
|
||||
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
set(CMAKE_INCLUDE_FLAG_ASM "-I")
|
||||
|
||||
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
|
||||
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
|
||||
|
||||
foreach(LANG IN ITEMS C CXX ASM)
|
||||
set(CMAKE_${LANG}_OUTPUT_EXTENSION .o)
|
||||
endforeach()
|
||||
|
||||
# Add target system root to cmake find path.
|
||||
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
|
||||
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
|
||||
|
||||
# Look for includes and libraries only in the target system prefix.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)
|
26
cmake/preload/toolchains/util/set_flags.cmake
Normal file
26
cmake/preload/toolchains/util/set_flags.cmake
Normal file
|
@ -0,0 +1,26 @@
|
|||
option(PICO_DEOPTIMIZED_DEBUG "Build debug builds with -O0" 0)
|
||||
option(PICO_DEBUG_INFO_IN_RELEASE "Include debug info in release builds" 1)
|
||||
|
||||
get_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
|
||||
foreach(LANG IN ITEMS C CXX ASM)
|
||||
set(CMAKE_${LANG}_FLAGS_INIT "${PICO_COMMON_LANG_FLAGS}")
|
||||
unset(CMAKE_${LANG}_FLAGS_DEBUG CACHE)
|
||||
if (PICO_DEOPTIMIZED_DEBUG)
|
||||
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
|
||||
else()
|
||||
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-Og")
|
||||
endif()
|
||||
if (PICO_DEBUG_INFO_IN_RELEASE)
|
||||
set(CMAKE_${LANG}_FLAGS_RELEASE_INIT "-g")
|
||||
set(CMAKE_${LANG}_FLAGS_MINSIZEREL_INIT "-g")
|
||||
endif()
|
||||
set(CMAKE_${LANG}_LINK_FLAGS "-Wl,--build-id=none")
|
||||
|
||||
# try_compile is where the feature testing is done, and at that point,
|
||||
# pico_standard_link is not ready to be linked in to provide essential
|
||||
# functions like _exit. So pass -nostdlib so it doesn't link in an exit()
|
||||
# function at all.
|
||||
if(IS_IN_TRY_COMPILE)
|
||||
set(CMAKE_${LANG}_LINK_FLAGS "${CMAKE_${LANG}_LINK_FLAGS} -nostdlib")
|
||||
endif()
|
||||
endforeach()
|
|
@ -40,13 +40,26 @@ if(PICO_BUILD_DOCS)
|
|||
endif()
|
||||
|
||||
set(DOXY_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doxygen")
|
||||
set(DOXY_INPUT_DIRS "${PICO_DOXYGEN_PATHS}")
|
||||
set(DOXY_EXCLUDE_DIRS "${PICO_DOXYGEN_EXCLUDE_PATHS}")
|
||||
string(REPLACE ";" " " DOXY_INPUT_DIRS "${PICO_DOXYGEN_PATHS}")
|
||||
string(REPLACE ";" " " DOXY_EXCLUDE_DIRS "${PICO_DOXYGEN_EXCLUDE_PATHS}")
|
||||
string(REPLACE ";" " " DOXY_PREDEFINED "${PICO_DOXYGEN_PRE_DEFINES}")
|
||||
string(REPLACE ";" " " DOXY_ENABLED_SECTIONS "${PICO_DOXYGEN_ENABLED_SECTIONS}")
|
||||
set(DOXY_EXAMPLE_DIR "${PICO_EXAMPLES_PATH}")
|
||||
|
||||
# auto genereate additional section enables from library paths
|
||||
foreach (DIR IN LISTS PICO_DOXYGEN_PATHS)
|
||||
get_filename_component(NAME "${DIR}" NAME)
|
||||
if (NOT DIR STREQUAL "src")
|
||||
set(DOXY_ENABLED_SECTIONS "${DOXY_ENABLED_SECTIONS} ${NAME}")
|
||||
endif()
|
||||
endforeach ()
|
||||
set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
|
||||
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||
|
||||
if (PICO_PLATFORM STREQUAL "rp2040")
|
||||
set(PICO_DOXYGEN_TAG "(RP2040)")
|
||||
elseif (PICO_PLATFORM STREQUAL "rp2350-arm-s" OR PICO_PLATFORM STREQUAL "rp2350-riscv")
|
||||
set(PICO_DOXYGEN_TAG "(RP2350)")
|
||||
endif()
|
||||
configure_file(${doxyfile_in} ${doxyfile} @ONLY)
|
||||
|
||||
add_custom_target(docs
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
PROJECT_NAME = "Raspberry Pi Pico SDK"
|
||||
PROJECT_BRIEF = "Raspberry Pi Pico SDK documentation"
|
||||
PROJECT_NUMBER = @PICO_SDK_VERSION_STRING@
|
||||
PROJECT_NUMBER = @PICO_SDK_VERSION_STRING@ @PICO_DOXYGEN_TAG@
|
||||
|
||||
#STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@
|
||||
STRIP_FROM_PATH = @DOXY_INPUT_DIRS@
|
||||
|
@ -50,15 +50,19 @@ EXTRACT_STATIC = YES
|
|||
|
||||
EXTRACT_ALL = NO
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
#REPEAT_BRIEF = NO
|
||||
#REPEAT_BRIEF = NO
|
||||
|
||||
ENABLE_PREPROCESSING = YES
|
||||
# Need these next options to ensure that functions with modifiers do not confuse the Doxygen parser.
|
||||
# And any further function modifiers here.
|
||||
MACRO_EXPANSION = YES
|
||||
|
||||
PREDEFINED = __not_in_flash_func(x) \
|
||||
__time_critical_func(x) \
|
||||
PREDEFINED = __not_in_flash_func(x)= \
|
||||
__time_critical_func(x)= \
|
||||
__not_in_flash(x)= \
|
||||
__no_inline_not_in_flash(x)= \
|
||||
__attribute__(x)= \
|
||||
DOXYGEN_GENERATION=
|
||||
DOXYGEN_GENERATION= \
|
||||
@DOXY_PREDEFINED@
|
||||
|
||||
ENABLED_SECTIONS = @DOXY_ENABLED_SECTIONS@
|
|
@ -7,12 +7,13 @@
|
|||
<tab type="user" url="@ref examples_page" visible="yes" title="Examples" intro="Links to SDK examples"/>
|
||||
<tab type="usergroup" url="@ref weblinks_page" visible="yes" title="Additional Documentation" intro="Links to datasheets and documentation">
|
||||
<tab type="user" url="https://rptl.io/pico-datasheet" visible="yes" title="Raspberry Pi Pico Datasheet" intro=""/>
|
||||
<tab type="user" url="https://rptl.io/picow-datasheet" visible="yes" title="Raspberry Pi Pico W Datasheet" intro=""/>
|
||||
<tab type="user" url="https://rptl.io/rp2040-datasheet" visible="yes" title="RP2040 Datasheet" intro=""/>
|
||||
<tab type="user" url="https://rptl.io/rp2040-design" visible="yes" title="Hardware design with RP2040" intro=""/>
|
||||
<tab type="user" url="https://rptl.io/pico-c-sdk" visible="yes" title="Raspberry Pi Pico C/C++ SDK" intro=""/>
|
||||
<tab type="user" url="https://rptl.io/pico-micropython" visible="yes" title="Raspberry Pi Pico Python SDK" intro=""/>
|
||||
<tab type="user" url="https://rptl.io/pico-get-started" visible="yes" title="Getting started with Raspberry Pi Pico" intro=""/>
|
||||
<tab type="user" url="https://rptl.io/pico-faq" visible="yes" title="Raspberry Pi Pico FAQ" intro=""/>
|
||||
<tab type="user" url="https://rptl.io/picow-connect" visible="yes" title="Connecting to the Internet with Raspberry Pi Pico W" intro=""/>
|
||||
</tab>
|
||||
<tab type="usergroup" url="@ref weblinks_page" visible="yes" title="Web" intro="useful weblinks">
|
||||
<tab type="user" url="https://www.raspberrypi.com/" visible="yes" title="Raspberry Pi Site" intro=""/>
|
||||
|
|
140
docs/index.h
140
docs/index.h
|
@ -6,61 +6,89 @@
|
|||
|
||||
// Here to organize documentation order
|
||||
|
||||
// for some reason cond/endcond work better here than if/endif
|
||||
|
||||
/**
|
||||
* \defgroup hardware Hardware APIs
|
||||
* This group of libraries provides a thin and efficient C API / abstractions to access the RP2040 hardware without having to read and write
|
||||
* This group of libraries provides a thin and efficient C API / abstractions to access the RP-series microcontroller hardware without having to read and write
|
||||
* hardware registers directly.
|
||||
* @{
|
||||
* \defgroup hardware_adc hardware_adc
|
||||
* \defgroup hardware_base hardware_base
|
||||
* \defgroup hardware_claim hardware_claim
|
||||
* \defgroup hardware_clocks hardware_clocks
|
||||
* \defgroup hardware_divider hardware_divider
|
||||
* \defgroup hardware_dma hardware_dma
|
||||
* \defgroup hardware_exception hardware_exception
|
||||
* \defgroup hardware_flash hardware_flash
|
||||
* \defgroup hardware_gpio hardware_gpio
|
||||
* \defgroup hardware_i2c hardware_i2c
|
||||
* \defgroup hardware_interp hardware_interp
|
||||
* \defgroup hardware_irq hardware_irq
|
||||
* \defgroup hardware_pio hardware_pio
|
||||
* \defgroup hardware_pll hardware_pll
|
||||
* \defgroup hardware_pwm hardware_pwm
|
||||
* \defgroup hardware_resets hardware_resets
|
||||
* \defgroup hardware_rtc hardware_rtc
|
||||
* \defgroup hardware_spi hardware_spi
|
||||
* \defgroup hardware_sync hardware_sync
|
||||
* \defgroup hardware_timer hardware_timer
|
||||
* \defgroup hardware_uart hardware_uart
|
||||
* \defgroup hardware_vreg hardware_vreg
|
||||
* \defgroup hardware_watchdog hardware_watchdog
|
||||
* \defgroup hardware_xosc hardware_xosc
|
||||
* \cond hardware_adc \defgroup hardware_adc hardware_adc \endcond
|
||||
* \cond hardware_base \defgroup hardware_base hardware_base \endcond
|
||||
* \cond hardware_bootlock \defgroup hardware_bootlock hardware_bootlock \endcond
|
||||
* \cond hardware_claim \defgroup hardware_claim hardware_claim \endcond
|
||||
* \cond hardware_clocks \defgroup hardware_clocks hardware_clocks \endcond
|
||||
* \cond hardware_divider \defgroup hardware_divider hardware_divider \endcond
|
||||
* \cond hardware_dcp \defgroup hardware_dcp hardware_dcp \endcond
|
||||
* \cond hardware_dma \defgroup hardware_dma hardware_dma \endcond
|
||||
* \cond hardware_exception \defgroup hardware_exception hardware_exception \endcond
|
||||
* \cond hardware_flash \defgroup hardware_flash hardware_flash \endcond
|
||||
* \cond hardware_gpio \defgroup hardware_gpio hardware_gpio \endcond
|
||||
* \cond hardware_hazard3 \defgroup hardware_hazard3 hardware_hazard3 \endcond
|
||||
* \cond hardware_i2c \defgroup hardware_i2c hardware_i2c \endcond
|
||||
* \cond hardware_interp \defgroup hardware_interp hardware_interp \endcond
|
||||
* \cond hardware_irq \defgroup hardware_irq hardware_irq \endcond
|
||||
* \cond hardware_pio \defgroup hardware_pio hardware_pio \endcond
|
||||
* \cond hardware_pll \defgroup hardware_pll hardware_pll \endcond
|
||||
* \cond hardware_powman \defgroup hardware_powman hardware_powman \endcond
|
||||
* \cond hardware_pwm \defgroup hardware_pwm hardware_pwm \endcond
|
||||
* \cond hardware_pwm \defgroup hardware_pwm hardware_pwm \endcond
|
||||
* \cond hardware_resets \defgroup hardware_resets hardware_resets \endcond
|
||||
* \cond hardware_riscv \defgroup hardware_riscv hardware_riscv \endcond
|
||||
* \cond hardware_riscv_platform_timer \defgroup hardware_riscv_platform_timer hardware_riscv_platform_timer \endcond
|
||||
* \cond hardware_rtc \defgroup hardware_rtc hardware_rtc \endcond
|
||||
* \cond hardware_rcp \defgroup hardware_rcp hardware_rcp \endcond
|
||||
* \cond hardware_spi \defgroup hardware_spi hardware_spi \endcond
|
||||
* \cond hardware_sha256 \defgroup hardware_sha256 hardware_sha256 \endcond
|
||||
* \cond hardware_sync \defgroup hardware_sync hardware_sync \endcond
|
||||
* \cond hardware_ticks \defgroup hardware_ticks hardware_ticks \endcond
|
||||
* \cond hardware_timer \defgroup hardware_timer hardware_timer \endcond
|
||||
* \cond hardware_uart \defgroup hardware_uart hardware_uart \endcond
|
||||
* \cond hardware_vreg \defgroup hardware_vreg hardware_vreg \endcond
|
||||
* \cond hardware_watchdog \defgroup hardware_watchdog hardware_watchdog \endcond
|
||||
* \cond hardware_xip_cache \defgroup hardware_xip_cache hardware_xip_cache \endcond
|
||||
* \cond hardware_xosc \defgroup hardware_xosc hardware_xosc \endcond
|
||||
* \cond hardware_powman hardware_powman
|
||||
* \cond hardware_hazard3 hardware_hazard3
|
||||
* \cond hardware_riscv hardware_riscv
|
||||
|
||||
* @}
|
||||
*
|
||||
* \defgroup high_level High Level APIs
|
||||
* This group of libraries provide higher level functionality that isn't hardware related or provides a richer
|
||||
* set of functionality above the basic hardware interfaces
|
||||
* @{
|
||||
* \defgroup pico_multicore pico_multicore
|
||||
* \defgroup pico_stdlib pico_stdlib
|
||||
* \defgroup pico_sync pico_sync
|
||||
* \defgroup pico_time pico_time
|
||||
* \defgroup pico_unique_id pico_unique_id
|
||||
* \defgroup pico_util pico_util
|
||||
* \cond pico_aon_timer \defgroup pico_aon_timer pico_aon_timer \endcond
|
||||
* \cond pico_async_context \defgroup pico_async_context pico_async_context \endcond
|
||||
* \cond pico_bootsel_via_double_reset \defgroup pico_bootsel_via_double_reset pico_bootsel_via_double_reset \endcond
|
||||
* \cond pico_flash \defgroup pico_flash pico_flash \endcond
|
||||
* \cond pico_i2c_slave \defgroup pico_i2c_slave pico_i2c_slave \endcond
|
||||
* \cond pico_multicore \defgroup pico_multicore pico_multicore \endcond
|
||||
* \cond pico_rand \defgroup pico_rand pico_rand \endcond
|
||||
* \cond pico_sha256 \defgroup pico_sha256 pico_sha256 \endcond
|
||||
* \cond pico_stdlib \defgroup pico_stdlib pico_stdlib \endcond
|
||||
* \cond pico_sync \defgroup pico_sync pico_sync \endcond
|
||||
* \cond pico_time \defgroup pico_time pico_time \endcond
|
||||
* \cond pico_unique_id \defgroup pico_unique_id pico_unique_id \endcond
|
||||
* \cond pico_util \defgroup pico_util pico_util \endcond
|
||||
* @}
|
||||
*
|
||||
* \defgroup third_party Third-party Libraries
|
||||
* Third party libraries for implementing high level functionality.
|
||||
* @{
|
||||
* \cond tinyusb
|
||||
* \defgroup tinyusb_device tinyusb_device
|
||||
* \defgroup tinyusb_host tinyusb_host
|
||||
* \endcond
|
||||
* @}
|
||||
*
|
||||
* \defgroup networking Networking Libraries
|
||||
* Functions for implementing networking
|
||||
* @{
|
||||
* \defgroup pico_lwip pico_lwip
|
||||
* \defgroup pico_cyw43_arch pico_cyw43_arch
|
||||
* \cond pico_btstack \defgroup pico_btstack pico_btstack \endcond
|
||||
* \cond pico_lwip \defgroup pico_lwip pico_lwip \endcond
|
||||
* \cond pico_cyw43_driver \defgroup pico_cyw43_driver pico_cyw43_driver \endcond
|
||||
* \cond pico_cyw43_arch \defgroup pico_cyw43_arch pico_cyw43_arch \endcond
|
||||
* @}
|
||||
*
|
||||
* \defgroup runtime Runtime Infrastructure
|
||||
|
@ -68,30 +96,36 @@
|
|||
* language level and C library functions, as well as CMake INTERFACE libraries
|
||||
* abstracting the compilation and link steps in the SDK
|
||||
* @{
|
||||
* \defgroup boot_stage2 boot_stage2
|
||||
* \defgroup pico_base pico_base
|
||||
* \defgroup pico_binary_info pico_binary_info
|
||||
* \defgroup pico_bit_ops pico_bit_ops
|
||||
* \defgroup pico_bootrom pico_bootrom
|
||||
* \defgroup pico_bootsel_via_double_reset pico_bootsel_via_double_reset
|
||||
* \defgroup pico_cxx_options pico_cxx_options
|
||||
* \defgroup pico_divider pico_divider
|
||||
* \defgroup pico_double pico_double
|
||||
* \defgroup pico_float pico_float
|
||||
* \defgroup pico_int64_ops pico_int64_ops
|
||||
* \defgroup pico_malloc pico_malloc
|
||||
* \defgroup pico_mem_ops pico_mem_ops
|
||||
* \defgroup pico_platform pico_platform
|
||||
* \defgroup pico_printf pico_printf
|
||||
* \defgroup pico_runtime pico_runtime
|
||||
* \defgroup pico_stdio pico_stdio
|
||||
* \defgroup pico_standard_link pico_standard_link
|
||||
* \cond boot_stage2 \defgroup boot_stage2 boot_stage2 \endcond
|
||||
* \cond pico_atomic \defgroup pico_atomic pico_atomic \endcond
|
||||
* \cond pico_base_headers \defgroup pico_base pico_base \endcond
|
||||
* \cond pico_binary_info \defgroup pico_binary_info pico_binary_info \endcond
|
||||
* \cond pico_bootrom \defgroup pico_bootrom pico_bootrom \endcond
|
||||
* \cond pico_bit_ops \defgroup pico_bit_ops pico_bit_ops \endcond
|
||||
* \cond pico_cxx_options \defgroup pico_cxx_options pico_cxx_options \endcond
|
||||
* \cond pico_clib_interface \defgroup pico_clib_interface pico_clib_interface \endcond
|
||||
* \cond pico_crt0 \defgroup pico_crt0 pico_crt0 \endcond
|
||||
* \cond pico_divider \defgroup pico_divider pico_divider \endcond
|
||||
* \cond pico_double \defgroup pico_double pico_double \endcond
|
||||
* \cond pico_float \defgroup pico_float pico_float \endcond
|
||||
* \cond pico_int64_ops \defgroup pico_int64_ops pico_int64_ops \endcond
|
||||
* \cond pico_malloc \defgroup pico_malloc pico_malloc \endcond
|
||||
* \cond pico_mem_ops \defgroup pico_mem_ops pico_mem_ops \endcond
|
||||
* \cond pico_platform \defgroup pico_platform pico_platform \endcond
|
||||
* \cond pico_printf \defgroup pico_printf pico_printf \endcond
|
||||
* \cond pico_runtime \defgroup pico_runtime pico_runtime \endcond
|
||||
* \cond pico_runtime_init \defgroup pico_runtime_init pico_runtime_init \endcond
|
||||
* \cond pico_stdio \defgroup pico_stdio pico_stdio \endcond
|
||||
* \cond pico_standard_binary_info \defgroup pico_standard_binary_info pico_standard_binary_info \endcond
|
||||
* \cond pico_standard_link \defgroup pico_standard_link pico_standard_link \endcond
|
||||
* @}
|
||||
*
|
||||
* \defgroup misc External API Headers
|
||||
* Headers for interfaces that are shared with code outside of the SDK
|
||||
* @{
|
||||
* \defgroup boot_picoboot boot_picoboot
|
||||
* \defgroup boot_uf2 boot_uf2
|
||||
* \cond boot_picobin_headers \defgroup boot_picobin_headers boot_picobin_headers \endcond
|
||||
* \cond boot_picoboot_headers \defgroup boot_picoboot_headers boot_picoboot_headers \endcond
|
||||
* \cond boot_uf2_headers \defgroup boot_uf2_headers boot_uf2_headers \endcond
|
||||
* \cond pico_usb_reset_interface_headers \defgroup pico_usb_reset_interface_headers pico_usb_reset_interface_headers \endcond
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
# Raspberry Pi Pico SDK
|
||||
|
||||
The Raspberry Pi Pico SDK (Software Development Kit), henceforth SDK, provides the headers, libraries and build system necessary to write programs for RP2040-based devices such as the Raspberry Pi Pico in C, C++ or assembly language. The SDK is designed to provide an API (Application Programming Interface) and programming environment that is familiar both to non-embedded C developers and embedded C developers alike.
|
||||
The Raspberry Pi Pico SDK (Software Development Kit), henceforth SDK, provides the headers, libraries and build system necessary to write programs for RP-series microcontroller devices such as the Raspberry Pi Pico in C, C++ or assembly language. The SDK is designed to provide an API (Application Programming Interface) and programming environment that is familiar both to non-embedded C developers and embedded C developers alike.
|
||||
|
||||
A single program runs on the device at a time with a conventional `main()` method. Standard C/C++ libraries are supported along with APIs for accessing the RP2040’s hardware, including DMA, IRQs, and the wide variety of fixed-function peripherals and PIO (Programmable IO).
|
||||
A single program runs on the device at a time with a conventional `main()` method. Standard C/C++ libraries are supported along with APIs for accessing the microcontroller's hardware, including DMA, IRQs, and the wide variety of fixed-function peripherals and PIO (Programmable IO).
|
||||
|
||||
Additionally the SDK provides higher-level libraries for dealing with timers, USB, synchronization and multi-core programming, along with additional high-level functionality built using PIO, such as audio. The SDK can be used to build anything from simple applications, or full-fledged runtime environments such as MicroPython, to low-level software such as the RP2040’s on-chip bootrom itself.
|
||||
Additionally the SDK provides higher-level libraries for dealing with timers, USB, synchronization and multi-core programming, along with additional high-level functionality built using PIO, such as audio. The SDK can be used to build anything from simple applications, or full-fledged runtime environments such as MicroPython, to low-level software such as the microcontroller's on-chip bootrom itself.
|
||||
|
||||
This documentation is generated from the SDK source tree using Doxygen. It provides basic information on the APIs used for each library, but does not provide usage information. Please refer to the Databooks for usage and more technical information.
|
||||
|
||||
## SDK Design
|
||||
|
||||
The RP2040 is a powerful chip, however it is an embedded environment, so both RAM and program space are at premium. Additionally the trade-offs between performance and other factors (e.g. edge-case error handling, runtime vs compile-time configuration) are necessarily much more visible to the developer than they might be on other higher-level platforms.
|
||||
The RP-series microcontroller range are powerful chips, however they are used in an embedded environment, so both RAM and program space are at premium. Additionally the trade-offs between performance and other factors (e.g. edge-case error handling, runtime vs compile-time configuration) are necessarily much more visible to the developer than they might be on other higher-level platforms.
|
||||
|
||||
The intention within the SDK has been for features to just work out of the box, with sensible defaults, but also to give the developer as much control and power as possible (if they want it) to fine-tune every aspect of the application they are building and the libraries used.
|
||||
|
||||
|
@ -20,9 +20,9 @@ The SDK uses CMake to manage the build. CMake is widely supported by IDEs (Integ
|
|||
|
||||
Apart from being a widely-used build system for C/C++ development, CMake is fundamental to the way the SDK is structured, and how applications are configured and built.
|
||||
|
||||
The SDK builds an executable which is bare-metal, i.e. it includes the entirety of the code needed to run on the device (other than floating-point and other optimized code contained in the bootrom within the RP2040).
|
||||
The SDK builds an executable which is bare-metal, i.e. it includes the entirety of the code needed to run on the device (other than device specific floating-point and other optimized code contained in the bootrom within the microcontroller).
|
||||
|
||||
## Examples
|
||||
|
||||
This SDK documentation contains a number of example code fragments. An index of these examples can be found [here](@ref examples_page). These examples, and any other source code included in this documentation, is Copyright © 2020 Raspberry Pi (Trading) Ltd. and licensed under the [3-Clause BSD](https://opensource.org/licenses/BSD-3-Clause) license.
|
||||
This SDK documentation contains a number of example code fragments. An index of these examples can be found [here](@ref examples_page). These examples, and any other source code included in this documentation, is Copyright © 2020 Raspberry Pi Ltd and licensed under the [3-Clause BSD](https://opensource.org/licenses/BSD-3-Clause) license.
|
||||
|
||||
|
|
|
@ -4,11 +4,14 @@ The full documentation for the RP2040 and Raspberry Pi Pico board can be found a
|
|||
|
||||
- [RP2040 Datasheet](https://rptl.io/rp2040-datasheet)
|
||||
- [Raspberry Pi Pico Datasheet](https://rptl.io/pico-datasheet)
|
||||
- [Hardware design with the RP2040](https://rptl.io/rp2040-design)
|
||||
- [RP235x Datasheet](https://rptl.io/rp2040-datasheet)
|
||||
- [Raspberry Pi Pico2 Datasheet](https://rptl.io/pico-datasheet)
|
||||
- [Raspberry Pi Pico W Datasheet](https://rptl.io/picow-datasheet)
|
||||
- [Hardware design with RP2040](https://rptl.io/rp2040-design)
|
||||
- [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk)
|
||||
- [Raspberry Pi Pico Python SDK](https://rptl.io/pico-micropython)
|
||||
- [Getting started with Raspberry Pi Pico](https://rptl.io/pico-get-started)
|
||||
- [Raspberry Pi Pico FAQ](https://rptl.io/pico-faq)
|
||||
- [Connecting to the Internet with Raspberry Pi Pico W](https://rptl.io/picow-connect)
|
||||
|
||||
### Weblinks
|
||||
|
||||
|
|
15
external/pico_sdk_import.cmake
vendored
15
external/pico_sdk_import.cmake
vendored
|
@ -18,9 +18,20 @@ if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_P
|
|||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
|
||||
endif ()
|
||||
|
||||
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
|
||||
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
|
||||
endif()
|
||||
|
||||
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
|
||||
|
||||
if (NOT PICO_SDK_PATH)
|
||||
if (PICO_SDK_FETCH_FROM_GIT)
|
||||
|
@ -34,14 +45,14 @@ if (NOT PICO_SDK_PATH)
|
|||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG master
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
GIT_SUBMODULES_RECURSE FALSE
|
||||
)
|
||||
else ()
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG master
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
|
1
lib/btstack
Submodule
1
lib/btstack
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 2b49e57bd1fae85ac32ac1f41cdb7c794de335f6
|
|
@ -1 +1 @@
|
|||
Subproject commit 195dfcc10bb6f379e3dea45147590db2203d3c7b
|
||||
Subproject commit cf924bb04c8984675ca0fc2178f082e404e048c3
|
2
lib/lwip
2
lib/lwip
|
@ -1 +1 @@
|
|||
Subproject commit 239918ccc173cb2c2a62f41a40fd893f57faf1d6
|
||||
Subproject commit 0a0452b2c39bdd91e252aef045c115f88f6ca773
|
1
lib/mbedtls
Submodule
1
lib/mbedtls
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 5a764e5555c64337ed17444410269ff21cb617b1
|
|
@ -1 +1 @@
|
|||
Subproject commit 4bfab30c02279a0530e1a56f4a7c539f2d35a293
|
||||
Subproject commit 5217cee5de4cd555018da90f9f1bcc87fb1c1d3a
|
|
@ -41,13 +41,6 @@ if (NOT TARGET _pico_sdk_pre_init_marker)
|
|||
include(pico_utils)
|
||||
|
||||
message("PICO_SDK_PATH is ${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
include(pico_pre_load_platform)
|
||||
|
||||
# We want to configure correct toolchain prior to project load
|
||||
# todo perhaps this should be included by the platform instead?
|
||||
include(pico_pre_load_toolchain)
|
||||
|
||||
macro(pico_sdk_init)
|
||||
if (NOT CMAKE_PROJECT_NAME)
|
||||
message(WARNING "pico_sdk_init() should be called after the project is created (and languages added)")
|
||||
|
@ -82,6 +75,7 @@ if (NOT TARGET _pico_sdk_pre_init_marker)
|
|||
PICO_SDK_POST_LIST_FILES
|
||||
PICO_CONFIG_HEADER_FILES
|
||||
PICO_RP2040_CONFIG_HEADER_FILES
|
||||
PICO_BOARD_CMAKE_OVERRIDES
|
||||
)
|
||||
|
||||
macro(pico_promote_common_scope_vars)
|
||||
|
@ -90,4 +84,10 @@ if (NOT TARGET _pico_sdk_pre_init_marker)
|
|||
SET(${VAR} ${${VAR}} PARENT_SCOPE)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
include(pico_pre_load_platform)
|
||||
|
||||
# We want to configure correct toolchain prior to project load
|
||||
# todo perhaps this should be included by the platform instead?
|
||||
include(pico_pre_load_toolchain)
|
||||
endif()
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, group=pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, group=pico_base
|
||||
set(PICO_SDK_VERSION_MAJOR 1)
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, group=pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, group=pico_base
|
||||
set(PICO_SDK_VERSION_MINOR 4)
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, group=pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, group=pico_base
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, default=Current SDK major version, group=pico_base
|
||||
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, default=Current SDK major version, group=pico_base
|
||||
set(PICO_SDK_VERSION_MAJOR 2)
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, default=Current SDK minor version, group=pico_base
|
||||
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, default=Current SDK minor version, group=pico_base
|
||||
set(PICO_SDK_VERSION_MINOR 1)
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, default=Current SDK revision, group=pico_base
|
||||
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, default=Current SDK revision, group=pico_base
|
||||
set(PICO_SDK_VERSION_REVISION 0)
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_PRE_RELEASE_ID, optional SDK pre-release version identifier, type=string, group=pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_PRE_RELEASE_ID, optional SDK pre-release version identifier, type=string, group=pico_base
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_PRE_RELEASE_ID, Optional SDK pre-release version identifier, default=Current SDK pre-release identifier, type=string, group=pico_base
|
||||
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_PRE_RELEASE_ID, Optional SDK pre-release version identifier, default=Current SDK pre-release identifier, type=string, group=pico_base
|
||||
#set(PICO_SDK_VERSION_PRE_RELEASE_ID develop)
|
||||
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_STRING, SDK version, type=string, group=pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_STRING, SDK version, type=string, group=pico_base
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_STRING, SDK version string, type=string, default=Current SDK version string, group=pico_base
|
||||
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_STRING, SDK version string, type=string, default=Current SDK version string, group=pico_base
|
||||
set(PICO_SDK_VERSION_STRING "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}")
|
||||
|
||||
if (PICO_SDK_VERSION_PRE_RELEASE_ID)
|
||||
|
|
31
src/BUILD.bazel
Normal file
31
src/BUILD.bazel
Normal file
|
@ -0,0 +1,31 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
# This shim exists as a way to break internal header dependency cycles
|
||||
# that occur within the dependency chain of the pico_platform target below.
|
||||
alias(
|
||||
name = "pico_platform_internal",
|
||||
actual = select({
|
||||
"//bazel/constraint:host": "//src/host/pico_platform:pico_platform_internal",
|
||||
"//conditions:default": "//src/rp2_common:pico_platform_internal",
|
||||
}),
|
||||
visibility = [
|
||||
"//src/common/boot_picobin_headers:__pkg__",
|
||||
"//src/common/boot_picoboot_headers:__pkg__",
|
||||
"//src/common/hardware_claim:__pkg__",
|
||||
"//src/common/pico_base_headers:__pkg__",
|
||||
"//src/common/pico_binary_info:__pkg__",
|
||||
# These libraries sometimes need the host version even though they live
|
||||
# in rp2_common.
|
||||
"//src/rp2_common/boot_bootrom_headers:__pkg__",
|
||||
"//src/rp2_common/hardware_boot_lock:__pkg__",
|
||||
"//src/rp2_common/pico_flash:__pkg__",
|
||||
],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "pico_platform",
|
||||
actual = select({
|
||||
"//bazel/constraint:host": "//src/host/pico_platform",
|
||||
"//conditions:default": "//src/rp2_common:pico_platform",
|
||||
}),
|
||||
)
|
|
@ -1,9 +1,15 @@
|
|||
cmake_policy(SET CMP0079 NEW) # allow inserting of dependencies into our INTERFACE libraries
|
||||
set(PICO_PLATFORM_CMAKE_FILE "" CACHE INTERNAL "")
|
||||
set(PICO_PLATFORM_CMAKE_FILE "${PICO_PLATFORM_CMAKE_FILE}" CACHE INTERNAL "")
|
||||
set(PICO_DOXYGEN_PATHS "" CACHE INTERNAL "") # generated each time
|
||||
set(PICO_DOXYGEN_EXCLUDE_PATHS "" CACHE INTERNAL "") # generated each time
|
||||
set(PICO_DOXYGEN_PRE_DEFINES "" CACHE INTERNAL "") # generated each time
|
||||
set(PICO_DOXYGEN_ENABLED_SECTIONS "" CACHE INTERNAL "") # generated each time
|
||||
|
||||
if (NOT PICO_PLATFORM_CMAKE_DIR)
|
||||
set(PICO_PLATFORM_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
endif()
|
||||
if (NOT PICO_PLATFORM_CMAKE_FILE)
|
||||
set(PICO_PLATFORM_CMAKE_FILE ${CMAKE_CURRENT_LIST_DIR}/${PICO_PLATFORM}.cmake CACHE INTERNAL "")
|
||||
set(PICO_PLATFORM_CMAKE_FILE ${PICO_PLATFORM_CMAKE_DIR}/${PICO_PLATFORM}.cmake CACHE INTERNAL "")
|
||||
endif ()
|
||||
|
||||
if (NOT EXISTS "${PICO_PLATFORM_CMAKE_FILE}")
|
||||
|
@ -11,22 +17,56 @@ if (NOT EXISTS "${PICO_PLATFORM_CMAKE_FILE}")
|
|||
Either specify a valid PICO_PLATFORM (or PICO_PLATFORM_CMAKE_FILE).")
|
||||
endif ()
|
||||
|
||||
# Initialize board related build/compile settings
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/board_setup.cmake)
|
||||
|
||||
# call add_subdirectory(subdir) unless SKIP_SUBDIR evaluates to true
|
||||
# second argument is optional path
|
||||
function(pico_add_subdirectory subdir)
|
||||
# todo add option to disable skip flag
|
||||
string(TOUPPER ${subdir} subdir_upper)
|
||||
# we do not include any path part of the subdir
|
||||
get_filename_component(subdir_upper ${subdir_upper} NAME)
|
||||
set(replace_flag SKIP_${subdir_upper})
|
||||
if (NOT ${replace_flag})
|
||||
add_subdirectory(${subdir})
|
||||
else ()
|
||||
string(TOUPPER ${subdir} subdir_upper)
|
||||
set(replace_flag SKIP_${subdir_upper})
|
||||
if (${ARGC} GREATER 1)
|
||||
# argv1 is the root where the subdir is relative to
|
||||
add_subdirectory(${ARGV1}/${subdir} ${subdir})
|
||||
# todo make this optional?
|
||||
pico_add_doxygen(${ARGV1}/${subdir})
|
||||
else()
|
||||
add_subdirectory(${subdir})
|
||||
# todo make this optional?
|
||||
pico_add_doxygen(${subdir})
|
||||
endif()
|
||||
else()
|
||||
message("Not including ${subdir} because ${replace_flag} defined.")
|
||||
endif ()
|
||||
pico_promote_common_scope_vars()
|
||||
endfunction()
|
||||
|
||||
# takes dependencies after the target
|
||||
function(pico_mirrored_target_link_libraries TARGET SCOPE)
|
||||
if (${ARGC} LESS 3)
|
||||
message(FATAL_ERROR "expected a target, scope and at least one dependency")
|
||||
endif()
|
||||
if (NOT TARGET ${TARGET}_headers)
|
||||
message(FATAL_ERROR "${TARGET} does not have headers")
|
||||
endif()
|
||||
# library should depend on its own header
|
||||
target_link_libraries(${TARGET} ${SCOPE} ${TARGET}_headers)
|
||||
foreach(DEPENDENCY IN LISTS ARGN)
|
||||
if (DEPENDENCY MATCHES ".*_headers")
|
||||
message(FATAL_ERROR "should not use headers with pico_mirrored_target_link_libraries")
|
||||
endif()
|
||||
# note, it would be nice to only add the dependency if it exists, but we do
|
||||
# not necessarily add libraries in reverse dependency order, so we do this
|
||||
# unconditionally, so this function should only be passed dependencies that
|
||||
# have headers, or link will fail with a missing library -lfoo_headers
|
||||
target_link_libraries(${TARGET}_headers ${SCOPE} ${DEPENDENCY}_headers)
|
||||
target_link_libraries(${TARGET} ${SCOPE} ${DEPENDENCY})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# add a link option to wrap the given function name; i.e. -Wl:wrap=FUNCNAME for gcc
|
||||
function(pico_wrap_function TARGET FUNCNAME)
|
||||
target_link_options(${TARGET} INTERFACE "LINKER:--wrap=${FUNCNAME}")
|
||||
|
@ -34,26 +74,43 @@ endfunction()
|
|||
|
||||
# add map file generation for the given target
|
||||
function(pico_add_map_output TARGET)
|
||||
pico_get_runtime_output_directory(${TARGET} output_path)
|
||||
get_target_property(target_type ${TARGET} TYPE)
|
||||
if ("EXECUTABLE" STREQUAL "${target_type}")
|
||||
target_link_options(${TARGET} PRIVATE "LINKER:-Map=$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map")
|
||||
target_link_options(${TARGET} PRIVATE "LINKER:-Map=${output_path}$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map")
|
||||
else ()
|
||||
target_link_options(${TARGET} INTERFACE "LINKER:-Map=$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map")
|
||||
target_link_options(${TARGET} INTERFACE "LINKER:-Map=${output_path}$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map")
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
# create a hardware_NAME_headers target (see pico_pico_simple_hardware_headers_target)
|
||||
# create a hardware_NAME target (see pico_pico_simple_hardware_target)
|
||||
# create a hardware_NAME_headers target (see pico_simple_hardware_headers_target)
|
||||
# create a hardware_NAME target (see pico_simple_hardware_target)
|
||||
macro(pico_simple_hardware_target NAME)
|
||||
pico_simple_hardware_headers_target(${NAME})
|
||||
pico_simple_hardware_impl_target(${NAME})
|
||||
endmacro()
|
||||
|
||||
# create an INTERFACE library named target, and define LIB_TARGET=1 (upper case) as a compile option
|
||||
# and make it dependent on a pre-existing corresponding _headers library
|
||||
# optional arg NOFLAG will skip the LIB_TARGET definition
|
||||
function(pico_add_impl_library target)
|
||||
add_library(${target} INTERFACE)
|
||||
string(TOUPPER ${target} TARGET_UPPER)
|
||||
target_compile_definitions(${target} INTERFACE LIB_${TARGET_UPPER}=1)
|
||||
if (${ARGC} GREATER 1)
|
||||
if (NOT "${ARGV1}" STREQUAL "NOFLAG")
|
||||
message(FATAL_ERROR "Unknown parameter ${ARGV1}")
|
||||
endif()
|
||||
else()
|
||||
target_compile_definitions(${target} INTERFACE LIB_${TARGET_UPPER}=1)
|
||||
endif()
|
||||
target_link_libraries(${target} INTERFACE ${target}_headers)
|
||||
endfunction()
|
||||
|
||||
# create an INTERFACE library named target along with associated header, and define LIB_TARGET=1 (upper case) as a compile option
|
||||
# optional arg NOFLAG will skip the LIB_TARGET definition
|
||||
function(pico_add_library target)
|
||||
add_library(${target}_headers INTERFACE)
|
||||
pico_add_impl_library(${target} ${ARGN})
|
||||
endfunction()
|
||||
|
||||
# create an INTERFACE library named hardware_NAME_headers INTERFACE library if it doesn't already exist,
|
||||
|
@ -63,10 +120,10 @@ macro(pico_simple_hardware_headers_target NAME)
|
|||
if (NOT TARGET hardware_${NAME}_headers)
|
||||
add_library(hardware_${NAME}_headers INTERFACE)
|
||||
|
||||
target_include_directories(hardware_${NAME}_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
target_include_directories(hardware_${NAME}_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
target_link_libraries(hardware_${NAME}_headers INTERFACE pico_base_headers)
|
||||
if (NOT PICO_NO_HARDWARE)
|
||||
target_link_libraries(hardware_${NAME}_headers INTERFACE hardware_structs hardware_claim)
|
||||
target_link_libraries(hardware_${NAME}_headers INTERFACE hardware_structs hardware_claim_headers)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
@ -80,13 +137,17 @@ macro(pico_simple_hardware_headers_only_target NAME)
|
|||
# super interesting except to determine functionality as they are mostly passive accessors, however
|
||||
# they could be useful to determine if the header is available.
|
||||
# pico_add_sdk_impl_library(hardware_${NAME})
|
||||
add_library(hardware_${NAME} INTERFACE)
|
||||
add_library(hardware_${NAME}_headers INTERFACE)
|
||||
|
||||
target_include_directories(hardware_${NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
target_link_libraries(hardware_${NAME} INTERFACE pico_base_headers)
|
||||
# a headers only target should still have an explicit _headers library for consistency
|
||||
target_include_directories(hardware_${NAME}_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
target_link_libraries(hardware_${NAME}_headers INTERFACE pico_base_headers)
|
||||
if (NOT PICO_NO_HARDWARE)
|
||||
target_link_libraries(hardware_${NAME} INTERFACE hardware_structs)
|
||||
target_link_libraries(hardware_${NAME}_headers INTERFACE hardware_structs)
|
||||
endif()
|
||||
|
||||
add_library(hardware_${NAME} INTERFACE)
|
||||
target_link_libraries(hardware_${NAME} INTERFACE hardware_${NAME}_headers)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -104,16 +165,37 @@ macro(pico_simple_hardware_impl_target NAME)
|
|||
${CMAKE_CURRENT_LIST_DIR}/${NAME}.c
|
||||
)
|
||||
|
||||
target_link_libraries(hardware_${NAME} INTERFACE hardware_${NAME}_headers pico_platform)
|
||||
pico_mirrored_target_link_libraries(hardware_${NAME} INTERFACE pico_platform)
|
||||
if (NOT PICO_NO_HARDWARE)
|
||||
target_link_libraries(hardware_${NAME} INTERFACE hardware_claim)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(pico_add_doxygen_pre_define PRE_DEFINE)
|
||||
list(APPEND PICO_DOXYGEN_PRE_DEFINES "${PRE_DEFINE}")
|
||||
set(PICO_DOXYGEN_PRE_DEFINES "${PICO_DOXYGEN_PRE_DEFINES}" CACHE INTERNAL "")
|
||||
endfunction()
|
||||
|
||||
function(pico_add_doxygen_enabled_section ENABLED_SECTION)
|
||||
list(APPEND PICO_DOXYGEN_ENABLED_SECTIONS "${ENABLED_SECTION}")
|
||||
set(PICO_DOXYGEN_ENABLED_SECTIONS "${PICO_DOXYGEN_ENABLED_SECTIONS}" CACHE INTERNAL "")
|
||||
endfunction()
|
||||
|
||||
function(pico_add_doxygen SOURCE_DIR)
|
||||
set(PICO_DOXYGEN_PATHS "${PICO_DOXYGEN_PATHS} ${SOURCE_DIR}" CACHE INTERNAL "")
|
||||
if (NOT IS_ABSOLUTE "${SOURCE_DIR}")
|
||||
get_filename_component(SOURCE_DIR "${SOURCE_DIR}" ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
list(APPEND PICO_DOXYGEN_PATHS "${SOURCE_DIR}")
|
||||
set(PICO_DOXYGEN_PATHS "${PICO_DOXYGEN_PATHS}" CACHE INTERNAL "")
|
||||
endfunction()
|
||||
|
||||
function(pico_add_doxygen_exclude SOURCE_DIR)
|
||||
set(PICO_DOXYGEN_EXCLUDE_PATHS "${PICO_DOXYGEN_EXCLUDE_PATHS} ${SOURCE_DIR}" CACHE INTERNAL "")
|
||||
if (NOT IS_ABSOLUTE "${SOURCE_DIR}")
|
||||
get_filename_component(SOURCE_DIR "${SOURCE_DIR}" ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
list(APPEND PICO_DOXYGEN_EXCLUDE_PATHS "${SOURCE_DIR}")
|
||||
set(PICO_DOXYGEN_EXCLUDE_PATHS "${PICO_DOXYGEN_EXCLUDE_PATHS}" CACHE INTERNAL "")
|
||||
endfunction()
|
||||
|
||||
include(${PICO_PLATFORM_CMAKE_FILE})
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
# PICO_CMAKE_CONFIG: PICO_BOARD, The board name being built for. This is overridable from the user environment, type=string, default=pico, group=build
|
||||
if (DEFINED ENV{PICO_BOARD})
|
||||
set(PICO_BOARD $ENV{PICO_BOARD})
|
||||
message("Using PICO_BOARD from environment ('${PICO_BOARD}')")
|
||||
else()
|
||||
if (NOT PICO_BOARD)
|
||||
set(PICO_BOARD "pico")
|
||||
pico_message("Defaulting PICO target board to ${PICO_BOARD} since not specified.")
|
||||
else()
|
||||
message("PICO target board is ${PICO_BOARD}.")
|
||||
endif()
|
||||
endif()
|
||||
set(PICO_BOARD ${PICO_BOARD} CACHE STRING "PICO target board (e.g. pico)")
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_BOARD_CMAKE_DIRS, Directories to look for <PICO_BOARD>.cmake in. This is overridable from the user environment, type=list, default="", group=build
|
||||
if (DEFINED ENV{PICO_BOARD_CMAKE_DIRS})
|
||||
set(PICO_BOARD_CMAKE_DIRS $ENV{PICO_BOARD_CMAKE_DIRS})
|
||||
message("Using PICO_BOARD_CMAKE_DIRS from environment ('${PICO_BOARD_CMAKE_DIRS}')")
|
||||
endif()
|
||||
|
||||
list(APPEND PICO_BOARD_CMAKE_DIRS ${CMAKE_CURRENT_LIST_DIR}/boards)
|
||||
|
||||
pico_find_in_paths(PICO_BOARD_CMAKE_FILE PICO_BOARD_CMAKE_DIRS ${PICO_BOARD}.cmake)
|
||||
if (EXISTS "${PICO_BOARD_CMAKE_FILE}")
|
||||
message("Using CMake board configuration from ${PICO_BOARD_CMAKE_FILE}")
|
||||
include(${PICO_BOARD_CMAKE_FILE} board_config)
|
||||
else()
|
||||
include(boards/generic_board.cmake)
|
||||
endif()
|
||||
|
||||
list(APPEND PICO_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/boards/include) # so boards/foo.h can be explicitly included
|
54
src/boards/BUILD.bazel
Normal file
54
src/boards/BUILD.bazel
Normal file
|
@ -0,0 +1,54 @@
|
|||
load("//bazel:defs.bzl", "pico_board_config")
|
||||
load("//bazel/util:multiple_choice_flag.bzl", "declare_flag_choices", "flag_choice")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
# Find all boards.
|
||||
BOARD_CHOICE_FILES = glob(["include/boards/*.h"])
|
||||
|
||||
# Extract just the name of the board.
|
||||
BOARD_CHOICES = [
|
||||
path.removeprefix("include/boards/").removesuffix(".h")
|
||||
for path in BOARD_CHOICE_FILES
|
||||
]
|
||||
|
||||
BOARD_CHOICE_MAP = {c: [":{}".format(c)] for c in BOARD_CHOICES}
|
||||
|
||||
# PICO_BUILD_DEFINE: PICO_BOARD, Name of board, type=string, default=CMake PICO_BOARD variable, group=pico_base
|
||||
[
|
||||
pico_board_config(
|
||||
name = board,
|
||||
hdrs = BOARD_CHOICE_FILES,
|
||||
defines = [
|
||||
'PICO_BOARD=\\"{}\\"'.format(board),
|
||||
],
|
||||
includes = ["include"],
|
||||
platform_includes = [
|
||||
"cmsis/rename_exceptions.h",
|
||||
"boards/{}.h".format(board),
|
||||
],
|
||||
deps = ["//src/rp2_common/cmsis:rename_exceptions"],
|
||||
)
|
||||
for board in BOARD_CHOICES
|
||||
]
|
||||
|
||||
# Creates a config_setting for each known board option with the name:
|
||||
# PICO_BOARD_[choice]
|
||||
declare_flag_choices(
|
||||
"//bazel/config:PICO_BOARD",
|
||||
BOARD_CHOICES,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "default",
|
||||
deps = select(
|
||||
flag_choice(
|
||||
"//bazel/config:PICO_BOARD",
|
||||
":__pkg__",
|
||||
BOARD_CHOICE_MAP,
|
||||
) | {
|
||||
"//bazel/constraint:host": [":none"],
|
||||
"//conditions:default": [":none"],
|
||||
},
|
||||
),
|
||||
)
|
|
@ -1,23 +0,0 @@
|
|||
# For boards without their own cmake file, simply include a header
|
||||
|
||||
# PICO_CMAKE_CONFIG: PICO_BOARD_HEADER_DIRS, Directories to look for <PICO_BOARD>.h in. This is overridable from the user environment, type=list, default="", group=build
|
||||
if (DEFINED ENV{PICO_BOARD_HEADER_DIRS})
|
||||
set(PICO_BOARD_HEADER_DIRS $ENV{PICO_BOARD_HEADER_DIRS})
|
||||
message("Using PICO_BOARD_HEADER_DIRS from environment ('${PICO_BOARD_HEADER_DIRS}')")
|
||||
endif()
|
||||
set(PICO_BOARD_HEADER_DIRS ${PICO_BOARD_HEADER_DIRS} CACHE STRING "PICO board header directories")
|
||||
|
||||
list(APPEND PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}/include/boards)
|
||||
pico_find_in_paths(PICO_BOARD_HEADER_FILE PICO_BOARD_HEADER_DIRS ${PICO_BOARD}.h)
|
||||
|
||||
if (EXISTS ${PICO_BOARD_HEADER_FILE})
|
||||
message("Using board configuration from ${PICO_BOARD_HEADER_FILE}")
|
||||
list(APPEND PICO_CONFIG_HEADER_FILES ${PICO_BOARD_HEADER_FILE})
|
||||
else()
|
||||
set(msg "Unable to find definition of board '${PICO_BOARD}' (specified by PICO_BOARD):\n")
|
||||
list(JOIN PICO_BOARD_HEADER_DIRS ", " DIRS)
|
||||
string(CONCAT msg ${msg} " Looked for ${PICO_BOARD}.h in ${DIRS} (additional paths specified by PICO_BOARD_HEADER_DIRS)\n")
|
||||
list(JOIN PICO_BOARD_CMAKE_DIRS ", " DIRS)
|
||||
string(CONCAT msg ${msg} " Looked for ${PICO_BOARD}.cmake in ${DIRS} (additional paths specified by PICO_BOARD_CMAKE_DIRS)")
|
||||
message(FATAL_ERROR ${msg})
|
||||
endif()
|
86
src/boards/include/boards/0xcb_helios.h
Normal file
86
src/boards/include/boards/0xcb_helios.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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
|
||||
// -----------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Board definition for the 0xCB Helios
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_0XCB_HELIOS_H
|
||||
#define _BOARDS_0XCB_HELIOS_H
|
||||
|
||||
// For board detection
|
||||
#define _0XCB_HELIOS
|
||||
|
||||
#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
|
||||
|
||||
// User LED and level shifted PIN
|
||||
#ifndef PICO_DEFAULT_LED_PIN
|
||||
#define PICO_DEFAULT_LED_PIN 17
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_WS2812_PIN
|
||||
#define PICO_DEFAULT_WS2812_PIN 25
|
||||
#endif
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN 2
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN 3
|
||||
#endif
|
||||
|
||||
// --- SPI ---
|
||||
#ifndef PICO_DEFAULT_SPI
|
||||
#define PICO_DEFAULT_SPI 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define PICO_DEFAULT_SPI_SCK_PIN 22
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||
#define PICO_DEFAULT_SPI_TX_PIN 23
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||
#define PICO_DEFAULT_SPI_RX_PIN 20
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_CSN_PIN
|
||||
#define PICO_DEFAULT_SPI_CSN_PIN 21
|
||||
#endif
|
||||
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
|
||||
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 2
|
||||
#endif
|
||||
|
||||
// board has 16M onboard flash
|
||||
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (16 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
|
||||
#endif
|
||||
// All boards have B1 RP2040
|
||||
|
||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||
#define PICO_RP2040_B0_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -9,6 +9,8 @@
|
|||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_ADAFRUIT_FEATHER_RP2040_H
|
||||
#define _BOARDS_ADAFRUIT_FEATHER_RP2040_H
|
||||
|
||||
|
@ -81,10 +83,10 @@
|
|||
#define PICO_FLASH_SPI_CLKDIV 4
|
||||
#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
|
||||
|
||||
// All boards have B1 RP2040
|
||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||
#define PICO_RP2040_B0_SUPPORTED 0
|
||||
|
|
92
src/boards/include/boards/adafruit_feather_rp2040_usb_host.h
Normal file
92
src/boards/include/boards/adafruit_feather_rp2040_usb_host.h
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* 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=rp2040
|
||||
|
||||
#ifndef _BOARDS_ADAFRUIT_FEATHER_RP2040_USB_HOST_H
|
||||
#define _BOARDS_ADAFRUIT_FEATHER_RP2040_USB_HOST_H
|
||||
|
||||
// For board detection
|
||||
#define ADAFRUIT_FEATHER_RP2040_USB_HOST
|
||||
|
||||
// On some samples, the xosc can take longer to stabilize than is usual
|
||||
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
|
||||
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
|
||||
#endif
|
||||
|
||||
//------------- 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 13
|
||||
#endif
|
||||
|
||||
//------------- I2C -------------//
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 1
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN 2
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN 3
|
||||
#endif
|
||||
|
||||
//------------- SPI -------------//
|
||||
#ifndef PICO_DEFAULT_SPI
|
||||
#define PICO_DEFAULT_SPI 1
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||
#define PICO_DEFAULT_SPI_TX_PIN 15
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||
#define PICO_DEFAULT_SPI_RX_PIN 8
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define PICO_DEFAULT_SPI_SCK_PIN 14
|
||||
#endif
|
||||
|
||||
//------------- FLASH -------------//
|
||||
|
||||
// Use slower generic flash access
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
|
||||
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 4
|
||||
#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
|
||||
|
||||
// All boards have B1 RP2040
|
||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||
#define PICO_RP2040_B0_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
#endif
|
86
src/boards/include/boards/adafruit_feather_rp2350.h
Normal file
86
src/boards/include/boards/adafruit_feather_rp2350.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
// -----------------------------------------------------
|
||||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
|
||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// This header may be included by other board headers as "boards/adafruit_feather_rp2350.h"
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2350
|
||||
|
||||
#ifndef _BOARDS_ADAFRUIT_FEATHER_RP2350_H
|
||||
#define _BOARDS_ADAFRUIT_FEATHER_RP2350_H
|
||||
|
||||
// For board detection
|
||||
#define ADAFRUIT_FEATHER_RP2350
|
||||
|
||||
// --- RP2350 VARIANT ---
|
||||
#define PICO_RP2350A 1
|
||||
|
||||
// --- 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 7
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_WS2812_PIN
|
||||
#define PICO_DEFAULT_WS2812_PIN 21
|
||||
#endif
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN 2
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN 3
|
||||
#endif
|
||||
|
||||
// --- SPI ---
|
||||
#ifndef PICO_DEFAULT_SPI
|
||||
#define PICO_DEFAULT_SPI 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define PICO_DEFAULT_SPI_SCK_PIN 22
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||
#define PICO_DEFAULT_SPI_TX_PIN 23
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||
#define PICO_DEFAULT_SPI_RX_PIN 20
|
||||
#endif
|
||||
|
||||
// --- FLASH ---
|
||||
|
||||
#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
|
||||
|
||||
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
|
||||
#ifndef PICO_RP2350_A2_SUPPORTED
|
||||
#define PICO_RP2350_A2_SUPPORTED 1
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -9,6 +9,8 @@
|
|||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_ADAFRUIT_ITSYBITSY_RP2040_H
|
||||
#define _BOARDS_ADAFRUIT_ITSYBITSY_RP2040_H
|
||||
|
||||
|
@ -48,7 +50,7 @@
|
|||
|
||||
//------------- I2C -------------//
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 0
|
||||
#define PICO_DEFAULT_I2C 1
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
|
@ -84,10 +86,10 @@
|
|||
#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
|
||||
|
||||
// All boards have B1 RP2040
|
||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||
#define PICO_RP2040_B0_SUPPORTED 0
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_ADAFRUIT_KB2040_H
|
||||
#define _BOARDS_ADAFRUIT_KB2040_H
|
||||
|
||||
|
@ -76,10 +78,10 @@
|
|||
#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
|
||||
|
||||
// All boards have B1 RP2040
|
||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||
#define PICO_RP2040_B0_SUPPORTED 0
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#ifndef _BOARDS_ADAFRUIT_MACROPAD_RP2040_H
|
||||
#define _BOARDS_ADAFRUIT_MACROPAD_RP2040_H
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
// For board detection
|
||||
#define ADAFRUIT_MACROPAD_RP2040
|
||||
|
||||
|
@ -171,10 +173,10 @@
|
|||
#define PICO_FLASH_SPI_CLKDIV 4
|
||||
#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
|
||||
|
||||
// All boards have B1 RP2040
|
||||
#ifndef PICO_FLOAT_SUPPORT_ROM_V1
|
||||
#define PICO_FLOAT_SUPPORT_ROM_V1 0
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_ADAFRUIT_QTPY_RP2040_H
|
||||
#define _BOARDS_ADAFRUIT_QTPY_RP2040_H
|
||||
|
||||
|
@ -83,10 +85,10 @@
|
|||
#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
|
||||
|
||||
// All boards have B1 RP2040
|
||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||
#define PICO_RP2040_B0_SUPPORTED 0
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_ADAFRUIT_TRINKEY_QT2040_H
|
||||
#define _BOARDS_ADAFRUIT_TRINKEY_QT2040_H
|
||||
|
||||
|
@ -61,10 +63,10 @@
|
|||
#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
|
||||
|
||||
// All boards have B1 RP2040
|
||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||
#define PICO_RP2040_B0_SUPPORTED 0
|
||||
|
|
107
src/boards/include/boards/amethyst_fpga.h
Normal file
107
src/boards/include/boards/amethyst_fpga.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* 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
|
||||
// -----------------------------------------------------
|
||||
|
||||
// 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
|
||||
|
||||
#if !PICO_RP2350
|
||||
#error "Invalid PICO_PLATFORM for amethyst_fpga.h: must be rp2350 or rp2350-riscv"
|
||||
#endif
|
||||
|
||||
// For board detection
|
||||
#define RASPBERRYPI_AMETHYST_FPGA
|
||||
|
||||
#define PICO_NO_FPGA_CHECK 0
|
||||
|
||||
// --- UART ---
|
||||
#ifndef PICO_DEFAULT_UART
|
||||
#define PICO_DEFAULT_UART 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
||||
#define PICO_DEFAULT_UART_TX_PIN 46
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
||||
#define PICO_DEFAULT_UART_RX_PIN 47
|
||||
#endif
|
||||
// Match bootrom UART baud rate of 1 Mbaud:
|
||||
#ifndef PICO_DEFAULT_UART_BAUD_RATE
|
||||
#define PICO_DEFAULT_UART_BAUD_RATE 1000000
|
||||
#endif
|
||||
|
||||
// --- LED ---
|
||||
#ifndef PICO_DEFAULT_LED_PIN
|
||||
#define PICO_DEFAULT_LED_PIN 25
|
||||
#endif
|
||||
// no PICO_DEFAULT_WS2812_PIN
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN 4
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN 5
|
||||
#endif
|
||||
|
||||
// --- SPI ---
|
||||
#ifndef PICO_DEFAULT_SPI
|
||||
#define PICO_DEFAULT_SPI 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define PICO_DEFAULT_SPI_SCK_PIN 18
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||
#define PICO_DEFAULT_SPI_TX_PIN 19
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||
#define PICO_DEFAULT_SPI_RX_PIN 16
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_CSN_PIN
|
||||
#define PICO_DEFAULT_SPI_CSN_PIN 17
|
||||
#endif
|
||||
|
||||
#define PICO_SD_CLK_PIN 18
|
||||
#define PICO_SD_CMD_PIN 19
|
||||
#define PICO_SD_DAT0_PIN 20
|
||||
|
||||
#define PICO_ON_FPGA 1
|
||||
|
||||
#define PICO_SCANVIDEO_COLOR_PIN_COUNT 16
|
||||
#define PICO_SCANVIDEO_DPI_PIXEL_RSHIFT 0u
|
||||
#define PICO_SCANVIDEO_DPI_PIXEL_GSHIFT 6u
|
||||
#define PICO_SCANVIDEO_DPI_PIXEL_BSHIFT 11u
|
||||
|
||||
#define PICO_SCANVIDEO_48MHZ 1
|
||||
#define PICO_AUDIO_I2S_DATA_PIN 29
|
||||
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE 30
|
||||
|
||||
#define PICO_AUDIO_PWM_L_PIN 28
|
||||
#define PICO_AUDIO_PWM_R_PIN 27
|
||||
|
||||
// --- 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 = (16 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
|
||||
#endif
|
||||
#endif
|
112
src/boards/include/boards/archi.h
Normal file
112
src/boards/include/boards/archi.h
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* 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
|
||||
// -----------------------------------------------------
|
||||
|
||||
// This header may be included by other board headers as "boards/archi.h"
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_ARCHI_H
|
||||
#define _BOARDS_ARCHI_H
|
||||
|
||||
// For board detection
|
||||
#define ARCHI
|
||||
|
||||
// On some samples, the xosc can take longer to stabilize than is usual
|
||||
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
|
||||
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
|
||||
#endif
|
||||
|
||||
// --- BOARD SPECIFIC ---
|
||||
#ifndef ARCHI_BUTTON1_PIN
|
||||
#define ARCHI_BUTTON1_PIN 23
|
||||
#endif
|
||||
|
||||
#ifndef ARCHI_BUTTON2_PIN
|
||||
#define ARCHI_BUTTON2_PIN 10
|
||||
#endif
|
||||
|
||||
#ifndef ARCHI_BUTTON3_PIN
|
||||
#define ARCHI_BUTTON3_PIN 25
|
||||
#endif
|
||||
|
||||
#ifndef ARCHI_BUTTON4_PIN
|
||||
#define ARCHI_BUTTON4_PIN 19
|
||||
#endif
|
||||
|
||||
#ifndef ARCHI_BUZZER_PIN
|
||||
#define ARCHI_BUZZER_PIN 22
|
||||
#endif
|
||||
|
||||
#ifndef ARCHI_NEOPIXEL_PIN
|
||||
#define ARCHI_NEOPIXEL_PIN 24
|
||||
#endif
|
||||
|
||||
// --- UART ---
|
||||
#ifndef PICO_DEFAULT_UART
|
||||
#define PICO_DEFAULT_UART 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
||||
#define PICO_DEFAULT_UART_TX_PIN 16
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
||||
#define PICO_DEFAULT_UART_RX_PIN 17
|
||||
#endif
|
||||
|
||||
// --- LED ---
|
||||
// no PICO_DEFAULT_LED_PIN
|
||||
|
||||
#ifndef PICO_DEFAULT_WS2812_PIN
|
||||
#define PICO_DEFAULT_WS2812_PIN ARCHI_NEOPIXEL_PIN
|
||||
#endif
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN 14
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN 15
|
||||
#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
|
||||
|
||||
// --- FLASH ---
|
||||
|
||||
// Use slower generic flash access
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
|
||||
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 4
|
||||
#endif
|
||||
|
||||
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (4 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -9,6 +9,8 @@
|
|||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_ARDUINO_NANO_RP2040_CONNECT_H
|
||||
#define _BOARDS_ARDUINO_NANO_RP2040_CONNECT_H
|
||||
|
||||
|
@ -72,10 +74,10 @@
|
|||
#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 (16 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
// All boards have B1 RP2040
|
||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||
#define PICO_RP2040_B0_SUPPORTED 0
|
||||
|
|
191
src/boards/include/boards/cytron_maker_pi_rp2040.h
Normal file
191
src/boards/include/boards/cytron_maker_pi_rp2040.h
Normal file
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* 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=rp2040
|
||||
|
||||
#ifndef _BOARDS_CYTRON_MAKER_PI_RP2040_H
|
||||
#define _BOARDS_CYTRON_MAKER_PI_RP2040_H
|
||||
|
||||
// For board detection
|
||||
#define CYTRON_MAKER_PI_RP2040
|
||||
|
||||
// --- BOARD SPECIFIC ---
|
||||
|
||||
// Motor driver
|
||||
#ifndef MAKER_PI_RP2040_M1A_PIN
|
||||
#define MAKER_PI_RP2040_M1A_PIN 8
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_M1B_PIN
|
||||
#define MAKER_PI_RP2040_M1B_PIN 9
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_M2A_PIN
|
||||
#define MAKER_PI_RP2040_M2A_PIN 10
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_M2B_PIN
|
||||
#define MAKER_PI_RP2040_M2B_PIN 11
|
||||
#endif
|
||||
|
||||
// Grove ports
|
||||
#ifndef MAKER_PI_RP2040_GROVE1A_PIN
|
||||
#define MAKER_PI_RP2040_GROVE1A_PIN 0
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE1B_PIN
|
||||
#define MAKER_PI_RP2040_GROVE1B_PIN 1
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE2A_PIN
|
||||
#define MAKER_PI_RP2040_GROVE2A_PIN 2
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE2B_PIN
|
||||
#define MAKER_PI_RP2040_GROVE2B_PIN 3
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE3A_PIN
|
||||
#define MAKER_PI_RP2040_GROVE3A_PIN 4
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE3B_PIN
|
||||
#define MAKER_PI_RP2040_GROVE3B_PIN 5
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE4A_PIN
|
||||
#define MAKER_PI_RP2040_GROVE4A_PIN 16
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE4B_PIN
|
||||
#define MAKER_PI_RP2040_GROVE4B_PIN 17
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE5A_PIN
|
||||
#define MAKER_PI_RP2040_GROVE5A_PIN 6
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE5B_PIN
|
||||
#define MAKER_PI_RP2040_GROVE5B_PIN 26
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE6A_PIN
|
||||
#define MAKER_PI_RP2040_GROVE6A_PIN 26
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE6B_PIN
|
||||
#define MAKER_PI_RP2040_GROVE6B_PIN 27
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE7A_PIN
|
||||
#define MAKER_PI_RP2040_GROVE7A_PIN 7
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_GROVE7B_PIN
|
||||
#define MAKER_PI_RP2040_GROVE7B_PIN 28
|
||||
#endif
|
||||
|
||||
// Buttons
|
||||
#ifndef MAKER_PI_RP2040_BUTTON1_PIN
|
||||
#define MAKER_PI_RP2040_BUTTON1_PIN 20
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_BUTTON2_PIN
|
||||
#define MAKER_PI_RP2040_BUTTON2_PIN 21
|
||||
#endif
|
||||
|
||||
// Servo headers
|
||||
#ifndef MAKER_PI_RP2040_SERVO1_PIN
|
||||
#define MAKER_PI_RP2040_SERVO1_PIN 12
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_SERVO2_PIN
|
||||
#define MAKER_PI_RP2040_SERVO2_PIN 13
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_SERVO3_PIN
|
||||
#define MAKER_PI_RP2040_SERVO3_PIN 14
|
||||
#endif
|
||||
|
||||
#ifndef MAKER_PI_RP2040_SERVO4_PIN
|
||||
#define MAKER_PI_RP2040_SERVO4_PIN 15
|
||||
#endif
|
||||
|
||||
// --- 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_WS2812_PIN
|
||||
#define PICO_DEFAULT_WS2812_PIN 18
|
||||
#endif
|
||||
|
||||
// This board has two WS2812 leds in series
|
||||
#ifndef PICO_DEFAULT_WS2812_NUM_PIXELS
|
||||
#define PICO_DEFAULT_WS2812_NUM_PIXELS 2
|
||||
#endif
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 1
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#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_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_SCK_PIN
|
||||
#define PICO_DEFAULT_SPI_SCK_PIN 2
|
||||
#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 = (2 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
|
||||
#endif
|
||||
// All boards have B1 RP2040
|
||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||
#define PICO_RP2040_B0_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -14,6 +14,8 @@
|
|||
//
|
||||
// This header may be included by other board headers as "boards/datanoisetv_rp2040_dsp.h"
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_DATANOISETV_RP2040_DSP_H
|
||||
#define _BOARDS_DATANOISETV_RP2040_DSP_H
|
||||
|
||||
|
@ -38,10 +40,10 @@
|
|||
#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 (16 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||
#define PICO_RP2040_B0_SUPPORTED 0
|
||||
#endif
|
||||
|
|
64
src/boards/include/boards/datanoisetv_rp2350_dsp.h
Normal file
64
src/boards/include/boards/datanoisetv_rp2350_dsp.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
|
||||
#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
|
118
src/boards/include/boards/defcon32_badge.h
Normal file
118
src/boards/include/boards/defcon32_badge.h
Normal file
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* 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_DEFCON32_BADGE_H
|
||||
#define _BOARDS_DEFCON32_BADGE_H
|
||||
|
||||
// For board detection
|
||||
#define DEFCON32_BADGE
|
||||
|
||||
// --- RP2350 VARIANT ---
|
||||
#define PICO_RP2350A 1
|
||||
|
||||
#define DEFCON32_BADGE_SRAM_CS_PIN 0
|
||||
#define DEFCON32_BADGE_TOUCH_INT_PIN 1
|
||||
#define DEFCON32_BADGE_I2C_SDA_PIN 2
|
||||
#define DEFCON32_BADGE_I2C_SDL_PIN 3
|
||||
#define DEFCON32_BADGE_WS2812_PIN 4
|
||||
#define DEFCON32_BADGE_DISPLAY_RS_PIN 5
|
||||
#define DEFCON32_BADGE_DISPLAY_DO_PIN 6
|
||||
#define DEFCON32_BADGE_IR_SD_PIN 7
|
||||
#define DEFCON32_BADGE_DISPLAY_SCK_PIN 8
|
||||
#define DEFCON32_BADGE_DISPLAY_CS_PIN 9
|
||||
#define DEFCON32_BADGE_DISPLAY_BL_PIN 10
|
||||
#define DEFCON32_BADGE_SYS_POWER_CONTROL_PIN 11
|
||||
#define DEFCON32_BADGE_SPI_MISO_PIN 12
|
||||
#define DEFCON32_BADGE_SD_CS_PIN 13
|
||||
#define DEFCON32_BADGE_SPI_CK_PIN 14
|
||||
#define DEFCON32_BADGE_SPI_MOSI_PIN 15
|
||||
#define DEFCON32_BADGE_SW_RIGHT_PIN 16
|
||||
#define DEFCON32_BADGE_SW_DOWN_PIN 17
|
||||
#define DEFCON32_BADGE_SW_UP_PIN 18
|
||||
#define DEFCON32_BADGE_SW_LEFT_PIN 19
|
||||
#define DEFCON32_BADGE_SW_B_PIN 20
|
||||
#define DEFCON32_BADGE_SW_A_PIN 21
|
||||
#define DEFCON32_BADGE_SW_START_PIN 22
|
||||
#define DEFCON32_BADGE_SW_SELECT_PIN 23
|
||||
#define DEFCON32_BADGE_SW_FN_PIN 24
|
||||
#define DEFCON32_BADGE_SPEAKER_OUT_PIN 25
|
||||
#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
|
||||
#define PICO_DEFAULT_WS2812_PIN DEFCON32_BADGE_WS2812_PIN
|
||||
#endif
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN DEFCON32_BADGE_I2C_SDA_PIN
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN DEFCON32_BADGE_I2C_SDL_PIN
|
||||
#endif
|
||||
|
||||
// --- SPI ---
|
||||
#ifndef PICO_DEFAULT_SPI
|
||||
#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_MOSI_PIN
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_RX_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
|
||||
|
||||
#ifndef PICO_AUDIO_PWM_L_PIN
|
||||
#define PICO_AUDIO_PWM_L_PIN DEFCON32_BADGE_SPEAKER_OUT_PIN
|
||||
#endif
|
||||
|
||||
#ifndef PICO_AUDIO_PWM_MONO_PIN
|
||||
#define PICO_AUDIO_PWM_MONO_PIN PICO_AUDIO_PWM_L_PIN
|
||||
#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 = (4 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
|
||||
#ifndef PICO_RP2350_A2_SUPPORTED
|
||||
#define PICO_RP2350_A2_SUPPORTED 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -9,6 +9,8 @@
|
|||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_EETREE_GAMEKIT_RP2040_H
|
||||
#define _BOARDS_EETREE_GAMEKIT_RP2040_H
|
||||
|
||||
|
@ -67,6 +69,7 @@
|
|||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 2
|
||||
#endif
|
||||
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (2 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||
|
||||
#ifndef _BOARDS_GARATRONIC_PYBSTICK26_RP2040_H
|
||||
#define _BOARDS_GARATRONIC_PYBSTICK26_RP2040_H
|
||||
|
||||
|
@ -68,10 +70,10 @@
|
|||
#define PICO_FLASH_SPI_CLKDIV 2
|
||||
#endif
|
||||
|
||||
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (1 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (1 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads)
|
||||
// Linear regulator on Pybstick26
|
||||
//#define PICO_SMPS_MODE_PIN 23
|
||||
|
|
119
src/boards/include/boards/gen4_rp2350_24.h
Normal file
119
src/boards/include/boards/gen4_rp2350_24.h
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* 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_GEN4_RP2350_24_H
|
||||
#define _BOARDS_GEN4_RP2350_24_H
|
||||
|
||||
// For board detection
|
||||
#define GEN4_RP2350_24
|
||||
|
||||
// --- RP2350 VARIANT ---
|
||||
#define PICO_RP2350A 0
|
||||
|
||||
// --- UART ---
|
||||
#ifndef PICO_DEFAULT_UART
|
||||
#define PICO_DEFAULT_UART 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
||||
#define PICO_DEFAULT_UART_TX_PIN 4
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
||||
#define PICO_DEFAULT_UART_RX_PIN 5
|
||||
#endif
|
||||
|
||||
// --- LED ---
|
||||
// no PICO_DEFAULT_LED_PIN
|
||||
// no PICO_DEFAULT_WS2812_PIN
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN 8
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN 9
|
||||
#endif
|
||||
|
||||
// --- SPI ---
|
||||
#ifndef PICO_DEFAULT_SPI
|
||||
#define PICO_DEFAULT_SPI 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define PICO_DEFAULT_SPI_SCK_PIN 42
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||
#define PICO_DEFAULT_SPI_TX_PIN 43
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||
#define PICO_DEFAULT_SPI_RX_PIN 44
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_CSN_PIN
|
||||
#define PICO_DEFAULT_SPI_CSN_PIN 45
|
||||
#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 = (16 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
|
||||
#ifndef PICO_RP2350_A2_SUPPORTED
|
||||
#define PICO_RP2350_A2_SUPPORTED 1
|
||||
#endif
|
||||
|
||||
// 4DLCD Interface
|
||||
|
||||
#define PORTRAIT 0
|
||||
#define LANDSCAPE 1
|
||||
#define PORTRAIT_R 2
|
||||
#define LANDSCAPE_R 3
|
||||
|
||||
#define LCD_ORIENTATION PORTRAIT
|
||||
#define LCD_WIDTH 240
|
||||
#define LCD_HEIGHT 320
|
||||
#define LCD_BACKLIGHT 17
|
||||
#define LCD_RS_PIN 18
|
||||
#define LCD_WR_PIN 19
|
||||
#define LCD_RD_PIN 20
|
||||
#define LCD_DATA0_PIN 21
|
||||
#define LCD_RESET 37
|
||||
#define LCD_TOUCH_INT 38
|
||||
#define LCD_TOUCH_SCL 39
|
||||
#define LCD_TOUCH_SDA 46
|
||||
#define LCD_TOUCH_RST 47
|
||||
#define LCD_TOUCH_YD LCD_TOUCH_INT
|
||||
#define LCD_TOUCH_XL LCD_TOUCH_SCL
|
||||
#define LCD_TOUCH_YU LCD_TOUCH_RST
|
||||
#define LCD_TOUCH_XR LCD_TOUCH_SDA
|
||||
#define LCD_TOUCH_I2C i2c1
|
||||
#define LCD_TOUCH_NONE
|
||||
#define LCD_TOUCH_POINTS 0
|
||||
|
||||
#define LCD_SD_CLK 10
|
||||
#define LCD_SD_CMD 11
|
||||
#define LCD_SD_D0 12
|
||||
#define LCD_SD_D1 13
|
||||
#define LCD_SD_D2 14
|
||||
#define LCD_SD_D3 15
|
||||
|
||||
#endif
|
119
src/boards/include/boards/gen4_rp2350_24ct.h
Normal file
119
src/boards/include/boards/gen4_rp2350_24ct.h
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* 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_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
|
||||
|
||||
// --- RP2350 VARIANT ---
|
||||
#define PICO_RP2350A 0
|
||||
|
||||
// --- UART ---
|
||||
#ifndef PICO_DEFAULT_UART
|
||||
#define PICO_DEFAULT_UART 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
||||
#define PICO_DEFAULT_UART_TX_PIN 4
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
||||
#define PICO_DEFAULT_UART_RX_PIN 5
|
||||
#endif
|
||||
|
||||
// --- LED ---
|
||||
// no PICO_DEFAULT_LED_PIN
|
||||
// no PICO_DEFAULT_WS2812_PIN
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN 8
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN 9
|
||||
#endif
|
||||
|
||||
// --- SPI ---
|
||||
#ifndef PICO_DEFAULT_SPI
|
||||
#define PICO_DEFAULT_SPI 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define PICO_DEFAULT_SPI_SCK_PIN 42
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||
#define PICO_DEFAULT_SPI_TX_PIN 43
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||
#define PICO_DEFAULT_SPI_RX_PIN 44
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_CSN_PIN
|
||||
#define PICO_DEFAULT_SPI_CSN_PIN 45
|
||||
#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 = (16 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
|
||||
#ifndef PICO_RP2350_A2_SUPPORTED
|
||||
#define PICO_RP2350_A2_SUPPORTED 1
|
||||
#endif
|
||||
|
||||
// 4DLCD Interface
|
||||
|
||||
#define PORTRAIT 0
|
||||
#define LANDSCAPE 1
|
||||
#define PORTRAIT_R 2
|
||||
#define LANDSCAPE_R 3
|
||||
|
||||
#define LCD_ORIENTATION PORTRAIT
|
||||
#define LCD_WIDTH 240
|
||||
#define LCD_HEIGHT 320
|
||||
#define LCD_BACKLIGHT 17
|
||||
#define LCD_RS_PIN 18
|
||||
#define LCD_WR_PIN 19
|
||||
#define LCD_RD_PIN 20
|
||||
#define LCD_DATA0_PIN 21
|
||||
#define LCD_RESET 37
|
||||
#define LCD_TOUCH_INT 38
|
||||
#define LCD_TOUCH_SCL 39
|
||||
#define LCD_TOUCH_SDA 46
|
||||
#define LCD_TOUCH_RST 47
|
||||
#define LCD_TOUCH_YD LCD_TOUCH_INT
|
||||
#define LCD_TOUCH_XL LCD_TOUCH_SCL
|
||||
#define LCD_TOUCH_YU LCD_TOUCH_RST
|
||||
#define LCD_TOUCH_XR LCD_TOUCH_SDA
|
||||
#define LCD_TOUCH_I2C i2c1
|
||||
#define LCD_TOUCH_CTP_FT
|
||||
#define LCD_TOUCH_POINTS 2
|
||||
|
||||
#define LCD_SD_CLK 10
|
||||
#define LCD_SD_CMD 11
|
||||
#define LCD_SD_D0 12
|
||||
#define LCD_SD_D1 13
|
||||
#define LCD_SD_D2 14
|
||||
#define LCD_SD_D3 15
|
||||
|
||||
#endif
|
119
src/boards/include/boards/gen4_rp2350_24t.h
Normal file
119
src/boards/include/boards/gen4_rp2350_24t.h
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* 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_GEN4_RP2350_24T_H
|
||||
#define _BOARDS_GEN4_RP2350_24T_H
|
||||
|
||||
// For board detection
|
||||
#define GEN4_RP2350_24T
|
||||
|
||||
// --- RP2350 VARIANT ---
|
||||
#define PICO_RP2350A 0
|
||||
|
||||
// --- UART ---
|
||||
#ifndef PICO_DEFAULT_UART
|
||||
#define PICO_DEFAULT_UART 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
||||
#define PICO_DEFAULT_UART_TX_PIN 4
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
||||
#define PICO_DEFAULT_UART_RX_PIN 5
|
||||
#endif
|
||||
|
||||
// --- LED ---
|
||||
// no PICO_DEFAULT_LED_PIN
|
||||
// no PICO_DEFAULT_WS2812_PIN
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN 8
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN 9
|
||||
#endif
|
||||
|
||||
// --- SPI ---
|
||||
#ifndef PICO_DEFAULT_SPI
|
||||
#define PICO_DEFAULT_SPI 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define PICO_DEFAULT_SPI_SCK_PIN 42
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||
#define PICO_DEFAULT_SPI_TX_PIN 43
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||
#define PICO_DEFAULT_SPI_RX_PIN 44
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_CSN_PIN
|
||||
#define PICO_DEFAULT_SPI_CSN_PIN 45
|
||||
#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 = (16 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
|
||||
#ifndef PICO_RP2350_A2_SUPPORTED
|
||||
#define PICO_RP2350_A2_SUPPORTED 1
|
||||
#endif
|
||||
|
||||
// 4DLCD Interface
|
||||
|
||||
#define PORTRAIT 0
|
||||
#define LANDSCAPE 1
|
||||
#define PORTRAIT_R 2
|
||||
#define LANDSCAPE_R 3
|
||||
|
||||
#define LCD_ORIENTATION PORTRAIT
|
||||
#define LCD_WIDTH 240
|
||||
#define LCD_HEIGHT 320
|
||||
#define LCD_BACKLIGHT 17
|
||||
#define LCD_RS_PIN 18
|
||||
#define LCD_WR_PIN 19
|
||||
#define LCD_RD_PIN 20
|
||||
#define LCD_DATA0_PIN 21
|
||||
#define LCD_RESET 37
|
||||
#define LCD_TOUCH_INT 38
|
||||
#define LCD_TOUCH_SCL 39
|
||||
#define LCD_TOUCH_SDA 46
|
||||
#define LCD_TOUCH_RST 47
|
||||
#define LCD_TOUCH_YD LCD_TOUCH_INT
|
||||
#define LCD_TOUCH_XL LCD_TOUCH_SCL
|
||||
#define LCD_TOUCH_YU LCD_TOUCH_RST
|
||||
#define LCD_TOUCH_XR LCD_TOUCH_SDA
|
||||
#define LCD_TOUCH_I2C i2c1
|
||||
#define LCD_TOUCH_4WIRE
|
||||
#define LCD_TOUCH_POINTS 1
|
||||
|
||||
#define LCD_SD_CLK 10
|
||||
#define LCD_SD_CMD 11
|
||||
#define LCD_SD_D0 12
|
||||
#define LCD_SD_D1 13
|
||||
#define LCD_SD_D2 14
|
||||
#define LCD_SD_D3 15
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue