I'm having an issue when trying to compile simple C code for my raspberry pi pico. I am using VSCode (this is reproducible in PS as well). I have set up everything correctly as far as I'm aware.
I have tried doing this only in PS and it gives me the exact same results.
CMakeLists.txt
cmake_minimum_required(VERSION 3.19)
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
project(blink C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
pico_sdk_init()
add_executable(${PROJECT_NAME}
main.c
)
pico_add_extra_outputs(${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME}
pico_stdlib
)
Main.c
#include <pico/stdlib.h>
int main()
{
const uint led_pin = 25;
//init ledpin
gpio_init(led_pin);
gpio_set_dir(led_pin, GPIO_OUT);
while(true)
{
//blink led
gpio_put(led_pin, true);
sleep_ms(1000);
gpio_put(led_pin, false);
sleep_ms(1000);
}
}
This when compiled using nmake. Spits out,
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/pico/Projects/Blink/build --config Release --target blink -j 6 --
[build] Warning: NMake does not support parallel builds. Ignoring parallel build command line option.
[build] makefile(7): Error(E21): Extension(s) (.PHONY) not defined
[build] makefile(10): Error(E21): Extension(s) (.NOTPARALLEL) not defined
[build] makefile(12): Error(E09): Ignoring out of place Extension
[build] makefile(14): Error(E21): Extension(s) (.PHONY) not defined
[build] makefile(28): Warning(W18): Unrecognized or out of place character '='
[build] makefile(31): Error(E09): Ignoring out of place Single-colon
[build] makefile(36): Error(E21): Extension(s) (.PHONY) not defined
...
[build] Error(E02): Make execution terminated
[build] Build finished with exit code 0
I am not able to find much in the sense of how to fix this exact thing, which is surprising to me. The only thing that I have found is that nmake doesn't use ".PHONY" and thats where most of my issues are coming from.
Do I just remove all of the ".PHONY" references in the Makefile? I hope someone can help with this very confusing problem.
Thank you.