diff --git a/extra_script.py b/extra_script.py index 5838f24..7dc4d53 100644 --- a/extra_script.py +++ b/extra_script.py @@ -281,5 +281,8 @@ def cleangenerated(source, target, env): print("#prescript...") prebuild(env) +env.Append( + LINKFLAGS=[ "-u", "custom_app_desc" ] +) #script does not run on clean yet - maybe in the future env.AddPostAction("clean",cleangenerated) diff --git a/src/main.cpp b/src/main.cpp index d35bb77..1fbce98 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,7 +11,6 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #define GWSTR(x) #x #define GWSTRINGIFY(x) GWSTR(x) #ifdef GWRELEASEVERSION @@ -56,6 +55,7 @@ const unsigned long HEAP_REPORT_TIME=2000; //set to 0 to disable heap reporting #include #include "GwJsonDocument.h" #include "N2kDataToNMEA0183.h" +#include #include "GwLog.h" @@ -76,6 +76,10 @@ const unsigned long HEAP_REPORT_TIME=2000; //set to 0 to disable heap reporting #include "GwStatistics.h" #include "GwUpdate.h" +#ifndef FIRMWARE_TYPE +#define FIRMWARE_TYPE PIO_ENV_BUILD +#endif + //NMEA message channels #define N2K_CHANNEL_ID 0 #define USB_CHANNEL_ID 1 @@ -87,9 +91,19 @@ const unsigned long HEAP_REPORT_TIME=2000; //set to 0 to disable heap reporting #define MAX_NMEA2000_MESSAGE_SEASMART_SIZE 500 #define MAX_NMEA0183_MESSAGE_SIZE 150 // For AIS -#ifndef FIRMWARE_TYPE -#define FIRMWARE_TYPE PIO_ENV_BUILD -#endif +__attribute__((section(".rodata_custom_desc"))) esp_app_desc_t custom_app_desc = { + ESP_APP_DESC_MAGIC_WORD, + 1, + {0,0}, + VERSION, + GWSTRINGIFY(FIRMWARE_TYPE), + "00:00:00", + "2021/12/13", + "0000", + {}, + {} +}; + String firmwareType(GWSTRINGIFY(FIRMWARE_TYPE));