Build unknown mraa platform
When the lib mraa is installed with apt it receives this MRAA version (v2.1.0-22-gb24cd50) on the Radxa ROCK Pi S.
- When done using buildroot, the version looks like this.
Version 2022.02.1 on Unknown platform
code
#include <iostream>
#include <mraa.hpp>
int main() {
// Inicializar o barramento I2C
mraa::I2c i2c(0); // O número 0 refere-se ao barramento I2C 0
// Verificar se o barramento I2C foi inicializado corretamente
if (!i2c.address(0x0A)) {
std::cerr << "Erro ao inicializar o barramento I2C" << std::endl;
return 1;
}
// Ler um byte do dispositivo no endereço 0x0A
uint8_t dataRead;
if (i2c.read(&dataRead, 1) != mraa::SUCCESS) {
std::cerr << "Erro ao ler do dispositivo I2C" << std::endl;
return 1;
}
std::cout << "Valor lido: " << static_cast<int>(dataRead) << std::endl;
return 0;
}
- The code above runs normally in the debian version, in the version with buildroot I have this error
# ./i2c-list
terminate called after throwing an instance of 'std::invalid_argument'
what(): Invalid i2c bus
Aborted
Using, it ok
# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- 0a -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
I don't know if it's appropriate to open an issue here, but I would like to compile this mraa lib to run on my image. can you help me ?
There could be a couple reasons for this; have you checked that upstream mraa supports ROCK Pi S, and are you using the default mraa package in Buildroot?
Are you using the default mraa package within Buildroot? I had this issue when cross-compiling a custom mraa version and it was due to the correct headers not being installed.
There could be a couple reasons for this; have you checked that upstream mraa supports ROCK Pi S, and are you using the default mraa package in Buildroot?
Are you using the default mraa package within Buildroot? I had this issue when cross-compiling a custom mraa version and it was due to the correct headers not being installed.
Yes, it is buildroot's own mraa lib.
If you look carefully in the buildroot/package/mrra directory
there is a *.pach correction that is to correct an import of a global variable.
1 Taking this into account, one of the ways to build mrra for RK03308 is to fork mraa on radxa's github, and apply the patch.
2 you can fork the radxa mrra lib and in the buildroot/package/mrra/mraa.mk directory change the flag #MRAA_SITE = $(call github,eclipse,mraa,v$(MRAA_VERSION)) to MRAA_SITE = https://github.com/kleysoncastro/mraa/archive/refs/tags.
of this "source" farm, you need to tag it in the lib,
but you can copy this line (MRAA_SITE = https://github.com/kleysoncastro/mraa/archive/refs/tags), then buildroot will do it in my repo. Hope this helps.