Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could the C++ standard library be supplemented? #44

Open
Kaiserreich-Unofficial opened this issue Jul 30, 2024 · 9 comments
Open

Could the C++ standard library be supplemented? #44

Kaiserreich-Unofficial opened this issue Jul 30, 2024 · 9 comments

Comments

@Kaiserreich-Unofficial
Copy link

Kaiserreich-Unofficial commented Jul 30, 2024

Hello! I'm trying to use the Arduino core(version 0.0.6) to built a matrix calculation program for my W806 board. I'm using the library ArduinoEigen([https://github.com/hideakitai/ArduinoEigen]) to build a simple example as below

#include <Arduino.h>
#include <stdio.h>
#include <cmath>

using namespace std;
using Eigen::MatrixXd;

void setup() {
    Serial.begin(115200);
    delay(2000);

    MatrixXd m(2, 2);
    m(0, 0) = 3;
    m(1, 0) = 2.5;
    m(0, 1) = -1;
    m(1, 1) = m(1, 0) + m(0, 1);

    Serial.println("m =");
    Serial.print(m(0, 0));
    Serial.print(" ");
    Serial.print(m(0, 1));
    Serial.println();
    Serial.print(m(1, 0));
    Serial.print(" ");
    Serial.print(m(1, 1));
    Serial.println();
}

void loop() {
  // put your main code here, to run repeatedly:

}

But when I compile it, the complier report errors as

Eigen/src/Core/MathFunctions.h:1318:21: error: 'fabsl' was not declared in this scope
   return fabsl(x - y);
Eigen/src/Core/arch/Default/BFloat16.h:477:19: error: 'std::isinf' has not been declared
   EIGEN_USING_STD(isinf);
Eigen/src/Core/arch/Default/BFloat16.h:251:25: error: expected unqualified-id before '(' token
     output.value = std::signbit(v) ? 0xFFC0: 0x7FC0;

It took me a long time to realize that the cause of this problem was the incomplete C++ standard library in the toolchain(I suspected the Arduino Core problem before), as I test this example on other boards(STM32F103 Bluepill, RaspberryPi pico, etc.), all of them went well. Considering that the W806 board has a very high main frequency compared to other boards in its price range, and also the board got a FPU. Is there any chance to do a C++ standard library patch to make the board support the Eigen lib?

Thanks for your effort to develop this efficient core!

@board707
Copy link
Owner

board707 commented Jul 30, 2024

Hi
It is not my field, sorry.

I don't see an include for the library in your code.
Did you try to install ArduinoEigen via standard Arduino library install procedure?

@board707
Copy link
Owner

board707 commented Jul 31, 2024

It seems to me that you wrote another message and delete it. Please restore the text if you are waiting my answer :)

@Kaiserreich-Unofficial
Copy link
Author

Sure. I forgot to copy the line at the very beginning of my program
#include <ArduinoEigen.h>

So actually the problem here is still in the toolchain. I understand that it's not your job to maintain the toolchain, you've done enough to perfect this core already! They should be the task of the t-head company. But given that the t-head maintenance team hasn't updated the SDK and toolchain in several years, it's possible that the W80x series has in fact been abandoned. So we may have to move to using a ported external CPP standard library, like the AVR version for 8bit arduino board, which orginally doesn't support STL. Do you have any plans to support external porting of standard libraries on W80x? Thanks for u reply.

@Kaiserreich-Unofficial
Copy link
Author

It seems to me that you wrote another message and delete it. Please restore the text if you are waiting my answer :)

Sry for delete my own reply before. I just don't want it to seem offensive.

@board707
Copy link
Owner

It's OK, I don't see anything offensive in your post.

Do you have any plans to support external porting of standard libraries on W80x?

I'm afraid I don't have enough knowledge for this. We did this project with my colleague @AnatolSher - I think he understands it more. He is currently on vacation, but when he returns, I will pass on your question to him.

@Kaiserreich-Unofficial
Copy link
Author

It's OK, I don't see anything offensive in your post.

Do you have any plans to support external porting of standard libraries on W80x?

I'm afraid I don't have enough knowledge for this. We did this project with my colleague @AnatolSher - I think he understands it more. He is currently on vacation, but when he returns, I will pass on your question to him.

That would be great, thanks a lot!

@AnatolSher
Copy link

Hi guys!
While I'm on vacation, I suggest studying the DSP library. The header files are include\arch\XT804\csi_dsp
There is a lot of interesting, mysterious and incomprehensible here. :))

@Kaiserreich-Unofficial
Copy link
Author

Hi guys!
While I'm on vacation, I suggest studying the DSP library. The header files are include\arch\XT804\csi_dsp
There is a lot of interesting, mysterious and incomprehensible here. :))

Sure about that. I'll look into the DSP library.

@AnatolSher
Copy link

AnatolSher commented Jul 31, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants