User avatar
HermannSW
Posts: 4518
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 3:40 pm

https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/raspiraw
https://stamm-wilbrandt.de/en/Raspberry_camera.html

oldblokeh
Posts: 22
Joined: Sat Jul 13, 2019 9:14 am

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 4:09 pm

Same as any of the pico-examples programs, but starting in pico-playground instead of pico-examples. Caveat: I only built it (with no errors), I haven't run it.

User avatar
HermannSW
Posts: 4518
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 6:35 pm

oldblokeh wrote:
Sat Mar 13, 2021 4:09 pm
Same as any of the pico-examples programs, but starting in pico-playground instead of pico-examples. Caveat: I only built it (with no errors), I haven't run it.
I asked because nothing happens when I do that -- no error, but no .uf2 created:

Code: Select all

pi@raspberrypi400:~ $ cd pico/pico-playground/build/net/usb_host_webserver/
pi@raspberrypi400:~/pico/pico-playground/build/net/usb_host_webserver $ make
pi@raspberrypi400:~/pico/pico-playground/build/net/usb_host_webserver $ ls -l
total 16
drwxr-xr-x 2 pi pi 4096 Mar 12 22:05 CMakeFiles
-rw-r--r-- 1 pi pi 1009 Mar 12 17:43 cmake_install.cmake
-rw-r--r-- 1 pi pi 4158 Mar 12 17:43 Makefile
pi@raspberrypi400:~/pico/pico-playground/build/net/usb_host_webserver $ 
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/raspiraw
https://stamm-wilbrandt.de/en/Raspberry_camera.html

oldblokeh
Posts: 22
Joined: Sat Jul 13, 2019 9:14 am

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 7:46 pm

HermannSW wrote:
Sat Mar 13, 2021 6:35 pm
oldblokeh wrote:
Sat Mar 13, 2021 4:09 pm
Same as any of the pico-examples programs, but starting in pico-playground instead of pico-examples. Caveat: I only built it (with no errors), I haven't run it.
I asked because nothing happens when I do that -- no error, but no .uf2 created:

Code: Select all

pi@raspberrypi400:~ $ cd pico/pico-playground/build/net/usb_host_webserver/
pi@raspberrypi400:~/pico/pico-playground/build/net/usb_host_webserver $ make
pi@raspberrypi400:~/pico/pico-playground/build/net/usb_host_webserver $ ls -l
total 16
drwxr-xr-x 2 pi pi 4096 Mar 12 22:05 CMakeFiles
-rw-r--r-- 1 pi pi 1009 Mar 12 17:43 cmake_install.cmake
-rw-r--r-- 1 pi pi 4158 Mar 12 17:43 Makefile
pi@raspberrypi400:~/pico/pico-playground/build/net/usb_host_webserver $ 
Try:

Code: Select all

cd ~/pico/pico-playground/build/net/usb_host_webserver 
cmake ../..
make

oldblokeh
Posts: 22
Joined: Sat Jul 13, 2019 9:14 am

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 8:01 pm

Sorry, got that wrong. Try:

Code: Select all

cd ~/pico/pico-playground/build
cmake ..
cd net/usb_host_webserver
make

hippy
Posts: 10553
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 8:20 pm

oldblokeh wrote:
Sat Mar 13, 2021 8:01 pm

Code: Select all

cd ~/pico/pico-playground/build
cmake ..
cd net/usb_host_webserver
make
Thanks. I had to create the '~/pico/pico-playground/build' directory, but then it all worked just as desired ...

Code: Select all

[100%] Linking CXX executable usb_host_webserver.elf
[100%] Built target usb_host_webserver
pi@Pi3B:~/pico/pico-playground/build/net/usb_host_webserver $ ls
CMakeFiles           usb_host_webserver.bin  usb_host_webserver.elf.map
cmake_install.cmake  usb_host_webserver.dis  usb_host_webserver.hex
Makefile             usb_host_webserver.elf  usb_host_webserver.uf2
pi@Pi3B:~/pico/pico-playground/build/net/usb_host_webserver $ 

incognitum
Posts: 767
Joined: Tue Oct 30, 2018 3:34 pm

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 8:27 pm

Thanks. I had to create the '~/pico/pico-playground/build' directory, but then it all worked just as desired ...
Have you also tried running it?
Looking at the source that example does not seem to be very functional.


If you want to have a webserver in USB Ethernet device (not host) mode, the example that comes with TinyUSB does work pretty well on the Pico with minimal modification.

User avatar
HermannSW
Posts: 4518
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 9:40 pm

oldblokeh wrote:
Sat Mar 13, 2021 8:01 pm
Sorry, got that wrong. Try:

Code: Select all

cd ~/pico/pico-playground/build
cmake ..
cd net/usb_host_webserver
make
Thanks .. I must have had some weird state.
I did remove complete build directory, created it newly and then executing your commands really built "usb_host_webserver.uf2".
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/raspiraw
https://stamm-wilbrandt.de/en/Raspberry_camera.html

User avatar
HermannSW
Posts: 4518
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 9:46 pm

Code: Select all

/*
this appears as either a RNDIS or CDC-ECM USB virtual network adapter; the OS picks its preference

RNDIS should be valid on Linux and Windows hosts, and CDC-ECM should be valid on Linux and macOS hosts

The MCU appears to the host as IP address 192.168.7.1, and provides a DHCP server, DNS server, and web server.
*/
Neither ping works after flashing the .uf2 to Pico, just hangs:

Code: Select all

$ ping 192.168.7.1
PING 192.168.7.1 (192.168.7.1) 56(84) bytes of data.


nmap states that 192.168.7.1 is not up:

Code: Select all

$ sudo nmap -sn 192.168.7.1/32
Starting Nmap 7.70 ( https://nmap.org ) at 2021-03-13 22:47 CET
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 3.16 seconds
$

So is the comment wrong stating Pico should appear as 192.168.7.1?
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/raspiraw
https://stamm-wilbrandt.de/en/Raspberry_camera.html

incognitum
Posts: 767
Joined: Tue Oct 30, 2018 3:34 pm

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 9:51 pm

HermannSW wrote:
Sat Mar 13, 2021 9:46 pm
So is the comment wrong stating Pico should appear as 192.168.7.1?
Yeah, like I mentioned.
It looks not so functional to me.

Author copied a few lines from the TinyUSB webserver example. The original does work (in device mode).
But he did not borrow enough lines to get you something working.
Just calling tuh_task() in a loop will not give you a webserver. ;)

incognitum
Posts: 767
Joined: Tue Oct 30, 2018 3:34 pm

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 10:51 pm

Anyway, in case you are interested in a webserver example that does work.
I'll share one in a new thread: viewtopic.php?f=145&t=306888

Does is DEVICE MODE (lets the Pico pretend to be a USB Ethernet adapter), and not host mode.

hippy
Posts: 10553
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Mar 13, 2021 11:45 pm

incognitum wrote:
Sat Mar 13, 2021 10:51 pm
Anyway, in case you are interested in a webserver example that does work.
I'll share one in a new thread: viewtopic.php?f=145&t=306888
Thanks; that's more like it and it works for me. Now to figure out how to adjust things so I can put the source in the directory I'd like to have it in.

SteveRPi
Posts: 14
Joined: Wed Oct 01, 2014 10:35 pm
Location: Canberra

Re: How to compile pico-playground/net/usb_host_webserver?

Sun Mar 14, 2021 5:36 am

Me too, after adjusting ipaddr to broadcast to my 192.168.1.x network:

Code: Select all

pico-webserver/tusb_lwip_glue.c (line 44):

static const ip_addr_t ipaddr  = IPADDR4_INIT_BYTES(192.168.1.107)
Edit: added image
Image
Attachments
Screenshot-20210314163759-1051x535.png
Screenshot-20210314163759-1051x535.png (168.38 KiB) Viewed 1105 times

incognitum
Posts: 767
Joined: Tue Oct 30, 2018 3:34 pm

Re: How to compile pico-playground/net/usb_host_webserver?

Sun Mar 14, 2021 12:23 pm

SteveRPi wrote:
Sun Mar 14, 2021 5:36 am
Me too, after adjusting ipaddr to broadcast to my 192.168.1.x network:

Code: Select all

pico-webserver/tusb_lwip_glue.c (line 44):

static const ip_addr_t ipaddr  = IPADDR4_INIT_BYTES(192.168.1.107)
You typically want it in another subnet than your normal network.
Otherwise you may not be able to reliably use your normal network connection and the Pico USB network connection at the same time.
(Unless you are making a bridge out of the two network interfaces).

pidd
Posts: 2509
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Jul 17, 2021 9:46 pm

usb_host_webserver no longer builds for me, the tinyusb build goes wrong

Code: Select all

Scanning dependencies of target usb_host_webserver
[  0%] Building C object net/usb_host_webserver/CMakeFiles/usb_host_webserver.dir/main.c.obj
[  0%] Building C object net/usb_host_webserver/CMakeFiles/usb_host_webserver.dir/home/pi/pico/pico-sdk/src/rp2_common/pico_stdlib/stdlib.c.obj
[  0%] Building C object net/usb_host_webserver/CMakeFiles/usb_host_webserver.dir/home/pi/pico/pico-sdk/src/rp2_common/hardware_gpio/gpio.c.obj
[  0%] Building C object net/usb_host_webserver/CMakeFiles/usb_host_webserver.dir/home/pi/pico/pico-sdk/src/rp2_common/hardware_claim/claim.c.obj
In file included from /home/pi/pico/pico-sdk/lib/tinyusb/src/host/usbh.h:38:0,
                 from /home/pi/pico/pico-sdk/lib/tinyusb/src/tusb.h:43,
                 from /home/pi/pico/pico-sdk/lib/tinyusb/hw/bsp/board.h:42,
                 from /home/pi/pico/pico-playground/net/usb_host_webserver/main.c:36:
/home/pi/pico/pico-sdk/lib/tinyusb/src/host/hcd.h:87:62: error: 'CFG_TUH_HID' undeclared here (not in a function); did you mean 'CFG_TUD_HID'?
   HCD_MAX_ENDPOINT = CFG_TUSB_HOST_DEVICE_MAX*(CFG_TUH_HUB + CFG_TUH_HID*2 + CFG_TUH_MSC*2 + CFG_TUH_CDC*3),
                                                              ^~~~~~~~~~~
                                                              CFG_TUD_HID

CFG_TUH_HID is defined in pico_sdk/lib/tinyusb/src/tusb_options.h

hippy
Posts: 10553
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Jul 17, 2021 10:17 pm

pidd wrote:
Sat Jul 17, 2021 9:46 pm
usb_host_webserver no longer builds for me, the tinyusb build goes wrong
Same for me; "CFG_TUH_HID" not defined.

My guess was ~/pico/pico-playground/net/usb_host_webserver/tusb_config.h no longer matches what TinyUSB expects.

Adding #define CFG_TUH_HID 0 got it built for me -

Code: Select all

pi@Pi3B:~/pico/pico-playground/build/net/usb_host_webserver $ picotool info -a usb_host_webserver.uf2
File usb_host_webserver.uf2:

Program Information
 name:          usb_host_webserver
 binary start:  0x10000000
 binary end:    0x10004b58

Fixed Pin Information
 0:   UART0 TX
 25:  LED

Build Information
 sdk version:       1.2.0
 pico_board:        pico
 build date:        Jul 17 2021
 build attributes:  Release
I can't file a GitHub issue so you or someone else will have to.

kilograham
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 876
Joined: Fri Apr 12, 2019 11:00 am
Location: austin tx

Re: How to compile pico-playground/net/usb_host_webserver?

Sat Jul 17, 2021 10:58 pm

~/pico/pico-playground/net/usb_host_webserver no longer exists.

All the examples "xxx" from here https://github.com/hathach/tinyusb/tree ... les/device are built by pico_examples as "tinyusb_dev_xxx"

pidd
Posts: 2509
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: How to compile pico-playground/net/usb_host_webserver?

Sun Jul 18, 2021 12:27 am

kilograham wrote:
Sat Jul 17, 2021 10:58 pm
~/pico/pico-playground/net/usb_host_webserver no longer exists.

All the examples "xxx" from here https://github.com/hathach/tinyusb/tree ... les/device are built by pico_examples as "tinyusb_dev_xxx"
Ta.

I assumed keeping pico up to date with git pull etc would keep this in order, I'm new to everything git, I now guess it doesn't delete anything - which would make sense.

I'll probably delete the whole sdk and start again, I separated all my projects away from the pico folder a while ago

I had a clean build of everything pico_examples earlier - that's good.

I'm getting very confused about the plethora of accounts on github "officially-ish" related to Raspberry products, there also appeared to be some potentially rogue pretenders last time I searched.

hippy
Posts: 10553
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to compile pico-playground/net/usb_host_webserver?

Mon Jul 19, 2021 11:34 am

kilograham wrote:
Sat Jul 17, 2021 10:58 pm
All the examples "xxx" from here https://github.com/hathach/tinyusb/tree ... les/device are built by pico_examples as "tinyusb_dev_xxx"
What do I need to do to build those examples ?

pidd
Posts: 2509
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: How to compile pico-playground/net/usb_host_webserver?

Mon Jul 19, 2021 11:39 am

hippy wrote:
Mon Jul 19, 2021 11:34 am
kilograham wrote:
Sat Jul 17, 2021 10:58 pm
All the examples "xxx" from here https://github.com/hathach/tinyusb/tree ... les/device are built by pico_examples as "tinyusb_dev_xxx"
What do I need to do to build those examples ?
They are in the current release of sdk so just the usual (if they were in place when sdk was installed it will have already built them)

This builds all of them

Code: Select all

cd pico/pico-examples
mkdir build
cd build
cmake ..
make
or on 4 core machine
make -j4
to speed things up.

hippy
Posts: 10553
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to compile pico-playground/net/usb_host_webserver?

Mon Jul 19, 2021 11:58 am

pidd wrote:
Mon Jul 19, 2021 11:39 am
This builds all of them
Thanks, but doesn't for me ...

Code: Select all

pi@Pi3B:~/pico/pico-examples $ git pull
Already up to date.
pi@Pi3B:~/pico/pico-examples $ rm -r build
pi@Pi3B:~/pico/pico-examples $ mkdir build
pi@Pi3B:~/pico/pico-examples $ cd build
pi@Pi3B:~/pico/pico-examples/build $ cmake ..
PICO_SDK_PATH is /home/pi/pico/pico-sdk
PICO platform is rp2040.
Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)
PICO target board is pico.
Using board configuration from /home/pi/pico/pico-sdk/src/boards/include/boards/pico.h
TinyUSB available at /home/pi/pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support.
Compiling TinyUSB with CFG_TUSB_DEBUG=1
CMake Error at picoboard/CMakeLists.txt:3 (add_subdirectory):
  The source directory

    /home/pi/pico/pico-examples/picoboard/button

  does not contain a CMakeLists.txt file.


-- Configuring incomplete, errors occurred!
See also "/home/pi/pico/pico-examples/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/pico/pico-examples/build/CMakeFiles/CMakeError.log".
pi@Pi3B:~/pico/pico-examples/build $ make
make: *** No targets specified and no makefile found.  Stop.
/home/pi/pico/pico-examples/build/CMakeFiles/CMakeOutput.log

Code: Select all

The target system is: PICO -  - cortex-m0plus
The host system is: Linux - 5.4.83-v7+ - armv7l
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/bin/arm-none-eabi-gcc 
Build flags: 
Id flags: -c 

The output was:
0


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.o"

The C compiler identification is GNU, found in "/home/pi/pico/pico-examples/build/CMakeFiles/3.13.4/CompilerIdC/CMakeCCompilerId.o"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /usr/bin/arm-none-eabi-g++ 
Build flags: 
Id flags: -c 

The output was:
0


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.o"

The CXX compiler identification is GNU, found in "/home/pi/pico/pico-examples/build/CMakeFiles/3.13.4/CompilerIdCXX/CMakeCXXCompilerId.o"

Checking whether the ASM compiler is GNU using "--version" matched "(GNU assembler)|(GCC)|(Free Software Foundation)":
arm-none-eabi-gcc (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The target system is: PICO -  - cortex-m0plus
The host system is: Linux - 5.10.17-v7+ - armv7l
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/bin/arm-none-eabi-gcc 
Build flags: -march=armv6-m;-mcpu=cortex-m0plus;-mthumb
Id flags: -c 

The output was:
0


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.o"

The C compiler identification is GNU, found in "/home/pi/pico/pico-examples/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.o"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /usr/bin/arm-none-eabi-g++ 
Build flags: -march=armv6-m;-mcpu=cortex-m0plus;-mthumb
Id flags: -c 

The output was:
0


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.o"

The CXX compiler identification is GNU, found in "/home/pi/pico/pico-examples/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.o"

Checking whether the ASM compiler is GNU using "--version" matched "(GNU assembler)|(GCC)|(Free Software Foundation)":
arm-none-eabi-gcc (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
/home/pi/pico/pico-examples/build/CMakeFiles/CMakeError.log

Code: Select all

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/arm-none-eabi-gcc 
Build flags: 
Id flags:  

The output was:
1
/usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
/tmp/building/package/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'
collect2: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /usr/bin/arm-none-eabi-g++ 
Build flags: 
Id flags:  

The output was:
1
/usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
/tmp/building/package/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'
collect2: error: ld returned 1 exit status


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/arm-none-eabi-gcc 
Build flags: -march=armv6-m;-mcpu=cortex-m0plus;-mthumb
Id flags:  

The output was:
1
/usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/lib/thumb/v6-m/libc.a(lib_a-exit.o): in function `exit':
/tmp/building/package/build/arm-none-eabi/thumb/v6-m/newlib/libc/stdlib/../../../../../../../newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'
collect2: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /usr/bin/arm-none-eabi-g++ 
Build flags: -march=armv6-m;-mcpu=cortex-m0plus;-mthumb
Id flags:  

The output was:
1
/usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/lib/thumb/v6-m/libc.a(lib_a-exit.o): in function `exit':
/tmp/building/package/build/arm-none-eabi/thumb/v6-m/newlib/libc/stdlib/../../../../../../../newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'
collect2: error: ld returned 1 exit status

pidd
Posts: 2509
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: How to compile pico-playground/net/usb_host_webserver?

Mon Jul 19, 2021 12:22 pm

Taking your first error, my picoboard/button has CMakeLists.txt

Code: Select all

~/pico/pico-examples/picoboard/button $ ls -al
total 16
drwxr-xr-x 2 pi pi 4096 Jul 18 01:33 .
drwxr-xr-x 4 pi pi 4096 Jul 18 01:33 ..
-rw-r--r-- 1 pi pi 2384 Jul 18 01:33 button.c
-rw-r--r-- 1 pi pi  324 Jul 18 01:33 CMakeLists.txt
I can only suggest you do what I ended up doing, deleting the whole SDK and re-installing. I guess the SDK's git pull might not update pico-examples?

Or if you are git-clever (that's definitely not me), you could pull pico-examples.

hippy
Posts: 10553
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to compile pico-playground/net/usb_host_webserver?

Mon Jul 19, 2021 12:58 pm

pidd wrote:
Mon Jul 19, 2021 12:22 pm
Taking your first error, my picoboard/button has CMakeLists.txt

Code: Select all

~/pico/pico-examples/picoboard/button $ ls -al
total 16
drwxr-xr-x 2 pi pi 4096 Jul 18 01:33 .
drwxr-xr-x 4 pi pi 4096 Jul 18 01:33 ..
-rw-r--r-- 1 pi pi 2384 Jul 18 01:33 button.c
-rw-r--r-- 1 pi pi  324 Jul 18 01:33 CMakeLists.txt
Weird ...

Code: Select all

pi@Pi3B:~/pico/pico-examples/picoboard/button $ ls -al
total 12
drwxr-xr-x 2 pi pi 4096 Mar 26 18:07 .
drwxr-xr-x 4 pi pi 4096 Jan 21 20:59 ..
-rw-r--r-- 1 pi pi 2384 Mar 26 18:07 button.c
pi@Pi3B:~/pico/pico-examples/picoboard/button $ 
Though I had forgotten how to, I am pretty sure I have built 'pico-examples' in the past. I am not at all sure how 'CMakeLists.txt' could have disappeared. I have had no reason to venture into the 'pico-examples' sub-directories, remove anything from those.
pidd wrote:
Mon Jul 19, 2021 12:22 pm
I can only suggest you do what I ended up doing, deleting the whole SDK and re-installing. I guess the SDK's git pull might not update pico-examples?

Or if you are git-clever (that's definitely not me), you could pull pico-examples.
I'm not git clever either but I was git-pulling just 'pico-examples' in the above. It reports "Already up to date". Same for 'pico-sdk'.

I removed the existing 'pico-examples' and reinstalled with a new 'git clone'. That seemed to have done the trick. Which makes me question why 'git pull' on 'pico-examples' was reporting it was "Already up to date" when it wasn't.

And I am not out of the woods yet. It sailed through 'cmake ..' and 'make' appears to building a variety of things, but, when it hits 'adc_console' ...

Code: Select all

[  5%] Linking CXX executable adc_console.elf
[  5%] Built target adc_console
Scanning dependencies of target PioasmBuild
[  5%] Creating directories for 'PioasmBuild'
[  5%] No download step for 'PioasmBuild'
[  5%] No patch step for 'PioasmBuild'
[  5%] No update step for 'PioasmBuild'
[  5%] Performing configure step for 'PioasmBuild'
-- Could NOT find BISON: Found unsuitable version "3.3.2", but required is at least "3.4.2" (found /usr/bin/bison)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/pico/pico-sdk/tools/pioasm
[  5%] Performing build step for 'PioasmBuild'
make[3]: *** No targets specified and no makefile found.  Stop.
make[2]: *** [adc/dma_capture/CMakeFiles/PioasmBuild.dir/build.make:112: adc/dma_capture/pioasm/src/PioasmBuild-stamp/PioasmBuild-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:4520: adc/dma_capture/CMakeFiles/PioasmBuild.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
I guess it is a case of reinstall and git clone 'pico-sdk' et al from scratch, even though 'git pull' on 'pico-sdk' also reports that as 'Already up to date'.

I am starting to feel sympathy with some who posit : Pi Pico - the most user un-friendly MCU?

hippy
Posts: 10553
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to compile pico-playground/net/usb_host_webserver?

Mon Jul 19, 2021 1:16 pm

Grrr ... Reinstalled 'pico-sdk' and it's still not working. Did a "hash -r" to flush any cached executables ...

Code: Select all

[  5%] Linking CXX executable adc_console.elf
[  5%] Built target adc_console
[  5%] Performing build step for 'PioasmBuild'
make[3]: *** No targets specified and no makefile found.  Stop.
make[2]: *** [adc/dma_capture/CMakeFiles/PioasmBuild.dir/build.make:112: adc/dma_capture/pioasm/src/PioasmBuild-stamp/PioasmBuild-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:4520: adc/dma_capture/CMakeFiles/PioasmBuild.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
This is utterly frustrating. if a full re-install doesn't make 'pico-sdk' work then I am not sure what will :?

pidd
Posts: 2509
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: How to compile pico-playground/net/usb_host_webserver?

Mon Jul 19, 2021 1:39 pm

Did you delete all the pico directory (pico-sdk, pico-examples etc) first?

Possibly check your environment for anything strange.

Code: Select all

env
On another thread there was a rogue compiler= in the environment which was installed by something else.

I'm reasonably happy with the SDK itself, it is cmake and git that catch me. Even my lifelong enemy "C" is looking a lot friendlier now (until it doesn't).

Return to “SDK”