From 26bb4ffe79064d736591ff65709346c23c2c91f0 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Tue, 25 May 2021 03:38:06 +0800 Subject: [PATCH 1/6] windows build wip --- docs/software/windows-build-instructions.md | 7 +++++++ src/RedirectablePrint.cpp | 3 +++ src/graphics/Screen.h | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 docs/software/windows-build-instructions.md diff --git a/docs/software/windows-build-instructions.md b/docs/software/windows-build-instructions.md new file mode 100644 index 000000000..9a7ec19e8 --- /dev/null +++ b/docs/software/windows-build-instructions.md @@ -0,0 +1,7 @@ + + +* install python +* install git (including git-bash) +* install platformio +* install vscode +* install https://sourceforge.net/projects/mingw-w64/ (for windows gcc/g++) - you'll need to add the bin directory to your PATH diff --git a/src/RedirectablePrint.cpp b/src/RedirectablePrint.cpp index 4c460d77f..aeee519b8 100644 --- a/src/RedirectablePrint.cpp +++ b/src/RedirectablePrint.cpp @@ -4,6 +4,9 @@ #include #include #include +#include + +using namespace std; /** * A printer that doesn't go anywhere diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 9be119a48..c0518f7c0 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -26,6 +27,8 @@ #define BRIGHTNESS_DEFAULT 150 #endif +using namespace std; + namespace graphics { From abe95ae1a42cf8d3d00b068590c0abefcc4fc904 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Tue, 25 May 2021 05:08:57 +0800 Subject: [PATCH 2/6] most of the changes needed to build native on Windows --- src/RedirectablePrint.cpp | 2 -- src/graphics/Screen.h | 2 -- src/mesh/PacketHistory.h | 6 ++---- src/mesh/ReliableRouter.h | 4 ++-- src/portduino/wifi-stubs.cpp | 1 - src/{nrf52 => }/wifi-stubs.cpp | 0 6 files changed, 4 insertions(+), 11 deletions(-) delete mode 120000 src/portduino/wifi-stubs.cpp rename src/{nrf52 => }/wifi-stubs.cpp (100%) diff --git a/src/RedirectablePrint.cpp b/src/RedirectablePrint.cpp index ca6bdb142..3f920f641 100644 --- a/src/RedirectablePrint.cpp +++ b/src/RedirectablePrint.cpp @@ -7,8 +7,6 @@ #include #include -using namespace std; - /** * A printer that doesn't go anywhere */ diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index e17fda0d6..65e7b0a12 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -44,8 +44,6 @@ class Screen #define BRIGHTNESS_DEFAULT 150 #endif -using namespace std; - namespace graphics { diff --git a/src/mesh/PacketHistory.h b/src/mesh/PacketHistory.h index d390915a2..8deee092e 100644 --- a/src/mesh/PacketHistory.h +++ b/src/mesh/PacketHistory.h @@ -4,8 +4,6 @@ #include #include -using namespace std; - /// We clear our old flood record five minute after we see the last of it #define FLOOD_EXPIRE_TIME (5 * 60 * 1000L) @@ -23,7 +21,7 @@ struct PacketRecord { class PacketRecordHashFunction { public: - size_t operator()(const PacketRecord &p) const { return (hash()(p.sender)) ^ (hash()(p.id)); } + size_t operator()(const PacketRecord &p) const { return (std::hash()(p.sender)) ^ (std::hash()(p.id)); } }; /// Order packet records by arrival time, we want the oldest packets to be in the front of our heap @@ -54,7 +52,7 @@ class PacketHistory /** FIXME: really should be a std::unordered_set with the key being sender,id. * This would make checking packets in wasSeenRecently faster. */ - vector recentPackets; + std::vector recentPackets; // priority_queue, PacketRecordOrderFunction> arrivalTimes; // unordered_set recentPackets; diff --git a/src/mesh/ReliableRouter.h b/src/mesh/ReliableRouter.h index 7299d1c18..e0890ff28 100644 --- a/src/mesh/ReliableRouter.h +++ b/src/mesh/ReliableRouter.h @@ -51,7 +51,7 @@ struct PendingPacket { class GlobalPacketIdHashFunction { public: - size_t operator()(const GlobalPacketId &p) const { return (hash()(p.node)) ^ (hash()(p.id)); } + size_t operator()(const GlobalPacketId &p) const { return (std::hash()(p.node)) ^ (std::hash()(p.id)); } }; /** @@ -60,7 +60,7 @@ class GlobalPacketIdHashFunction class ReliableRouter : public FloodingRouter { private: - unordered_map pending; + std::unordered_map pending; public: /** diff --git a/src/portduino/wifi-stubs.cpp b/src/portduino/wifi-stubs.cpp deleted file mode 120000 index b90e66295..000000000 --- a/src/portduino/wifi-stubs.cpp +++ /dev/null @@ -1 +0,0 @@ -../nrf52/wifi-stubs.cpp \ No newline at end of file diff --git a/src/nrf52/wifi-stubs.cpp b/src/wifi-stubs.cpp similarity index 100% rename from src/nrf52/wifi-stubs.cpp rename to src/wifi-stubs.cpp From 6b5658302375160ad629d9aed63b875231e89ebe Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Tue, 25 May 2021 11:18:36 +0800 Subject: [PATCH 3/6] copy windows install scripts into build dir --- bin/build-all.sh | 2 +- geeksville-private/TODO.md | 4 ++-- proto | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/build-all.sh b/bin/build-all.sh index 096488f22..a821737c4 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -98,6 +98,6 @@ XML echo Generating $ARCHIVEDIR/firmware-$VERSION.zip rm -f $ARCHIVEDIR/firmware-$VERSION.zip -zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $ARCHIVEDIR/spiffs-$VERSION.bin $OUTDIR/bins/universal/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh +zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $ARCHIVEDIR/spiffs-$VERSION.bin $OUTDIR/bins/universal/firmware-*-$VERSION.* images/system-info.bin bin/device-install.* bin/device-update.* echo BUILT ALL diff --git a/geeksville-private/TODO.md b/geeksville-private/TODO.md index 2e0a1399a..7edacb356 100644 --- a/geeksville-private/TODO.md +++ b/geeksville-private/TODO.md @@ -2,10 +2,10 @@ You probably don't care about this section - skip to the next one. -* admin remote nodes reboot sometimes https://github.com/meshtastic/Meshtastic-device/issues/811 +* list portduino on platformio +* add crash logging to flash and use memory pools - admin remote nodes reboot sometimes https://github.com/meshtastic/Meshtastic-device/issues/811 * router mode dropping messages? https://meshtastic.discourse.group/t/router-mode-missing-messages/3329/3 * fix ttgo eink screen -* list portduino on platformio * figure our wss for mqtt.meshtastic - use cloudflare? 2052 ws, 2053 crypt * pine64 lora module * @havealoha fixedposition not working diff --git a/proto b/proto index dfcfba8d1..f604be5bb 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit dfcfba8d1a6bad4233436c39f0571df878f8d2d2 +Subproject commit f604be5bb2ada77c6205617b500d406b629a44b8 From 29ff778e22fa54c622b13de6056f796fa40dca31 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Wed, 26 May 2021 10:00:23 +0800 Subject: [PATCH 4/6] fix #811 nodes rebooting due to invalid printf call, thanks @IZ1IVA Ouch, this was nasty - printf format string wasn't matching the parameters passed in causing a NPE due to a missing last param. I'll investigate why printf format strings were not being checked by the compiler (normally gcc offers that feature) --- src/mesh/mesh-pb-constants.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/mesh-pb-constants.cpp b/src/mesh/mesh-pb-constants.cpp index eab15799a..e7ccf45a3 100644 --- a/src/mesh/mesh-pb-constants.cpp +++ b/src/mesh/mesh-pb-constants.cpp @@ -18,7 +18,7 @@ size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize); if (!pb_encode(&stream, fields, src_struct)) { - DEBUG_MSG("Panic: can't encode protobuf reason='%s', reason=%s\n", PB_GET_ERROR(&stream)); + DEBUG_MSG("Panic: can't encode protobuf reason='%s'\n", PB_GET_ERROR(&stream)); assert(0); // If this asser fails it probably means you made a field too large for the max limits specified in mesh.options } else { return stream.bytes_written; @@ -30,7 +30,7 @@ bool pb_decode_from_bytes(const uint8_t *srcbuf, size_t srcbufsize, const pb_msg { pb_istream_t stream = pb_istream_from_buffer(srcbuf, srcbufsize); if (!pb_decode(&stream, fields, dest_struct)) { - DEBUG_MSG("Error: can't decode protobuf reason='%s', pb_msgdesc 0x%p, reason=%s\n", PB_GET_ERROR(&stream), fields); + DEBUG_MSG("Error: can't decode protobuf reason='%s', pb_msgdesc 0x%p\n", PB_GET_ERROR(&stream), fields); return false; } else { return true; From e7e09cb7ed0b9c27ec1501a1f0df41f58b9be081 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Wed, 26 May 2021 10:20:44 +0800 Subject: [PATCH 5/6] fix wifistubs to not be on esp32 --- src/wifi-stubs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wifi-stubs.cpp b/src/wifi-stubs.cpp index 6051e195c..3d110c723 100644 --- a/src/wifi-stubs.cpp +++ b/src/wifi-stubs.cpp @@ -1,7 +1,7 @@ //#include "mesh/wifi/WebServer.h" #include "configuration.h" -#ifndef NO_ESP32 +#ifdef NO_ESP32 //#include "mesh/wifi/WiFiAPClient.h" From 42f31540795e341d262786f6ee709d46b2f1e192 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Wed, 26 May 2021 10:21:26 +0800 Subject: [PATCH 6/6] store elfs (for later debugging) in github artifacts --- .github/workflows/main.yml | 9 ++++++++- .github/workflows/release.yml | 14 ++++++++++++-- bin/build-all.sh | 4 ++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9b1424419..8c0f0eb1a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,9 +78,16 @@ jobs: - name: Build everything run: bin/build-all.sh - - name: Store release zip as an artifact + - name: Store binaries as an artifact uses: actions/upload-artifact@v2 with: name: built path: release/archive/firmware-*.zip retention-days: 30 + + - name: Store debugging elf files as an artifact + uses: actions/upload-artifact@v2 + with: + name: debug-elfs + path: release/archive/elfs-*.zip + retention-days: 7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 470614817..3403a145d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,7 +69,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} - - name: Add artifact to release + - name: Add bins to release uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} @@ -77,4 +77,14 @@ jobs: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: release/archive/firmware-${{ steps.version.outputs.version }}.zip asset_name: firmware-${{ steps.version.outputs.version }}.zip - asset_content_type: application/zip \ No newline at end of file + asset_content_type: application/zip + + - name: Add debug elfs to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: release/archive/elfs-${{ steps.version.outputs.version }}.zip + asset_name: debug-elfs-${{ steps.version.outputs.version }}.zip + asset_content_type: application/zip \ No newline at end of file diff --git a/bin/build-all.sh b/bin/build-all.sh index a821737c4..dc614cf6f 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -10,6 +10,7 @@ BOARDS_ESP32="tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v2.0 helt # FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine BOARDS_NRF52="rak4631 t-echo" +#BOARDS_NRF52="" OUTDIR=release/latest @@ -99,5 +100,8 @@ XML echo Generating $ARCHIVEDIR/firmware-$VERSION.zip rm -f $ARCHIVEDIR/firmware-$VERSION.zip zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $ARCHIVEDIR/spiffs-$VERSION.bin $OUTDIR/bins/universal/firmware-*-$VERSION.* images/system-info.bin bin/device-install.* bin/device-update.* +echo Generating $ARCHIVEDIR/elfs-$VERSION.zip +rm -f $ARCHIVEDIR/elfs-$VERSION.zip +zip --junk-paths $ARCHIVEDIR/elfs-$VERSION.zip $OUTDIR/elfs/universal/firmware-*-$VERSION.* echo BUILT ALL