diff --git a/examples/rp2040/pico-rmii/CMakeLists.txt b/examples/rp2040/pico-rmii/CMakeLists.txt index de31f712..de9dbce0 100644 --- a/examples/rp2040/pico-rmii/CMakeLists.txt +++ b/examples/rp2040/pico-rmii/CMakeLists.txt @@ -1,33 +1,26 @@ cmake_minimum_required(VERSION 3.13) include(pico-sdk/pico_sdk_init.cmake) -project(pico_rmii_ethernet) - -# initialize the Pico SDK +project(firmware) pico_sdk_init() -add_compile_definitions( - MIP_DEBUG=1 - MG_ENABLE_PACKED_FS=1 - MG_ENABLE_TCPIP=1 -) - add_executable(firmware - driver_rp2040_rmii.c - main.c - ../../../mongoose.c - ) + driver_rp2040_rmii.c + main.c + mongoose.c) target_include_directories(firmware PUBLIC - . - ../../.. -) - -# enable usb output, disable uart output -pico_enable_stdio_usb(firmware 1) -pico_enable_stdio_uart(firmware 0) + .) target_link_libraries(firmware hardware_pio hardware_dma pico_stdlib) +pico_add_extra_outputs(firmware) # create map/bin/hex file etc. -# create map/bin/hex file etc. -pico_add_extra_outputs(firmware) +pico_enable_stdio_usb(firmware 1) # Route stdio +pico_enable_stdio_uart(firmware 0) # to USB + +# Mongoose build flags +add_definitions(-DMG_ENABLE_TCPIP=1) +add_definitions(-DMG_ENABLE_PACKED_FS=1) + +# Extra build flags (enable if needed) +add_definitions(-DDUAL_CONFIG=0) diff --git a/examples/rp2040/pico-rmii/Makefile b/examples/rp2040/pico-rmii/Makefile index 584371e2..08adf5f2 100644 --- a/examples/rp2040/pico-rmii/Makefile +++ b/examples/rp2040/pico-rmii/Makefile @@ -1,16 +1,20 @@ -SDK_VERSION ?= 1.4.0 -SDK_REPO ?= https://github.com/raspberrypi/pico-sdk +RM = rm -rf +MKBUILD = test -d build || mkdir build +ifeq ($(OS),Windows_NT) + RM = cmd /C del /Q /F /S + MKBUILD = if not exist build mkdir build +endif all example: true build: pico-sdk - test -d build || mkdir build - cd build && cmake .. && make + $(MKBUILD) + cd build && cmake -G "Unix Makefiles" .. && make pico-sdk: - git clone --depth 1 -b $(SDK_VERSION) $(SDK_REPO) $@ + git clone --depth 1 -b 1.4.0 https://github.com/raspberrypi/pico-sdk $@ cd $@ && git submodule update --init clean: - rm -rf pico-sdk build + $(RM) pico-sdk build diff --git a/examples/rp2040/pico-rmii/mongoose.c b/examples/rp2040/pico-rmii/mongoose.c new file mode 120000 index 00000000..5e522bbc --- /dev/null +++ b/examples/rp2040/pico-rmii/mongoose.c @@ -0,0 +1 @@ +../../../mongoose.c \ No newline at end of file diff --git a/examples/rp2040/pico-rmii/mongoose.h b/examples/rp2040/pico-rmii/mongoose.h new file mode 120000 index 00000000..ee4ac823 --- /dev/null +++ b/examples/rp2040/pico-rmii/mongoose.h @@ -0,0 +1 @@ +../../../mongoose.h \ No newline at end of file diff --git a/examples/rp2040/pico-rndis-dashboard/CMakeLists.txt b/examples/rp2040/pico-rndis-dashboard/CMakeLists.txt index 9de6b2e5..e8bdcb99 100644 --- a/examples/rp2040/pico-rndis-dashboard/CMakeLists.txt +++ b/examples/rp2040/pico-rndis-dashboard/CMakeLists.txt @@ -8,18 +8,17 @@ add_executable(firmware main.c msc_disk.c usb_descriptors.c - ../../../mongoose.c - ../../device-dashboard/net.c - ../../device-dashboard/packed_fs.c + mongoose.c + net.c + packed_fs.c pico-sdk/lib/tinyusb/lib/networking/rndis_reports.c) target_include_directories(firmware PUBLIC . - ../../.. pico-sdk/lib/tinyusb/lib/networking) target_link_libraries(firmware pico_stdlib hardware_spi tinyusb_device) -pico_add_extra_outputs(firmware) +pico_add_extra_outputs(firmware) # create map/bin/hex file etc. pico_enable_stdio_usb(firmware 0) # Route stdio pico_enable_stdio_uart(firmware 1) # to the UART diff --git a/examples/rp2040/pico-rndis-dashboard/Makefile b/examples/rp2040/pico-rndis-dashboard/Makefile index 584371e2..08adf5f2 100644 --- a/examples/rp2040/pico-rndis-dashboard/Makefile +++ b/examples/rp2040/pico-rndis-dashboard/Makefile @@ -1,16 +1,20 @@ -SDK_VERSION ?= 1.4.0 -SDK_REPO ?= https://github.com/raspberrypi/pico-sdk +RM = rm -rf +MKBUILD = test -d build || mkdir build +ifeq ($(OS),Windows_NT) + RM = cmd /C del /Q /F /S + MKBUILD = if not exist build mkdir build +endif all example: true build: pico-sdk - test -d build || mkdir build - cd build && cmake .. && make + $(MKBUILD) + cd build && cmake -G "Unix Makefiles" .. && make pico-sdk: - git clone --depth 1 -b $(SDK_VERSION) $(SDK_REPO) $@ + git clone --depth 1 -b 1.4.0 https://github.com/raspberrypi/pico-sdk $@ cd $@ && git submodule update --init clean: - rm -rf pico-sdk build + $(RM) pico-sdk build diff --git a/examples/rp2040/pico-rndis-dashboard/mongoose.c b/examples/rp2040/pico-rndis-dashboard/mongoose.c new file mode 120000 index 00000000..5e522bbc --- /dev/null +++ b/examples/rp2040/pico-rndis-dashboard/mongoose.c @@ -0,0 +1 @@ +../../../mongoose.c \ No newline at end of file diff --git a/examples/rp2040/pico-rndis-dashboard/mongoose.h b/examples/rp2040/pico-rndis-dashboard/mongoose.h new file mode 120000 index 00000000..ee4ac823 --- /dev/null +++ b/examples/rp2040/pico-rndis-dashboard/mongoose.h @@ -0,0 +1 @@ +../../../mongoose.h \ No newline at end of file diff --git a/examples/rp2040/pico-rndis-dashboard/net.c b/examples/rp2040/pico-rndis-dashboard/net.c new file mode 120000 index 00000000..fe0e6f06 --- /dev/null +++ b/examples/rp2040/pico-rndis-dashboard/net.c @@ -0,0 +1 @@ +../../device-dashboard/net.c \ No newline at end of file diff --git a/examples/rp2040/pico-rndis-dashboard/packed_fs.c b/examples/rp2040/pico-rndis-dashboard/packed_fs.c new file mode 120000 index 00000000..e06bf092 --- /dev/null +++ b/examples/rp2040/pico-rndis-dashboard/packed_fs.c @@ -0,0 +1 @@ +../../device-dashboard/packed_fs.c \ No newline at end of file diff --git a/examples/rp2040/pico-w5500/CMakeLists.txt b/examples/rp2040/pico-w5500/CMakeLists.txt index c554cf74..861f51cd 100644 --- a/examples/rp2040/pico-w5500/CMakeLists.txt +++ b/examples/rp2040/pico-w5500/CMakeLists.txt @@ -4,20 +4,24 @@ include(pico-sdk/pico_sdk_init.cmake) project(firmware) pico_sdk_init() -add_executable(firmware main.c mongoose.c net.c packed_fs.c) +add_executable(firmware + main.c mongoose.c net.c packed_fs.c) + +target_include_directories(firmware PUBLIC + .) -target_include_directories(firmware PUBLIC .) target_link_libraries(firmware pico_stdlib hardware_spi pico_rand pico_mbedtls) -pico_add_extra_outputs(firmware) +pico_add_extra_outputs(firmware) # create map/bin/hex file etc. -# Enable USB output. Comment out in order to use UART -pico_enable_stdio_usb(firmware 0) -pico_enable_stdio_uart(firmware 1) +pico_enable_stdio_usb(firmware 0) # Route stdio +pico_enable_stdio_uart(firmware 1) # to the UART # Mongoose build flags -add_definitions(-DMG_ARCH=MG_ARCH_RP2040) add_definitions(-DMG_ENABLE_TCPIP=1) add_definitions(-DMG_ENABLE_PACKED_FS=1) add_definitions(-DMG_ENABLE_MBEDTLS=0) # TODO(cpq): enable add_definitions(-DMG_ENABLE_CUSTOM_RANDOM=1) add_definitions(-DMG_ENABLE_FILE=0) + +# Extra build flags (enable if needed) +add_definitions(-DDUAL_CONFIG=0) diff --git a/examples/rp2040/pico-w5500/Makefile b/examples/rp2040/pico-w5500/Makefile index 8d6d76c5..1e388660 100644 --- a/examples/rp2040/pico-w5500/Makefile +++ b/examples/rp2040/pico-w5500/Makefile @@ -1,21 +1,30 @@ -all example build obj/firmware.uf2: obj pico-sdk main.c net.c packed_fs.c - cd obj && cmake .. && make +RM = rm -rf +MKBUILD = test -d build || mkdir build +ifeq ($(OS),Windows_NT) + RM = cmd /C del /Q /F /S + MKBUILD = if not exist build mkdir build +endif + +all example: + true + +build build/firmware.uf2: pico-sdk + $(MKBUILD) + cd build && cmake -G "Unix Makefiles" .. && make -obj: - mkdir $@ pico-sdk: git clone --depth 1 -b 1.5.0 https://github.com/raspberrypi/pico-sdk $@ cd $@ && git submodule update --init -# Requires env variable VCON_API_KEY set +# Automated remote test. Requires env variable VCON_API_KEY set. See https://vcon.io/automated-firmware-tests/ DEVICE_URL ?= https://dash.vcon.io/api/v3/devices/3 -test: update - curl --fail -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt - grep 'Ethernet: up' /tmp/output.txt - grep 'MQTT connected' /tmp/output.txt +update: build/firmware.uf2 + curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/ota?uf2=1 --data-binary @$< -update: obj/firmware.uf2 - curl --fail -su :$(VCON_API_KEY) $(DEVICE_URL)/ota?uf2=1 --data-binary @$< +test: update + curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt + grep 'READY, IP:' /tmp/output.txt # Check for network init + grep 'MQTT connected' /tmp/output.txt # Check for MQTT connection success clean: - rm -rf pico-sdk obj + $(RM) pico-sdk build