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

Enabling Threads - Linux OS #202

Open
IronFist16 opened this issue Mar 23, 2024 · 3 comments
Open

Enabling Threads - Linux OS #202

IronFist16 opened this issue Mar 23, 2024 · 3 comments

Comments

@IronFist16
Copy link

IronFist16 commented Mar 23, 2024

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:

cmake_minimum_required(VERSION 3.15)

include(proj.conf)

find_package(bouffalo_sdk REQUIRED HINTS $ENV{BL_SDK_BASE})

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)

find_package(Threads REQUIRED)

if(Threads_FOUND)
    message(STATUS "Thread Library found ${CMAKE_THREAD_LIBS_INIT}")
    if(CMAKE_USE_PTHREADS_INIT
    target_compile_options(app PRIVATE -pthread)
    target_link_options(app PRIVATE -pthread)
    message(STATUS "Pthread included !")
    else()
    message(WARNING "pthread not included !")
    endif()
endif()

target_link_libraries(app ${CMAKE_THREAD_LIBS_INIT})

sdk_set_main_file(main.c)

project(helloworld)

while I do #include <pthread.h> , I can see the below warning only message during compilation, which end successfully:

/usr/bin/toolchain_gcc_t-head_linux/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: CMakeFiles/helloworld_bl808_m0.elf.dir/main.c.o: in function `main':
/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/main.c:117: warning: pthread_create is not implemented and will always fail
/usr/bin/toolchain_gcc_t-head_linux/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: 
/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/main.c:122: warning: pthread_join is not implemented and will always fail

Below is the complete log.


./../../tools/cmake/bin/cmake -S . -B build -G "Unix Makefiles" -DCROSS_COMPILE=riscv64-unknown-elf- -DCHIP=bl808 -DCPU_ID=m0 -DBOARD=bl808dk -DBOARD_DIR= -DCONFIG_DEBUG=y -DCONFIG_ROMAPI=y -DCONFIG_USB_HS=y -DCONFIG_COMX=COM5 -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF -DCONFIG_TLSF=y -DCONFIG_COREDUMP=y
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/toolchain_gcc_t-head_linux/bin/riscv64-unknown-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/toolchain_gcc_t-head_linux/bin/riscv64-unknown-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/toolchain_gcc_t-head_linux/bin/riscv64-unknown-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [register library : libc], path:/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/components/libc
-- [register library : mm], path:/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/components/mm
-- [register library : utils], path:/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/components/utils
-- [register library : lhal], path:/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/drivers/lhal
-- [register extern library : libcsi_xt900p32f_dsp], path:/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/drivers/lhal
-- [register extern library : libpka], path:/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/drivers/lhal
-- [register library : std], path:/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/drivers/soc/bl808/std
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Thread Library found -pthread
-- Pthread included !
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CONFIG_COMX
    CONFIG_ROMAPI
    CONFIG_USB_HS


-- Build files have been written to: /home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/build
make -C build -j8
[  0%] Building C object CMakeFiles/app.dir/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/bsp/board/bl808dk/board.c.o
[  1%] Building C object CMakeFiles/app.dir/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/bsp/board/bl808dk/fw_header.c.o
[  2%] Building ASM object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/startup/m0/start.S.o
[  3%] Building C object build_out/components/libc/CMakeFiles/libc.dir/newlib/port_memory.c.o
[  4%] Building C object build_out/components/mm/CMakeFiles/mm.dir/mem.c.o
[  5%] Building ASM object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/startup/m0/vector.S.o
[  6%] Building C object build_out/components/utils/CMakeFiles/utils.dir/log/log.c.o
[  7%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_common.c.o
[  8%] Building C object build_out/components/utils/CMakeFiles/utils.dir/ring_buffer/ring_buffer.c.o
[  8%] Building C object build_out/components/libc/CMakeFiles/libc.dir/newlib/syscalls_nosys.c.o
[  8%] Building ASM object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/startup/m0/riscv_fpu.S.o
[  9%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/startup/m0/start_load.c.o
[ 10%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/startup/m0/system_bl808.c.o
[ 11%] Building C object build_out/components/mm/CMakeFiles/mm.dir/tlsf/tlsf.c.o
[ 11%] Building C object build_out/components/mm/CMakeFiles/mm.dir/tlsf/bflb_tlsf.c.o
[ 12%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_adc.c.o
[ 13%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_abs.c.o
[ 14%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_atof.c.o
[ 15%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_atoi.c.o
[ 15%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_atol.c.o
[ 15%] Building C object build_out/components/utils/CMakeFiles/utils.dir/bflb_block_pool/bflb_block_pool.c.o
[ 16%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_atoll.c.o
[ 17%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_bsearch.c.o
[ 18%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_checkbase.c.o
[ 19%] Building C object build_out/components/utils/CMakeFiles/utils.dir/bflb_timestamp/bflb_timestamp.c.o
[ 20%] Building C object build_out/components/utils/CMakeFiles/utils.dir/getopt/utils_getopt.c.o
[ 21%] Linking C static library ../../lib/libmm.a
[ 22%] Linking C static library build_out/lib/libapp.a
[ 22%] Built target mm
[ 22%] Built target app
[ 23%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_acomp.c.o
[ 24%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/startup/m0/interrupt.c.o
[ 25%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_itoa.c.o
[ 26%] Building C object build_out/components/utils/CMakeFiles/utils.dir/coredump/bflb_coredump.c.o
[ 26%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_llabs.c.o
[ 26%] Building C object build_out/components/utils/CMakeFiles/utils.dir/cjson/cJSON.c.o
[ 27%] Building C object build_out/components/utils/CMakeFiles/utils.dir/math/src/utils_base64.c.o
[ 28%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_lldiv.c.o
[ 29%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_qsort.c.o
[ 29%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_cks.c.o
[ 30%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_ef_ctrl.c.o
[ 31%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_aon.c.o
[ 32%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_strtod.c.o
[ 33%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_gpio.c.o
[ 34%] Building C object build_out/components/utils/CMakeFiles/utils.dir/math/src/utils_crc.c.o
[ 35%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_i2c.c.o
[ 36%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_dma.c.o
[ 36%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_ffs.c.o
[ 36%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_clock.c.o
[ 37%] Building C object build_out/components/utils/CMakeFiles/utils.dir/math/src/utils_hex.c.o
[ 37%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_rtc.c.o
[ 38%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_common.c.o
[ 39%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_ffsl.c.o
[ 40%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_ffsll.c.o
[ 41%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_sec_aes.c.o
[ 42%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_fls.c.o
[ 42%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_flsl.c.o
[ 43%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_flsll.c.o
[ 44%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_sec_sha.c.o
[ 45%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_memccpy.c.o
[ 46%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_index.c.o
[ 47%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_memchr.c.o
[ 48%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_sec_trng.c.o
[ 49%] Linking C static library ../../lib/libutils.a
[ 49%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_memcmp.c.o
[ 50%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_memmove.c.o
[ 51%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_memrchr.c.o
[ 52%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_ef_cfg.c.o
[ 52%] Built target utils
[ 53%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_glb.c.o
[ 53%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_spi.c.o
[ 54%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_memset.c.o
[ 54%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_stpcpy.c.o
[ 55%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_stpncpy.c.o
[ 56%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_timer.c.o
[ 56%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_glb_gpio.c.o
[ 57%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strcasecmp.c.o
[ 58%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strcasestr.c.o
[ 58%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strcat.c.o
[ 59%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strchr.c.o
[ 60%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_uart.c.o
[ 61%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strcmp.c.o
[ 62%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_wdg.c.o
[ 62%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_flash.c.o
[ 63%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_hbn.c.o
[ 64%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/flash/bflb_sf_cfg.c.o
[ 65%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strcspn.c.o
[ 66%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_l1c.c.o
[ 67%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strdup.c.o
[ 68%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/flash/bflb_xip_sflash.c.o
[ 68%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strnlen.c.o
[ 69%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_pds.c.o
[ 70%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/flash/bflb_sflash.c.o
[ 71%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strpbrk.c.o
[ 72%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/flash/bflb_sf_ctrl.c.o
[ 72%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_dac.c.o
[ 73%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strrchr.c.o
[ 73%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_sdh.c.o
[ 74%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_emac.c.o
[ 75%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strsep.c.o
[ 76%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_tzc_sec.c.o
[ 77%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_ir.c.o
[ 77%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strspn.c.o
[ 78%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_mjpeg.c.o
[ 79%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_psram_uhs.c.o
[ 80%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_uhs_phy.c.o
[ 80%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_pwm_v2.c.o
[ 81%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strstr.c.o
[ 82%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strtok.c.o
[ 83%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_strtokr.c.o
[ 84%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/src/bl808_ipc.c.o
[ 84%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/string/lib_vikmemcpy.c.o
[ 85%] Building C object build_out/components/libc/CMakeFiles/libc.dir/vsnprintf.c.o
[ 86%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_cam.c.o
[ 86%] Building C object build_out/drivers/soc/bl808/std/CMakeFiles/std.dir/port/bl808_clock.c.o
[ 87%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_csi.c.o
[ 88%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_i2s.c.o
[ 89%] Building C object build_out/components/libc/CMakeFiles/libc.dir/snprintf.c.o
[ 89%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_wo.c.o
[ 90%] Building C object build_out/components/libc/CMakeFiles/libc.dir/sprintf.c.o
[ 91%] Building C object build_out/components/libc/CMakeFiles/libc.dir/vsprintf.c.o
[ 91%] Building C object build_out/components/libc/CMakeFiles/libc.dir/printf.c.o
[ 92%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_irq.c.o
[ 93%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_l1c.c.o
[ 94%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_mtimer.c.o
[ 95%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/include/arch/risc-v/t-head/rv_hart.c.o
[ 95%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/include/arch/risc-v/t-head/rv_pmp.c.o
[ 96%] Linking C static library ../../lib/liblibc.a
[ 97%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/config/bl808/device_table.c.o
[ 97%] Built target libc
[ 98%] Linking C static library ../../lib/liblhal.a
[ 98%] Built target lhal
[ 99%] Linking C static library ../../../../lib/libstd.a
[ 99%] Built target std
[100%] Building C object CMakeFiles/helloworld_bl808_m0.elf.dir/main.c.o
[100%] Linking C executable build_out/helloworld_bl808_m0.elf
/usr/bin/toolchain_gcc_t-head_linux/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: CMakeFiles/helloworld_bl808_m0.elf.dir/main.c.o: in function `main':
/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/main.c:117: warning: pthread_create is not implemented and will always fail
/usr/bin/toolchain_gcc_t-head_linux/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/main.c:122: warning: pthread_join is not implemented and will always fail
Generate /home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/build/build_out/helloworld_bl808_m0.bin
[100%] Built target helloworld_bl808_m0.elf
make -C build combine
[03:03:53.711] - bflb firmware post process : V1.2.3
[03:03:53.711] - Chipname: bl808
[03:03:53.711] - Board config dir: ./../../bsp/board/bl808dk/config
[03:03:53.711] - Create partition using partition_cfg_8M.toml
[03:03:53.714] - Create dts for /home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/build/build_out/helloworld_bl808_m0.bin
[03:03:53.714] - Create dts using bl_factory_params_IoTKitA_auto.dts
[03:03:53.721] - BLRFPARA magic not found, skip append dts file
[03:03:53.721] - Copy boot2_bl808_release_v8.1.1.bin
[03:03:53.722] - Copy mfg_bl808_gu_8476f7743_v0.59.bin
[03:03:53.723] - Create dts for /home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/build/build_out/mfg_bl808_gu_8476f7743_v0.59.bin
[03:03:53.723] - Create dts using bl_factory_params_IoTKitA_auto.dts
[03:03:53.732] - 4K header found,append dts file
[03:03:53.733] - 
Process /home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/build/build_out/helloworld_bl808_m0.bin
[03:03:53.734] - ========= sp image create =========
[03:03:53.734] - Flash config crc: b'b5fec518'
[03:03:53.734] - Clock config crc: b'0a894b86'
[03:03:53.734] - Flash  Image
[03:03:53.734] - Image Offset:0x1000
[03:03:53.735] - Image hash is b'5ec442f24a5daae21f690b6dea75435ce9d048de8eb2212eb81389ab0426aa04'
[03:03:53.735] - Encrypt efuse data
[03:03:53.736] - Image Offset:0x1000
[03:03:53.736] - Image hash ignore,not calculate
[03:03:53.736] - Bootheader config crc: b'e321710b'
[03:03:53.736] - 
Process /home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/build/build_out/boot2_bl808_release_v8.1.1.bin
[03:03:53.737] - ========= sp image create =========
[03:03:53.737] - Flash config crc: b'b5fec518'
[03:03:53.737] - Clock config crc: b'0a894b86'
[03:03:53.737] - Flash  Image
[03:03:53.737] - Image Offset:0x2000
[03:03:53.737] - Image hash is b'e654721f94cf21a36d9a506c406e87ad58902147378cc69ee8af56978ab4aa5c'
[03:03:53.738] - Encrypt efuse data
[03:03:53.739] - Image Offset:0x2000
[03:03:53.739] - Image hash ignore,not calculate
[03:03:53.739] - Bootheader config crc: b'ffe76ec5'
[03:03:53.739] - 
Process /home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/build/build_out/mfg_bl808_gu_8476f7743_v0.59.bin
[03:03:53.740] - ========= sp image create =========
[03:03:53.740] - Flash config crc: b'4fb1fe70'
[03:03:53.741] - Clock config crc: b'0a894b86'
[03:03:53.741] - Flash  Image
[03:03:53.741] - Image Offset:0x1000
[03:03:53.743] - Image hash is b'fab0b31dd27d4dabde2a644292c34a6566921af6429b5149629e29b5df88f151'
[03:03:53.744] - Encrypt efuse data
[03:03:53.746] - Image Offset:0x1000
[03:03:53.746] - Image hash ignore,not calculate
[03:03:53.746] - Bootheader config crc: b'e172682a'
[03:03:53.747] - create OTA file:/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/build/build_out/helloworld_bl808_m0.bin.ota
[03:03:53.768] - create XZ file:/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/build/build_out/helloworld_bl808_m0.xz
[03:03:53.804] - create XZ OTA file:/home/ironfist/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld/build/build_out/helloworld_bl808_m0.xz.ota
Built target combine
ironfist@Iron-Fist-Box:~/Documents/Robot/Docs/M1S_Dock/bl808_linux/bouffalo_sdk/examples/helloworld$ 


@IronFist16
Copy link
Author

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) 

@gamelaster
Copy link
Contributor

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.

@IronFist16
Copy link
Author

IronFist16 commented Mar 25, 2024

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?

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

2 participants