edgeimpulse / firmware-syntiant-tinyml

Edge Impulse firmware for Syntiant TinyML board
Apache License 2.0
20 stars 8 forks source link

Unable to compile with Arduino IDE on Windows 10 #4

Closed Elsklivet closed 2 years ago

Elsklivet commented 2 years ago

After running update_libraries_windows.bat and selecting MKRZero, I am not able to compile the firmware in the Arduino IDE on Windows 10.

I am on Windows 10, using Arduino IDE v1.8.19 installed from the Windows Store (Windows Store v1.8.57.0), Edge Impulse CLI v1.15.0, and Arduino CLI v0.22.0. (I do not believe the Arduino CLI version is the issue. I have succeeded in getting this to compile on an Ubuntu machine with no edits to the source by using Arduino CLI v0.22.0 and not the IDE, so I know it is not just that the CLI is too recent, as it works perfectly with the bash build script. Interestingly, Arduino IDE v1.8.19 runs into the same compilation error on Ubuntu.)

I first run into this:

...\firmware-syntiant-tinyml\src\QCBOR\src\UsefulBuf.c:56:10: fatal error: UsefulBuf.h: No such file or directory
 #include "UsefulBuf.h"
          ^~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino MKRZERO.

This is roughly the same error message mentioned in this issue, which was closed without a solution being posted: #3

I saw that edgeimpulse/firmware-syntiant-tinyml@5bad031bfd6733c7a07bb1eb348367f21595e26e included additions to the arduino-build.sh script to change the INCLUDE environment variable, but the include paths are still broken for IDE users. I went through and fixed all of the include directives throughout the repository locally, which resolved all of the "No such file or directory" errors. However, I then got an even longer string of errors about undeclared variables and redefined macros:

In file included from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:29:0:
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.h:36:2: error: #error "EI_SENSOR_AQ_STREAM not defined, and not on POSIX system. Please specify the EI_SENSOR_AQ_STREAM macro"
 #error "EI_SENSOR_AQ_STREAM not defined, and not on POSIX system. Please specify the EI_SENSOR_AQ_STREAM macro"
  ^~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.h:141:51: error: 'EI_SENSOR_AQ_STREAM' has not been declared
     size_t (*fwrite)(const void*, size_t, size_t, EI_SENSOR_AQ_STREAM*);
                                                   ^~~~~~~~~~~~~~~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.h:142:21: error: 'EI_SENSOR_AQ_STREAM' has not been declared
     int    (*fseek)(EI_SENSOR_AQ_STREAM*, long int, int);
                     ^~~~~~~~~~~~~~~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.h:160:5: error: 'EI_SENSOR_AQ_STREAM' does not name a type
     EI_SENSOR_AQ_STREAM *stream;
     ^~~~~~~~~~~~~~~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.h:191:78: error: 'EI_SENSOR_AQ_STREAM' has not been declared
 int sensor_aq_init(sensor_aq_ctx *ctx, sensor_aq_payload_info *payload_info, EI_SENSOR_AQ_STREAM *stream, bool allow_empty_stream);
                                                                              ^~~~~~~~~~~~~~~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp: In function 'size_t ei_fwrite(sensor_aq_ctx*, const void*, size_t, size_t)':
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:49:14: error: 'struct sensor_aq_ctx' has no member named 'stream'
     if (ctx->stream == NULL) {
              ^~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:53:63: error: 'struct sensor_aq_ctx' has no member named 'stream'
     size_t items_written = ctx->fwrite(ptr, size, count, ctx->stream);
                                                               ^~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp: In function 'int ei_fseek(sensor_aq_ctx*, long int, int)':
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:62:14: error: 'struct sensor_aq_ctx' has no member named 'stream'
     if (ctx->stream == NULL) {
              ^~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:66:28: error: 'struct sensor_aq_ctx' has no member named 'stream'
     return ctx->fseek(ctx->stream, offset, origin);
                            ^~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp: In function 'int sensor_aq_update_sig_and_write_to_file(sensor_aq_ctx*, uint8_t*, size_t)':
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:82:14: error: 'struct sensor_aq_ctx' has no member named 'stream'
     if (ctx->stream == NULL) {
              ^~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp: In function 'int sensor_aq_flush_buffer(sensor_aq_ctx*)':
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:104:14: error: 'struct sensor_aq_ctx' has no member named 'stream'
     if (ctx->stream == NULL) {
              ^~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp: At global scope:
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:135:78: error: 'EI_SENSOR_AQ_STREAM' has not been declared
 int sensor_aq_init(sensor_aq_ctx *ctx, sensor_aq_payload_info *payload_info, EI_SENSOR_AQ_STREAM *stream, bool allow_empty_stream = false) {
                                                                              ^~~~~~~~~~~~~~~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp: In function 'int sensor_aq_init(sensor_aq_ctx*, sensor_aq_payload_info*, int*, bool)':
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:166:10: error: 'struct sensor_aq_ctx' has no member named 'stream'
     ctx->stream = stream;
          ^~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp: In function 'int sensor_aq_add_data(sensor_aq_ctx*, float*, size_t)':
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:332:14: error: 'struct sensor_aq_ctx' has no member named 'stream'
     if (ctx->stream == NULL) {
              ^~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp: In function 'int sensor_aq_add_data_i16(sensor_aq_ctx*, int16_t*, size_t)':
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:371:14: error: 'struct sensor_aq_ctx' has no member named 'stream'
     if (ctx->stream == NULL) {
              ^~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp: In function 'int sensor_aq_add_data_batch(sensor_aq_ctx*, int16_t*, size_t)':
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:434:14: error: 'struct sensor_aq_ctx' has no member named 'stream'
     if (ctx->stream == NULL) {
              ^~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp: In function 'int sensor_aq_finish(sensor_aq_ctx*)':
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.cpp:462:14: error: 'struct sensor_aq_ctx' has no member named 'stream'
     if (ctx->stream == NULL) {
              ^~~~~~
In file included from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\ei_fusion.h:29:0,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\ei_fusion.cpp:29:
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.h:36:2: error: #error "EI_SENSOR_AQ_STREAM not defined, and not on POSIX system. Please specify the EI_SENSOR_AQ_STREAM macro"
 #error "EI_SENSOR_AQ_STREAM not defined, and not on POSIX system. Please specify the EI_SENSOR_AQ_STREAM macro"
  ^~~~~
In file included from ...\Arduino\libraries\Adafruit_ASFcore/tc.h:458:0,
                 from ...\Arduino\libraries\Adafruit_ZeroTimer_Library/Adafruit_ZeroTimer.h:11,
                 from ...\Arduino\libraries\avdweb_SAMDtimer/avdweb_SAMDtimer.h:12,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:55:
...\Arduino\libraries\Adafruit_ASFcore/compiler.h:176:0: warning: "WEAK" redefined
 #   define WEAK __attribute__ ((weak))

In file included from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:50:0:
...\Arduino\libraries\NDP\src/NDP.h:55:0: note: this is the location of the previous definition
 #define WEAK __attribute__((weak))

In file included from ...\Arduino\libraries\Adafruit_ASFcore/tc.h:458:0,
                 from ...\Arduino\libraries\Adafruit_ZeroTimer_Library/Adafruit_ZeroTimer.h:11,
                 from ...\Arduino\libraries\avdweb_SAMDtimer/avdweb_SAMDtimer.h:12,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:55:
...\Arduino\libraries\Adafruit_ASFcore/compiler.h:729:0: warning: "min" redefined
 #define min(a, b)   Min(a, b)

In file included from ...\Arduino\libraries\AudioUSB\src/AudioUSB.h:11:0,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:44:
...\ArduinoData\packages\arduino\hardware\samd\1.8.9\cores\arduino/Arduino.h:100:0: note: this is the location of the previous definition
 #define min(a,b) ((a)<(b)?(a):(b))

In file included from ...\Arduino\libraries\Adafruit_ASFcore/tc.h:458:0,
                 from ...\Arduino\libraries\Adafruit_ZeroTimer_Library/Adafruit_ZeroTimer.h:11,
                 from ...\Arduino\libraries\avdweb_SAMDtimer/avdweb_SAMDtimer.h:12,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:55:
...\Arduino\libraries\Adafruit_ASFcore/compiler.h:740:0: warning: "max" redefined
 #define max(a, b)   Max(a, b)

In file included from ...\Arduino\libraries\AudioUSB\src/AudioUSB.h:11:0,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:44:
...\ArduinoData\packages\arduino\hardware\samd\1.8.9\cores\arduino/Arduino.h:101:0: note: this is the location of the previous definition
 #define max(a,b) ((a)>(b)?(a):(b))

In file included from ...\Arduino\libraries\Adafruit_ASFcore/tc.h:458:0,
                 from ...\Arduino\libraries\Adafruit_ZeroTimer_Library/Adafruit_ZeroTimer.h:11,
                 from ...\Arduino\libraries\avdweb_SAMDtimer/avdweb_SAMDtimer.h:12,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:55:
...\Arduino\libraries\Adafruit_ASFcore/compiler.h:945:0: warning: "LOW" redefined
 #define LOW       0

In file included from ...\ArduinoData\packages\arduino\hardware\samd\1.8.9\cores\arduino/Arduino.h:50:0,
                 from ...\Arduino\libraries\AudioUSB\src/AudioUSB.h:11,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:44:
...\ArduinoData\packages\arduino\hardware\samd\1.8.9\cores\arduino/wiring_constants.h:26:0: note: this is the location of the previous definition
 #define LOW             (0x0)

In file included from ...\Arduino\libraries\Adafruit_ASFcore/tc.h:458:0,
                 from ...\Arduino\libraries\Adafruit_ZeroTimer_Library/Adafruit_ZeroTimer.h:11,
                 from ...\Arduino\libraries\avdweb_SAMDtimer/avdweb_SAMDtimer.h:12,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:55:
...\Arduino\libraries\Adafruit_ASFcore/compiler.h:946:0: warning: "HIGH" redefined
 #define HIGH      1

In file included from ...\ArduinoData\packages\arduino\hardware\samd\1.8.9\cores\arduino/Arduino.h:50:0,
                 from ...\Arduino\libraries\AudioUSB\src/AudioUSB.h:11,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:44:
...\ArduinoData\packages\arduino\hardware\samd\1.8.9\cores\arduino/wiring_constants.h:27:0: note: this is the location of the previous definition
 #define HIGH            (0x1)

In file included from ...\Arduino\libraries\Adafruit_ZeroTimer_Library/Adafruit_ZeroTimer.h:11:0,
                 from ...\Arduino\libraries\avdweb_SAMDtimer/avdweb_SAMDtimer.h:12,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:55:
...\Arduino\libraries\Adafruit_ASFcore/tc.h:466:0: warning: "SAMD21G" redefined
  #define SAMD21G    1

In file included from ...\Arduino\libraries\avdweb_SAMDtimer/avdweb_SAMDtimer.h:12:0,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:55:
...\Arduino\libraries\Adafruit_ZeroTimer_Library/Adafruit_ZeroTimer.h:4:0: note: this is the location of the previous definition
   #define SAMD21G

In file included from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\ei_fusion.h:29:0,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\ei_fusion.cpp:29:
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.h:141:51: error: 'EI_SENSOR_AQ_STREAM' has not been declared
     size_t (*fwrite)(const void*, size_t, size_t, EI_SENSOR_AQ_STREAM*);
                                                   ^~~~~~~~~~~~~~~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.h:142:21: error: 'EI_SENSOR_AQ_STREAM' has not been declared
     int    (*fseek)(EI_SENSOR_AQ_STREAM*, long int, int);
                     ^~~~~~~~~~~~~~~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.h:160:5: error: 'EI_SENSOR_AQ_STREAM' does not name a type
     EI_SENSOR_AQ_STREAM *stream;
     ^~~~~~~~~~~~~~~~~~~
...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\firmware-sdk\sensor_aq.h:191:78: error: 'EI_SENSOR_AQ_STREAM' has not been declared
 int sensor_aq_init(sensor_aq_ctx *ctx, sensor_aq_payload_info *payload_info, EI_SENSOR_AQ_STREAM *stream, bool allow_empty_stream);
                                                                              ^~~~~~~~~~~~~~~~~~~
In file included from ...\arduino\libraries\hid-project\src\hid-apis\KeyboardAPI.h:29:0,
                 from ...\arduino\libraries\hid-project\src\hid-apis\defaultkeyboardapi.h:27,
                 from ...\Arduino\libraries\HID-Project\src/SingleReport/BootKeyboard.h:30,
                 from ...\Arduino\libraries\HID-Project\src/HID-Project.h:50,
                 from ...\firmware-syntiant-tinyml-master\firmware-syntiant-tinyml\src\syntiant.cpp:53:
...\arduino\libraries\hid-project\src\keyboardlayouts\improvedkeylayouts.h:54:18: note: #pragma message: Using default ASCII layout for keyboard modules
  #pragma message "Using default ASCII layout for keyboard modules"
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exit status 1
Error compiling for board Arduino MKRZERO.

Are there other steps Windows users should take to compile the firmware than the ones described in the README?

SolomonGithu commented 2 years ago

Try the initial commit version. Works even on windows

Elsklivet commented 2 years ago

One of the most recent commits (probably edgeimpulse/firmware-syntiant-tinyml@0e97cf968e716e53710a0e8e4e4f25a21b0fa805) seems to have fixed the issue, and I'm able to compile it on Windows with the Arduino IDE now. Thank you!