Compile error on Portenta H7

Hello, Me again :frowning:

I am attempting to compile the example-portenta-lorawan example with my own model for the Portenta H7, I am getting an error when trying to compile with my model, but everything works when attempting to compile the model in a clean pull of the repo. So whatever is going wrong is something that I am doing.

My image size is 64x64,
Single image recognition,
Grayscale
and using MobileNetV2 0.1
with version 0.13.0 of the Arduino-CLI - arduino-cli Version: 0.13.0 Commit: 693a045

The error I receive is:

/home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/add.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    In file included from /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/conv.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    In file included from /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/depthwise_conv.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    In file included from /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/fully_connected.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    In file included from /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/mul.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    In file included from /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/mbed.h:4:0,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/../../../../classifier/ei_classifier_config.h:29,
                     from /tmp/arduino-sketch-45116531070844582DF2F37665C60C4C/sketch/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/pooling.cpp:2:
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h: In function 'tflite::QuantizationParams tflite::ChooseQuantizationParams(double, double, bool)':
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:12: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:67:36: note: in expansion of macro 'abs'
           std::abs(qmin_double) + std::abs(rmin / scale);
                                        ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:12: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                ^
    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: error: expected unqualified-id before '(' token
     #define abs(x) ((x)>0?(x):-(x))
                    ^
    ./src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h:69:36: note: in expansion of macro 'abs'
           std::abs(qmax_double) + std::abs(rmax / scale);
                                        ^
    Still building...
    Error during build: exit status 1

Is this an error with the model settings I am producing? Did I forget something???

Thank you so very much!
-Kevin

Hi @kevin192291

Can you try updating your Arduino CLI version? I am using 0.18.2 (despite our message of expecting 0.13.x) and it compiles successfully with the model included in the repo.

If that does not work, can you please share the URL to your Edge Impulse project? And I can try compiling your model with the lorawan repo locally as well.

Thanks!
Jenny

1 Like

Hello @jenny,
Thank you for your response, I appreciate it!
I started a new project with the upgraded version of the Arduino CLI, and get the same error.
Here is the public repo I created from the project I am having issues with: https://studio.edgeimpulse.com/public/32867/latest
If you get a moment, let me know if this works for you :slight_smile: Thank you so much for testing this for me!!!

1 Like

I posted a Feature Request to update the MKRWAN and MBED and minor version here

@kevin192291 The model link you gave only has one object to detect. You will need unknown objects so that the computer can tell the difference.

@kevin192291 Sorry completely missed this thread, but in

    /home/kevin/.arduino15/packages/arduino/hardware/mbed/1.3.1/cores/arduino/Arduino.h:77:16: 

Comment out this line:

     #define abs(x) ((x)>0?(x):-(x))
1 Like

@Rocksetta we’ll do a proper release of the Portenta H7 as soon as some fixes are landed in the core and then will update both Nano 33 BLE Sense and the Portenta H7 to latest cores.

1 Like

@janjongboom, any chance you could explain to me what the fixes are that are needed with the Portenta/Nano33BleSense, a few Arduino Programmers seem to respond well to my suggestions/requests (Martino and Giampaolo: they politely put up with me :slightly_smiling_face:), at least they spend the time to explain the situation to me very clearly. Examples: recent with MQTT Broker, a while ago with true LoRa.

@Rocksetta some fixes in the PDM driver, some fixes in automatic exposure for the camera, and a way to change the memory layout (with more RAM assigned to the M7 over the M4). We’re in contact with Arduino on these though, so no need to push it through.

1 Like

Things don’t seem to happen really fast over at Arduino (I have been bashing my head against the Portenta for almost a year now and things are just starting to get robust), the PDM and Camera changes might happen soon, but in my opinion the M4 to M7 memory changes will bring with them a whole ton of bugs that will take months to fix.

Arduino/OpenMV solved the memory issue by giving OpenMV all the memory, but that destroys the dual core ability of the Portenta, which is really my main interest in it. I was however caught off guard by how difficult and slow it is to exchange data using RPC between the M7 and M4 cores.

I agree, memory flexibility would be great, I just don’t think it is going to happen in a stable way anytime soon. Any chance of a beta release of the Portenta once the PDM and camera changes occur? :grinning:

Wow @janjongboom looks like you are correct and Arduino is looking into M7 M4 memory allocations in this PR

https://github.com/arduino/ArduinoCore-mbed/pull/167

Looks like you were tagged.

Wonder how it all works?

1 Like

Really good job on the video @janjongboom

https://twitter.com/arduino/status/1425115123597942786?s=19

Quick question, How do we get the Portenta to feel? I have ordered the same accelerometer as is on the Nano 33BleSense but is there something on the Portenta I don’t know about?

@Rocksetta, nothing special - but any accelerometer should just work. Not sure if they’ll come out with another plugin board with environmental / accelerometer sensors.

I was asking about an environmental shield for the Portenta series, but since it is part of the MKR form factor all these shields should be fine:

A couple like the UNO shield you wont be able to also attach the Vision shield, but most of the MKR shields will attach both ways. I have my female headers coming up away from the Portenta so I can also attach the Vision shields.