mirror of
https://codeberg.org/libreboot/pico-sdk.git
synced 2025-07-04 08:17:03 +00:00
Compare commits
697 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 | ||
|
2e6142b15b | ||
|
5e9a5e827b | ||
|
77c04e458c | ||
|
bc5d1b8485 | ||
|
85dbbfdf4d | ||
|
e7267f99fe | ||
|
4c49427bf3 | ||
|
33818dd0bd | ||
|
8f09099757 | ||
|
9644399993 | ||
|
b3c56e7169 | ||
|
7858601a58 | ||
|
0bdd463898 | ||
|
7daa20ce4c | ||
|
705b5cedcd | ||
|
bdd9746635 | ||
|
babc4a1794 | ||
|
6c19d20aa5 | ||
|
672e48e9e9 | ||
|
ef47dfeeaf | ||
|
6389927cf9 | ||
|
d3dcbb8292 | ||
|
f3c446ae14 | ||
|
4e4cf11d9b | ||
|
426e46126b | ||
|
ebc601f71f | ||
|
1e6c122fc9 | ||
|
7880405292 | ||
|
530204ec0c | ||
|
ea79d29cd6 | ||
|
b2ad632c24 | ||
|
658a21b946 | ||
|
e44d2c0010 | ||
|
43a5593e8f | ||
|
792813926d | ||
|
159d552150 | ||
|
3a3d5fe6c4 | ||
|
5e22c09660 | ||
|
4e62c26a2c | ||
|
5a927792ef | ||
|
60a6fea534 | ||
|
04c68c554b | ||
|
0d2591e1f1 | ||
|
81bdcb6681 | ||
|
9c616da1e5 | ||
|
f260477802 | ||
|
e1c5fd34e4 | ||
|
5d422deed1 | ||
|
0c501c246a | ||
|
259da19660 | ||
|
5325008956 | ||
|
510ca47c92 | ||
|
d5121dc880 | ||
|
3c450011da | ||
|
6149b9e4ec | ||
|
8554fc4ea1 | ||
|
01290c4cb3 | ||
|
8d43364cfb | ||
|
1c9f72ba1c | ||
|
76c1830aeb | ||
|
c66a2c1c3b | ||
|
e4a2aa7262 | ||
|
fc86203f49 | ||
|
6619a2d329 | ||
|
5a427fbf1f | ||
|
bb5a2a3906 | ||
|
8291f1013a | ||
|
e90f831756 | ||
|
541f93541c | ||
|
17d53af105 | ||
|
1896b1491b | ||
|
3d45276423 | ||
|
d35083b3f7 | ||
|
38b26b5d65 | ||
|
d54104a1e5 | ||
|
bc3484e793 | ||
|
b7e82b638a | ||
|
bf9848eaf9 | ||
|
ae7ef546a6 | ||
|
b3cf3e8f6f | ||
|
25a3b36793 | ||
|
96afce8ece | ||
|
5bcf4ed83a | ||
|
e379f6764b | ||
|
91462e430a | ||
|
d831eff5a2 | ||
|
215f77b836 | ||
|
0f67a6c00c | ||
|
add120e4f6 | ||
|
386e2a7bc6 | ||
|
0562089fab | ||
|
269332dc21 | ||
|
a8fa19a74d | ||
|
699838d153 | ||
|
2062372d20 | ||
|
60c5a929cc | ||
|
d0af70bd77 | ||
|
da476610e2 | ||
|
d7358e4ed8 | ||
|
ccccff8450 | ||
|
d0c7642369 | ||
|
cc1e2e8758 | ||
|
e4d6ff9ecd | ||
|
97eec951b1 | ||
|
fba9c8ce4d | ||
|
da7c39bc23 | ||
|
b04a09110f | ||
|
5641cd0a4a | ||
|
68555c9751 | ||
|
e5110dfce1 | ||
|
3604a6fa13 | ||
|
e850214938 | ||
|
723dfd04ff | ||
|
05418b4e71 | ||
|
83cd1da1ef | ||
|
0ccd0db163 | ||
|
22b0d5d2ed | ||
|
3c72e753b6 | ||
|
9320d192c3 | ||
|
68571ad33e | ||
|
a0450d0133 | ||
|
3c94bc8137 | ||
|
f808b5f2dc | ||
|
2f2e62968d | ||
|
a793222331 | ||
|
ec4036181f | ||
|
db47fba48d | ||
|
a0d4bdf731 | ||
|
d50e743e0e | ||
|
30673fb6d0 | ||
|
e76d5a9008 | ||
|
9f1c37318b | ||
|
4c9ba3e8ad | ||
|
ace97f3387 | ||
|
0fa58ed219 | ||
|
0a32023aac | ||
|
13be546dc3 | ||
|
12017a07ab | ||
|
9319ab11d9 | ||
|
62854f5eff | ||
|
13ed99df0d | ||
|
0fdf543126 | ||
|
3c53029c24 | ||
|
ce0db40223 | ||
|
a119b5bd9f | ||
|
eb42ecfaa5 | ||
|
cd4e53a202 | ||
|
f63a14e9ee | ||
|
2214468b51 | ||
|
e12713d70b | ||
|
e6b8c7b64e | ||
|
1d0dcc8177 | ||
|
46d8597d35 | ||
|
d7feac1495 | ||
|
ca232e9404 | ||
|
c08136b696 | ||
|
672d18a6f0 | ||
|
2622e9bc29 | ||
|
9a586371db | ||
|
a6a436b1fe | ||
|
7e90980118 | ||
|
ae6e574f53 | ||
|
ccc0ba5649 | ||
|
5e05469373 | ||
|
dc4342f0f6 | ||
|
35b4965054 | ||
|
e02c6b327d | ||
|
f4ab723eb5 | ||
|
529d7087eb | ||
|
cefe5c5b2a | ||
|
edcb65c916 | ||
|
f16ccfa1ff | ||
|
44feae4caf | ||
|
61b7cbdc54 | ||
|
21bbaf3ca6 | ||
|
4328b2c75f | ||
|
1f1c6162cd | ||
|
979045dc12 | ||
|
d42e6a9d10 | ||
|
654b66693f | ||
|
bfcbefafc5 | ||
|
fdf695b8d8 | ||
|
45a1e08265 | ||
|
c44e62defd | ||
|
bba0420c76 | ||
|
8d7bdd2006 | ||
|
4b0dea4339 | ||
|
eeb6b501ff | ||
|
5afa3636d6 | ||
|
91e9327ff1 | ||
|
b3e1d2d8b8 | ||
|
561502c2da | ||
|
496ff66d19 | ||
|
66c54d807b | ||
|
27c1a89b3d | ||
|
895bad790e | ||
|
30041d8513 | ||
|
d026118499 | ||
|
42cbdcb13a | ||
|
c573775f86 | ||
|
1996a21e3a | ||
|
e0872a32cc | ||
|
5ad072af5b | ||
|
a531123080 | ||
|
6994a3858d | ||
|
2eb76bb058 | ||
|
b8dc054eba | ||
|
cc8b2156fb | ||
|
048fcdefd6 | ||
|
80356a4f02 | ||
|
d79dd219ce | ||
|
94b83315d9 | ||
|
777ccb8e56 | ||
|
17ee1a877d | ||
|
b2832b3acb | ||
|
060123dc8d | ||
|
596d08ea62 | ||
|
a32d614b43 | ||
|
5384b6b4d3 | ||
|
607b42006a | ||
|
574fdee37b | ||
|
c6c4eeb122 | ||
|
54c78bf985 | ||
|
b05d863428 | ||
|
6182a2a078 | ||
|
508828f8ea | ||
|
36dda1c5c4 | ||
|
e57b99a652 | ||
|
9396b9c7e1 | ||
|
ecf66bf514 | ||
|
114dc5a80d | ||
|
8d4f4e148d | ||
|
6d87da4c59 | ||
|
ec0dc7a88b | ||
|
53f1915a6b | ||
|
7fc75d8c90 | ||
|
8f3c3ff12a | ||
|
18c39856bd | ||
|
929ede7482 | ||
|
b6f812f647 | ||
|
b7da70a53b | ||
|
6796faf0d5 | ||
|
c979ca591f | ||
|
d35d1b331e | ||
|
4c83c10f01 | ||
|
5259693774 | ||
|
6c4d25b887 | ||
|
b17fc76c8f | ||
|
b8dbbcf0d7 | ||
|
93d3cf4d8e | ||
|
c6d70d51f4 | ||
|
127543a425 | ||
|
9c3538e8b0 | ||
|
ec16d3ff28 | ||
|
5fdc663ff8 | ||
|
962da33ea7 | ||
|
344b961ebf | ||
|
814d2bd855 | ||
|
f69f513a29 | ||
|
4fe995d0ec | ||
|
aabae62caa | ||
|
2e777d47d3 | ||
|
162098678b | ||
|
fd16563f8f | ||
|
1089c1b83a | ||
|
707555f5bc | ||
|
3c0309c10e | ||
|
98574564b8 | ||
|
cdf1a956eb | ||
|
336aae518e | ||
|
6c1150f3f4 | ||
|
a2576202ff | ||
|
26fd36f853 | ||
|
3ad5e1570c | ||
|
a2c7d7507b | ||
|
ea40696827 | ||
|
5867849b17 | ||
|
6f7dc67791 | ||
|
090c5cd83b | ||
|
20b9823aca |
1097 changed files with 400780 additions and 55748 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
|
4
.github/pull_request_template.md
vendored
Normal file
4
.github/pull_request_template.md
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
_Instructions: (please delete)_
|
||||||
|
- _please do not submit against `master`, use `develop` instead_
|
||||||
|
- _please make sure there is an associated issue for your PR, and reference it via "Fixes #num" in the description_
|
||||||
|
- _please enter a detailed description_
|
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
|
name: CMake
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- 'iar/**'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||||
|
@ -7,7 +11,8 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
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]
|
runs-on: [self-hosted, Linux, X64]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -18,7 +23,7 @@ jobs:
|
||||||
mkdir -p "${{ github.workspace }}"
|
mkdir -p "${{ github.workspace }}"
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Checkout submodules
|
- name: Checkout submodules
|
||||||
run: git submodule update --init
|
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
|
# 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.
|
# 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
|
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPICO_SDK_TESTS_ENABLED=1
|
||||||
|
|
||||||
- name: Get core count
|
|
||||||
id: core_count
|
|
||||||
run : cat /proc/cpuinfo | grep processor | wc -l
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ${{github.workspace}}/build
|
working-directory: ${{github.workspace}}/build
|
||||||
shell: bash
|
shell: bash
|
||||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
# 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
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
cmake-*
|
cmake-*
|
||||||
|
.cache
|
||||||
.DS_Store
|
.DS_Store
|
||||||
build
|
build
|
||||||
|
build-*
|
||||||
|
|
||||||
|
bazel-*
|
||||||
|
|
||||||
|
# Ignore until https://github.com/bazelbuild/bazel/issues/20369 is fixed.
|
||||||
|
MODULE.bazel.lock
|
||||||
|
__pycache__/
|
||||||
|
|
15
.gitmodules
vendored
15
.gitmodules
vendored
|
@ -1,4 +1,15 @@
|
||||||
[submodule "tinyusb"]
|
[submodule "tinyusb"]
|
||||||
path = lib/tinyusb
|
path = lib/tinyusb
|
||||||
url = https://github.com/raspberrypi/tinyusb.git
|
url = https://github.com/hathach/tinyusb.git
|
||||||
branch = pico
|
[submodule "lib/cyw43-driver"]
|
||||||
|
path = lib/cyw43-driver
|
||||||
|
url = https://github.com/georgerobotics/cyw43-driver.git
|
||||||
|
[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,10 +1,27 @@
|
||||||
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
|
||||||
if (NOT TARGET _pico_sdk_inclusion_marker)
|
if (NOT TARGET _pico_sdk_inclusion_marker)
|
||||||
add_library(_pico_sdk_inclusion_marker INTERFACE)
|
add_library(_pico_sdk_inclusion_marker INTERFACE)
|
||||||
|
# This is a no-op unless we are the top-level CMakeLists.txt
|
||||||
include(pico_sdk_init.cmake)
|
include(pico_sdk_init.cmake)
|
||||||
|
|
||||||
project(pico_sdk C CXX ASM)
|
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 ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||||
if (PICO_DEOPTIMIZED_DEBUG)
|
if (PICO_DEOPTIMIZED_DEBUG)
|
||||||
message("Using fully de-optimized debug build (set PICO_DEOPTIMIZED_DEBUG=0 to optimize)")
|
message("Using fully de-optimized debug build (set PICO_DEOPTIMIZED_DEBUG=0 to optimize)")
|
||||||
|
@ -24,14 +41,17 @@ if (NOT TARGET _pico_sdk_inclusion_marker)
|
||||||
|
|
||||||
# allow customization
|
# allow customization
|
||||||
add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS)
|
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(tools)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
add_compile_options(-Winline)
|
|
||||||
|
|
||||||
# allow customization
|
# allow customization
|
||||||
add_sub_list_dirs(PICO_SDK_POST_LIST_DIRS)
|
add_sub_list_dirs(PICO_SDK_POST_LIST_DIRS)
|
||||||
|
add_sub_list_files(PICO_SDK_POST_LIST_FILES)
|
||||||
|
|
||||||
if (PICO_SDK_TOP_LEVEL_PROJECT AND NOT DEFINED PICO_SDK_TESTS_ENABLED)
|
if (PICO_SDK_TOP_LEVEL_PROJECT AND NOT DEFINED PICO_SDK_TESTS_ENABLED)
|
||||||
set(PICO_SDK_TESTS_ENABLED 1)
|
set(PICO_SDK_TESTS_ENABLED 1)
|
||||||
|
@ -44,5 +64,8 @@ if (NOT TARGET _pico_sdk_inclusion_marker)
|
||||||
|
|
||||||
# add docs at the end, as we gather documentation dirs as we go
|
# add docs at the end, as we gather documentation dirs as we go
|
||||||
add_subdirectory(docs)
|
add_subdirectory(docs)
|
||||||
endif()
|
|
||||||
|
|
||||||
|
if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
|
||||||
|
pico_promote_common_scope_vars()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
25
CONTRIBUTING.md
Normal file
25
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# Contributing to Raspberry Pi Pico C/C++ SDK
|
||||||
|
|
||||||
|
## How to Report a Bug
|
||||||
|
|
||||||
|
We use GitHub to host code, track [issues](https://github.com/raspberrypi/pico-sdk/issues) and feature requests, and to accept [pull requests](https://github.com/raspberrypi/pico-sdk/pulls). If you find think you have found a bug in the SDK please report it by [opening a new issue](https://github.com/raspberrypi/pico-sdk/issues/new). Please include as much detail as possible, and ideally some code to reproduce the problem.
|
||||||
|
|
||||||
|
## How to Contribute Code
|
||||||
|
|
||||||
|
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 [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.
|
||||||
|
|
||||||
|
### Code Style
|
||||||
|
|
||||||
|
If you are contributing new or updated code please match the existing code style, particularly:
|
||||||
|
|
||||||
|
* Use 4 spaces for indentation rather than tabs.
|
||||||
|
* Braces are required for everything except single line `if` statements.
|
||||||
|
* Opening braces should not be placed on a new line.
|
||||||
|
|
||||||
|
### Licensing
|
||||||
|
|
||||||
|
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,
|
||||||
|
)
|
85
README.md
85
README.md
|
@ -1,28 +1,31 @@
|
||||||
# Raspberry Pi Pico SDK
|
# Raspberry Pi Pico SDK
|
||||||
|
|
||||||
The Raspberry Pi Pico SDK (henceforth the SDK) provides the headers, libraries and build system
|
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.
|
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.
|
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
|
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
|
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.
|
||||||
along with various utilities.
|
|
||||||
|
|
||||||
The SDK can be used to build anything from simple applications, to fully fledged runtime environments such as MicroPython, to low level software
|
The SDK can be used to build anything from simple applications, fully-fledged runtime environments such as MicroPython, to low level software
|
||||||
such as RP2040's on-chip bootrom itself.
|
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).
|
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
|
# Documentation
|
||||||
|
|
||||||
See [Getting Started with the Raspberry Pi Pico](https://rptl.io/pico-get-started) for information on how to setup your
|
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 for how to build and debug software for the Raspberry Pi Pico
|
hardware, IDE/environment and how to build and debug software for the Raspberry Pi Pico and other RP-series microcontroller based devices.
|
||||||
and other RP2040-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.
|
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.
|
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.
|
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
|
# Quick-start your own project
|
||||||
|
|
||||||
These instructions are extremely terse, and Linux-based only. For detailed steps,
|
## Using Visual Studio Code
|
||||||
instructions for other platforms, and just in general, we recommend you see [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk)
|
|
||||||
|
|
||||||
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
|
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
|
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:
|
3. Setup a `CMakeLists.txt` like:
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13...3.27)
|
||||||
|
|
||||||
# initialize the SDK based on PICO_SDK_PATH
|
# initialize the SDK based on PICO_SDK_PATH
|
||||||
# note: this must happen before project()
|
# 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:
|
1. Setup a `CMakeLists.txt` like:
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13...3.27)
|
||||||
|
|
||||||
# initialize pico-sdk from submodule
|
# initialize pico-sdk from submodule
|
||||||
# note: this must happen before project()
|
# note: this must happen before project()
|
||||||
|
@ -110,7 +125,25 @@ instructions for other platforms, and just in general, we recommend you see [Ras
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
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)
|
* Or by cloning the SDK locally, but without copying `pico_sdk_import.cmake`:
|
||||||
|
1. `git clone` this Raspberry Pi Pico SDK repository
|
||||||
|
2. Setup a `CMakeLists.txt` like:
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
|
# initialize the SDK directly
|
||||||
|
include(/path/to/pico-sdk/pico_sdk_init.cmake)
|
||||||
|
|
||||||
|
project(my_project)
|
||||||
|
|
||||||
|
# initialize the Raspberry Pi Pico SDK
|
||||||
|
pico_sdk_init()
|
||||||
|
|
||||||
|
# rest of your project
|
||||||
|
|
||||||
|
```
|
||||||
|
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)
|
About the simplest you can do is a single source file (e.g. hello_world.c)
|
||||||
|
|
||||||
|
@ -119,7 +152,7 @@ instructions for other platforms, and just in general, we recommend you see [Ras
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
setup_default_uart();
|
stdio_init_all();
|
||||||
printf("Hello, world!\n");
|
printf("Hello, world!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -141,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_;
|
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.
|
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.
|
1. Setup a CMake build directory.
|
||||||
For example, if not using an IDE:
|
For example, if not using an IDE:
|
||||||
```
|
```
|
||||||
|
@ -150,9 +182,22 @@ instructions for other platforms, and just in general, we recommend you see [Ras
|
||||||
$ cmake ..
|
$ 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.
|
1. Make your target from the build directory you created.
|
||||||
```sh
|
```sh
|
||||||
$ make hello_world
|
$ 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_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||||
set(CMAKE_EXECUTABLE_SUFFIX .elf)
|
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
|
# PICO_BOARD is the root of config as it can define PICO_PLATFORM and other build vars
|
||||||
if (DEFINED ENV{PICO_PLATFORM} AND (NOT PICO_PLATFORM))
|
|
||||||
|
# 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})
|
set(PICO_PLATFORM $ENV{PICO_PLATFORM})
|
||||||
message("Using PICO_PLATFORM from environment ('${PICO_PLATFORM}')")
|
message("Initializing PICO_PLATFORM from environment ('${PICO_PLATFORM}')")
|
||||||
else()
|
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)
|
if (NOT PICO_PLATFORM)
|
||||||
set(PICO_PLATFORM "rp2040")
|
# if we have neither BOARD nor PLATFORM default PLATFORM silently, so we don't end up with a board of "none"
|
||||||
pico_message("Defaulting PICO_PLATFORM to ${PICO_PLATFORM} since not specified.")
|
# on platform that does have a default board (we want default PLATFORM and BOARD in that case)
|
||||||
else()
|
set(PICO_PLATFORM ${PICO_DEFAULT_PLATFORM})
|
||||||
message("PICO platform is ${PICO_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()
|
||||||
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
|
list(APPEND PICO_BOARD_CMAKE_DIRS ${CMAKE_CURRENT_LIST_DIR}/../src/boards)
|
||||||
set(PICO_CMAKE_PRELOAD_PLATFORM_FILE "" CACHE INTERNAL "")
|
|
||||||
set(PICO_CMAKE_PRELOAD_PLATFORM_DIR "${CMAKE_CURRENT_LIST_DIR}/preload/platforms" CACHE INTERNAL "")
|
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)
|
if (NOT PICO_CMAKE_PRELOAD_PLATFORM_FILE)
|
||||||
set(PICO_CMAKE_PRELOAD_PLATFORM_FILE ${PICO_CMAKE_PRELOAD_PLATFORM_DIR}/${PICO_PLATFORM}.cmake CACHE INTERNAL "")
|
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(PICO_TOOLCHAIN_PATH "${PICO_TOOLCHAIN_PATH}" CACHE INTERNAL "")
|
||||||
|
|
||||||
# Set a default build type if none was specified
|
# Set a default build type if none was specified
|
||||||
set(default_build_type "Release")
|
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)
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
message(STATUS "Defaulting build type to '${default_build_type}' since not specified.")
|
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)
|
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")
|
error("Default build type is NOT supported")
|
||||||
endif()
|
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 (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 PICO_COMPILER is specified, set toolchain file to ${PICO_COMPILER}.cmake.
|
||||||
if (DEFINED PICO_COMPILER)
|
if (DEFINED PICO_COMPILER)
|
||||||
if (DEFINED CMAKE_TOOLCHAIN_FILE)
|
# maintain backwards compatibility with RP2040 SDK compilers
|
||||||
get_filename_component(toolchain "${CMAKE_TOOLCHAIN_FILE}" NAME_WE)
|
set(ORIG_PICO_COMPILER "${PICO_COMPILER}")
|
||||||
if (NOT "${PICO_COMPILER}" STREQUAL "${toolchain}")
|
if (PICO_COMPILER STREQUAL "pico_arm_gcc")
|
||||||
message(WARNING "CMAKE_TOOLCHAIN_FILE is already defined to ${toolchain}.cmake, you\
|
if (PICO_PLATFORM STREQUAL "rp2040")
|
||||||
need to delete cache and reconfigure if you want to switch compiler.")
|
set(PICO_COMPILER "pico_arm_cortex_m0plus_gcc")
|
||||||
endif ()
|
elseif(PICO_PLATFORM STREQUAL "rp2350")
|
||||||
else ()
|
set(PICO_COMPILER "pico_arm_cortex_m33_gcc")
|
||||||
set(toolchain_dir "${CMAKE_CURRENT_LIST_DIR}/preload/toolchains")
|
endif()
|
||||||
set(toolchain_file "${toolchain_dir}/${PICO_COMPILER}.cmake")
|
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}")
|
if (EXISTS "${toolchain_file}")
|
||||||
set(CMAKE_TOOLCHAIN_FILE "${toolchain_file}" CACHE INTERNAL "")
|
set(CMAKE_TOOLCHAIN_FILE "${toolchain_file}")
|
||||||
else ()
|
else ()
|
||||||
# todo improve message
|
# todo improve message
|
||||||
message(FATAL_ERROR "Toolchain file \"${PICO_COMPILER}.cmake\" does not exist, please\
|
message(FATAL_ERROR "Toolchain file \"${PICO_COMPILER}.cmake\" does not exist, please\
|
||||||
select one from \"cmake/toolchains\" folder.")
|
select one from \"cmake/toolchains\" folder.")
|
||||||
endif ()
|
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 ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
message("PICO compiler is ${PICO_COMPILER}")
|
set(PICO_PREVIOUS_CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE} CACHE INTERNAL "Saved CMAKE_TOOLCHAIN_FILE" FORCE)
|
||||||
unset(PICO_COMPILER CACHE)
|
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
|
# 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
|
# 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
|
# 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
|
# include our Platform/PICO.cmake
|
||||||
set(CMAKE_SYSTEM_NAME PICO)
|
set(CMAKE_SYSTEM_NAME PICO)
|
||||||
|
@ -27,10 +27,6 @@ set(CMAKE_INCLUDE_FLAG_ASM "-I")
|
||||||
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
|
set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
|
||||||
set(CMAKE_OBJDUMP ${PICO_OBJDUMP} 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.
|
# Add target system root to cmake find path.
|
||||||
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
|
get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
|
||||||
get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" 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_PACKAGE ONLY)
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
|
||||||
# todo move to platform/Generix-xxx
|
set(ARM_TOOLCHAIN_COMMON_FLAGS " --cpu=Cortex-M0plus")
|
||||||
set(ARM_CLANG_COMMON_FLAGS " --cpu=Cortex-M0plus")
|
include(${CMAKE_CURRENT_LIST_DIR}/util/set_flags.cmake)
|
||||||
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")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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)
|
|
||||||
message("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}.
|
# 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
|
# If not found, issue a fatal message and stop processing. PICO_TOOLCHAIN_PATH can be provided from
|
||||||
# commandline as additional search path.
|
# 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.
|
# Search user provided path first.
|
||||||
find_program(
|
find_program(
|
||||||
${compiler_path} ${compiler_exe}
|
${compiler_path} NAMES ${compiler_exes}
|
||||||
PATHS ENV PICO_TOOLCHAIN_PATH
|
PATHS ENV PICO_TOOLCHAIN_PATH
|
||||||
PATH_SUFFIXES bin
|
PATH_SUFFIXES bin
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
|
@ -21,11 +21,21 @@ function(pico_find_compiler compiler_path compiler_exe)
|
||||||
if (DEFINED ENV{PICO_TOOLCHAIN_PATH})
|
if (DEFINED ENV{PICO_TOOLCHAIN_PATH})
|
||||||
message(WARNING "PICO_TOOLCHAIN_PATH specified ($ENV{PICO_TOOLCHAIN_PATH}), but ${compiler_exe} not found there")
|
message(WARNING "PICO_TOOLCHAIN_PATH specified ($ENV{PICO_TOOLCHAIN_PATH}), but ${compiler_exe} not found there")
|
||||||
endif()
|
endif()
|
||||||
find_program(${compiler_path} ${compiler_exe})
|
find_program(${compiler_path} NAMES ${compiler_exes})
|
||||||
endif ()
|
endif ()
|
||||||
if ("${${compiler_path}}" STREQUAL "${compiler_path}-NOTFOUND")
|
if ("${${compiler_path}}" STREQUAL "${compiler_path}-NOTFOUND")
|
||||||
set(PICO_TOOLCHAIN_PATH "" CACHE PATH "Path to search for compiler.")
|
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\".")
|
\"PICO_TOOLCHAIN_PATH\".")
|
||||||
endif ()
|
endif ()
|
||||||
endfunction()
|
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()
|
|
@ -1,4 +1,4 @@
|
||||||
find_package(Doxygen)
|
find_package(Doxygen QUIET)
|
||||||
if (PICO_SDK_TOP_LEVEL_PROJECT AND ${DOXYGEN_FOUND})
|
if (PICO_SDK_TOP_LEVEL_PROJECT AND ${DOXYGEN_FOUND})
|
||||||
set(PICO_BUILD_DOCS_DEFAULT 1)
|
set(PICO_BUILD_DOCS_DEFAULT 1)
|
||||||
endif()
|
endif()
|
||||||
|
@ -40,13 +40,26 @@ if(PICO_BUILD_DOCS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(DOXY_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doxygen")
|
set(DOXY_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doxygen")
|
||||||
set(DOXY_INPUT_DIRS "${PICO_DOXYGEN_PATHS}")
|
string(REPLACE ";" " " DOXY_INPUT_DIRS "${PICO_DOXYGEN_PATHS}")
|
||||||
set(DOXY_EXCLUDE_DIRS "${PICO_DOXYGEN_EXCLUDE_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}")
|
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_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
|
||||||
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
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)
|
configure_file(${doxyfile_in} ${doxyfile} @ONLY)
|
||||||
|
|
||||||
add_custom_target(docs
|
add_custom_target(docs
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
PROJECT_NAME = "Raspberry Pi Pico SDK"
|
PROJECT_NAME = "Raspberry Pi Pico SDK"
|
||||||
PROJECT_BRIEF = "Raspberry Pi Pico SDK documentation"
|
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 = @PROJECT_SOURCE_DIR@
|
||||||
STRIP_FROM_PATH = @DOXY_INPUT_DIRS@
|
STRIP_FROM_PATH = @DOXY_INPUT_DIRS@
|
||||||
|
@ -52,12 +52,17 @@ EXTRACT_ALL = NO
|
||||||
ALWAYS_DETAILED_SEC = 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.
|
# Need these next options to ensure that functions with modifiers do not confuse the Doxygen parser.
|
||||||
# And any further function modifiers here.
|
# And any further function modifiers here.
|
||||||
MACRO_EXPANSION = YES
|
MACRO_EXPANSION = YES
|
||||||
|
|
||||||
PREDEFINED = __not_in_flash_func(x) \
|
PREDEFINED = __not_in_flash_func(x)= \
|
||||||
__time_critical_func(x) \
|
__time_critical_func(x)= \
|
||||||
__not_in_flash(x)= \
|
__not_in_flash(x)= \
|
||||||
__no_inline_not_in_flash(x)= \
|
__no_inline_not_in_flash(x)= \
|
||||||
__attribute__(x)=
|
__attribute__(x)= \
|
||||||
|
DOXYGEN_GENERATION= \
|
||||||
|
@DOXY_PREDEFINED@
|
||||||
|
|
||||||
|
ENABLED_SECTIONS = @DOXY_ENABLED_SECTIONS@
|
|
@ -7,17 +7,18 @@
|
||||||
<tab type="user" url="@ref examples_page" visible="yes" title="Examples" intro="Links to SDK examples"/>
|
<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="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/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-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/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-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-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-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>
|
||||||
<tab type="usergroup" url="@ref weblinks_page" visible="yes" title="Web" intro="useful weblinks">
|
<tab type="usergroup" url="@ref weblinks_page" visible="yes" title="Web" intro="useful weblinks">
|
||||||
<tab type="user" url="https://www.raspberrypi.org/" visible="yes" title="Raspberry Pi Site" intro=""/>
|
<tab type="user" url="https://www.raspberrypi.com/" visible="yes" title="Raspberry Pi Site" intro=""/>
|
||||||
<tab type="user" url="https://rptl.io/rp2040-get-started" visible="yes" title="Raspberry Pi Pico Page" intro=""/>
|
<tab type="user" url="https://rptl.io/rp2040-get-started" visible="yes" title="Raspberry Pi Pico Page" intro=""/>
|
||||||
<tab type="user" url="https://www.raspberrypi.org/forums" visible="yes" title="Raspberry Pi Forums" intro=""/>
|
<tab type="user" url="https://forums.raspberrypi.com/" visible="yes" title="Raspberry Pi Forums" intro=""/>
|
||||||
<tab type="user" url="https://github.com/raspberrypi/pico-sdk" visible="yes" title="Raspberry Pi Pico SDK on GitHub" intro=""/>
|
<tab type="user" url="https://github.com/raspberrypi/pico-sdk" visible="yes" title="Raspberry Pi Pico SDK on GitHub" intro=""/>
|
||||||
<tab type="user" url="https://github.com/raspberrypi/pico-examples" visible="yes" title="Pico Examples on GitHub" intro=""/>
|
<tab type="user" url="https://github.com/raspberrypi/pico-examples" visible="yes" title="Pico Examples on GitHub" intro=""/>
|
||||||
<tab type="user" url="https://github.com/raspberrypi/pico-extras" visible="yes" title="Pico Extras on GitHub" intro=""/>
|
<tab type="user" url="https://github.com/raspberrypi/pico-extras" visible="yes" title="Pico Extras on GitHub" intro=""/>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
## Examples Index {#examples_page}
|
## Examples Index {#examples_page}
|
||||||
|
|
||||||
This page links to the various example code fragments in this documentation. For more complete examples, please see the pico_examples repository, which contains complete buildable projects.
|
This page links to the various example code fragments in this documentation. For more complete examples, please see the [pico-examples](https://github.com/raspberrypi/pico-examples) repository, which contains complete buildable projects.
|
||||||
|
|
||||||
- [RTC example](@ref rtc_example)
|
- [RTC example](@ref rtc_example)
|
||||||
- [UART example](@ref uart_example)
|
- [UART example](@ref uart_example)
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
<div class="navigation-footer">
|
<div class="navigation-footer">
|
||||||
<img src="logo-mobile.svg" alt="Raspberry Pi">
|
<img src="logo-mobile.svg" alt="Raspberry Pi">
|
||||||
<a href="https://www.raspberrypi.org/" target="_blank">By Raspberry Pi (Trading) Ltd</a>
|
<a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="search">
|
<!-- <div class="search">
|
||||||
<form>
|
<form>
|
||||||
|
|
142
docs/index.h
142
docs/index.h
|
@ -6,53 +6,89 @@
|
||||||
|
|
||||||
// Here to organize documentation order
|
// Here to organize documentation order
|
||||||
|
|
||||||
|
// for some reason cond/endcond work better here than if/endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \defgroup hardware Hardware APIs
|
* \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.
|
* hardware registers directly.
|
||||||
* @{
|
* @{
|
||||||
* \defgroup hardware_adc hardware_adc
|
* \cond hardware_adc \defgroup hardware_adc hardware_adc \endcond
|
||||||
* \defgroup hardware_base hardware_base
|
* \cond hardware_base \defgroup hardware_base hardware_base \endcond
|
||||||
* \defgroup hardware_claim hardware_claim
|
* \cond hardware_bootlock \defgroup hardware_bootlock hardware_bootlock \endcond
|
||||||
* \defgroup hardware_clocks hardware_clocks
|
* \cond hardware_claim \defgroup hardware_claim hardware_claim \endcond
|
||||||
* \defgroup hardware_divider hardware_divider
|
* \cond hardware_clocks \defgroup hardware_clocks hardware_clocks \endcond
|
||||||
* \defgroup hardware_dma hardware_dma
|
* \cond hardware_divider \defgroup hardware_divider hardware_divider \endcond
|
||||||
* \defgroup hardware_flash hardware_flash
|
* \cond hardware_dcp \defgroup hardware_dcp hardware_dcp \endcond
|
||||||
* \defgroup hardware_gpio hardware_gpio
|
* \cond hardware_dma \defgroup hardware_dma hardware_dma \endcond
|
||||||
* \defgroup hardware_i2c hardware_i2c
|
* \cond hardware_exception \defgroup hardware_exception hardware_exception \endcond
|
||||||
* \defgroup hardware_interp hardware_interp
|
* \cond hardware_flash \defgroup hardware_flash hardware_flash \endcond
|
||||||
* \defgroup hardware_irq hardware_irq
|
* \cond hardware_gpio \defgroup hardware_gpio hardware_gpio \endcond
|
||||||
* \defgroup hardware_pio hardware_pio
|
* \cond hardware_hazard3 \defgroup hardware_hazard3 hardware_hazard3 \endcond
|
||||||
* \defgroup hardware_pll hardware_pll
|
* \cond hardware_i2c \defgroup hardware_i2c hardware_i2c \endcond
|
||||||
* \defgroup hardware_pwm hardware_pwm
|
* \cond hardware_interp \defgroup hardware_interp hardware_interp \endcond
|
||||||
* \defgroup hardware_resets hardware_resets
|
* \cond hardware_irq \defgroup hardware_irq hardware_irq \endcond
|
||||||
* \defgroup hardware_rtc hardware_rtc
|
* \cond hardware_pio \defgroup hardware_pio hardware_pio \endcond
|
||||||
* \defgroup hardware_spi hardware_spi
|
* \cond hardware_pll \defgroup hardware_pll hardware_pll \endcond
|
||||||
* \defgroup hardware_sync hardware_sync
|
* \cond hardware_powman \defgroup hardware_powman hardware_powman \endcond
|
||||||
* \defgroup hardware_timer hardware_timer
|
* \cond hardware_pwm \defgroup hardware_pwm hardware_pwm \endcond
|
||||||
* \defgroup hardware_uart hardware_uart
|
* \cond hardware_pwm \defgroup hardware_pwm hardware_pwm \endcond
|
||||||
* \defgroup hardware_vreg hardware_vreg
|
* \cond hardware_resets \defgroup hardware_resets hardware_resets \endcond
|
||||||
* \defgroup hardware_watchdog hardware_watchdog
|
* \cond hardware_riscv \defgroup hardware_riscv hardware_riscv \endcond
|
||||||
* \defgroup hardware_xosc hardware_xosc
|
* \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
|
* \defgroup high_level High Level APIs
|
||||||
* This group of libraries provide higher level functionality that isn't hardware related or provides a richer
|
* 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
|
* set of functionality above the basic hardware interfaces
|
||||||
* @{
|
* @{
|
||||||
* \defgroup pico_multicore pico_multicore
|
* \cond pico_aon_timer \defgroup pico_aon_timer pico_aon_timer \endcond
|
||||||
* \defgroup pico_stdlib pico_stdlib
|
* \cond pico_async_context \defgroup pico_async_context pico_async_context \endcond
|
||||||
* \defgroup pico_sync pico_sync
|
* \cond pico_bootsel_via_double_reset \defgroup pico_bootsel_via_double_reset pico_bootsel_via_double_reset \endcond
|
||||||
* \defgroup pico_time pico_time
|
* \cond pico_flash \defgroup pico_flash pico_flash \endcond
|
||||||
* \defgroup pico_unique_id pico_unique_id
|
* \cond pico_i2c_slave \defgroup pico_i2c_slave pico_i2c_slave \endcond
|
||||||
* \defgroup pico_util pico_util
|
* \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
|
* \defgroup third_party Third-party Libraries
|
||||||
* Third party libraries for implementing high level functionality.
|
* Third party libraries for implementing high level functionality.
|
||||||
* @{
|
* @{
|
||||||
|
* \cond tinyusb
|
||||||
* \defgroup tinyusb_device tinyusb_device
|
* \defgroup tinyusb_device tinyusb_device
|
||||||
* \defgroup tinyusb_host tinyusb_host
|
* \defgroup tinyusb_host tinyusb_host
|
||||||
|
* \endcond
|
||||||
|
* @}
|
||||||
|
*
|
||||||
|
* \defgroup networking Networking Libraries
|
||||||
|
* Functions for implementing networking
|
||||||
|
* @{
|
||||||
|
* \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
|
* \defgroup runtime Runtime Infrastructure
|
||||||
|
@ -60,30 +96,36 @@
|
||||||
* language level and C library functions, as well as CMake INTERFACE libraries
|
* language level and C library functions, as well as CMake INTERFACE libraries
|
||||||
* abstracting the compilation and link steps in the SDK
|
* abstracting the compilation and link steps in the SDK
|
||||||
* @{
|
* @{
|
||||||
* \defgroup boot_stage2 boot_stage2
|
* \cond boot_stage2 \defgroup boot_stage2 boot_stage2 \endcond
|
||||||
* \defgroup pico_base pico_base
|
* \cond pico_atomic \defgroup pico_atomic pico_atomic \endcond
|
||||||
* \defgroup pico_binary_info pico_binary_info
|
* \cond pico_base_headers \defgroup pico_base pico_base \endcond
|
||||||
* \defgroup pico_bit_ops pico_bit_ops
|
* \cond pico_binary_info \defgroup pico_binary_info pico_binary_info \endcond
|
||||||
* \defgroup pico_bootrom pico_bootrom
|
* \cond pico_bootrom \defgroup pico_bootrom pico_bootrom \endcond
|
||||||
* \defgroup pico_bootsel_via_double_reset pico_bootsel_via_double_reset
|
* \cond pico_bit_ops \defgroup pico_bit_ops pico_bit_ops \endcond
|
||||||
* \defgroup pico_cxx_options pico_cxx_options
|
* \cond pico_cxx_options \defgroup pico_cxx_options pico_cxx_options \endcond
|
||||||
* \defgroup pico_divider pico_divider
|
* \cond pico_clib_interface \defgroup pico_clib_interface pico_clib_interface \endcond
|
||||||
* \defgroup pico_double pico_double
|
* \cond pico_crt0 \defgroup pico_crt0 pico_crt0 \endcond
|
||||||
* \defgroup pico_float pico_float
|
* \cond pico_divider \defgroup pico_divider pico_divider \endcond
|
||||||
* \defgroup pico_int64_ops pico_int64_ops
|
* \cond pico_double \defgroup pico_double pico_double \endcond
|
||||||
* \defgroup pico_malloc pico_malloc
|
* \cond pico_float \defgroup pico_float pico_float \endcond
|
||||||
* \defgroup pico_mem_ops pico_mem_ops
|
* \cond pico_int64_ops \defgroup pico_int64_ops pico_int64_ops \endcond
|
||||||
* \defgroup pico_platform pico_platform
|
* \cond pico_malloc \defgroup pico_malloc pico_malloc \endcond
|
||||||
* \defgroup pico_printf pico_printf
|
* \cond pico_mem_ops \defgroup pico_mem_ops pico_mem_ops \endcond
|
||||||
* \defgroup pico_runtime pico_runtime
|
* \cond pico_platform \defgroup pico_platform pico_platform \endcond
|
||||||
* \defgroup pico_stdio pico_stdio
|
* \cond pico_printf \defgroup pico_printf pico_printf \endcond
|
||||||
* \defgroup pico_standard_link pico_standard_link
|
* \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
|
* \defgroup misc External API Headers
|
||||||
* Headers for interfaces that are shared with code outside of the SDK
|
* Headers for interfaces that are shared with code outside of the SDK
|
||||||
* @{
|
* @{
|
||||||
* \defgroup boot_picoboot boot_picoboot
|
* \cond boot_picobin_headers \defgroup boot_picobin_headers boot_picobin_headers \endcond
|
||||||
* \defgroup boot_uf2 boot_uf2
|
* \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,17 +1,29 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="50mm" height="50mm" viewBox="0 0 141.73228 141.73228">
|
||||||
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="570" height="720">
|
<defs>
|
||||||
<path d="m 158.375,1.65625 c -3.6193,0.1123192 -7.51715,1.4493266 -11.9375,4.9375 C 135.61054,2.4174496 125.11041,0.9665612 115.71875,9.46875 101.22489,7.5879922 96.508461,11.469494 92.9375,16 89.754953,15.934135 69.118652,12.72793 59.65625,26.84375 35.874602,24.030329 28.359472,40.831625 36.875,56.5 c -4.856911,7.518955 -9.889503,14.947226 1.46875,29.28125 -4.018006,7.983514 -1.527431,16.64403 7.9375,27.125 -2.497857,11.2226 2.412077,19.14086 11.21875,25.3125 -1.64709,15.35756 14.083505,24.28743 18.78125,27.46875 1.803677,8.94868 5.56291,17.3927 23.53125,22.0625 2.96323,13.3361 13.76206,15.63906 24.21875,18.4375 -34.561929,20.08954 -64.20067,46.52266 -64,111.375 l -5.0625,9.03125 C 15.337882,350.69604 -20.316547,428.16001 35.4375,491.125 c 3.641871,19.70838 9.749589,33.86396 15.1875,49.53125 8.133834,63.13058 61.21763,92.69161 75.21875,96.1875 20.51653,15.62812 42.36818,30.45672 71.9375,40.84375 27.87515,28.74946 58.07388,39.7064 88.4375,39.6875 0.44515,-2.8e-4 0.89853,0.005 1.34375,0 30.36363,0.0189 60.56235,-10.93804 88.4375,-39.6875 29.56932,-10.38703 51.42097,-25.21563 71.9375,-40.84375 14.00112,-3.49589 67.08492,-33.05692 75.21875,-96.1875 5.43791,-15.66729 11.54562,-29.82287 15.1875,-49.53125 55.75404,-62.96499 20.09961,-140.42896 -19.53125,-164.53125 L 513.75,317.5625 c 0.20067,-64.85234 -29.43807,-91.28546 -64,-111.375 10.45669,-2.79844 21.25552,-5.1014 24.21875,-18.4375 17.96834,-4.6698 21.72758,-13.11382 23.53125,-22.0625 4.69775,-3.18132 20.42834,-12.11119 18.78125,-27.46875 8.80668,-6.17164 13.71661,-14.0899 11.21875,-25.3125 9.46494,-10.48097 11.9555,-19.141487 7.9375,-27.125 C 546.79575,71.447226 541.76316,64.018955 536.90625,56.5 545.42178,40.831625 537.90665,24.030329 514.125,26.84375 504.6626,12.72793 484.0263,15.934135 480.84375,16 477.27279,11.469494 472.55636,7.587992 458.0625,9.46875 448.67084,0.96656132 438.17071,2.41745 427.34375,6.59375 414.48455,-3.5536631 405.97149,4.580454 396.25,7.65625 380.67615,2.568472 377.11698,9.5371578 369.46875,12.375 352.4935,8.7869238 347.33315,16.598532 339.1875,24.84375 l -9.46875,-0.1875 c -25.61054,15.093115 -38.33378,45.825501 -42.84375,61.625 -4.51206,-15.801979 -17.20647,-46.534542 -42.8125,-61.625 l -9.46875,0.1875 C 226.4481,16.598532 221.28775,8.7869235 204.3125,12.375 196.66427,9.5371583 193.1051,2.5684729 177.53125,7.65625 c -6.37973,-2.0184911 -12.24667,-6.2144276 -19.15625,-6 z" style="fill:#000000" />
|
<style>
|
||||||
<path d="m 107.39184,68.055583 c 67.94767,35.031357 107.44689,63.368967 129.08717,87.504467 -11.08235,44.41759 -68.89638,46.44464 -90.03559,45.19858 4.32842,-2.01474 7.93988,-4.42778 9.22051,-8.13574 -5.30449,-3.76981 -24.11289,-0.39719 -37.24363,-7.77416 5.04407,-1.04499 7.40348,-2.06302 9.76289,-5.78542 -12.40571,-3.9567 -25.76862,-7.36642 -33.627746,-13.92116 4.241253,0.0524 8.201156,0.9488 13.740366,-2.89271 -11.111694,-5.98819 -22.969108,-10.73351 -32.18139,-19.88738 5.745213,-0.14063 11.939452,-0.0568 13.740371,-2.16953 -10.17044,-6.30068 -18.751242,-13.30787 -25.853592,-20.97215 8.039979,0.97052 11.435284,0.13478 13.378782,-1.26556 -7.687795,-7.87419 -17.417559,-14.52319 -22.056911,-24.22644 5.969606,2.057484 11.431249,2.84506 15.36752,-0.180795 -2.612365,-5.893453 -13.805413,-9.369618 -20.248967,-23.141676 6.284359,0.609377 12.949606,1.371108 14.282753,0 C 61.802068,58.517346 56.796919,51.835885 51.887978,44.913906 65.338021,44.714177 85.715734,44.966253 84.792549,43.82914 l -8.31654,-8.497335 c 13.137617,-3.537241 26.580651,0.568164 36.339661,3.615887 4.38186,-3.457681 -0.0776,-7.82998 -5.42383,-12.294015 11.16496,1.490646 21.25382,4.057389 30.37345,7.593362 4.87238,-4.399329 -3.16389,-8.798658 -7.05098,-13.197987 17.24936,3.272568 24.55716,7.87068 31.81981,12.47481 5.26935,-5.050799 0.30166,-9.343299 -3.2543,-13.740371 13.00566,4.817048 19.70478,11.035551 26.75756,17.175463 2.39119,-3.227053 6.07494,-5.592408 1.62715,-13.378781 9.23416,5.322725 16.18926,11.59506 21.33374,18.621817 5.71336,-3.637941 3.40387,-8.613023 3.43509,-13.197987 9.59665,7.806516 15.68687,16.11395 23.14168,24.226443 1.50169,-1.093437 2.81661,-4.80171 3.97747,-10.666867 22.89539,22.211815 55.24591,78.158241 8.31654,100.340861 C 207.95028,109.95728 160.25292,86.016909 107.39184,68.055583 z" style="fill:#75a928" />
|
.cls-1 {
|
||||||
<path d="M 467.92487,68.055583 C 399.9772,103.08694 360.47798,131.42455 338.8377,155.56005 c 11.08235,44.41759 68.89638,46.44464 90.03559,45.19858 -4.32842,-2.01474 -7.93988,-4.42778 -9.22051,-8.13574 5.30449,-3.76981 24.11289,-0.39719 37.24363,-7.77416 -5.04407,-1.04499 -7.40348,-2.06302 -9.76289,-5.78542 12.40571,-3.9567 25.76862,-7.36642 33.62775,-13.92116 -4.24126,0.0524 -8.20116,0.9488 -13.74037,-2.89271 11.11169,-5.98819 22.96911,-10.73351 32.18139,-19.88738 -5.74521,-0.14063 -11.93945,-0.0568 -13.74037,-2.16953 10.17044,-6.30068 18.75124,-13.30787 25.85359,-20.97215 -8.03998,0.97052 -11.43528,0.13478 -13.37878,-1.26556 7.68779,-7.87419 17.41756,-14.52319 22.05691,-24.22644 -5.96961,2.057484 -11.43125,2.84506 -15.36752,-0.180795 2.61237,-5.893453 13.80541,-9.369618 20.24897,-23.141676 -6.28436,0.609377 -12.94961,1.371108 -14.28276,0 2.92231,-11.888563 7.92746,-18.570024 12.8364,-25.492003 -13.45004,-0.199729 -33.82775,0.05235 -32.90457,-1.084766 l 8.31654,-8.497335 c -13.13762,-3.537241 -26.58065,0.568164 -36.33966,3.615887 -4.38186,-3.457681 0.0776,-7.82998 5.42383,-12.294015 -11.16496,1.490646 -21.25382,4.057389 -30.37345,7.593362 -4.87238,-4.399329 3.16389,-8.798658 7.05098,-13.197987 -17.24936,3.272568 -24.55716,7.87068 -31.81981,12.47481 -5.26935,-5.050799 -0.30166,-9.343299 3.2543,-13.740371 -13.00566,4.817048 -19.70478,11.035551 -26.75756,17.175463 -2.39119,-3.227053 -6.07494,-5.592408 -1.62715,-13.378781 -9.23416,5.322725 -16.18926,11.59506 -21.33374,18.621817 -5.71336,-3.637941 -3.40387,-8.613023 -3.43509,-13.197987 -9.59665,7.806516 -15.68687,16.11395 -23.14168,24.226443 -1.50169,-1.093437 -2.81661,-4.80171 -3.97747,-10.666867 -22.89539,22.211815 -55.24591,78.158241 -8.31654,100.340861 39.91877,-32.94716 87.61613,-56.887531 140.47721,-74.848857 z" style="fill:#75a928" />
|
fill: #46af4b;
|
||||||
<path d="m 365.2046,521.84937 a 71.956154,66.532318 0 1 1 -143.91231,0 71.956154,66.532318 0 1 1 143.91231,0 z" transform="matrix(1.131107,0,0,1.1280497,-43.139135,-68.310983)" style="fill:#bc1142" />
|
}
|
||||||
<path d="m 262.84091,276.64774 a 61.875,28.125 0 1 1 -123.75,0 61.875,28.125 0 1 1 123.75,0 z" transform="matrix(0.76741684,-1.1613112,2.171115,1.4224368,-560.88858,217.68859)" style="fill:#bc1142" />
|
|
||||||
<path d="m 262.84091,276.64774 a 61.875,28.125 0 1 1 -123.75,0 61.875,28.125 0 1 1 123.75,0 z" transform="matrix(-0.76741684,-1.1613112,-2.171115,1.4224368,1134.8288,213.68859)" style="fill:#bc1142" />
|
.cls-2 {
|
||||||
<path d="M 72.910253,342.0878 C 109.32447,332.33088 85.201845,492.72431 55.576871,479.56357 22.990103,453.35089 12.493801,376.58814 72.910253,342.0878 z" style="fill:#bc1142" />
|
fill: #cd2355;
|
||||||
<path d="m 493.67828,340.0878 c -36.41422,-9.75692 -12.2916,150.63651 17.33338,137.47577 32.58677,-26.21268 43.08307,-102.97543 -17.33338,-137.47577 z" style="fill:#bc1142" />
|
}
|
||||||
<path d="m 369.97158,220.6534 c 62.83486,-10.61013 115.11594,26.72229 113.01138,94.85796 -2.06693,26.12112 -136.15872,-90.96907 -113.01138,-94.85796 z" style="fill:#bc1142" />
|
</style>
|
||||||
<path d="M 196.35975,218.6534 C 133.52489,208.04327 81.24381,245.37569 83.34837,313.51136 85.4153,339.63248 219.50709,222.54229 196.35975,218.6534 z" style="fill:#bc1142" />
|
</defs>
|
||||||
<path d="m 286.61932,202.75568 c -37.50259,-0.97548 -73.49548,27.83418 -73.58158,44.54443 -0.10462,20.30426 29.6512,41.09266 73.83726,41.62035 45.12305,0.32321 73.91561,-16.64049 74.0611,-37.59409 0.16484,-23.73996 -41.03879,-48.93744 -74.31678,-48.57069 z" style="fill:#bc1142" />
|
<g>
|
||||||
<path d="m 288.90937,619.11675 c 32.69744,-1.42711 76.57083,10.53196 76.6568,26.39598 0.5427,15.4052 -39.78969,50.21055 -78.82634,49.53765 -40.42729,1.74391 -80.06908,-33.11559 -79.54951,-45.19859 -0.60506,-17.71593 49.226,-31.54796 81.71905,-30.73504 z" style="fill:#bc1142" />
|
<path d="M120.397,80.45865c-.56815-5.90742-3.22385-11.16309-6.995-13.93267a17.27379,17.27379,0,0,0-3.24656-6.31353,19.36966,19.36966,0,0,0-6.892-13.02018,7.27722,7.27722,0,0,0,1.59572-1.944c4.57759-2.04455,7.80508-6.33776,8.1794-9.53072a12.5259,12.5259,0,0,0,3.95675-8.20484,7.846,7.846,0,0,0-.69989-3.69357,7.01847,7.01847,0,0,0,1.82922-7.2442c-1.36677-3.95887-6.15514-6.52856-12.58679-6.80113A10.13626,10.13626,0,0,0,98.52937,7.374a16.203,16.203,0,0,0-3.78352.46578,8.61261,8.61261,0,0,0-3.719-.75319,14.555,14.555,0,0,0-7.0952,1.934,6.5202,6.5202,0,0,0-.85646-.05542c-3.193-.0003-6.38471,2.19991-8.00284,3.51125a24.2642,24.2642,0,0,0-4.2063,4.38226,24.27017,24.27017,0,0,0-4.206-4.38195c-1.61814-1.31135-4.80988-3.51126-8.00254-3.51156a6.525,6.525,0,0,0-.85677.05542,14.55806,14.55806,0,0,0-7.09489-1.934,8.614,8.614,0,0,0-3.71931.75319A16.201,16.201,0,0,0,43.203,7.374a10.13676,10.13676,0,0,0-7.00858,2.39979c-6.432.27257-11.22033,2.84226-12.5871,6.80143a7.018,7.018,0,0,0,1.82922,7.2439A7.84794,7.84794,0,0,0,24.737,27.513a12.52529,12.52529,0,0,0,3.95675,8.20454c.37432,3.19326,3.60181,7.48617,8.1794,9.53072a7.27538,7.27538,0,0,0,1.59542,1.944,19.37028,19.37028,0,0,0-6.89168,13.02018A17.27118,17.27118,0,0,0,28.33031,66.526c-3.77111,2.76958-6.42681,8.02525-6.99495,13.93236-.56482,5.87168,1.046,11.35328,4.32471,14.82547a20.99222,20.99222,0,0,0,3.56516,8.18667,21.30368,21.30368,0,0,0,5.378,12.42629,22.01533,22.01533,0,0,0,11.859,7.04734,28.71359,28.71359,0,0,0,9.48469,5.87137A20.881,20.881,0,0,0,70.866,134.64567a20.8833,20.8833,0,0,0,14.91936-5.83019,28.72034,28.72034,0,0,0,9.48469-5.87137,22.01559,22.01559,0,0,0,11.85873-7.04734,21.3036,21.3036,0,0,0,5.378-12.426,20.98659,20.98659,0,0,0,3.56517-8.187C119.35068,91.81162,120.96155,86.33,120.397,80.45865Z"/>
|
||||||
<path d="m 168.13874,525.10369 c 23.2791,28.04573 33.89066,77.31899 14.46355,91.84353 -18.37917,11.08784 -63.01228,6.52162 -94.736237,-39.05157 -21.395052,-38.24168 -18.637584,-77.15663 -3.615887,-88.58924 22.464424,-13.68429 57.173424,4.79902 83.888574,35.79728 z" style="fill:#bc1142" />
|
<path class="cls-1" d="M82.88834,15.64565a.50715.50715,0,0,1,.64431.53875c-.16085,1.517.75688,1.32594.97375,1.05634,2.38917-2.97065,4.91974-3.64653,7.18552-3.447a.5073.5073,0,0,1,.347.81808c-.90026,1.33535.06917,1.58923.42806,1.34935,3.67706-2.299,7.18462-2.30316,8.53087-1.33751a.50652.50652,0,0,1,.03017.78741c-1.36075,1.15928-.599,1.73636-.11843,1.56042,3.73308-1.31743,8.88679-.15193,10.68462,1.36809a.511.511,0,0,1,.01278.77323,10.12618,10.12618,0,0,0-3.89825,6.80014c-.10141.89409,1.38228.706,2.00839.54492a.50694.50694,0,0,1,.63161.47341c.05646,2.14911-1.97606,4.51144-5.00017,6.53158-.405.27055-.34746.91972.57694.94363a.50088.50088,0,0,1,.43014.75445c-1.0784,2.00172-2.545,3.88636-7.54009,5.18055a.51181.51181,0,0,0-.07052.96565.48972.48972,0,0,1,.15941.86532c-4.97342,4.27273-17.58014,2.58829-19.18036-4.603a.50477.50477,0,0,1,.09069-.4114A47.92158,47.92158,0,0,1,100.721,21.25148a.3975.3975,0,0,0-.19687-.76539,34.186,34.186,0,0,0-22.704,13.68742.512.512,0,0,1-.65061.14752C69.08866,30.14885,75.72444,17.82948,82.88834,15.64565Z"/>
|
||||||
<path d="m 405.0209,516.21177 c -25.18682,29.50165 -39.21227,83.30951 -20.83785,100.6428 17.56828,13.46361 64.7292,11.58162 99.56566,-36.75574 25.29599,-32.46471 16.82013,-86.68225 2.37077,-101.07511 -21.46408,-16.60213 -52.27691,4.64489 -81.09858,37.18805 z" style="fill:#bc1142" />
|
<path class="cls-1" d="M35.37668,35.161a.50084.50084,0,0,1,.43005-.75445c.92449-.02391.982-.67308.57694-.94363-3.02411-2.02014-5.05663-4.38247-5.00007-6.53158a.5069.5069,0,0,1,.6316-.47341c.626.16108,2.10971.34917,2.0083-.54492a10.126,10.126,0,0,0-3.89816-6.80014.51094.51094,0,0,1,.0127-.77323c1.79782-1.52,6.95154-2.68552,10.6847-1.36809.48048.17594,1.24223-.40114-.11843-1.56042a.50652.50652,0,0,1,.03008-.78741c1.34634-.96565,4.85381-.96146,8.53087,1.33751.3589.23988,1.32833-.014.42815-1.34935a.5073.5073,0,0,1,.34692-.81808c2.26588-.19954,4.79644.47634,7.18561,3.447.21678.2696,1.13461.46062.97375-1.05634a.50711.50711,0,0,1,.64422-.53875c7.164,2.18383,13.79977,14.5032,5.71877,18.67538a.512.512,0,0,1-.65061-.14752A34.18579,34.18579,0,0,0,41.20821,20.48609a.3975.3975,0,0,0-.19688.76539,47.92145,47.92145,0,0,1,20.90622,15.9066.50472.50472,0,0,1,.0906.4114c-1.60022,7.19128-14.20694,8.87572-19.18035,4.603a.48975.48975,0,0,1,.15941-.86532.51183.51183,0,0,0-.07043-.96565C37.92166,39.04731,36.455,37.16267,35.37668,35.161Z"/>
|
||||||
|
<path class="cls-2" d="M102.70391,57.14512c2.07215,5.51262.45788,8.1631-4.45781,5.35681a35.23186,35.23186,0,0,1-10.324-8.6538c-3.70264-4.39923-1.29618-6.3588,4.53643-5.30214A15.74307,15.74307,0,0,1,102.70391,57.14512Z"/>
|
||||||
|
<path class="cls-2" d="M80.656,50.9434c7.02971,5.84278-1.02445,9.97893-9.78984,9.97893s-16.81947-4.13615-9.78976-9.97893a15.62992,15.62992,0,0,1,19.5796,0Z"/>
|
||||||
|
<path class="cls-2" d="M39.02843,57.14512A15.74294,15.74294,0,0,1,49.27372,48.546c5.83261-1.05666,8.23916.90291,4.53644,5.30214a35.232,35.232,0,0,1-10.324,8.6538C38.57056,65.30822,36.95628,62.65774,39.02843,57.14512Z"/>
|
||||||
|
<path class="cls-2" d="M28.86006,87.77634a15.73764,15.73764,0,0,1,1.16828-13.39206c2.59721-4.419,5.21118-4.2431,6.24869-.49944a23.47909,23.47909,0,0,1-1.35309,15.47529C33.00057,93.18313,30.595,91.89119,28.86006,87.77634Z"/>
|
||||||
|
<path class="cls-2" d="M47.58848,116.39963A15.64491,15.64491,0,0,1,35.82,102.43657C36.79507,79.749,69.49268,120.26554,47.58848,116.39963Z"/>
|
||||||
|
<path class="cls-2" d="M48.254,88.14263c-5.48323-3.16572-6.9343-10.91794-3.24093-17.31507s11.13243-9.01664,16.61566-5.85087c5.48323,3.16572,6.9343,10.918,3.24094,17.31507S53.73709,91.3084,48.254,88.14263Z"/>
|
||||||
|
<path class="cls-2" d="M80.0159,125.05829a15.6584,15.6584,0,0,1-18.29955,0c-5.43318-3.75194.03278-8.06894,9.14978-8.06894S85.44917,121.30635,80.0159,125.05829Z"/>
|
||||||
|
<ellipse class="cls-2" cx="70.86613" cy="100.39562" rx="12.72753" ry="10.90937"/>
|
||||||
|
<path class="cls-2" d="M76.86255,82.29176c-3.69336-6.39709-2.24229-14.14935,3.24094-17.31507,5.48323-3.16577,12.9223-.54622,16.61567,5.85087s2.24229,14.14935-3.24094,17.31507C87.99516,91.3084,80.55592,88.68885,76.86255,82.29176Z"/>
|
||||||
|
<path class="cls-2" d="M94.14377,116.39963c-21.9042,3.86591,10.79341-36.65066,11.7686-13.96306A15.64488,15.64488,0,0,1,94.14377,116.39963Z"/>
|
||||||
|
<path class="cls-2" d="M112.87229,87.77634c-1.73505,4.11485-4.14061,5.40679-6.064,1.58379a23.47913,23.47913,0,0,1-1.353-15.47529c1.03742-3.74366,3.65139-3.9196,6.2486.49944A15.73769,15.73769,0,0,1,112.87229,87.77634Z"/>
|
||||||
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 6.1 KiB |
|
@ -1,31 +1,28 @@
|
||||||
# Raspberry Pi Pico SDK
|
# 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 the RP2040 based devices such as the Raspberry Pi Pico 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.
|
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 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, 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.
|
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
|
## 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.
|
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.
|
||||||
|
|
||||||
## The Build System
|
## The Build System
|
||||||
|
|
||||||
The SDK uses CMake to manage the build. CMake is widely supported by IDEs (Integrated Development Environments), and allows a simple specification of the build (via CMakeLists.txt files), from which CMake can generate a build system (for use by `make`, `ninja` or other build tools) customized for the platform and by any configuration variables the developer chooses for a list of configuration variables).
|
The SDK uses CMake to manage the build. CMake is widely supported by IDEs (Integrated Development Environments), and allows a simple specification of the build (via `CMakeLists.txt` files), from which CMake can generate a build system (for use by `make`, `ninja` or other build tools) customized for the platform and by any configuration variables the developer chooses.
|
||||||
|
|
||||||
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.
|
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
|
## 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 Ltd and licensed under the [3-Clause BSD](https://opensource.org/licenses/BSD-3-Clause) license.
|
||||||
This SDK contains a number of example code fragments. An index of these examples can be found [here](@ref examples_page)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,22 @@ The full documentation for the RP2040 and Raspberry Pi Pico board can be found a
|
||||||
|
|
||||||
- [RP2040 Datasheet](https://rptl.io/rp2040-datasheet)
|
- [RP2040 Datasheet](https://rptl.io/rp2040-datasheet)
|
||||||
- [Raspberry Pi Pico Datasheet](https://rptl.io/pico-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 C/C++ SDK](https://rptl.io/pico-c-sdk)
|
||||||
- [Raspberry Pi Pico Python SDK](https://rptl.io/pico-micropython)
|
- [Raspberry Pi Pico Python SDK](https://rptl.io/pico-micropython)
|
||||||
- [Getting started with Raspberry Pi Pico](https://rptl.io/pico-get-started)
|
- [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
|
### Weblinks
|
||||||
|
|
||||||
At Raspberry Pi we have a very community-based attitude to help. We run a very popular and busy forum where you can ask questions about any aspect of the Raspberry Pi ecosystem, including the Raspberry Pi Pico.
|
At Raspberry Pi we have a very community-based attitude to help. We run a very popular and busy forum where you can ask questions about any aspect of the Raspberry Pi ecosystem, including the Raspberry Pi Pico.
|
||||||
|
|
||||||
You can find our forums at the [following link](https://www.raspberrypi.org/forums).
|
You can find our forums at the [following link](https://forums.raspberrypi.com/).
|
||||||
|
|
||||||
For the main Raspberry Pi website, [see here](https://www.raspberrypi.org)
|
For the main Raspberry Pi website, [see here](https://www.raspberrypi.com)
|
||||||
|
|
||||||
For the Raspberry Pi Pico page, [see here](https://rptl.io/rp2040-get-started)
|
For the Raspberry Pi Pico page, [see here](https://rptl.io/rp2040-get-started)
|
||||||
|
|
||||||
|
|
24
external/pico_sdk_import.cmake
vendored
24
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}')")
|
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||||
endif ()
|
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_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 "${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_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 (NOT PICO_SDK_PATH)
|
||||||
if (PICO_SDK_FETCH_FROM_GIT)
|
if (PICO_SDK_FETCH_FROM_GIT)
|
||||||
|
@ -29,11 +40,22 @@ if (NOT PICO_SDK_PATH)
|
||||||
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
||||||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||||
endif ()
|
endif ()
|
||||||
|
# GIT_SUBMODULES_RECURSE was added in 3.17
|
||||||
|
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
pico_sdk
|
pico_sdk
|
||||||
GIT_REPOSITORY https://github.com/raspberrypi/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 ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (NOT pico_sdk)
|
if (NOT pico_sdk)
|
||||||
message("Downloading Raspberry Pi Pico SDK")
|
message("Downloading Raspberry Pi Pico SDK")
|
||||||
FetchContent_Populate(pico_sdk)
|
FetchContent_Populate(pico_sdk)
|
||||||
|
|
1
lib/btstack
Submodule
1
lib/btstack
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 2b49e57bd1fae85ac32ac1f41cdb7c794de335f6
|
1
lib/cyw43-driver
Submodule
1
lib/cyw43-driver
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit cf924bb04c8984675ca0fc2178f082e404e048c3
|
1
lib/lwip
Submodule
1
lib/lwip
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 0a0452b2c39bdd91e252aef045c115f88f6ca773
|
1
lib/mbedtls
Submodule
1
lib/mbedtls
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 5a764e5555c64337ed17444410269ff21cb617b1
|
|
@ -1 +1 @@
|
||||||
Subproject commit 11c23f88bf42f64ce14b8a7b0b2a4e207dc4dd12
|
Subproject commit 5217cee5de4cd555018da90f9f1bcc87fb1c1d3a
|
|
@ -1,12 +1,14 @@
|
||||||
# Initialize the Raspberry Pi Pico SDK
|
# Pre-initialize the Raspberry Pi Pico SDK, setting up the platform and toolchain and some CMake utility functions
|
||||||
# This file must be included prior to the project() call
|
# This file must be included prior to the project() call
|
||||||
|
|
||||||
if (_PICO_SDK_INIT)
|
# Note: this file is perhaps named badly, as it provides a method pico_sdk_init which
|
||||||
return()
|
# the enclosing project calls LATER to actually "initialize" the SDK (by including the CMakeLists.txt from this
|
||||||
endif ()
|
# same directory)
|
||||||
set(_PICO_SDK_INIT 1)
|
|
||||||
|
|
||||||
function(pico_is_top_level_project VAR)
|
if (NOT TARGET _pico_sdk_pre_init_marker)
|
||||||
|
add_library(_pico_sdk_pre_init_marker INTERFACE)
|
||||||
|
|
||||||
|
function(pico_is_top_level_project VAR)
|
||||||
string(TOLOWER ${CMAKE_CURRENT_LIST_DIR} __list_dir)
|
string(TOLOWER ${CMAKE_CURRENT_LIST_DIR} __list_dir)
|
||||||
string(TOLOWER ${CMAKE_SOURCE_DIR} __source_dir)
|
string(TOLOWER ${CMAKE_SOURCE_DIR} __source_dir)
|
||||||
if (__source_dir STREQUAL __list_dir)
|
if (__source_dir STREQUAL __list_dir)
|
||||||
|
@ -14,41 +16,78 @@ function(pico_is_top_level_project VAR)
|
||||||
else()
|
else()
|
||||||
set(${VAR} 0 PARENT_SCOPE)
|
set(${VAR} 0 PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if (NOT PICO_SDK_PATH)
|
function(pico_message_debug MESSAGE)
|
||||||
|
# The log-level system was added in CMake 3.15.
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS "3.15.0")
|
||||||
|
message(${MESSAGE})
|
||||||
|
else()
|
||||||
|
message(DEBUG ${MESSAGE})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if (NOT PICO_SDK_PATH)
|
||||||
set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR})
|
set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||||
|
|
||||||
set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${PICO_SDK_PATH}/cmake)
|
list(APPEND CMAKE_MODULE_PATH ${PICO_SDK_PATH}/cmake)
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_version.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_version.cmake)
|
||||||
include(pico_utils)
|
include(pico_utils)
|
||||||
|
|
||||||
message("PICO_SDK_PATH is ${CMAKE_CURRENT_LIST_DIR}")
|
message("PICO_SDK_PATH is ${CMAKE_CURRENT_LIST_DIR}")
|
||||||
|
macro(pico_sdk_init)
|
||||||
include(pico_pre_load_platform)
|
|
||||||
|
|
||||||
# todo perhaps this should be included by the platform instead?
|
|
||||||
# We want to configure correct toolchain prior to project load
|
|
||||||
include(pico_pre_load_toolchain)
|
|
||||||
|
|
||||||
macro(pico_sdk_init)
|
|
||||||
if (NOT CMAKE_PROJECT_NAME)
|
if (NOT CMAKE_PROJECT_NAME)
|
||||||
message(WARNING "pico_sdk_init() should be called after the project is created (and languages added)")
|
message(WARNING "pico_sdk_init() should be called after the project is created (and languages added)")
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(${PICO_SDK_PATH} pico-sdk)
|
add_subdirectory(${PICO_SDK_PATH} pico-sdk)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(add_sub_list_dirs var)
|
macro(add_sub_list_dirs var)
|
||||||
foreach(LIST_DIR IN LISTS ${var})
|
foreach(LIST_DIR IN LISTS ${var})
|
||||||
get_filename_component(SHORT_NAME "${LIST_DIR}" NAME)
|
get_filename_component(SHORT_NAME "${LIST_DIR}" NAME)
|
||||||
message("Including custom CMakeLists.txt ${SHORT_NAME}")
|
pico_message_debug("Including custom CMakeLists.txt ${SHORT_NAME}")
|
||||||
add_subdirectory(${LIST_DIR} ${SHORT_NAME})
|
add_subdirectory(${LIST_DIR} ${SHORT_NAME})
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
macro(add_sub_list_files var)
|
||||||
|
foreach(LIST_FILE IN LISTS ${var})
|
||||||
|
pico_message_debug("Including custom CMake file ${LIST_FILE}")
|
||||||
|
include(${LIST_FILE})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(pico_register_common_scope_var NAME)
|
||||||
|
if (NOT ${NAME} IN_LIST PICO_PROMOTE_COMMON_SCOPE_VARS)
|
||||||
|
list(APPEND PICO_PROMOTE_COMMON_SCOPE_VARS ${NAME})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
set(PICO_PROMOTE_COMMON_SCOPE_VARS
|
||||||
|
PICO_INCLUDE_DIRS
|
||||||
|
PICO_SDK_POST_LIST_DIRS
|
||||||
|
PICO_SDK_POST_LIST_FILES
|
||||||
|
PICO_CONFIG_HEADER_FILES
|
||||||
|
PICO_RP2040_CONFIG_HEADER_FILES
|
||||||
|
PICO_BOARD_CMAKE_OVERRIDES
|
||||||
|
)
|
||||||
|
|
||||||
|
macro(pico_promote_common_scope_vars)
|
||||||
|
set(PICO_PROMOTE_COMMON_SCOPE_VARS ${PICO_PROMOTE_COMMON_SCOPE_VARS} PARENT_SCOPE)
|
||||||
|
foreach(VAR IN LISTS PICO_PROMOTE_COMMON_SCOPE_VARS)
|
||||||
|
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_BUILD_DEFINE: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, default=Current SDK major version, group=pico_base
|
||||||
# PICO_CONFIG: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, 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 1)
|
set(PICO_SDK_VERSION_MAJOR 2)
|
||||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, group=pico_base
|
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, default=Current SDK minor version, group=pico_base
|
||||||
# PICO_CONFIG: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, 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)
|
set(PICO_SDK_VERSION_MINOR 1)
|
||||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, group=pico_base
|
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, default=Current SDK revision, group=pico_base
|
||||||
# PICO_CONFIG: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, 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 2)
|
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_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_CONFIG: PICO_SDK_VERSION_PRE_RELEASE_ID, optional SDK pre-release version 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)
|
#set(PICO_SDK_VERSION_PRE_RELEASE_ID develop)
|
||||||
|
|
||||||
# PICO_BUILD_DEFINE: 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_CONFIG: PICO_SDK_VERSION_STRING, SDK version, type=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}")
|
set(PICO_SDK_VERSION_STRING "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}")
|
||||||
|
|
||||||
if (PICO_SDK_VERSION_PRE_RELEASE_ID)
|
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
|
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_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)
|
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 ()
|
endif ()
|
||||||
|
|
||||||
if (NOT EXISTS "${PICO_PLATFORM_CMAKE_FILE}")
|
if (NOT EXISTS "${PICO_PLATFORM_CMAKE_FILE}")
|
||||||
|
@ -11,79 +17,187 @@ if (NOT EXISTS "${PICO_PLATFORM_CMAKE_FILE}")
|
||||||
Either specify a valid PICO_PLATFORM (or PICO_PLATFORM_CMAKE_FILE).")
|
Either specify a valid PICO_PLATFORM (or PICO_PLATFORM_CMAKE_FILE).")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/board_setup.cmake)
|
# call add_subdirectory(subdir) unless SKIP_SUBDIR evaluates to true
|
||||||
|
# second argument is optional path
|
||||||
# todo add option to disable skip flag
|
|
||||||
function(pico_add_subdirectory subdir)
|
function(pico_add_subdirectory subdir)
|
||||||
|
# todo add option to disable skip flag
|
||||||
string(TOUPPER ${subdir} subdir_upper)
|
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})
|
set(replace_flag SKIP_${subdir_upper})
|
||||||
if (NOT ${replace_flag})
|
if (NOT ${replace_flag})
|
||||||
|
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})
|
add_subdirectory(${subdir})
|
||||||
else ()
|
# todo make this optional?
|
||||||
|
pico_add_doxygen(${subdir})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
message("Not including ${subdir} because ${replace_flag} defined.")
|
message("Not including ${subdir} because ${replace_flag} defined.")
|
||||||
endif ()
|
endif ()
|
||||||
|
pico_promote_common_scope_vars()
|
||||||
endfunction()
|
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)
|
function(pico_wrap_function TARGET FUNCNAME)
|
||||||
target_link_options(${TARGET} INTERFACE "LINKER:--wrap=${FUNCNAME}")
|
target_link_options(${TARGET} INTERFACE "LINKER:--wrap=${FUNCNAME}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# add map file generation for the given target
|
||||||
function(pico_add_map_output TARGET)
|
function(pico_add_map_output TARGET)
|
||||||
|
pico_get_runtime_output_directory(${TARGET} output_path)
|
||||||
get_target_property(target_type ${TARGET} TYPE)
|
get_target_property(target_type ${TARGET} TYPE)
|
||||||
if ("EXECUTABLE" STREQUAL "${target_type}")
|
if ("EXECUTABLE" STREQUAL "${target_type}")
|
||||||
target_link_options(${TARGET} PRIVATE "LINKER:-Map=$<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 ()
|
else ()
|
||||||
target_link_options(${TARGET} INTERFACE "LINKER:-Map=$<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 ()
|
endif ()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# 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)
|
macro(pico_simple_hardware_target NAME)
|
||||||
pico_simple_hardware_headers_target(${NAME})
|
pico_simple_hardware_headers_target(${NAME})
|
||||||
pico_simple_hardware_impl_target(${NAME})
|
pico_simple_hardware_impl_target(${NAME})
|
||||||
endmacro()
|
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)
|
||||||
|
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,
|
||||||
|
# and add include/ relative to the calling directory to the includes.
|
||||||
|
# and hardware_structs and hardware_claim as dependencies of the library
|
||||||
macro(pico_simple_hardware_headers_target NAME)
|
macro(pico_simple_hardware_headers_target NAME)
|
||||||
if (NOT TARGET hardware_${NAME}_headers)
|
if (NOT TARGET hardware_${NAME}_headers)
|
||||||
add_library(hardware_${NAME}_headers INTERFACE)
|
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)
|
target_link_libraries(hardware_${NAME}_headers INTERFACE pico_base_headers)
|
||||||
if (NOT PICO_NO_HARDWARE)
|
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()
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# create an INTERFACE library named hardware_NAME if it doesn't exist, along with a hardware_NAME_headers
|
||||||
|
# INTERFACE library that it depends on. The hardware_NAME_headers library add include/ relative to
|
||||||
|
# and pico_base_headers, and harddware_structs as a dependency of the library
|
||||||
macro(pico_simple_hardware_headers_only_target NAME)
|
macro(pico_simple_hardware_headers_only_target NAME)
|
||||||
if (NOT TARGET hardware_${NAME})
|
if (NOT TARGET hardware_${NAME})
|
||||||
add_library(hardware_${NAME} INTERFACE)
|
# Choosing not to add LIB_HARDWARE_ defines to avoid command line bloat pending a need (they aren't
|
||||||
|
# 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}_headers INTERFACE)
|
||||||
|
|
||||||
target_include_directories(hardware_${NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
# a headers only target should still have an explicit _headers library for consistency
|
||||||
target_link_libraries(hardware_${NAME} INTERFACE pico_base_headers)
|
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)
|
if (NOT PICO_NO_HARDWARE)
|
||||||
target_link_libraries(hardware_${NAME} INTERFACE hardware_structs)
|
target_link_libraries(hardware_${NAME}_headers INTERFACE hardware_structs)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_library(hardware_${NAME} INTERFACE)
|
||||||
|
target_link_libraries(hardware_${NAME} INTERFACE hardware_${NAME}_headers)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# create an INTERFACE library named hardware_NAME if it doesn't exist, dependent on a pre-existing hardware_NAME_headers
|
||||||
|
# INTERFACE library and pico_platform. The file NAME.c relative to the caller is added to the C sources for the hardware_NAME
|
||||||
macro(pico_simple_hardware_impl_target NAME)
|
macro(pico_simple_hardware_impl_target NAME)
|
||||||
if (NOT TARGET hardware_${NAME})
|
if (NOT TARGET hardware_${NAME})
|
||||||
|
# Choosing not to add LIB_HARDWARE_ defines to avoid command line bloat pending a need (they aren't
|
||||||
|
# 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} INTERFACE)
|
||||||
|
|
||||||
target_sources(hardware_${NAME} INTERFACE
|
target_sources(hardware_${NAME} INTERFACE
|
||||||
${CMAKE_CURRENT_LIST_DIR}/${NAME}.c
|
${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()
|
endif()
|
||||||
endmacro()
|
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)
|
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()
|
endfunction()
|
||||||
|
|
||||||
function(pico_add_doxygen_exclude SOURCE_DIR)
|
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()
|
endfunction()
|
||||||
|
|
||||||
include(${PICO_PLATFORM_CMAKE_FILE})
|
include(${PICO_PLATFORM_CMAKE_FILE})
|
||||||
|
|
||||||
|
pico_promote_common_scope_vars()
|
|
@ -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=rp2040, 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,12 +9,19 @@
|
||||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||||
// -----------------------------------------------------
|
// -----------------------------------------------------
|
||||||
|
|
||||||
|
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||||
|
|
||||||
#ifndef _BOARDS_ADAFRUIT_FEATHER_RP2040_H
|
#ifndef _BOARDS_ADAFRUIT_FEATHER_RP2040_H
|
||||||
#define _BOARDS_ADAFRUIT_FEATHER_RP2040_H
|
#define _BOARDS_ADAFRUIT_FEATHER_RP2040_H
|
||||||
|
|
||||||
// For board detection
|
// For board detection
|
||||||
#define ADAFRUIT_FEATHER_RP2040
|
#define ADAFRUIT_FEATHER_RP2040
|
||||||
|
|
||||||
|
// 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 -------------//
|
//------------- UART -------------//
|
||||||
#ifndef PICO_DEFAULT_UART
|
#ifndef PICO_DEFAULT_UART
|
||||||
#define PICO_DEFAULT_UART 0
|
#define PICO_DEFAULT_UART 0
|
||||||
|
@ -39,7 +46,7 @@
|
||||||
|
|
||||||
//------------- I2C -------------//
|
//------------- I2C -------------//
|
||||||
#ifndef PICO_DEFAULT_I2C
|
#ifndef PICO_DEFAULT_I2C
|
||||||
#define PICO_DEFAULT_I2C 0
|
#define PICO_DEFAULT_I2C 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||||
|
@ -76,17 +83,13 @@
|
||||||
#define PICO_FLASH_SPI_CLKDIV 4
|
#define PICO_FLASH_SPI_CLKDIV 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
|
||||||
#ifndef PICO_FLASH_SIZE_BYTES
|
#ifndef PICO_FLASH_SIZE_BYTES
|
||||||
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
|
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// All boards have B1 RP2040
|
// All boards have B1 RP2040
|
||||||
#ifndef PICO_FLOAT_SUPPORT_ROM_V1
|
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||||
#define PICO_FLOAT_SUPPORT_ROM_V1 0
|
#define PICO_RP2040_B0_SUPPORTED 0
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_DOUBLE_SUPPORT_ROM_V1
|
|
||||||
#define PICO_DOUBLE_SUPPORT_ROM_V1 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
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,12 +9,19 @@
|
||||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||||
// -----------------------------------------------------
|
// -----------------------------------------------------
|
||||||
|
|
||||||
|
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||||
|
|
||||||
#ifndef _BOARDS_ADAFRUIT_ITSYBITSY_RP2040_H
|
#ifndef _BOARDS_ADAFRUIT_ITSYBITSY_RP2040_H
|
||||||
#define _BOARDS_ADAFRUIT_ITSYBITSY_RP2040_H
|
#define _BOARDS_ADAFRUIT_ITSYBITSY_RP2040_H
|
||||||
|
|
||||||
// For board detection
|
// For board detection
|
||||||
#define ADAFRUIT_ITSYBITSY_RP2040
|
#define ADAFRUIT_ITSYBITSY_RP2040
|
||||||
|
|
||||||
|
// 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 -------------//
|
//------------- UART -------------//
|
||||||
#ifndef PICO_DEFAULT_UART
|
#ifndef PICO_DEFAULT_UART
|
||||||
#define PICO_DEFAULT_UART 0
|
#define PICO_DEFAULT_UART 0
|
||||||
|
@ -43,7 +50,7 @@
|
||||||
|
|
||||||
//------------- I2C -------------//
|
//------------- I2C -------------//
|
||||||
#ifndef PICO_DEFAULT_I2C
|
#ifndef PICO_DEFAULT_I2C
|
||||||
#define PICO_DEFAULT_I2C 0
|
#define PICO_DEFAULT_I2C 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||||
|
@ -79,17 +86,13 @@
|
||||||
#define PICO_FLASH_SPI_CLKDIV 2
|
#define PICO_FLASH_SPI_CLKDIV 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
|
||||||
#ifndef PICO_FLASH_SIZE_BYTES
|
#ifndef PICO_FLASH_SIZE_BYTES
|
||||||
#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024)
|
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// All boards have B1 RP2040
|
// All boards have B1 RP2040
|
||||||
#ifndef PICO_FLOAT_SUPPORT_ROM_V1
|
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||||
#define PICO_FLOAT_SUPPORT_ROM_V1 0
|
#define PICO_RP2040_B0_SUPPORTED 0
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_DOUBLE_SUPPORT_ROM_V1
|
|
||||||
#define PICO_DOUBLE_SUPPORT_ROM_V1 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
90
src/boards/include/boards/adafruit_kb2040.h
Normal file
90
src/boards/include/boards/adafruit_kb2040.h
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
* 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_KB2040_H
|
||||||
|
#define _BOARDS_ADAFRUIT_KB2040_H
|
||||||
|
|
||||||
|
// For board detection
|
||||||
|
#define ADAFRUIT_KB2040
|
||||||
|
|
||||||
|
// 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_WS2812_PIN
|
||||||
|
#define PICO_DEFAULT_WS2812_PIN 17
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------- I2C -------------//
|
||||||
|
#ifndef PICO_DEFAULT_I2C
|
||||||
|
#define PICO_DEFAULT_I2C 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||||
|
#define PICO_DEFAULT_I2C_SDA_PIN 12
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||||
|
#define PICO_DEFAULT_I2C_SCL_PIN 13
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------- SPI -------------//
|
||||||
|
#ifndef PICO_DEFAULT_SPI
|
||||||
|
#define PICO_DEFAULT_SPI 0
|
||||||
|
#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 20
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||||
|
#define PICO_DEFAULT_SPI_SCK_PIN 18
|
||||||
|
#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
|
||||||
|
// All boards have B1 RP2040
|
||||||
|
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||||
|
#define PICO_RP2040_B0_SUPPORTED 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
189
src/boards/include/boards/adafruit_macropad_rp2040.h
Normal file
189
src/boards/include/boards/adafruit_macropad_rp2040.h
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
// -----------------------------------------------------
|
||||||
|
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
|
||||||
|
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||||
|
// -----------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _BOARDS_ADAFRUIT_MACROPAD_RP2040_H
|
||||||
|
#define _BOARDS_ADAFRUIT_MACROPAD_RP2040_H
|
||||||
|
|
||||||
|
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||||
|
|
||||||
|
// For board detection
|
||||||
|
#define ADAFRUIT_MACROPAD_RP2040
|
||||||
|
|
||||||
|
// 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 ADAFRUIT_MACROPAD_KEY1_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY1_PIN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY2_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY2_PIN 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY3_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY3_PIN 3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY4_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY4_PIN 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY5_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY5_PIN 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY6_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY6_PIN 6
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY7_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY7_PIN 7
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY8_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY8_PIN 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY9_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY9_PIN 9
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY10_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY10_PIN 10
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY11_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY11_PIN 11
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_KEY12_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_KEY12_PIN 12
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_LED_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_LED_PIN 13
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_SPEAKER_ENABLE_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_SPEAKER_ENABLE_PIN 14
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_SPEAKER_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_SPEAKER_PIN 16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_BUTTON_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_BUTTON_PIN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_ROTA_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_ROTA_PIN 17
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_ROTB_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_ROTB_PIN 18
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_NEOPIXEL_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_NEOPIXEL_PIN 19
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_DISPLAY_OLED_CS_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_DISPLAY_OLED_CS_PIN 22
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_DISPLAY_OLED_RESET_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_DISPLAY_OLED_RESET_PIN 23
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_DISPLAY_OLED_DC_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_DISPLAY_OLED_DC_PIN 24
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_DISPLAY_SCK_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_DISPLAY_SCK_PIN 26
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_DISPLAY_MOSI_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_DISPLAY_MOSI_PIN 27
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADAFRUIT_MACROPAD_DISPLAY_MISO_PIN
|
||||||
|
#define ADAFRUIT_MACROPAD_DISPLAY_MISO_PIN 28
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// no PICO_DEFAULT_UART
|
||||||
|
|
||||||
|
//------------- LED -------------//
|
||||||
|
#ifndef PICO_DEFAULT_LED_PIN
|
||||||
|
#define PICO_DEFAULT_LED_PIN ADAFRUIT_MACROPAD_LED_PIN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_WS2812_PIN
|
||||||
|
#define PICO_DEFAULT_WS2812_PIN ADAFRUIT_MACROPAD_NEOPIXEL_PIN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------- I2C -------------//
|
||||||
|
#ifndef PICO_DEFAULT_I2C
|
||||||
|
#define PICO_DEFAULT_I2C 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||||
|
#define PICO_DEFAULT_I2C_SDA_PIN 20
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||||
|
#define PICO_DEFAULT_I2C_SCL_PIN 21
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------- SPI -------------//
|
||||||
|
#ifndef PICO_DEFAULT_SPI
|
||||||
|
#define PICO_DEFAULT_SPI 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||||
|
#define PICO_DEFAULT_SPI_TX_PIN 27
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||||
|
#define PICO_DEFAULT_SPI_RX_PIN 28
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||||
|
#define PICO_DEFAULT_SPI_SCK_PIN 26
|
||||||
|
#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_FLOAT_SUPPORT_ROM_V1
|
||||||
|
#define PICO_FLOAT_SUPPORT_ROM_V1 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DOUBLE_SUPPORT_ROM_V1
|
||||||
|
#define PICO_DOUBLE_SUPPORT_ROM_V1 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -9,12 +9,19 @@
|
||||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||||
// -----------------------------------------------------
|
// -----------------------------------------------------
|
||||||
|
|
||||||
|
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||||
|
|
||||||
#ifndef _BOARDS_ADAFRUIT_QTPY_RP2040_H
|
#ifndef _BOARDS_ADAFRUIT_QTPY_RP2040_H
|
||||||
#define _BOARDS_ADAFRUIT_QTPY_RP2040_H
|
#define _BOARDS_ADAFRUIT_QTPY_RP2040_H
|
||||||
|
|
||||||
// For board detection
|
// For board detection
|
||||||
#define ADAFRUIT_QTPY_RP2040
|
#define ADAFRUIT_QTPY_RP2040
|
||||||
|
|
||||||
|
// 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 -------------//
|
//------------- UART -------------//
|
||||||
#ifndef PICO_DEFAULT_UART
|
#ifndef PICO_DEFAULT_UART
|
||||||
#define PICO_DEFAULT_UART 1
|
#define PICO_DEFAULT_UART 1
|
||||||
|
@ -25,7 +32,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
#ifndef PICO_DEFAULT_UART_RX_PIN
|
||||||
#define PICO_DEFAULT_UART_RX_PIN 9
|
#define PICO_DEFAULT_UART_RX_PIN 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//------------- LED -------------//
|
//------------- LED -------------//
|
||||||
|
@ -78,17 +85,13 @@
|
||||||
#define PICO_FLASH_SPI_CLKDIV 2
|
#define PICO_FLASH_SPI_CLKDIV 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
|
||||||
#ifndef PICO_FLASH_SIZE_BYTES
|
#ifndef PICO_FLASH_SIZE_BYTES
|
||||||
#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024)
|
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// All boards have B1 RP2040
|
// All boards have B1 RP2040
|
||||||
#ifndef PICO_FLOAT_SUPPORT_ROM_V1
|
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||||
#define PICO_FLOAT_SUPPORT_ROM_V1 0
|
#define PICO_RP2040_B0_SUPPORTED 0
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PICO_DOUBLE_SUPPORT_ROM_V1
|
|
||||||
#define PICO_DOUBLE_SUPPORT_ROM_V1 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
75
src/boards/include/boards/adafruit_trinkey_qt2040.h
Normal file
75
src/boards/include/boards/adafruit_trinkey_qt2040.h
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 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_TRINKEY_QT2040_H
|
||||||
|
#define _BOARDS_ADAFRUIT_TRINKEY_QT2040_H
|
||||||
|
|
||||||
|
// For board detection
|
||||||
|
#define ADAFRUIT_TRINKEY_QT2040
|
||||||
|
|
||||||
|
// 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 -------------//
|
||||||
|
// no PICO_DEFAULT_UART
|
||||||
|
// no PICO_DEFAULT_UART_TX_PIN
|
||||||
|
// no PICO_DEFAULT_UART_RX_PIN
|
||||||
|
|
||||||
|
//------------- LED -------------//
|
||||||
|
// No normal LED
|
||||||
|
// #define PICO_DEFAULT_LED_PIN 13
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_WS2812_PIN
|
||||||
|
#define PICO_DEFAULT_WS2812_PIN 27
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------- I2C -------------//
|
||||||
|
#ifndef PICO_DEFAULT_I2C
|
||||||
|
#define PICO_DEFAULT_I2C 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||||
|
#define PICO_DEFAULT_I2C_SDA_PIN 16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||||
|
#define PICO_DEFAULT_I2C_SCL_PIN 17
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------- SPI -------------//
|
||||||
|
// no PICO_DEFAULT_SPI
|
||||||
|
// no PICO_DEFAULT_SPI_SCK_PIN
|
||||||
|
// no PICO_DEFAULT_SPI_TX_PIN
|
||||||
|
// no PICO_DEFAULT_SPI_RX_PIN
|
||||||
|
// no PICO_DEFAULT_SPI_CSN_PIN
|
||||||
|
|
||||||
|
//------------- 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
|
||||||
|
// All boards have B1 RP2040
|
||||||
|
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||||
|
#define PICO_RP2040_B0_SUPPORTED 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
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
|
86
src/boards/include/boards/arduino_nano_rp2040_connect.h
Normal file
86
src/boards/include/boards/arduino_nano_rp2040_connect.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
|
||||||
|
// -----------------------------------------------------
|
||||||
|
|
||||||
|
// pico_cmake_set PICO_PLATFORM=rp2040
|
||||||
|
|
||||||
|
#ifndef _BOARDS_ARDUINO_NANO_RP2040_CONNECT_H
|
||||||
|
#define _BOARDS_ARDUINO_NANO_RP2040_CONNECT_H
|
||||||
|
|
||||||
|
// For board detection
|
||||||
|
#define ARDUINO_NANO_RP2040_CONNECT
|
||||||
|
|
||||||
|
//------------- 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 6
|
||||||
|
#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 12
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||||
|
#define PICO_DEFAULT_I2C_SCL_PIN 13
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------- SPI -------------//
|
||||||
|
#ifndef PICO_DEFAULT_SPI
|
||||||
|
#define PICO_DEFAULT_SPI 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||||
|
#define PICO_DEFAULT_SPI_TX_PIN 7
|
||||||
|
#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 6
|
||||||
|
#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
|
||||||
|
// All boards have B1 RP2040
|
||||||
|
#ifndef PICO_RP2040_B0_SUPPORTED
|
||||||
|
#define PICO_RP2040_B0_SUPPORTED 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
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
|
62
src/boards/include/boards/datanoisetv_rp2040_dsp.h
Normal file
62
src/boards/include/boards/datanoisetv_rp2040_dsp.h
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* 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 RP2040 DSP Board
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
// For board detection
|
||||||
|
#define DATANOISETV_RP2040_DSP
|
||||||
|
|
||||||
|
// --- 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 = (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
|
||||||
|
|
||||||
|
|
||||||
|
// --- I2S ---
|
||||||
|
#ifndef PICO_AUDIO_I2S_DATA_PIN
|
||||||
|
#define PICO_AUDIO_I2S_DATA_PIN 16
|
||||||
|
#endif
|
||||||
|
#ifndef PICO_AUDIO_I2S_CLOCK_PIN_BASE
|
||||||
|
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE 17
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "boards/pico.h"
|
||||||
|
|
||||||
|
#endif
|
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
|
||||||
|
|
||||||
|
|
82
src/boards/include/boards/eetree_gamekit_rp2040.h
Normal file
82
src/boards/include/boards/eetree_gamekit_rp2040.h
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 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_EETREE_GAMEKIT_RP2040_H
|
||||||
|
#define _BOARDS_EETREE_GAMEKIT_RP2040_H
|
||||||
|
|
||||||
|
// For board detection
|
||||||
|
#define EETREE_GAMEKIT_RP2040
|
||||||
|
|
||||||
|
// --- UART ---
|
||||||
|
// no PICO_DEFAULT_UART
|
||||||
|
// no PICO_DEFAULT_UART_TX_PIN
|
||||||
|
// no PICO_DEFAULT_UART_RX_PIN
|
||||||
|
|
||||||
|
// --- LED ---
|
||||||
|
#ifndef PICO_DEFAULT_LED_PIN
|
||||||
|
#define PICO_DEFAULT_LED_PIN 4
|
||||||
|
#endif
|
||||||
|
// no PICO_DEFAULT_WS2812_PIN
|
||||||
|
|
||||||
|
// --- I2C ---
|
||||||
|
#ifndef PICO_DEFAULT_I2C
|
||||||
|
#define PICO_DEFAULT_I2C 1
|
||||||
|
#endif
|
||||||
|
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||||
|
#define PICO_DEFAULT_I2C_SDA_PIN 10
|
||||||
|
#endif
|
||||||
|
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||||
|
#define PICO_DEFAULT_I2C_SCL_PIN 11
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// --- SPI ---
|
||||||
|
// no PICO_DEFAULT_SPI
|
||||||
|
// no PICO_DEFAULT_SPI_SCK_PIN
|
||||||
|
// no PICO_DEFAULT_SPI_TX_PIN
|
||||||
|
// no PICO_DEFAULT_SPI_RX_PIN
|
||||||
|
// no PICO_DEFAULT_SPI_CSN_PIN
|
||||||
|
|
||||||
|
// --- LCD ---
|
||||||
|
#ifndef EETREE_RP2040_LCD_SPI
|
||||||
|
#define EETREE_RP2040_LCD_SPI 0
|
||||||
|
#endif
|
||||||
|
#ifndef EETREE_RP2040_LCD_DC_PIN
|
||||||
|
#define EETREE_RP2040_LCD_DC_PIN 1
|
||||||
|
#endif
|
||||||
|
#ifndef EETREE_RP2040_LCD_SCLK_PIN
|
||||||
|
#define EETREE_RP2040_LCD_SCLK_PIN 2
|
||||||
|
#endif
|
||||||
|
#ifndef EETREE_RP2040_LCD_TX_PIN
|
||||||
|
#define EETREE_RP2040_LCD_TX_PIN 3
|
||||||
|
#endif
|
||||||
|
#ifndef EETREE_RP2040_LCD_RST_PIN
|
||||||
|
#define EETREE_RP2040_LCD_RST_PIN 0
|
||||||
|
#endif
|
||||||
|
// no EETREE_RP2040_LCD_CS_PIN
|
||||||
|
|
||||||
|
// --- 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 // _BOARDS_EETREE_GAMEKIT_RP2040_H
|
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