diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 829fc965..edcb37b0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -99,70 +99,38 @@ jobs: fail-fast: false matrix: example: - - name: esp32/device-dashboard - path: esp32/device-dashboard - - name: esp32/uart-bridge - path: esp32/uart-bridge - - name: esp8266 - path: esp8266 - - name: stm32-freertos-tcp - path: stm32/stm32-freertos-tcp - - name: stm32-nucleo-f746z - path: stm32/stm32-nucleo-f746z - - name: stm32-nucleo-f746zg - path: stm32/stm32-nucleo-f746zg - - name: stm32-nucleo-f429z - path: stm32/stm32-nucleo-f429z - - name: stm32-nucleo-h743z - path: stm32/stm32-nucleo-h743z - - name: stm32-nucleo-f429zi-baremetal - path: stm32/nucleo-f429zi-baremetal - - name: stm32-nucleo-f746zg-baremetal - path: stm32/nucleo-f746zg-baremetal - - name: nxp-mimxrt1020-azurertos - path: nxp/nxp-mimxrt1020-azurertos - - name: nxp-frdmk66f-freertos - path: nxp/nxp-frdmk66f-freertos - - name: nxp-lpcxpresso54s018m-freertos - path: nxp/nxp-lpcxpresso54s018m-freertos - - name: nxp-mimxrt1020-freertos - path: nxp/nxp-mimxrt1020-freertos - - name: nxp-evkbimxrt1050-lwip-freertos - path: nxp/nxp-evkbimxrt1050-lwip-freertos - - name: nxp-evkmimxrt1020-lwip-freertos - path: nxp/nxp-evkmimxrt1020-lwip-freertos - - name: nxp-evkmimxrt1024-lwip-freertos - path: nxp/nxp-evkmimxrt1024-lwip-freertos - - name: nxp-evkmimxrt1060-lwip-freertos - path: nxp/nxp-evkmimxrt1060-lwip-freertos - - name: nxp-evkmimxrt1064-lwip-freertos - path: nxp/nxp-evkmimxrt1064-lwip-freertos - - name: nxp-evkmimxrt1160-cm7-lwip-freertos - path: nxp/nxp-evkmimxrt1160-cm7-lwip-freertos - - name: nxp-evkmimxrt1170-cm7-lwip-freertos - path: nxp/nxp-evkmimxrt1170-cm7-lwip-freertos - - name: nxp-frdmk64f-lwip-freertos - path: nxp/nxp-frdmk64f-lwip-freertos - - name: nxp-frdmk66f-lwip-freertos - path: nxp/nxp-frdmk66f-lwip-freertos - - name: nxp-lpcxpresso54018-lwip-freertos - path: nxp/nxp-lpcxpresso54018-lwip-freertos - - name: nxp-lpcxpresso54608-lwip-freertos - path: nxp/nxp-lpcxpresso54608-lwip-freertos - - name: nxp-lpcxpresso54618-lwip-freertos - path: nxp/nxp-lpcxpresso54618-lwip-freertos - - name: nxp-lpcxpresso54628-lwip-freertos - path: nxp/nxp-lpcxpresso54628-lwip-freertos - - name: nxp-twrk65f180m-lwip-freertos - path: nxp/nxp-twrk65f180m-lwip-freertos - - name: nxp-twrkv58f220m-lwip-freertos - path: nxp/nxp-twrkv58f220m-lwip-freertos - - name: infineon-xmc4700_4800-lwip-rtx-rtos - path: infineon/infineon-xmc4700_4800-lwip-rtx-rtos - - name: ti - path: ti/ti-ek-tm4c1294xl-http-server - - name: pico-w - path: raspberry/raspberry-pi-pico-w + - path: esp32/device-dashboard + - path: esp32/uart-bridge + - path: esp8266 + - path: stm32/stm32-freertos-tcp + - path: stm32/stm32-nucleo-f746z + - path: stm32/stm32-nucleo-f746zg + - path: stm32/stm32-nucleo-f429z + - path: stm32/stm32-nucleo-h743z + - path: stm32/nucleo-f429zi-baremetal + - path: stm32/nucleo-f746zg-baremetal + - path: nxp/nxp-mimxrt1020-azurertos + - path: nxp/nxp-frdmk66f-freertos + - path: nxp/nxp-lpcxpresso54s018m-freertos + - path: nxp/nxp-mimxrt1020-freertos + - path: nxp/nxp-evkbimxrt1050-lwip-freertos + - path: nxp/nxp-evkmimxrt1020-lwip-freertos + - path: nxp/nxp-evkmimxrt1024-lwip-freertos + - path: nxp/nxp-evkmimxrt1060-lwip-freertos + - path: nxp/nxp-evkmimxrt1064-lwip-freertos + - path: nxp/nxp-evkmimxrt1160-cm7-lwip-freertos + - path: nxp/nxp-evkmimxrt1170-cm7-lwip-freertos + - path: nxp/nxp-frdmk64f-lwip-freertos + - path: nxp/nxp-frdmk66f-lwip-freertos + - path: nxp/nxp-lpcxpresso54018-lwip-freertos + - path: nxp/nxp-lpcxpresso54608-lwip-freertos + - path: nxp/nxp-lpcxpresso54618-lwip-freertos + - path: nxp/nxp-lpcxpresso54628-lwip-freertos + - path: nxp/nxp-twrk65f180m-lwip-freertos + - path: nxp/nxp-twrkv58f220m-lwip-freertos + - path: infineon/infineon-xmc4700_4800-lwip-rtx-rtos + - path: ti/ti-ek-tm4c1294xl-http-server + - path: raspberry/raspberry-pi-pico-w name: ${{ matrix.example.name }} steps: - uses: actions/checkout@v3 @@ -174,16 +142,11 @@ jobs: fail-fast: false matrix: zephyrexample: - - name: zephyr-device-dashboard - path: zephyr/device-dashboard - - name: zephyr-http-client - path: zephyr/http-client - - name: zephyr-http-server - path: zephyr/http-server - - name: zephyr-mqtt-aws-client - path: zephyr/mqtt-aws-client - - name: zephyr-websocket-server - path: zephyr/websocket-server + - path: zephyr/device-dashboard + - path: zephyr/http-client + - path: zephyr/http-server + - path: zephyr/mqtt-aws-client + - path: zephyr/websocket-server name: ${{ matrix.zephyrexample.name }} steps: - uses: actions/checkout@v3 diff --git a/examples/zephyr/http-client/Makefile b/examples/zephyr/http-client/Makefile index 1c329a82..d58c488d 100644 --- a/examples/zephyr/http-client/Makefile +++ b/examples/zephyr/http-client/Makefile @@ -1,59 +1,41 @@ -MONGOOSE_ROOT ?= $(realpath $(CURDIR)/../../..) -DOCKER_PROJECT_DIR ?= /workdir -ZEPHYR_DIR ?= zephyrproject -PROJECT_NAME = $(notdir $(CURDIR)) -PROJECT_PATH = $(realpath $(CURDIR)) -ZEPHYR_PATH = $(realpath $(CURDIR)/..)/$(ZEPHYR_DIR) -DOCKER_PROJECT_PATH = $(DOCKER_PROJECT_DIR)/$(PROJECT_NAME) -DOCKER_ZEPHYR_PATH = $(DOCKER_PROJECT_DIR)/$(ZEPHYR_DIR) - -BOARD ?= qemu_x86 -ifeq "$(BOARD)" "qemu_x86" -OVERLAY ?= -DOVERLAY_CONFIG=overlay-e1000.conf -else -OVERLAY ?= -endif - -SHAREUSB ?= --privileged -v /dev/bus/usb/:/dev/bus/usb -SHARETUN ?= --cap-add=NET_ADMIN --device /dev/net/tun --net=host -DOCKER ?= docker run --rm -v $(PROJECT_PATH):$(DOCKER_PROJECT_PATH) -v $(ZEPHYR_PATH):$(DOCKER_ZEPHYR_PATH) -REPO ?= zephyrprojectrtos/ci - +TOP_DIR ?= $(realpath $(CURDIR)/../../..) +ZEPHYR_DIR ?= $(realpath $(CURDIR)/..)/zephyrproject +DOCKER ?= docker run --rm \ + -v $(TOP_DIR):$(TOP_DIR) \ + -w $(realpath $(CURDIR)) \ + -e ZEPHYR_BASE=$(ZEPHYR_DIR)/zephyr \ + $(DOCKER_ARGS) zephyrprojectrtos/ci +#BUILD_ARGS ?= -b qemu_x86 -DOVERLAY_CONFIG=overlay-e1000.conf +BUILD_ARGS ?= -b nucleo_f429zi +.PHONY: build example: true -build: - cp $(MONGOOSE_ROOT)/mongoose.[c,h] src/ - $(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH)/zephyr && \ - west build -b $(BOARD) -p auto $(DOCKER_PROJECT_PATH) $(OVERLAY) --build-dir $(DOCKER_PROJECT_PATH)/build' +zephyr: + test -d $(ZEPHYR_DIR) || ( mkdir -p $(ZEPHYR_DIR) ; $(DOCKER) west init $(ZEPHYR_DIR)) + $(DOCKER) sh -c 'cd $(ZEPHYR_DIR) && west update' +build: + cp $(TOP_DIR)/mongoose.[c,h] src/ + $(DOCKER) west build $(BUILD_ARGS) -p auto $(realpath $(CURDIR)) + +run: DOCKER_ARGS ?= --cap-add=NET_ADMIN --device /dev/net/tun --net=host -it run: - $(DOCKER) -it $(SHARETUN) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \ - west build -t run --build-dir $(DOCKER_PROJECT_PATH)/build' + $(DOCKER) west build -t run clean: - $(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \ - west build -t clean --build-dir $(DOCKER_PROJECT_PATH)/build' + -$(DOCKER) west build -t clean pristine: - $(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \ - west build -t pristine --build-dir $(DOCKER_PROJECT_PATH)/build' + -$(DOCKER) west build -t pristine +purge: clean pristine + rm -rf $(TOP_DIR)/.west $(ZEPHYR_DIR) build +flash debug: DOCKER_ARGS ?= --privileged -v /dev/bus/usb/:/dev/bus/usb -it flash: - $(DOCKER) $(SHAREUSB) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \ - west flash --build-dir $(DOCKER_PROJECT_PATH)/build' + $(DOCKER) west flash --build-dir $(realpath $(CURDIR))/build debug: - $(DOCKER) -it $(SHAREUSB) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \ - west debug --build-dir $(DOCKER_PROJECT_PATH)/build' - -.PHONY: build flash zephyr clean pristine run - -zephyr: -ifeq ($(wildcard $(ZEPHYR_PATH)/.*),) - mkdir $(ZEPHYR_PATH) - $(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_PROJECT_DIR) && west init ./$(ZEPHYR_DIR)' -endif - $(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && west update' + $(DOCKER) west debug --build-dir $(realpath $(CURDIR))/build diff --git a/examples/zephyr/http-client/prj.conf b/examples/zephyr/http-client/prj.conf index 1c530a00..d4199066 100644 --- a/examples/zephyr/http-client/prj.conf +++ b/examples/zephyr/http-client/prj.conf @@ -13,11 +13,11 @@ CONFIG_NET_LOG=y CONFIG_LOG=y CONFIG_ISR_STACK_SIZE=2048 -CONFIG_MAIN_STACK_SIZE=16000 +CONFIG_MAIN_STACK_SIZE=8192 CONFIG_IDLE_STACK_SIZE=1024 CONFIG_MBEDTLS=y -CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=8192 +CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=4096 CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT=y CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y CONFIG_MBEDTLS_ECP_ALL_ENABLED=y diff --git a/examples/zephyr/http-client/src/mongoose.c b/examples/zephyr/http-client/src/mongoose.c index ee00a90c..971cda15 100644 --- a/examples/zephyr/http-client/src/mongoose.c +++ b/examples/zephyr/http-client/src/mongoose.c @@ -5614,7 +5614,6 @@ uint64_t mg_millis(void) { } #endif - #ifdef MG_ENABLE_LINES #line 1 "src/ws.c" #endif diff --git a/examples/zephyr/http-client/src/mongoose.h b/examples/zephyr/http-client/src/mongoose.h index 03f916ad..bd4049ba 100644 --- a/examples/zephyr/http-client/src/mongoose.h +++ b/examples/zephyr/http-client/src/mongoose.h @@ -293,6 +293,12 @@ struct timeval { #define EINTR pdFREERTOS_ERRNO_EINTR #endif +// FreeRTOS-TCP uses non-standard semantics for listen() backlog size. It is +// not a backlog size for pending SYN connections, but a max socket number +#ifndef MG_SOCK_LISTEN_BACKLOG_SIZE +#define MG_SOCK_LISTEN_BACKLOG_SIZE 128 +#endif + #endif // MG_ARCH == MG_ARCH_FREERTOS_TCP