From 8e46e05e1b14d85baf0de7c3ac17c7d90caac679 Mon Sep 17 00:00:00 2001 From: cpq Date: Fri, 11 Nov 2022 08:50:57 +0000 Subject: [PATCH] Fix arduino-xiao build and add GA test --- .github/workflows/test.yml | 5 +++++ Makefile | 17 ++++++++++++++++- examples/arduino/w5500/mongoose_custom.h | 2 ++ examples/arduino/w5500/w5500.ino | 10 ++++------ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a5173778..c8a1033e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,6 +62,11 @@ jobs: - run: make vc22 - run: make mingw - run: make mingw++ + arduino-xiao: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: make arduino-xiao arm: runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index 2c3226b6..078b9a0a 100644 --- a/Makefile +++ b/Makefile @@ -140,6 +140,21 @@ mingw: Makefile mongoose.h $(SRCS) $(DOCKER) mdashnet/mingw x86_64-w64-mingw32-gcc $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o $@.exe $(DOCKER) mdashnet/mingw wine64 $@.exe +arduino: ENV = -v $(CWD)/arduino:/root +arduino: + curl -sL http://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz | unxz | tar -xf - + mv arduino-* $@ + $(DOCKER) mdashnet/cc2 ./arduino/arduino --pref "boardsmanager.additional.urls=https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json" --save-prefs + $(DOCKER) mdashnet/cc2 ./arduino/arduino --pref "compiler.warning_level=all" --save-prefs + $(DOCKER) mdashnet/cc2 ./arduino/arduino --install-boards Seeeduino:samd + +arduino-xiao: ENV = -v $(CWD)/arduino:/root +arduino-xiao: arduino + rm -rf tmp; mkdir tmp + cp examples/arduino/w5500/w5500.ino tmp/tmp.ino + cp mongoose.c mongoose.h examples/arduino/w5500/mongoose_custom.h tmp/ + $(DOCKER) mdashnet/cc2 ./arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 tmp/tmp.ino + mingw++: Makefile mongoose.h $(SRCS) $(DOCKER) mdashnet/mingw x86_64-w64-mingw32-g++ $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o $@.exe @@ -163,5 +178,5 @@ mongoose.h: $(HDRS) Makefile (cat src/license.h; echo; echo '#ifndef MONGOOSE_H'; echo '#define MONGOOSE_H'; echo; cat src/version.h ; echo; echo '#ifdef __cplusplus'; echo 'extern "C" {'; echo '#endif'; cat src/arch.h src/arch_*.h src/net_*.h src/config.h src/str.h src/fmt.h src/log.h src/timer.h src/fs.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/tls_mbed.h src/tls_openssl.h src/ws.h src/sntp.h src/mqtt.h src/dns.h src/json.h src/rpc.h mip/mip.h mip/driver_*.h | sed -e '/keep/! s,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif'; echo '#endif // MONGOOSE_H')> $@ clean: - rm -rf $(PROG) *.exe *.o *.dSYM *_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out data.txt crash-* test/packed_fs.c pack + rm -rf $(PROG) *.exe *.o *.dSYM *_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out data.txt crash-* test/packed_fs.c pack arduino tmp @for X in $(EXAMPLES); do $(MAKE) -C $$X clean; done diff --git a/examples/arduino/w5500/mongoose_custom.h b/examples/arduino/w5500/mongoose_custom.h index 9d10e69a..ce27f4b1 100644 --- a/examples/arduino/w5500/mongoose_custom.h +++ b/examples/arduino/w5500/mongoose_custom.h @@ -4,9 +4,11 @@ #include #include +#include #include #define MG_ARCH MG_ARCH_CUSTOM #define MG_ENABLE_SOCKET 0 #define MG_ENABLE_MIP 1 +#define mkdir(a, b) (-1) //#define MG_ENABLE_LOG 0 diff --git a/examples/arduino/w5500/w5500.ino b/examples/arduino/w5500/w5500.ino index 503a531c..b2f1ed3a 100644 --- a/examples/arduino/w5500/w5500.ino +++ b/examples/arduino/w5500/w5500.ino @@ -22,12 +22,10 @@ void setup() { delay(3000); MG_INFO(("Starting TCP/IP stack...")); - struct mip_if mif = { - .mac = {0, 0, 1, 2, 3, 5}, - .use_dhcp = true, - .driver = &mip_driver_w5500, - .driver_data = &spi, - }; + struct mip_if mif = {.mac = {0, 0, 1, 2, 3, 5}}; + mif.use_dhcp = true; + mif.driver = &mip_driver_w5500; + mif.driver_data = &spi; mip_init(&mgr, &mif); // Start a 5 sec timer, print status message periodically