Open IronFist16 opened 3 months ago
Just to add, I though the compiler had the thread flag disabled, so I checked the version details, where I can see that:
enable-threads=posix
Thread model: posix
ironfist@Iron-Fist-Box:~/Documents/Robot/Docs/M1S_Dock/bl808_linux$ riscv64-unknown-elf-gcc -v
Using built-in specs.
COLLECT_GCC=riscv64-unknown-elf-gcc
COLLECT_LTO_WRAPPER=/usr/bin/toolchain_gcc_t-head_linux/bin/../libexec/gcc/riscv64-unknown-elf/10.2.0/lto-wrapper
Target: riscv64-unknown-elf
Configured with: /mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/./source/riscv/riscv-gcc/configure --target=riscv64-unknown-elf --with-gmp=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/build-Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/lib-for-gcc-x86_64-linux --with-mpfr=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/build-Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/lib-for-gcc-x86_64-linux --with-mpc=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/build-Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/lib-for-gcc-x86_64-linux --with-libexpat-prefix=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/build-Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/lib-for-gcc-x86_64-linux --with-libmpfr-prefix=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/build-Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/lib-for-gcc-x86_64-linux --with-pkgversion='Xuantie-900 elf newlib gcc Toolchain V2.6.1 B-20220906' CXXFLAGS='-g -O2 -DTHEAD_VERSION_NUMBER=2.6.1 ' --enable-libgcctf --prefix=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1 --disable-shared --**enable-threads=posix** --enable-languages=c,c++ --with-system-zlib --enable-tls --with-newlib --with-sysroot=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/riscv64-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/./source/riscv/riscv-gcc --enable-multilib --with-abi=lp64d --with-arch=rv64gcxthead 'CFLAGS_FOR_TARGET=-Os -mcmodel=medany' 'CXXFLAGS_FOR_TARGET=-Os -mcmodel=medany'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (Xuantie-900 elf newlib gcc Toolchain V2.6.1 B-20220906)
You can't use POSIX threads in Bouffalo SDK, as it does not provide POSIX compatible threading. That's mainly because this SDK is without any RTOS by default, and optionally you can use FreeRTOS, but you still need to use their functions/API, instead of classic pthread headers.
Yes I get that,
However, in the linux version, the kernel is there, so upon checking elsewhere I understood for that to work I will need to compile the code with Linux tool chain instead.
1-Is this correct?
Eventually, I downloaded the toolchain and setup the env. var then upon compilation, I face another issues:
/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/components/libc/newlib/port_memory.c:2:10: fatal error: reent.h: No such file or directory
2 | #include <reent.h>
| ^~~~~~~~~
/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/components/libc/./sys/types.h:20:10: fatal error: _ansi.h: No such file or directory
20 | #include <_ansi.h>
| ^~~~~~~~~
Which I assume it's due to the difference between the elf (Newlib) & linux (libc) tool chain.
2 - Is this also correct?
Probably I missed updating configuration in the make files or compilation flags,
3-Can you please explain to me how to properly migrate into the linuxtool chain in this case?
Hello All,
I was trying to test threading with this SDK, looks like I'm not able to wrap my head over the proper library and setup in the CMakeLists.txt file. Can anyone help me please?
The below is an example of my CMakeLists.txt file:
while I do
#include <pthread.h>
, I can see the below warning only message during compilation, which end successfully:Below is the complete log.