w80x_arduino icon indicating copy to clipboard operation
w80x_arduino copied to clipboard

Could the C++ standard library be supplemented?

Open Kaiserreich-Unofficial opened this issue 1 year ago • 9 comments

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!

Kaiserreich-Unofficial avatar Jul 30 '24 20:07 Kaiserreich-Unofficial

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 avatar Jul 30 '24 20:07 board707

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

board707 avatar Jul 31 '24 10:07 board707

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 avatar Jul 31 '24 11:07 Kaiserreich-Unofficial

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.

Kaiserreich-Unofficial avatar Jul 31 '24 11:07 Kaiserreich-Unofficial

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.

board707 avatar Jul 31 '24 11:07 board707

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!

Kaiserreich-Unofficial avatar Jul 31 '24 11:07 Kaiserreich-Unofficial

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. :))

AnatolSher avatar Jul 31 '24 13:07 AnatolSher

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.

Kaiserreich-Unofficial avatar Jul 31 '24 14:07 Kaiserreich-Unofficial

@Kaiserreich-Unofficial https://www.xrvm.cn/document?temp=t-head-chip-standard-interface-csi&slug=csi You can see here what the CSI API can do DSP csi-dsp-v4.2.2.tar.gz CPU - _CK804e

AnatolSher avatar Jul 31 '24 17:07 AnatolSher