avatar
/home/robomico
Dev envorinment for HiSilicon WS63 on Linux

Dev envorinment for HiSilicon WS63 on Linux

HiSpark Studio? never heard of that

Dev envorinment for HiSilicon WS63 on Linux

Work in progress. Comments are welcome!

Why You Should Develop WS63 on Linux

  • Huawei and HiSilicon have not provided any official configuration documentation for the Linux environment, which gives Linux developers a rebellious edge;
  • Enjoy compilation speeds up to 8x faster than on Windows;
  • Simply had enough with HiSpark Studio or Windows.

Software Prerequisites

Ensure the following packages are installed on your system:

1
python cmake ninja make gcc musl kconfig

Verify that the default Python environment includes the following libraries:

1
kconfiglib pycparser setuptools

Use Visual Studio Code as your primary IDE. The only essential extension you need is C/C++. Do not install the HiSpark Studio plugin, as it is Windows-only and incompatible with Linux.

Base Code Repository

Directly clone the official Hisilicon GitCode repository:

1
git clone https://gitcode.com/HiSpark/fbb_ws63.git

Navigate into the src subdirectory to serve as your main project code directory.

Project Configuration

Open the TUI configuration menu in the terminal using the following command:

1
python build.py ws63-liteos-app menuconfig

Use arrow keys for navigation, Space to toggle checkboxes or enter sub-menus, S to save changes, Esc to go back one level, and Q to quit.

Compilation

Before compiling, configure your environment variables to enable the compiler to utilize all CPU cores for parallel builds. Add the following configuration to your shell profile (e.g., ~/.bashrc, depending on your choice of shell):

1
2
3
THREADS_COUNT=$(cat /proc/cpuinfo | grep "processor" | sort -u | wc -l)
export CMAKE_BUILD_PARALLEL_LEVEL=${THREADS_COUNT}
export MAKEFLAGS="-j${THREADS_COUNT}"

Clean rebuild (perform this after modifying project configuration):

1
python build.py -c ws63-liteos-app

Incremental build (use when project configuration remains unchanged to speed up compilation):

1
python build.py ws63-liteos-app

Flashing Firmware

To flash the board, use the wild community-maintained Linux flashing tool available at:
https://github.com/goodspeed34/ws63flash

Important note when compiling from source: During configuration, set the C compiler to musl-gcc:

1
CC="musl-gcc" ./configure

For users of Arch-based distributions, AUR package is available:

1
yay -S ws63flash-git

Before flashing, identify the corresponding serial device file for your development board (/dev/ttyUSBx, where x is typically 0 or 1):

1
find /dev | grep "ttyUSB"

If you’re unsure which device corresponds to your board, unplug it, run the command, then replug it, then run the command again, so you can see the device from the difference of the two outputs.

Full flash (includes Bootloader and all components):

1
sudo ws63flash -b921600 --flash /dev/ttyUSBx ./output/ws63/fwpkg/ws63-liteos-app/ws63-liteos-app_all.fwpkg

Flash only the application load (recommended for subsequent flashes after initial setup):

1
sudo ws63flash -b921600 --flash /dev/ttyUSBx ./output/ws63/fwpkg/ws63-liteos-app/ws63-liteos-app_load_only.fwpkg

Serial Debugging

Linux includes a universal serial console tool called minicom. After installing the minicom package, keep your development board connected and run:

1
sudo minicom -D /dev/ttyUSBx

Replace /dev/ttyUSBx with the correct device name identified in the flashing step.

  • Press any key on your keyboard to send a single ASCII character to the board.
  • To send a multi-character message: save the message as a file, then press Ctrl+A, followed by S to open the “Send File” menu. Select ascii as the encoding, then navigate to your file in the TUI interface, or directly type its path.

To access the command help menu, press Ctrl+A then Z.
The two most frequently used function keys are:

  • Ctrl+A; C: Clear screen
  • Ctrl+A; X: Exit minicom

Commands Cheat Sheet

(Replace /dev/ttyUSBx with the actual device file)

FunctionCommand
Project configurationpython build.py ws63-liteos-app menuconfig
Clean rebuildpython build.py ws63-liteos-app -c
Incremental buildpython build.py ws63-liteos-app
Full flashsudo ws63flash -b921600 --flash /dev/ttyUSBx ./output/ws63/fwpkg/ws63-liteos-app/ws63-liteos-app_all.fwpkg
Flash only the application loadsudo ws63flash -b921600 --flash /dev/ttyUSBx ./output/ws63/fwpkg/ws63-liteos-app/ws63-liteos-app_load_only.fwpkg
Serial debuggersudo minicom -D /dev/ttyUSBx
This post is licensed under CC BY 4.0 by the author.