Update symlinks and Makefiles

This commit is contained in:
Sergio R. Caprile 2023-02-28 18:18:26 -03:00
parent aeb04deae4
commit 9cc70d0323
12 changed files with 77 additions and 58 deletions

View File

@ -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)

View File

@ -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

View File

@ -0,0 +1 @@
../../../mongoose.c

View File

@ -0,0 +1 @@
../../../mongoose.h

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@
../../../mongoose.c

View File

@ -0,0 +1 @@
../../../mongoose.h

View File

@ -0,0 +1 @@
../../device-dashboard/net.c

View File

@ -0,0 +1 @@
../../device-dashboard/packed_fs.c

View File

@ -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)

View File

@ -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