Skip to main content
qqzlqqzlqqzl
Associate III
December 3, 2024
Solved

NEAI_COMPILER_ERROR with NanoEdge AI Studio 4.6.0 on STM32H7 Deployment

  • December 3, 2024
  • 1 reply
  • 1103 views

I am encountering an issue when deploying a classification model generated with NanoEdge AI Studio 4.6.0 to my STM32H7 development board. Below are the details:

  1. Issue: When calling neai_classification_init(knowledge), the function returns NEAI_COMPILER_ERROR. Debugging further, I found the following comment in the generated NanoEdgeAI.h file:

 

 

enum neai_state { 
 NEAI_OK = 0,
 NEAI_INIT_FCT_NOT_CALLED = 123,
 NEAI_BOARD_ERROR,
 NEAI_KNOWLEDGE_BUFFER_ERROR,
 NEAI_NOT_ENOUGH_CALL_TO_LEARNING, //This is a fail-safe to prevent users from learning one or even no signals.
 NEAI_MINIMAL_RECOMMENDED_LEARNING_DONE,
 NEAI_UNKNOWN_ERROR,

 /* Error due to a potential compatibility issue affecting user of the ARMCC toolchain.
 * Contact our support for further details or consider using a different toolchain */
 NEAI_COMPILER_ERROR
};

 

 

  1. Setup:

    • Toolchain: Keil MDK 5.37 with ARMCC (AC5) compiler.
    • Initialization Code: Generated with STM32CubeMX.
    • NanoEdge Versions:
      • Models generated with NanoEdge AI Studio 4.5.x work perfectly on the same setup and provide correct class IDs.
      • Models generated with NanoEdge AI Studio 4.6.0 exhibit the error.
  2. Observations:

    • The issue is specific to the 4.6.0 version of NanoEdge AI Studio. The same hardware and project setup works fine with files generated by 4.5.x.
    • The classification output does not change when using the 4.6.0 generated files, which suggests the inference process does not work correctly.
  3. Questions:

    • Is there a known compatibility issue between NanoEdge AI Studio 4.6.0 and ARMCC (AC5)?
    • Are there any specific toolchain settings or alternative methods to resolve this issue without switching compilers (e.g., to ARMCLANG or GCC)?
    • Should I use a particular configuration in NanoEdge AI Studio 4.6.0 to ensure compatibility with my current setup?

Your assistance and guidance on this matter would be greatly appreciated.

Thank you in advance!

Best answer by Julian E.

Hello @qqzlqqzlqqzl ,

NanoEdgeAI Studio dev team has remarked that a bug of the ARMCC toolchains (V5 & V6) impact the execution of most NanoEdgeAI libraries, due to a wrong management of some specific calculations in FPU.

I insist on the fact that the bug is on ARMCC toolchain side, not in NanoEdgeAI libraries. Other libraries than NanoEdge are probably affected.

We have already contacted ARM support several months ago and wait for a new toolchain release fixing this issue.

 

In the meantime, we see 2 solutions:

  • Use another toolchain (like GCC)
  • Compile the NanoEdgeAI library and your firmware without using the FPU (mfloat-abi=soft)

Of course we understand that both solutions may affect your developments and execution performance.

 

Independently of this bug, we also suggest to avoid using ARMCC V5 toolchain, NanoEdgeAI libraries are not fully compatible with this version in terms of floating-point calculations.

 

Best regards,

Julian

1 reply

Julian E.
Julian E.Best answer
Technical Moderator
December 3, 2024

Hello @qqzlqqzlqqzl ,

NanoEdgeAI Studio dev team has remarked that a bug of the ARMCC toolchains (V5 & V6) impact the execution of most NanoEdgeAI libraries, due to a wrong management of some specific calculations in FPU.

I insist on the fact that the bug is on ARMCC toolchain side, not in NanoEdgeAI libraries. Other libraries than NanoEdge are probably affected.

We have already contacted ARM support several months ago and wait for a new toolchain release fixing this issue.

 

In the meantime, we see 2 solutions:

  • Use another toolchain (like GCC)
  • Compile the NanoEdgeAI library and your firmware without using the FPU (mfloat-abi=soft)

Of course we understand that both solutions may affect your developments and execution performance.

 

Independently of this bug, we also suggest to avoid using ARMCC V5 toolchain, NanoEdgeAI libraries are not fully compatible with this version in terms of floating-point calculations.

 

Best regards,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
qqzlqqzlqqzl
Associate III
December 4, 2024

Hello Julian,

Thank you very much for your detailed explanation. I appreciate your support on this matter.

  1. In NanoEdge AI Studio 4.5.X, this issue did not occur. Could you please provide the last version of 4.5.X for me to reinstall? I updated to 4.6.0 because it seemed necessary to continue using NanoEdge due to the update requirements of 4.5.X.

Thank you again for your assistance!

Julian E.
Technical Moderator
December 4, 2024

Hello @qqzlqqzlqqzl,

 

Sadly I cannot as we are not supporting multiversions.

Moreover, your issue is not linked to the versions, you just got lucky that it worked for some reason.

The only solutions you have are: 

  • Use another toolchain (like GCC)
  • Compile the NanoEdgeAI library and your firmware without using the FPU (mfloat-abi=soft)

 

Have a good day,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.