bl_mcu_sdk is MCU software development kit provided by Bouffalo Lab Team for BL602/BL604, BL702/BL704/BL706 and other series of RISC-V based chips in the future.

Overview

License Release

中文版

Introduction

bl mcu sdk is an MCU software development kit provided by the Bouffalo Lab Team for BL602/BL604, BL702/BL704/BL706 and other series of chips in the future.

Code Framework


bl_mcu_sdk
├── bsp
│   ├── board
│   │   ├── bl602
│   │   └── bl702
│   └── bsp_common
├── build
├── common
│   ├── bl_math
│   ├── device
│   ├── list
│   ├── memheap
│   ├── misc
│   ├── partition
│   ├── pid
│   ├── ring_buffer
│   ├── soft_crc
│   └── timestamp
├── components
│   ├── ble
│   ├── fatfs
│   ├── freertos
│   ├── lvgl
│   ├── lwip
│   ├── mbedtls
│   ├── nmsis
│   ├── romfs
│   ├── rt-thread
│   ├── shell
│   ├── tflite
│   ├── tiny_jpeg
│   ├── usb_stack
│   └── xz
├── docs
│   ├── chipSpecification
│   ├── development_guide
│   └── development_guide_en
├── drivers
│   ├── bl602_driver
│   └── bl702_driver
├── examples
│   ├── acomp
│   ├── adc
│   ├── audio_cube
│   ├── ble
│   ├── boot2_iap
│   ├── camera
│   ├── coremark
│   ├── cxx
│   ├── dac
│   ├── dma
│   ├── dsp
│   ├── emac
│   ├── flash
│   ├── freertos
│   ├── gpio
│   ├── hellowd
│   ├── i2c
│   ├── i2s
│   ├── keyscan
│   ├── lvgl
│   ├── mbedtls
│   ├── memheap
│   ├── nn
│   ├── pka
│   ├── pm
│   ├── psram
│   ├── pwm
│   ├── qdec
│   ├── rt-thread
│   ├── rtc
│   ├── shell
│   ├── spi
│   ├── systick
│   ├── tensorflow
│   ├── timer
│   ├── uart
│   └── usb
├── out
└── tools
    ├── bflb_flash_tool
    ├── cdk_flashloader
    ├── cmake
    └── openocd
  • bsp/board : store the board-level description file such as clock_config.h (describes the clock configuration file) pinmux_config.h (describes the io function file) peripheral_config.h (describes the default configuration file of the peripheral) , These files together describe the board hardware information.
  • bsp/bsp_common : store some common peripheral driver codes related to the board.
  • common : store some common functions and macros that chip drivers will need.
  • components : store the third-party library public component library.
  • drivers : store bouffalo series of chip drivers.
  • examples : store the official sample code.
  • tools : store toolkits related to compiling and downloading.
  • docs : store tutorial documents and other help information.
  • build : store cmake cache files.
  • out : store the bin and map file generated after compiling and linking.

Hierarchy

Hierarchy

Resources

Hardware Resources

  • BL706 IOT Development board BL706_IOT

  • BL706 AVB Development Board BL706_AVB

There is currently no official purchase channel. If you want to get the above development board, you can apply for it in Forum post.

Chip Manual

Chip Reference Manual | Chip Data Manual

For more information, please visit the BouffaloLab developer website: https://dev.bouffalolab.com/

Documentation Tutorial

To get more bl mcu sdk documentation tutorial, like api manual or peripheral demo and so on, please visit:

Video Tutorial

Development Tools

Command Line Development

For the tools needed for command line development, please refer to linux development guide


git clone https://gitee.com/bouffalolab/toolchain_gcc_sifive_linux.git

Eclipse Development

For the tools needed for Eclipse development, please refer to Eclipse Development Guide


git clone https://gitee.com/bouffalolab/toolchain_gcc_sifive_windows.git

  • J-Link v10, J-Link debugger, used to debug the chip online, it is recommended to use the hardware of J-Link V10 or above, and the software driver is recommended to use V6 .98 version

CDK Development

For tools needed for CDK development, please refer to CDK Development Guide

  • CDK, Jianchi CDK integrated development environment of T-Head , it is recommended to use CDK v2.8.4 or above

Flash Tool

In addition to using CK-link, J-link and command line programming, it also supports graphical programming tools. Graphical programming tools provided by Bouffalolab:

Board Config Wizard

We provide BL Config Wizard to generate clock_config.hpinmux_config.h and peripheral_config.h file online.

How to make sdk as submodule

First add bl_mcu_sdk to your own project using the add submodule command, and then commit the gitmodules file to the remote repo.


git submodule add https://gitee.com/bouffalolab/bl_mcu_sdk.git bl_mcu_sdk
cd bl_mcu_sdk
git pull --rebase
cd ..
git add .gitmodules
git add bl_mcu_sdk
git commit -m "xxx"
git push

The final catalog presents the following results:

.
├── hardware
├── xxxx
├── xxxx
├── xxxx
├── bl_mcu_sdk
├── user_code
│   └── gpio
│       ├── gpio_blink
│       ├── gpio_dht11
│       └── gpio_int

Command Line compile

    cd bl_mcu_sdk
    make APP=xxx APP_DIR=../user_code

Forum

Bouffalolab Developer Forum: https://bbs.bouffalolab.com/

License

bl mcu sdk is completely open source and follows the Apache License 2.0 open source license agreement. It can be used in commercial products for free and does not require public private code.

/*
 * Copyright (c) 2021 Bouffalolab team
 *
 * SPDX-License-Identifier: Apache-2.0
 */
Issues
  • [feat][zephyr] Enable bl_mcu_sdk as zephyr module

    [feat][zephyr] Enable bl_mcu_sdk as zephyr module

    The ZephyrRTOS is a newer Open Source RTOS. It strives to deliver the best-in-class RTOS for connected resource-constrained devices, built to be secure and safe.

    This add ZephyrRTOS entry point and define environment to build Bouffalo Lab low level peripheral drivers as hal_bouffalolab. Initially, bl602 is the target but can be extended to any other SoC series present in the bl_mcu_sdk.

    The commit sequence try fix small issues found due to code isolation. The BFLB_USE_PLATFORM was necessary to be created to isolate low level drivers and Bouffalo Lab HAL, once Zephyr have their own.

    The zephyr directory is completely isolated from bl_mcu_sdk and not interfere. This layout was created to allow add manufacturer repositories as external modules into ZephyrRTOS.

    Currently there is a minimal attempt to enable Bouffalo Lab SoC at ZephyrRTOS at PR 37686

    How to Build/Flash on a working zephyr environment:

    1. Clone PR 37686
    2. Read board/riscv/dt_bl10_devkit/doc/index.rst
    3. west update
    4. west build -b dt_bl10_devkit samples/hello_world
    5. west flash
    opened by nandojve 17
  • USB Flashing doesn't work on Windows 11

    USB Flashing doesn't work on Windows 11

    I have BL70X IoT DVK-MB-V1.1, which have BL706 with no internal FLASH or RAM, everything is external. It have Winbond 25Q32JVS1Q and 1604M-3SQR.

    Unfortunately, I can't get this flashed with bflb_mcu_tool or Bouffalo Lab Dev Cube, it all ends on Flash load shake hand. I tried to change flash_id = ef8016 (which is flash config for W25Q32JW_ef8016.conf), although, the eflash_loader still can't load the SPI flash. Also I tried to change boot headers with SPI configuration for that same Winbond, still no success. Any ideas?

    Thanks

    opened by gamelaster 10
  • BL602 sdk no wifi feature

    BL602 sdk no wifi feature

    bl-mcu-iot I can't find how to use the wifi feature, is there not yet a wifi SDK feature for BL602 in this SDK? Is there a bouffalolab team that can help?

    opened by Eltopinovatif 5
  • cmake: handle STREQUAL when variable is not defined

    cmake: handle STREQUAL when variable is not defined

    When I try to compile any example using cmake from the official sdk download from https://dev.bouffalolab.com, I am getting this error:

    CMake Error at tools/cmake/compiler_flags.cmake:12 (if):
      if given arguments:
    
        "STREQUAL" "y"
    
      Unknown arguments specified
    Call Stack (most recent call first):
      CMakeLists.txt:4 (include)
    

    This issue is well described here https://stackoverflow.com/questions/39707772/cmake-error-if-given-arguments-followed-by-parenthesis-not-equals-and-si/39733128 and good workarounds are given.

    IMO, this issue is fixed in more recent versions of cmake, but I want it to work with cmake provided with gcc on https://dev.bouffalolab.com

    opened by cooldome 3
  • [Feature Request]: Please add sipeed RV BL702 board as mcu target to run examples

    [Feature Request]: Please add sipeed RV BL702 board as mcu target to run examples

    Please add "sipeed RV plus Debugger BL702" board support as mcu target. It would allow for the favorable setup with two sipeed BL702 boards: one as mcu and one as debugger. Also Iam looking for the way to connect two boards as JTAG debugger for one another. If you know the correct wiring please let me know.

    Thank you

    opened by cooldome 3
  • BL602 : unknown type names : Efuse_Ldo11VoutSelTrim_Info_Type & Efuse_TxPower_Info_Type

    BL602 : unknown type names : Efuse_Ldo11VoutSelTrim_Info_Type & Efuse_TxPower_Info_Type

    Hello!

    I'm trying to use this SDK to build an app for the BL602 (Pine64 board). I tried to build the helloworld app as follows:

    make BOARD=bl602_iot CHIP=bl602 APP=helloworld
    

    But I get build errors related to Efuse_Ldo11VoutSelTrim_Info_Type and Efuse_TxPower_Info_Type that are unknown. Here's the full build log:

    $ make BOARD=bl602_iot CHIP=bl602 APP=helloworld
    cmake -E make_directory build
    cmake -E copy project.build build
    make -C ./build -f ./project.build
    make[1]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    cmake -DCHIP=bl602 -DCPU_ID=m0 -DBOARD=bl602_iot -DSUPPORT_FLOAT=n -DSUPPORT_SHELL=n -DSUPPORT_FREERTOS=n -DSUPPORT_CRYPTO=n -DSUPPORT_LVGL=n -DSUPPORT_BLE=n -DSUPPORT_XZ=n -DSUPPORT_LWIP=n -DSUPPORT_TFLITE=n -DAPP_DIR=examples -DAPP=helloworld ..
    -- TOOLCHAIN_PATH:/home/jf/bl602/riscv64-elf-x86_64-20210120/bin/
    -- TOOLCHAIN_PATH:/home/jf/bl602/riscv64-elf-x86_64-20210120/bin/
    -- The C compiler identification is GNU 8.4.0
    -- The CXX compiler identification is GNU 8.4.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/jf/bl602/riscv64-elf-x86_64-20210120/bin/riscv64-unknown-elf-gcc
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /home/jf/bl602/riscv64-elf-x86_64-20210120/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: /home/jf/bl602/riscv64-elf-x86_64-20210120/bin/riscv64-unknown-elf-g++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- [run app:helloworld], path:/home/jf/git/bl_mcu_sdk/examples/hellowd/helloworld
    -- [register library component: common], path:/home/jf/git/bl_mcu_sdk/common
    -- [register library component: fatfs], path:/home/jf/git/bl_mcu_sdk/components/fatfs
    -- [register library component: usb_stack], path:/home/jf/git/bl_mcu_sdk/components/usb_stack
    -- [register library component: bl602_driver], path:/home/jf/git/bl_mcu_sdk/drivers/bl602_driver
    -- Configuring done
    -- Generating done
    CMake Warning:
      Manually-specified variables were not used by the project:
    
        CPU_ID
    
    
    -- Build files have been written to: /home/jf/git/bl_mcu_sdk/build
    make -j4
    make[2]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    make[3]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    make[4]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    make[4]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    make[4]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    make[4]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    make[4]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    make[4]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    make[4]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    make[4]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    make[4]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    [  1%] Building C object libraries/usb_stack/CMakeFiles/usb_stack.dir/class/audio/usbd_audio.c.obj
    [  3%] Building C object libraries/fatfs/CMakeFiles/fatfs.dir/diskio.c.obj
    [  4%] Building C object libraries/common/CMakeFiles/common.dir/device/drv_device.c.obj
    [  6%] Building C object libraries/common/CMakeFiles/common.dir/memheap/drv_mmheap.c.obj
    [  7%] Building C object libraries/usb_stack/CMakeFiles/usb_stack.dir/class/cdc/usbd_cdc.c.obj
    [  9%] Building C object libraries/fatfs/CMakeFiles/fatfs.dir/ff.c.obj
    [ 11%] Building C object libraries/common/CMakeFiles/common.dir/misc/misc.c.obj
    [ 12%] Building C object libraries/usb_stack/CMakeFiles/usb_stack.dir/class/hid/usbd_hid.c.obj
    [ 14%] Building C object libraries/usb_stack/CMakeFiles/usb_stack.dir/class/msc/usbd_msc.c.obj
    [ 15%] Building C object libraries/common/CMakeFiles/common.dir/partition/partition.c.obj
    [ 17%] Building C object libraries/usb_stack/CMakeFiles/usb_stack.dir/class/video/usbd_video.c.obj
    [ 20%] Building C object libraries/usb_stack/CMakeFiles/usb_stack.dir/core/usbd_core.c.obj
    [ 20%] Building C object libraries/common/CMakeFiles/common.dir/ring_buffer/ring_buffer.c.obj
    [ 22%] Building C object libraries/common/CMakeFiles/common.dir/soft_crc/softcrc.c.obj
    [ 23%] Building C object libraries/fatfs/CMakeFiles/fatfs.dir/ffsystem.c.obj
    [ 25%] Linking C static library libcommon.a
    [ 26%] Building C object libraries/fatfs/CMakeFiles/fatfs.dir/ffunicode.c.obj
    make[4]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    [ 26%] Built target common
    make[4]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    Scanning dependencies of target bl602_driver
    make[4]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    make[4]: Entering directory '/home/jf/git/bl_mcu_sdk/build'
    [ 28%] Linking C static library libusb_stack.a
    [ 30%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/hal_drv/src/hal_clock.c.obj
    make[4]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    [ 30%] Built target usb_stack
    [ 31%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/hal_drv/src/hal_gpio.c.obj
    [ 33%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/hal_drv/src/hal_dma.c.obj
    [ 34%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/hal_drv/src/hal_mtimer.c.obj
    [ 36%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/hal_drv/src/hal_uart.c.obj
    [ 38%] Building ASM object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/startup/GCC/entry.S.obj
    [ 39%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/startup/GCC/start_load.c.obj
    [ 41%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/startup/interrupt.c.obj
    [ 42%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/startup/system_bl602.c.obj
    [ 44%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/std_drv/src/bl602_acomp.c.obj
    [ 46%] Linking C static library libfatfs.a
    make[4]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    [ 46%] Built target fatfs
    [ 47%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/std_drv/src/bl602_adc.c.obj
    [ 49%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/std_drv/src/bl602_aon.c.obj
    [ 50%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/std_drv/src/bl602_common.c.obj
    [ 52%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/std_drv/src/bl602_dac.c.obj
    [ 53%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/std_drv/src/bl602_dma.c.obj
    [ 55%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/std_drv/src/bl602_ef_ctrl.c.obj
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c: In function 'EF_Ctrl_Read_Ldo11VoutSel_Opt':
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:382:5: error: unknown type name 'Efuse_Ldo11VoutSelTrim_Info_Type'; did you mean 'Efuse_Capcode_Info_Type'?
         Efuse_Ldo11VoutSelTrim_Info_Type *trim = (Efuse_Ldo11VoutSelTrim_Info_Type *)&tmp;
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         Efuse_Capcode_Info_Type
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:382:47: error: 'Efuse_Ldo11VoutSelTrim_Info_Type' undeclared (first use in this function); did you mean 'Efuse_Capcode_Info_Type'?
         Efuse_Ldo11VoutSelTrim_Info_Type *trim = (Efuse_Ldo11VoutSelTrim_Info_Type *)&tmp;
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                   Efuse_Capcode_Info_Type
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:382:47: note: each undeclared identifier is reported only once for each function it appears in
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:382:81: error: expected expression before ')' token
         Efuse_Ldo11VoutSelTrim_Info_Type *trim = (Efuse_Ldo11VoutSelTrim_Info_Type *)&tmp;
                                                                                     ^
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:391:13: error: request for member 'en' in something not a structure or union
         if (trim->en) {
                 ^~
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:392:17: error: request for member 'parity' in something not a structure or union
             if (trim->parity == EF_Ctrl_Get_Trim_Parity(trim->sel_value, 4)) {
                     ^~
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:392:57: error: request for member 'sel_value' in something not a structure or union
             if (trim->parity == EF_Ctrl_Get_Trim_Parity(trim->sel_value, 4)) {
                                                             ^~
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:393:38: error: request for member 'sel_value' in something not a structure or union
                 *Ldo11VoutSelValue = trim->sel_value;
                                          ^~
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:381:14: warning: variable 'tmp' set but not used [-Wunused-but-set-variable]
         uint32_t tmp;
                  ^~~
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c: In function 'EF_Ctrl_Read_TxPower_ATE':
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:411:5: error: unknown type name 'Efuse_TxPower_Info_Type'; did you mean 'Efuse_Capcode_Info_Type'?
         Efuse_TxPower_Info_Type *trim = (Efuse_TxPower_Info_Type *)&tmp;
         ^~~~~~~~~~~~~~~~~~~~~~~
         Efuse_Capcode_Info_Type
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:411:38: error: 'Efuse_TxPower_Info_Type' undeclared (first use in this function); did you mean 'Efuse_Capcode_Info_Type'?
         Efuse_TxPower_Info_Type *trim = (Efuse_TxPower_Info_Type *)&tmp;
                                          ^~~~~~~~~~~~~~~~~~~~~~~
                                          Efuse_Capcode_Info_Type
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:411:63: error: expected expression before ')' token
         Efuse_TxPower_Info_Type *trim = (Efuse_TxPower_Info_Type *)&tmp;
                                                                   ^
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:422:17: error: request for member 'parity' in something not a structure or union
             if (trim->parity == EF_Ctrl_Get_Trim_Parity(trim->txpower, 5)) {
                     ^~
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:422:57: error: request for member 'txpower' in something not a structure or union
             if (trim->parity == EF_Ctrl_Get_Trim_Parity(trim->txpower, 5)) {
                                                             ^~
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:423:21: error: request for member 'txpower' in something not a structure or union
                 if (trim->txpower >= 16) {
                         ^~
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:424:32: error: request for member 'txpower' in something not a structure or union
                     *TxPower = trim->txpower - 32;
                                    ^~
    /home/jf/git/bl_mcu_sdk/drivers/bl602_driver/std_drv/src/bl602_ef_ctrl.c:426:32: error: request for member 'txpower' in something not a structure or union
                     *TxPower = trim->txpower;
                                    ^~
    [ 57%] Building C object libraries/bl602_driver/CMakeFiles/bl602_driver.dir/std_drv/src/bl602_glb.c.obj
    make[4]: *** [libraries/bl602_driver/CMakeFiles/bl602_driver.dir/build.make:285: libraries/bl602_driver/CMakeFiles/bl602_driver.dir/std_drv/src/bl602_ef_ctrl.c.obj] Error 1
    make[4]: *** Waiting for unfinished jobs....
    make[4]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    make[3]: *** [CMakeFiles/Makefile2:274: libraries/bl602_driver/CMakeFiles/bl602_driver.dir/all] Error 2
    make[3]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    make[2]: *** [Makefile:91: all] Error 2
    make[2]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    make[1]: *** [project.build:18: __build] Error 2
    make[1]: Leaving directory '/home/jf/git/bl_mcu_sdk/build'
    make: *** [Makefile:44: build] Error 2
    

    I'm using the current master branch (tag v1.2.3 from 1 July).

    opened by JF002 3
  • BLE example build problem

    BLE example build problem

    I tried to compile ble_peripheral example and get:

    [ 97%] Linking C executable ../../../out/examples/ble/ble_peripheral/ble_peripheral_bl702.elf
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(hci_onchip.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(hci_onchip.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(hci_onchip.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_msg.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_msg.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_msg.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_task.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_task.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_task.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(arch_main.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(arch_main.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(arch_main.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(em_buf.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(em_buf.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(em_buf.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(lld.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(lld.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(lld.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(llm.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(llm.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(llm.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(rwble.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(rwble.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(rwble.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(ea.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(ea.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(ea.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(rwip.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(rwip.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(rwip.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_event.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_event.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_event.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_mem.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_mem.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(ke_mem.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(llc_util.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(llc_util.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(llc_util.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(lld_evt.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(lld_evt.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(lld_evt.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(lld_pdu.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(lld_pdu.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(lld_pdu.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(hci_tl.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(hci_tl.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(hci_tl.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(llc_llcp.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(llc_llcp.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(llc_llcp.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(llm_hci.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(llm_hci.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(llm_hci.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(llc_hci.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: ../../../components/ble/blecontroller/lib/libblecontroller.a(llc_hci.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file ../../../components/ble/blecontroller/lib/libblecontroller.a(llc_hci.o)
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: /home/ubuntu/bl_mcu_sdk/components/ble/bl702_rf/lib/libbl702_rf.a(bl702_rf_private.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: error: /home/ubuntu/bl_mcu_sdk/components/ble/bl702_rf/lib/libbl702_rf.a(bl702_rf_private.o): conflicting priv spec version (major/minor/revision).
    /usr/bin/riscv64-elf-20210120/bin/../lib/gcc/riscv64-unknown-elf/8.4.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file /home/ubuntu/bl_mcu_sdk/components/ble/bl702_rf/lib/libbl702_rf.a(bl702_rf_private.o)
    collect2: error: ld returned 1 exit status
    make[3]: *** [samples/ble_peripheral/CMakeFiles/ble_peripheral_bl702.elf.dir/build.make:153: ../out/examples/ble/ble_peripheral/ble_peripheral_bl702.elf] Error 1
    make[3]: Leaving directory '/home/ubuntu/bl_mcu_sdk/build'
    make[2]: *** [CMakeFiles/Makefile2:202: samples/ble_peripheral/CMakeFiles/ble_peripheral_bl702.elf.dir/all] Error 2
    make[2]: Leaving directory '/home/ubuntu/bl_mcu_sdk/build'
    make[1]: *** [Makefile:84: all] Error 2
    make[1]: Leaving directory '/home/ubuntu/bl_mcu_sdk/build'
    make: *** [Makefile:51: build] Error 2
    

    I'm starting loosing my mind working with this bl702 mcu, it's seems to be too soon for real development...

    opened by Jatsekku 2
  • BL604 support

    BL604 support

    Hello!

    I was wondering if BL602 and BL604 are binary compatible (code that runs on the 602 runs out of the box on the 604)? Or does BL604 need additional support from bl_mcu_sdk and flash tools?

    Thanks!

    opened by JF002 2
  • Allow to use the SDK from a subfolder of another project

    Allow to use the SDK from a subfolder of another project

    I would like to use the MCU SDK in another project structured like this:

    MyProject/ | - sdk/ | - | - | - src/ | - | - main.cpp | - CMakeLists.txt

    The SDK would be included (as a git submodule) in the sdk subfolder. The sources of my own project are stored in src. And the root CMakeLists.txt file glues everything together.

    The only think that prevent me from doing this is the include of cpu_flags.cmake in compiler_flags.cmake. Moving this include into the main CMakeLists.txt file fixes the issue.

    If needed, I can push my own project using the SDK as soon as I've cleaned the code a bit :) EDIT : here is my project

    opened by JF002 1
  • Fix build errors in entry.S. allows helloworld to compile and link.

    Fix build errors in entry.S. allows helloworld to compile and link.

    1. __riscv_float_abi_single is not in the provided preprocessor namespace. The default build sets -Werror and has -Warn implicitly. Testing something that's not defined with an #if is therefore an error. This is possibly a behavior change. If your builds ever define that AND set it to 0, this way will fail, but #if defined (foo) + #if foo is akward and probably not what you intended.

    2. "csrw mtvt, t0" is not legal in at least GNU assembler (GNU Binutils) 2.35 Fortunately, riscv_encoding.h #defines a perfectly lovely value of $0x307 that's appropriate for the chips AND is compatible with more assemblers. This appears to be an extension in GNU assembler (SiFive Binutils 2.32.0-2019.08.0) 2.32 (present in bl_io_sdk, as provided by SiFive) and that's probably what's in your $PATH, but not relying on vendor extension in this case is dead easy.

    Two distinct problems. No, I'm not making different pull requests. ...this is a lot of words for a two line change. :-)

    opened by robertlipe 1
  • Add freertos for bl602

    Add freertos for bl602

    FreeRTOS for BL602 is missing. I copied the files from BL702 as both MCU are very similar. Please correct me if I'm wrong ;) Also fixed a typo that prevented from building when FreeRTOS was enabled.

    opened by JF002 0
  • Windows 7 CDC Driver

    Windows 7 CDC Driver

    At the moment, custom USB CDC driver is required for flashing BL70X via USB on Windows 7. It was mentioned in https://github.com/bouffalolab/bl_mcu_sdk/issues/22#issuecomment-1056040870 that Windows 7 driver should be created someday.

    opened by gamelaster 0
  • Building toolchain from scratch?

    Building toolchain from scratch?

    I was trying to setup development environment on the Rpi3 but it was impossible with the prebuilded toolchain. Is there chance to provide sources in order to build it from scratch under choosen platform?

    opened by Jatsekku 1
  • BL702: compilation warnings about macro redefinitions

    BL702: compilation warnings about macro redefinitions

    When compiling SDK with including usb_core.h and bluetooth.h, several macros are redefined:

    DJ_90HP)}0B)}}4MU XCYD0

    • BIT(x): predefinition is checked in bl_port.h, but not in usb_util.h.
    • ARRAY_SIZE(x): these definitions are different in util.h and usbd_util.h.

    Please fix it to compile warning-free programs.

    opened by metro94 1
  • [RFC] Changes to clean and speed up integration with other systems

    [RFC] Changes to clean and speed up integration with other systems

    Is your enhancement proposal related to a problem? Please describe. I start to integrate bl_mcu_sdk with Zephyr RTOS. I noted that there are duplicated code between devices and would like propose changes that may help to easy integrate with another systems, like Zephyr RTOS.

    My steps can be checked at:

    Zephyr RTOS currently is a Work In Process (WIP) and only have a hello world.

    Describe the solution you'd like

    • At drivers, move std_drv outside SoC driver and unify as a common base. Why? To avoid duplicated code since IPs are same.

    from

    ├── bl602_driver
    │   └── std_drv
    │       ├── inc
    │       └── src
    └── bl702_driver
        └── std_drv
            ├── inc
            └── src
    

    to

    ├── bl602_driver
    ├── bl702_driver
    └── std_drv
        ├── inc
        └── src
    
    • Change API signature to use register address instead instance index. Why? This will keep code clean and will drop a table at low level driver. In fact, BL already uses register address but it is necessary get it from a table. You can continue to use this at hal_drv to have better compatibility. This will avoid unnecessary overhead low level driver. examples:

    from

    - uint32_t UART_GetBaudrate(UART_ID_Type uartId)
    {
        ...
        uint32_t UARTx = uartAddr[uartId];
        ...
        tmpVal = BL_RD_REG(UARTx, UART_BIT_PRD);
        ...
    }
    

    to

    - uint32_t UART_GetBaudrate(uint32_t UARTx)
    {
        ...
        tmpVal = BL_RD_REG(UARTx, UART_BIT_PRD);
        ...
    }
    
    • Refactor BL_Err_Type to int and use errno.h definitions, see errno-base.h. Why? This will generalize the functions and allow better portability.

    from

    BL_Err_Type UART_SendDataBlock(UART_ID_Type uartId, uint8_t *data, uint32_t len)
    {
        ...
                    return TIMEOUT;
        ...
    
        return SUCCESS;
    }
    

    to

    int UART_SendDataBlock(uint32_t UARTx, uint8_t *data, uint32_t len)
    {
        ...
                    return -EAGAIN;
        ...
    
        return 0;
    }
    
    • Refactor all public functions to return errno value or use bool or even void . Why? Portability.

    from

    BL_Sts_Type UART_GetIntStatus(UART_ID_Type uartId, UART_INT_Type intType)
    BL_Err_Type UART_AutoBaudDetection(UART_ID_Type uartId, BL_Fun_Type autoBaud)
    BL_Err_Type UART_IntMask(UART_ID_Type uartId, UART_INT_Type intType, BL_Mask_Type intMask)
    

    to

    bool UART_GetIntStatus(uint32_t UARTx, UART_INT_Type intType)
    bool UART_AutoBaudDetection(uint32_t UARTx, bool autoBaud)
    bool UART_IntMask(uint32_t UARTx, UART_INT_Type intType, bool intMask)
    
    • Drop interrupt register handlers. Why? Each RTOS probably will handle it differently. On a low level driver Bouffalo register interrupts from another code base. In fact, there are entries at uart_open, which corroborate with this change.

    from

    BL_Err_Type UART_Init(UART_ID_Type uartId, UART_CFG_Type *uartCfg)
    {
    ...
        Interrupt_Handler_Register(UART0_IRQn, UART0_IRQHandler);
        Interrupt_Handler_Register(UART1_IRQn, UART1_IRQHandler);
    ...
        return SUCCESS;
    }
    

    to

    int UART_Init(uint32_t UARTx, UART_CFG_Type *uartCfg)
    {
    ...
        return 0;
    }
    
    • Refactor all #include directives from c header files to c source files. This is a good practice to clean up references and allow better portability and avoid include problems. This is best way to have a clean header to be used on any place.

    from

    #ifndef __BL602_UART_H__
    #define __BL602_UART_H__
    
    #include "uart_reg.h"
    #include "bl602_common.h"
        ...
    #endif /* __BL602_UART_H__ */
    

    to

    // bl602_uart.h
    #ifndef __BL602_UART_H__
    #define __BL602_UART_H__
        ...
    #endif /* __BL602_UART_H__ */
    
    // bl602_uart.c
    ...
    #include <errno.h>
    #include <stdint.h>
    #include <stdbool.h>
    #include "uart_reg.h"
    #include "bl602_uart.h"
    #include "bl602_glb.h"
    ...
    

    Describe alternatives you've considered This changes are not a block to port code. However, changes will clean up, integrate and improve portability. In other words, it will help to integrate faster. The other alternative is write native driver code to improve performance.

    Additional context All this changes can be implemented in parallel and allow deprecate <mcu>_driver/std_drv without break code. People can be encouraged to move to new model until n releases, which will drop <mcu>_driver/std_drv .

    opened by nandojve 4
Owner
Bouffalo Lab
Bouffalo Lab
LoRa Driver for Semtech SX1262 on Linux (PineDio USB Adapter) and BL602 (PineDio Stack BL604)

LoRa Driver for Semtech SX1262 on Linux (PineDio USB Adapter) and BL602 (PineDio Stack BL604) Read the articles... "Build a Linux Driver for PineDio L

Lee Lup Yuen 7 Mar 15, 2022
Single-chip solution for Hi-speed USB2.0(480Mbps) JTAG/SPI Debugger based on RISC-V MCU CH32V30x/CH32V20x

480Mbps High Speed USB2.0 JTAG Debugger Open source information |-- bin |--------MCU: MCU target program |--------WIN APP |------------------USB20Jtag

RISC-V 38 Jun 28, 2022
All lab practicals c++ source code will be stored here, for future references.

Karnataka-State-Ist-PU-LAB-practicals-source-code All lab practicals c++ source code will be stored here, for future references. Sourced from this web

Sachit 1 Feb 1, 2022
CSC404: Computer Graphics [CG] & CSL402: Computer Graphics Lab [CG Lab]

COMPUTER-GRAPHICS-AND-COMPUTER-GRAPHICS-LAB CSC404: CG & CSL402: CG LAB [SEMESTER IV] Syllabus CG - Reference Books THE WALL MEGA SATISH - AUTHOR CG C

AMEY THAKUR 7 Apr 28, 2022
RV-Debugger-BL702 is an opensource project that implement a JTAG+UART debugger with BL702C-A0.

BL702 is highly integrated BLE and Zigbee combo chipset for IoT applications, contains 32-bit RISC-V CPU with FPU, frequency up to 144MHz, with 132KB RAM and 192 KB ROM, 1Kb eFuse, 512KB embedded Flash, USB2.0 FS device interface, and many other features.

Sipeed 73 Jun 21, 2022
sipeed opensource mechanical keyboard make with BL706

sipeed_keyboard sipeed opensource mechanical keyboard make with BL706 矽π 开源双模机械键盘 目录结构 ./ ├── LICENSE ├── README.md ├── firmware // 存放键盘固件 ├── hardwar

Sipeed 53 Jun 6, 2022
Internal Software Development Kit for Battlefield 2042

battlefield-2042-internal-sdk Internal Software Development Kit for Battlefield 2042 SDK Includes the following: Entity Classes Player Classes Vehicle

Skengdo 11 Jun 27, 2022
This repository is to share the EdgeAI Lab with Microcontrollers Series material to the entire community

This repository is to share the EdgeAI Lab with Microcontrollers Series material to the entire community. We will share documents, presentations and source code of two demo applications.

Machine Learning Tokyo 15 Oct 23, 2021
🎮 Cross platform development kit for Z80 and SM83 based consoles.

cdk ?? Cross platform development kit for Z80 and SM83 based consoles. Platform We planned to support the following consoles: Nintendo Game Boy Ninten

Micro Console 4 Jan 10, 2022
The Lua development repository, as seen by the Lua team. Mirrored irregularly

The Lua development repository, as seen by the Lua team. Mirrored irregularly

Lua 5.7k Jun 23, 2022
Kit: a magical, high performance programming language, designed for game development

Kit: a magical, high performance programming language, designed for game development

Kit Programming Language 990 Jun 25, 2022
cdk is a minimal cross-platform c language development kit.

Overview cdk is a minimal cross-platform c language development kit. Requirement Based on c11 standard. Compile create a build directory under the cdk

Red 18 Jun 10, 2022
Servo library with stm developed by the Liek Software Team. We are working on new versions.

Liek-Servo-Library Liek Servo Library is a library that makes it easy for you to drive servo motors with STM32F10x series cards. The library is still

null 14 Jan 13, 2022
Software Running on the VEX V5 Brain for the USF IEEE VEX Robotics Team.

This is an ongoing Project at USF IEEE VEX Team for VEX Head-to-Head 2022 This is the software running on our USF Big-Bull-Bot, specified to compete i

John Koch 1 Jan 9, 2022
This is a tool for software engineers to view,record and analyse data(sensor data and module data) In the process of software development.

![Contributors][Huang Jianyu] Statement 由于工具源码在网上公开,除使用部分开源项目代码外,其余代码均来自我个人,工具本身不包含公司的知识产权,所有与公司有关的内容均从软件包中移除,软件发布遵循Apache协议,任何人均可下载进行修改使用,如使用过程中出现任何问

HuangJianyu 34 May 5, 2022
Firmware for DMR transceivers using the NXP MK22 MCU, AT1846S RF chip and HR-C6000 DMR chipset. Including the Radioddiy GD-77, Baofeng DM-1801 and Baofeng RD-5R.

OpenGD77 Firmware for DMR transceivers using the NXP MK22 MCU, AT1846S RF chip and HR-C6000 DMR chipset. This includes the Radioddiy GD-77, Radioddity

Open Ham 86 Jun 26, 2022
Tiny and portable usb host and device stack for mcu with usb ip

Tiny and portable usb host and device stack for mcu with usb ip

sakumisu 364 Jun 28, 2022
A simple tool using PC mouse via USART to control MCU and LCD/OLED (with LVGL library), if your screen cannot be controlled by touch.

LVGL_USB_Mouse A simple tool using PC mouse via USART to control MCU and LCD/OLED (with LVGL library), if your screen cannot be controlled by touch. 如

k_ying 5 May 5, 2022
Create a firework effect with WS2812b LED and a MCU

LED-Fireworks Firework effect with WS2812b LED and a MCU This project uses FastLED library to control the LED strip. WS2812b IC is embedded into each

null 76 Jun 10, 2022