Lab1
- Please explain what is
arm-linux-gnueabihf-gcc
? Why don’t we just compile with gcc
?
- eabi: 嵌入式ABI,嵌入式應用二進制街口指定了文件格式、數據類型、暫存器使用、堆積組織優化和在一個嵌入式軟件中的參數的標準約定。
- hf: armhf架構,用fpu計算,傳參數也用fpu中的浮點暫存器傳,省去了轉換,性能最好,但是中斷負荷高
- 因為 embedded 和 host 的計算機架構不同,所使用的library也不同,所以不能直接用
gcc
- Can executable
hello_world
run on the host computer? Why or Why not?
Lab2
- What are the cmake and make for? What is the relationship between them?
- cmake & make 都是編譯工具
- CMake是一种跨平台编译工具,比make更为高级,使用起来要方便得多。CMake主要是编写CMakeLists.txt文件,然后用cmake命令将CMakeLists.txt文件转化为make所需要的makefile文件,最后用make命令编译源码生成可执行程序或共享库(so(shared object)).它的作用和qt的qmake是相似的。
- Why there are so many arguments in the compilation command(step 4.4.2)? What are they for?
- -I:這用於指定編譯器應該查找header files的其他包含目錄
- -L:這用於指定連接器應該查找library的其他庫目錄
- -Wl,-rpath-link:這用於為連接器指定運行時dependent shared library搜索路徑 RUNPATH。這些路徑用於在執行期間查找動態庫(.so文件)
- provides a hint to the linker about where to find dependent shared libraries during the linking process. It doesn't affect the runtime behavior of the resulting binary or library.
- -lpthread:這鏈接了libpthread庫
- -lopencv_world:這鏈接了OpenCV庫,具體是libopencv_world庫
- What is
libopencv_world.so.3.4.7
for? Why do we need to use LD_LIBRARY_PATH=. ./demo
to run the executable? What would happen if we just run with ./demo
? Why?
- .so: dynamically linked shared object libraries,在執行時動態載入
- The "world" module in OpenCV is a unified binary/library that contains all the individual OpenCV modules combined. Instead of linking against each module's library separately
- LD_LIBRARY_PATH是Linux環境變數名,該環境變數主要用於指定查找共享庫(動態連結庫)時除了默認路徑之外的其他路徑(/lib & /usr/lib)。
- 程式執行時,當執行函數動態連接.so時,只會從找/lib & /usr/lib,若找不到library則會發生錯誤
- It is so complex and difficult to show a picture by using the framebuffer. Why don’t we just use
cv::imshow()
to do this work?
- cv::imshow(): 在指定視窗中顯示影像(受到螢幕解析度的限制)
- No Windowing System (such as X11 (on Linux))
- Direct Control & Performance
- What is a framebuffer?
- framebuffer 是把螢幕上的每個點對映成一段線性記憶體空間,程式可以簡單的改變這段記憶體的值來改變螢幕上某一點的顏色
- What is the result of the command below? Why?
- screen redirect to file
- file redirect to frame buffer
- So, 螢幕不會改變
- You can find there is a file named
fb1
under /dev
directory. What is the difference between /dev/fb0
and /dev/fb1
? Why we use /dev/fb0
rather than /dev/fb1
?
/dev/fb0
: primary, 是embedded framebuffer(LCD)
/dev/fb1
: secondary
LABs Details
- 透過
open
+ ioctl
來取得 framebuffer 資訊 (/dev/fb0)
- 藉由
ofstream
寫入到 LCD framebuffer
- DOS: 顯卡 bios 直接對螢幕寫屏
- Linux: 顯卡硬體抽象化,提供 framebuffer 讓用戶直接寫屏
- RS-232(UART): 按照1個bit 接著1個bit傳輸 (串列通訊)
- 只用一條線來傳資料,所以它沒有額外的clock
- 要設定 baud rate ,盡量跟對方傳輸速度一樣
-
cv::imread
或 cv::VideoCapture
取得圖片資訊
-
- BGR to BGR565 (16-bit image) –> LCD requirement
-
- ofstream 操作螢幕寫入
cv::VideoWriter
: 錄影
cv::imwrite
: 截圖
- multi-thread: 偵測按鍵輸入
https://zhuanlan.zhihu.com/p/558495267
https://ecomputernotes.com/computer-graphics/basic-of-computer-graphics/what-is-frame-buffer
https://www.cnblogs.com/createyuan/p/4437912.html
https://www.cnblogs.com/liangliangge/p/14403773.html
https://makerpro.cc/2016/07/learning-interfaces-about-uart-i2c-spi/
https://ithelp.ithome.com.tw/articles/10325085?sc=rss.iron
https://www.strongpilab.com/rs232-uart-difference/