2020-10-29 11:46:14 +00:00
|
|
|
BL602 SDK (Pine64 version)
|
|
|
|
==========================
|
2020-10-26 12:35:25 +00:00
|
|
|
|
2020-12-30 21:35:01 +00:00
|
|
|
Join us on
|
|
|
|
`Discord <https://discord.gg/89VWQVH>`_,
|
|
|
|
`Telegram <https://t.me/joinchat/Kmi2S0nOsT240emHk-aO6g>`_,
|
|
|
|
`Matrix <https://matrix.to/#/#pine64-nutcracker:matrix.org>`_
|
2020-10-29 08:29:21 +00:00
|
|
|
|
2020-10-29 11:46:14 +00:00
|
|
|
This repository contains the Pine64 fork of Bouffalo Lab's SDK for their BL602
|
2020-10-29 22:57:39 +00:00
|
|
|
Wi-Fi/BLE Combo RISC-V SoC. Documentation, including upstream documentation,
|
|
|
|
translations, mirrored technical documentation, and original reverse engineered
|
|
|
|
documentation is at `bl602-docs <https://github.com/pine64/bl602-docs>`_, which
|
2020-12-30 21:35:01 +00:00
|
|
|
is cloned as a submodule of this repository at ``docs``. Use ``git submodule
|
|
|
|
update --init`` to initialize the submodule.
|
2020-10-26 12:35:25 +00:00
|
|
|
|
2020-10-29 11:46:14 +00:00
|
|
|
This repository is the central focus of Pine64's
|
2020-12-30 21:35:01 +00:00
|
|
|
`Nutcracker Challenge <https://www.pine64.org/2020/10/28/nutcracker-challenge-blob-free-wifi-ble/>`_.
|
|
|
|
The main task is to reverse engineer the following files:
|
2020-11-21 02:19:32 +00:00
|
|
|
|
|
|
|
- `components/bl602/bl602_wifi/lib/libbl602_wifi.a <https://github.com/pine64/bl_iot_sdk/blob/master/components/bl602/bl602_wifi/lib/libbl602_wifi.a>`_
|
|
|
|
- `components/network/ble/blecontroller/lib/libblecontroller.a <https://github.com/pine64/bl_iot_sdk/blob/master/components/network/ble/blecontroller/lib/libblecontroller.a>`_
|
|
|
|
- `components/stage/atcmd/lib/libatcmd.a <https://github.com/pine64/bl_iot_sdk/blob/master/components/stage/atcmd/lib/libatcmd.a>`_
|
|
|
|
|
|
|
|
This is being done at `bl602-re <https://github.com/pine64/bl602-re>`_.
|
|
|
|
|
2020-10-28 22:20:25 +00:00
|
|
|
|
2020-11-03 16:15:41 +00:00
|
|
|
Documentation
|
|
|
|
------------
|
2020-12-30 21:35:01 +00:00
|
|
|
You can find a lot of documentation on `PINE64 Documentation Website <https://pine64.github.io/bl602-docs/>`_
|
|
|
|
and `PINE64 Documentation Repository <https://github.com/pine64/bl602-docs>`_,
|
|
|
|
where you can find Datasheets, Reference Manuals and various other documentation
|
|
|
|
materials.
|
2020-11-03 16:15:41 +00:00
|
|
|
|
2020-10-28 22:26:15 +00:00
|
|
|
Quick Start
|
2020-10-29 11:46:14 +00:00
|
|
|
-----------
|
2020-10-29 16:24:31 +00:00
|
|
|
In order to build sample apps, you need to set a few environment variables::
|
2020-10-29 06:26:48 +00:00
|
|
|
|
|
|
|
export BL60X_SDK_PATH=/path/to/this/repo
|
2020-10-31 14:56:08 +00:00
|
|
|
export CONFIG_CHIP_NAME=BL602
|
2020-10-29 06:26:48 +00:00
|
|
|
|
2020-11-21 02:19:32 +00:00
|
|
|
In order to build all sample apps simply call `make`, for example::
|
|
|
|
|
2020-10-29 16:24:31 +00:00
|
|
|
make
|
|
|
|
|
|
|
|
To only build the sample app of interest, go to the directory of the app,
|
|
|
|
then call `make`, for example::
|
2020-10-29 06:26:48 +00:00
|
|
|
|
|
|
|
cd customer_app/bl602_boot2
|
|
|
|
make
|
2020-10-29 02:39:42 +00:00
|
|
|
|
2020-11-21 02:19:32 +00:00
|
|
|
Call
|
|
|
|
====
|
|
|
|
|
|
|
|
::
|
2020-10-29 06:26:48 +00:00
|
|
|
|
|
|
|
make CONFIG_TOOLPREFIX=riscv64-linux-gnu-
|
|
|
|
|
2020-11-19 17:30:30 +00:00
|
|
|
if you wish to bypass the bundled cross-compiler and using your distribution's own
|
2020-10-29 06:26:48 +00:00
|
|
|
cross-compiler.
|
2020-10-29 02:39:42 +00:00
|
|
|
|
2020-10-28 22:26:15 +00:00
|
|
|
There is a linker script (written in python) at `image_conf/flash_build.py`.
|
2020-10-29 06:26:48 +00:00
|
|
|
To run this, you need to specify the application and the target, for example::
|
|
|
|
|
|
|
|
python3 flash_build.py bl602_boot2 bl602
|
2020-10-28 22:20:25 +00:00
|
|
|
|
2020-11-19 17:30:30 +00:00
|
|
|
**Note:** If you decide to copy any project outside of the `customer_app` folder,
|
|
|
|
you will need to define a few variables in order to compile it::
|
|
|
|
|
|
|
|
export BL60X_SDK_PATH=/path/to/this/repo
|
|
|
|
export CONFIG_CHIP_NAME=bl602
|
|
|
|
|
2020-10-28 22:20:25 +00:00
|
|
|
Hardware
|
2020-10-29 11:46:14 +00:00
|
|
|
--------
|
2020-10-29 06:26:48 +00:00
|
|
|
BL602 is a 32-bit RISC-V based combo chipset supporting Wi-Fi and BLE (Bluetooth
|
|
|
|
Low Energy). The chip is made by `Nanjing-based Bouffalo Lab <https://www.bouffalolab.com/bl602>`_
|
|
|
|
for ultra-low-power applications. In terms of price range and feature set, the
|
2020-10-29 22:57:39 +00:00
|
|
|
chip is competing against `Espressif ESP8266 <https://www.espressif.com/en/products/socs/esp8266>`_.
|
2020-10-31 16:07:33 +00:00
|
|
|
The RISC-V core is based on `SiFive E24 <https://www.sifive.com/cores/e24>`_.
|
|
|
|
|
|
|
|
At the moment there are mainly three development boards:
|
|
|
|
|
|
|
|
- `PineCone <https://www.pine64.org/2020/10/28/nutcracker-challenge-blob-free-wifi-ble/>`_: USB-C evaluation board by Pine64 (datasheet `here <https://www.cnx-software.com/pdf/schematics/Pine64%20BL602%20EVB%20Schematic%20ver%201.1.pdf>`_), RGB LED, CH340N USB-to-UART chip
|
|
|
|
- `Doi.am DT-BL10 <https://www.cnx-software.com/2020/10/25/bl602-iot-sdk-and-5-dt-bl10-wifi-ble-risc-v-development-board/>`_: micro USB
|
|
|
|
- `Official BL EVB <https://twitter.com/nnn112358/status/1321289916249235457>`_ (Sipeed early adopter program): mini USB, FTDI chip?
|
2020-10-29 06:35:05 +00:00
|
|
|
|
2020-10-28 22:20:25 +00:00
|
|
|
Comparison with ESP8266
|
2020-10-29 11:46:14 +00:00
|
|
|
-----------------------
|
2020-10-28 22:20:25 +00:00
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| | Bouffalo Lab BL602 | Espressif ESP8266 |
|
|
|
|
+===================+=============================+==================================+
|
2020-10-31 16:07:33 +00:00
|
|
|
| Architecture | 32-bit RISC-V (SiFive E24) | 32-bit Xtensa |
|
2020-10-28 22:20:25 +00:00
|
|
|
| | | |
|
|
|
|
| | @192MHz (dynamic @1-192MHz) | @80MHz (and 160MHz) |
|
|
|
|
| | | |
|
|
|
|
| | L1 cache | |
|
|
|
|
| | | |
|
|
|
|
| | FPU | |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| Memory | 276KB SRAM | 32 KiB instruction RAM |
|
|
|
|
| | | |
|
|
|
|
| | 128KB ROM | 32 KiB instruction cache RAM |
|
|
|
|
| | | |
|
|
|
|
| | 1 Kb eFuse | 80 KiB user-data RAM |
|
|
|
|
| | | |
|
|
|
|
| | optional embdedded flash | 16 KiB ETS system-data RAM |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | XIP QSPI flash support | No programmable ROM |
|
|
|
|
| | | |
|
|
|
|
| | | QSPI flash support |
|
|
|
|
| | | (up to 16 MB) |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| Wi-Fi | 802.11 b/g/n @2.4GHz | 802.11 b/g/n @2.4GHz |
|
|
|
|
| | | |
|
|
|
|
| | WPS/WEP/WPA/WPA2/WPA3 | WEP/WPA/WPA2 |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| Bluetooth | LE 5.0 | NONE |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| GPIO | x16 | x16 |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| SDIO | x1 2.0 slave | x1 v2.0 slave |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| SPI | x1 | x2 |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| UART | x2 | x1.5 |
|
|
|
|
| | | (One Tx only) |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| I2C | x1 | x1 (software implemented) |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| I2S | NONE | x1 (with DMA) |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| PWM channels | x5 | x4 |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| ADC | 12-bit | 10-bit (SAR) |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| DAC | 10-bit | NONE |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| Analog Comparator | x2 | NONE |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| DMA | x4 | with I2S |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| Timer | RTC (up to 1 year) | x1 hardware |
|
|
|
|
| | | |
|
|
|
|
| | x2 32-bit general-purpose | x1 software |
|
|
|
|
| | | |
|
|
|
|
| | | (no interrupt gen. on sw. timer) |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| IR Remote Control | x1 | x1 |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|
|
|
|
| Debug | JTAG support | ? |
|
|
|
|
+-------------------+-----------------------------+----------------------------------+
|