Linux Command Line Compilation Environment Setup
Download Tools
Recommended version of CMake: 3.25.1 (version cannot be lower than 3.20), official download link: CMake — Download;Backup download address: Download。
Ninja recommended version: 1.11.1, official download link: Ninja — Download;Backup download address: Download。
Ccache recommended version: 4.7.4 (optional), official download link: Ccache — Download;Backup download address: Download。
Recommended use of Python: Python3 (version not less than 3.8), official download link: Python — Download (Linux system provides source code package);Backup download address: Download。
- Toolchain, official download link: Tool chain download;Backup download address: Tool chain download。
The approximate name of the toolchain is csky-elfabiv2-tools-***.tar,the toolchains with -mingw- in the name are for Windows, while others are for Linux.
Some versions of the toolchain on Linux may depend on ncurses. If you see the prompt “error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory” , install libncurses5 (e.g., sudo apt install libncurses5). Other similar issues may need to be resolved by the user.
- DebugServer (optional): Official Download <https://www.xrvm.cn/community/download?id=4313368247333359616>, Alternate Download <https://zone.winnermicro.net:60443/wmios/tools/linux/XuanTie-DebugServer-linux.zip>.
For detailed installation instructions, please refer to the relevant installation section of the T-Head Debugger Server User Guide <../../../../wmios/debug_server/T-Head_Debugger_Server_User_Guide_ZH-CN.pdf>_.
Besides downloading from the above addresses, Linux systems often allow installation via built-in package managers. Details are not provided here.
If these tools already exist on your system and meet version requirements, you can use them directly without reinstalling.
On Linux systems, it’s recommended to use package managers like apt
、yum
、dnf
to automatically install the related tools. Below is an example using the apt command on Ubuntu. Specific steps are as follows:
Install CMake
sudo apt-get install cmake
Instal Ninja
sudo apt-get install ninja-build
Instal Ccache
sudo apt-get install ccache
Instal Python3
sudo apt-get install python3
Toolchain tools still need to be installed manually as mentioned above.
Install Python Dependencies
Assuming the WM IoT SDK has been downloaded and named wm_iot_sdk
。
python -m pip install --user -r /home/wm/wm_iot_sdk/tools/wm/requirements.txt
In addition,the Tkinter module needs to be installed for Python on Linux. For Ubuntu systems, you can use sudo apt-get install python-tk
(or sudo apt-get install python3-tk
) to install it.
Set Environment Variables for Tools
If tools are installed by package managers(apt、yum), environment variables might already be set and do not need to be configured again.
Add CMake to PATH
export PATH=/home/wm/tools/cmake/bin:$PATH
Add Ninja to PATH
export PATH=/home/wm/tools/ninja:$PATH
Add Ccache to PATH
export PATH=/home/wm/tools/ccache:$PATH
Add Python to PATH
//Under the Linux system, only the source code package is provided, so it needs to be compiled first and then added to the environment variables:
./configure --prefix=/home/wm/tools/python
make
make install
export PATH=/home/wm/tools/python:$PATH
Add Toolchain to PATH
export PATH=/home/wm/tools/csky-elfabiv2-tools/bin:$PATH
Set WM IoT SDK Environment Variable
export WM_IOT_SDK_PATH=/home/wm/wm_iot_sdk
Add wm.py Tool to PATH
export PATH=$WM_IOT_SDK_PATH/tools/wm:$PATH
The above operations are temporary settings,, only effective for the current session. To make them permanent, save the environment variables to the ~/.bashrc
file.