樹莓派3b 移植RT-Thread 64位操作系統


樹莓派3b 移植RT-Thread 64位操作系統

一、資源准備

1、系統要求

​ 本方法使用的是Linux (Ubuntu16.04) 系統。

2、硬件資源

  • 樹莓派3b
  • sd卡
  • ttl轉usb模塊

3、軟件資源

二、燒錄樹莓派原生系統

1、格式化SD卡

​ 有時使用windows進行格式化可能會導致后續的燒錄操作失敗,推薦使用SD Card Formatter進行格式化。

2、燒錄系統鏡像

​ 將下載的系統鏡像壓縮包進行解壓得到img文件,使用balenaEtcher將鏡像燒錄到sd卡中,顯示如下畫面即為燒錄成功。

image-20200928202531014

三、移植RT-Thread

1、工具鏈及源代碼准備

​ 將下載下來的 gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz 文件放在系統opt/目錄下進行解壓
若官網下載速度過慢可通過下方鏈接進行下載

鏈接:https://pan.baidu.com/s/1rroD0IqHPnBOXcE_NeVQ6g 

提取碼:hv3i 

​ 使用如下指令下載RTT源碼:

git clone git@github.com:RT-Thread/rt-thread.git

​ 注:使用git指令進行下載需要先在系統中使用sudo apt-get install git指令來安裝git,並對github進行配置,配置過程可參考下方鏈接博文。

[[Ubuntu Github基本使用方法]: https://blog.csdn.net/weixin_43793181/article/details/103111290

或可直接從github下載源碼並解壓到系統某處。

2、下載scons

​ scons為Python編寫的自動化構建工具,我們使用此工具編譯RTT源代碼並生成系統鏡像。使用如下指令安裝scons:

sudo apt-get install scons

3、編譯源碼

​ 打開Terminal進入RTT源碼rt-thread-master\bsp\raspberry-pi\raspi3-64目錄下,輸入指令scons進行編譯,並得到系統鏡像文件 kernal8.img,將此文件拷入sd卡,完成移植。

【注1】:若在輸入scons指令后出現 scons sh: 1: aarch64-elf-gcc: not found報錯,請檢查 gcc-arm-8.3-2019.03-x86_64-aarch64-elf 是否在opt/目錄下,或將rt-thread-master\bsp\raspberry-pi\raspi3-64下的rtconfig.py文件中

EXEC_PATH   = r'/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/'  

/bin/之前的部分改為編譯工具的實際路徑。

【注2】:若在輸入scons指令后出現形如以下的錯誤

In file included from /home/matassos/Desktop/rt-thread-master/include/libc/libc_signal.h:71,
from /home/matassos/Desktop/rt-thread-master/include/rtlibc.h:21,
from /home/matassos/Desktop/rt-thread-master/include/rtdef.h:1024,
from /home/matassos/Desktop/rt-thread-master/include/rtthread.h:23,
from applications/main.c:27:
/opt/riscv/riscv64-unknown-elf/include/sys/signal.h:42:7: error: redefinition of 'union sigval'
union sigval {
^~~~~~
In file included from /home/matassos/Desktop/rt-thread-master/include/rtlibc.h:21,
from /home/matassos/Desktop/rt-thread-master/include/rtdef.h:1024,
from /home/matassos/Desktop/rt-thread-master/include/rtthread.h:23,
from applications/main.c:27:
/home/matassos/Desktop/rt-thread-master/include/libc/libc_signal.h:31:7: note: originally defined here
union sigval
^~~~~~
In file included from /home/matassos/Desktop/rt-thread-master/include/rtlibc.h:21,
from /home/matassos/Desktop/rt-thread-master/include/rtdef.h:1024,
from /home/matassos/Desktop/rt-thread-master/include/rtthread.h:23,
from applications/main.c:27:
/home/matassos/Desktop/rt-thread-master/include/libc/libc_signal.h:39:8: note: originally defined here
struct sigevent
^~~~~~~~
In file included from /home/matassos/Desktop/rt-thread-master/include/libc/libc_signal.h:71,
from /home/matassos/Desktop/rt-thread-master/include/rtlibc.h:21,
from /home/matassos/Desktop/rt-thread-master/include/rtdef.h:1024,
from /home/matassos/Desktop/rt-thread-master/include/rtthread.h:23,
from applications/main.c:27:
/opt/riscv/riscv64-unknown-elf/include/sys/signal.h:72:3: error: conflicting types for 'siginfo_t'
} siginfo_t;
^~~~~~~~~

請使用指令scons -c之后再次進行嘗試。

四、驗證

使用杜邦線將ttl轉usb模塊連接樹莓派,接線方式如圖所示。

image-20200928204019997

image-20200928204049719

連接電腦后,打開串口工具連接串口,波特率115200,停止位1,數據位8,樹莓派上電后串口打印如下信息即為移植成功。

image-20200928205407557


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM