Reputation: 33
I'm pretty new to Raspberry Pi Pico. I am using Windows 10.
I installed all neccesary stuff (Visual Studio Code, CMake, compiller, etc.) using executable from here.
I buit example projects from there, but there was no pico_w
folder.
I went to https://github.com/raspberrypi/pico-examples and download all example projects, inclunding pico_w
and just replaced with my current pico-examples
folder.
I also did the same for SDK (download folder from GitHub and replace current one with it).
Then I restarted VS Code, switched to "Cmake" extension tab, pressed "Configure All Projects", however there was no pico_w
element in the list, although in "Explorer" tab, of the project folder, of course it was.
Then I copied pico_w\wifi\access_point
folder to hello_world
, just near serial
and usb
folders.
After that, it started to be displayed at CMake list, however can't be compiled, becuause it can't find most of include header, such as pico/cyw43_arch.h
, lwip/pbuf.h
, dhcpserver.h
.
Project without that headers sucessfully complies.
What am I doing wrong?
I added "PICO_BOARD": "pico_w"
in .vscode/setting.json
, now, in CMakeLists.txt
PICO_CYW43_SUPPORTED
is true, however, NOT TARGET pico_cyw43_arch
is also true.
So, what is TARGET
and how do I make it be pico_cyw43_arch
?
Current CMakeLists.txt
cmake_minimum_required(VERSION 3.13)
# initialize the SDK directly
include("C:/Program Files/Raspberry Pi/Pico SDK v1.5.1/pico-sdk/pico_sdk_init.cmake")
project(pico_examples C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
if (PICO_SDK_VERSION_STRING VERSION_LESS "1.3.0")
message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.3.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
endif()
# initialize the Raspberry Pi Pico SDK
pico_sdk_init()
include(example_auto_set_url.cmake)
add_compile_options(-Wall
-Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
-Wno-unused-function # we have some for the docs that aren't called
)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-maybe-uninitialized)
endif()
set(PICO_BOARD pico_w)
# rest of your project
add_subdirectory(pico_w)
add_executable(wifi
pico_w/wifi/access_point/picow_access_point.c
)
# Add pico_stdlib library which aggregates commonly used features
target_link_libraries(wifi pico_stdlib
pico_cyw43_arch_lwip_poll # we need Wifi to access the GPIO, but we don't need anything else
hardware_flash
hardware_irq
hardware_adc
hardware_pwm
hardware_i2c
hardware_spi
hardware_dma
hardware_exception)
# create map/bin/hex/uf2 file in addition to ELF.
pico_add_extra_outputs(wifi)
Current project tree
pico_w -> wifi -> access_point -> dhcpserver -> ...
| | | -> dnsserver -> ...
| | | -> CMakeLists.txt
| | | -> lwipopts.txt
| | | -> picow_access_point.c
| | -> CMakeLists.txt
| | -> lwipopts_examples_common.h
| -> CMakeLists.txt
CMakeLists.txt (content above)
exemaple_auto_set_url.cmake
Content of wifi
folder just from GitHub.
Also there is .vscode
folder, with setting.json
where I put:
{
"files.associations": {
"dhcpserver.h": "c"
},
"cmake.configureSettings": {
"PICO_BOARD": "pico_w",
"TARGET": "access_point",
"DPICO_CYW43_SUPPORTED": 1
}
}
Update
Seems, like "submodules" are not initizalied:
[cmake] cyw43-driver submodule has not been initialized; Pico W
wireless support will be unavailable
[cmake] hint: try 'git submodule update --init' from your SDK directory
What exactly should I do? Just running that command it from cmd or PowerShell does not work
Upvotes: 1
Views: 1663
Reputation: 21
Once you successfully installed CMake, you should just clone the Pico SDK from its GitHub page and follow the installation procedure as explained in the readme file.
You can also try to replace "pico_w" by "pico" in your CMakeLists.txt: sometimes, dependencies problems can be solved just by doing that.
Once the installation is done, you should have a correct environment to build your project with all the Pico libraries available.
Upvotes: 0