[The 3rd Xuantie Cup RISC-V Application Innovation Competition] LicheePi 4A+Rust environment experience
[Copy link]
This post was last edited by eew_EAHZ4Z on 2023-10-18 16:56
I received the board yesterday and tried it out today. This article will share some information about setting up the Rust development environment and using some software.
Note: If you have problems with the network speed, please refer to the proxy settings section below.
This article initially uses rust to install some software for testing, and the effect is great
First install `sudo apt install neofetch` and execute as follows
Native installation environment
Install the necessary environment
sudo apt install build-essential curl git
Then execute
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs
Follow the prompts to select 2 to choose the following, then select 1 to install
default host triple: riscv64gc-unknown-linux-gnu
default toolchain: nightly
profile: complete
modify PATH variable: yes
After the installation is complete, follow the prompts to set up the environment or restart the current shell
source "$HOME/.cargo/env"
(Optional) Cross-compilation environment
First test C/C++ cross compilation
# 安装环境
sudo apt install gcc-riscv64-linux-gnu
# 写入以下内容到demo.c
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
# 编译
riscv64-linux-gnu-gcc demo.c -o hello_riscv
# 上传到荔枝派
chmod +x ./hello_riscv
./hello_riscv
# 正常应该会运行成功并可以打印
Testing with Rust
# 更新链接文件
cat >>~/.cargo/config <<EOF
[target.riscv64gc-unknown-linux-gnu]
linker = "riscv64-linux-gnu-gcc"
EOF
# 以一个demo为例子
cargo new --bin demo1
cd demo1
# 编译
cargo build --target=riscv64gc-unknown-linux-gnu
# 荔枝host主机测试
# 上传 target/riscv64gc-unknown-linux-gnu/debug/demo1
# 运行
chmod +x demo1
./demo1
test
Install on the host
cargo install static-web-server
# ring存在问题,先禁用http2
cargo install static-web-server --no-default-features --features "compression directory-listing basic-auth fallback-page"
run
static-web-server -d wwwroot/ -z -p 8080
Check the effect as shown below. (A random file is placed under wwwroot)
Remote IDE
It is not possible to run using vscode.Unsupported architecture
Then you can only think of other ways, either cross-compile vscode locally and run it, or compile it on the host and run it directly.
The host can deploy a remote environment, so that it is OK to run the editor directly on the host. ( Compilation is not completed, and more platform-available software will be updated later )
Setting up the remote environment
Enter the following command to install the remote service
sudo apt update
sudo apt install xrdp
sudo systemctl enable xrdp
sudo systemctl start xrdp
Just use Windows remote connection. As shown below
(Optional) Proxy settings
Using socks5 proxy
install software
sudo apt install build-essential wget
Download and compile proxychains-ng
wget http://ftp.barfooze.de/pub/sabotage/tarballs/proxychains-ng-4.16.tar.xz
tar -xJf proxychains-ng-4.16.tar.xz
cd proxychains-ng-4.16/
./cpmfohire --prefix=/usr/local
make
sudo make install
sudo make install-config
Change setting
sudo nano /usr/local/etc/proxychains.conf
# 修改以下内容
quiet_mode
#socks4 127.0.0.1 9050
# 添加自己的代理
socks5 192.168.x.x 1080
proxychains4 Each time you execute it , you can use
Use another proxy RsProxy
Just follow the instructions on the RsProxy official website to set it up. The availability has not been tested.
|