cmake_minimum_required(VERSION 3.13)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE Release)
set(PICO_BOARD pico2)
set(PICO_PLATFORM rp2350)

set(PROJECT_NAME uart_test)

include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake) 
project(${PROJECT_NAME} C CXX ASM) 

pico_sdk_init()

add_compile_options(-Wall
-Wno-format # int != int32_t
-Wno-unused-function # we have some for the docs that aren't called
-Wno-maybe-uninitialized

add_executable(${PROJECT_NAME}
${PROJECT_NAME}.c

target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}

target_link_libraries(${PROJECT_NAME}
pico_stdlib
)

pico_add_extra_outputs(${PROJECT_NAME})
pico_enable_stdio_usb(${PROJECT_NAME} 1) 
pico_enable_stdio_uart(${PROJECT_NAME} 1)
CMakeLists.txt mods for PICO2 
Makelist.txt changes to re-compile unmodified C source for PICO 2 target using UBUNTU on Windows
 
cmake -DPICO_BOARD=pico2  
option forces pico2.h inclusion
 
pete@DESKTOP-PJ5ODUN:~/pico/pete-uart$ export PICO_SDK_PATH=/home/pete/pico/pico-sdk
pete@DESKTOP-PJ5ODUN:~/pico/pete-uart$ rm -r build
pete@DESKTOP-PJ5ODUN:~/pico/pete-uart$ mkdir build
pete@DESKTOP-PJ5ODUN:~/pico/pete-uart$ cd build
pete@DESKTOP-PJ5ODUN:~/pico/pete-uart/build$ cmake -DPICO_BOARD=pico2 ..
Using PICO_SDK_PATH from environment ('/home/pete/pico/pico-sdk')
PICO_SDK_PATH is /home/pete/pico/pico-sdk
Target board (PICO_BOARD) is 'pico2'.
Using board configuration from /home/pete/pico/pico-sdk/src/boards/include/boards/pico2.h
Pico Platform (PICO_PLATFORM) is 'rp2350-arm-s'.
Defaulting compiler (PICO_COMPILER) to 'pico_arm_cortex_m33_gcc' since not specified.
Configuring toolchain based on PICO_COMPILER 'pico_arm_cortex_m33_gcc'
Defaulting PICO_GCC_TRIPLE to 'arm-none-eabi'
.
.
.
-- Generating done
-- Build files have been written to: /home/pete/pico/pete-uart/build
pete@DESKTOP-PJ5ODUN:~/pico/pete-uart/build$ make -j4
Scanning dependencies of target bs2_default
[ 1%] Building ASM object pico-sdk/src/rp2350/boot_stage2/CMakeFiles/bs2_default.dir/compile_time_choice.S.obj
.
.
.
[ 98%] Building C object CMakeFiles/uart_test.dir/home/pete/pico/pico-sdk/lib/tinyusb/src/common/tusb_fifo.c.obj
[100%] Linking CXX executable uart_test.elf
[100%] Built target uart_test
pete@DESKTOP-PJ5ODUN:~/pico/pete-uart/build$ dir
CMakeCache.txt Makefile generated pico_flash_region.ld pioasm-install uart_test.dis uart_test.elf.map
CMakeFiles cmake_install.cmake pico-sdk pioasm uart_test.bin uart_test.elf uart_test.uf2
pete@DESKTOP-PJ5ODUN:~/pico/pete-uart/build$ explorer.exe .
pete@DESKTOP-PJ5ODUN:~/pico/pete-uart/build$
*
*
*
file:///C:/Users/pete/pi/pico/pico2.html
pete@DESKTOP-PJ5ODUN:~/learn_c$ cat hw.c

#include <stdio.h>


int main() {

printf ("e.g.\ngcc hw.c -o x.exe\n./x.exe\n");

return 0;
}

pete@DESKTOP-PJ5ODUN:~/learn_c$ ./readme
./readme will execute this file
compiling hw.c
e.g.
gcc hw.c -o x.exe
./x.exe
pete@DESKTOP-PJ5ODUN:~/learn_c$ cat readme
echo ./readme will execute this file
echo compiling hw.c
gcc hw.c -o x.exe
./x.exe


pete@DESKTOP-PJ5ODUN:~/learn_c$
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.153.1-microsoft-standard-WSL2 x86_64)

echo
https://github.com/jtarrio/pascual

pete@DESKTOP-PJ5ODUN:~/pascual$
pwd
/home/pete/pascual
pete@DESKTOP-PJ5ODUN:~/pascual$
cat check.pas
program p;

function isswitch(var s:string):string;
var
i:integer;
begin
i:=pos('/',s);
if i>0 then
begin
result:=copy(s,1,pred(i));
delete(s,1,i)
end else result:='';
end;

var
s,x:string;
begin
s:='one/two/three/four';
x:=isswitch(s);
writeln(x,' ',s);
x:=isswitch(s);
writeln(x,' ',s);
x:=isswitch(s);
writeln(x,' ',s);
readln;
end.
pete@DESKTOP-PJ5ODUN:~/pascual$ dist/pascualc check.pas
pete@DESKTOP-PJ5ODUN:~/pascual$
./check
one two/three/four
two three/four
three four
pete@DESKTOP-PJ5ODUN:~/pascual$ dist/pascualc check.pas -c
pete@DESKTOP-PJ5ODUN:~/pascual$
cat check.c
/* Program: P */
#include "pascual.h"

PString S;
PString X;

PString ISSWITCH(PString* S) {
PString RESULT;
PInteger I;
PString tmp1;
I = ({ tmp1 = str_of('/'); POS(&tmp1, S); });
if (I > 0) {
RESULT = COPY(S, 1, I - 1);
DELETE(S, 1, I);
}
else RESULT = str_make(0, "");
return RESULT;
}

void pascual_main() {
S = str_make(18, "one/two/three/four");
X = ISSWITCH(&S);
Write(&OUTPUT, 1, RwpStringPtr, &X, RwpLenPtr, 3, " ", RwpStringPtr | RwpLn | RwpEnd, &S);
X = ISSWITCH(&S);
Write(&OUTPUT, 1, RwpStringPtr, &X, RwpLenPtr, 3, " ", RwpStringPtr | RwpLn | RwpEnd, &S);
X = ISSWITCH(&S);
Write(&OUTPUT, 1, RwpStringPtr, &X, RwpLenPtr, 3, " ", RwpStringPtr | RwpLn | RwpEnd, &S);
Read(&INPUT, 1, RwpEnd | RwpLn);
}
pete@DESKTOP-PJ5ODUN:~/pascual$
*