當前位置:首頁 » 操作系統 » arm源碼

arm源碼

發布時間: 2022-11-16 03:40:38

① ARM匯編中的ldr和adr的區別及其在uboot中相關源碼的分析

ARM匯編有ldr指令以及ldr、adr偽指令,它們都可以將標號表達式作為操作數,下面通過分析一段代碼以及對應的反匯編結果來說明它們的區別。
ldr r0, _start
adr r0, _start
ldr r0, =_start
_start:
b _start
編譯的時候設置 RO 為 0x30000000,下面是反匯編的結果:
0x00000000: e59f0004 ldr r0, [pc, #4] ; 0xc
0x00000004: e28f0000 add r0, pc, #0 ; 0x0
0x00000008: e59f0000 ldr r0, [pc, #0] ; 0x10
0x0000000c: eafffffe b 0xc
0x00000010: 3000000c andcc r0, r0, ip
1.ldr r0, _start

這是一條指令,從內存地址 _start 的位置把值讀入。在這里_start是一個標號(是一個相對程序的表達式),匯編程序計算相對於 PC 的偏移量,並生成相對於 PC的前索引的指令:ldr r0, [pc, #4]。執行指令後,r0 =0xeafffffe。
ldr r0, _start是根據_start對當前PC的相對位置讀取其所在地址的值,因此可以在和_start標號的相對位置不變的情況下移動。
2.adr r0, _start

這是一條偽指令,總是會被匯編程序匯編為一個指令。匯編程序嘗試產生單個 ADD或 SUB 指令來裝載該地址。如果不能在一個指令中構造該地址,則生成一個錯誤,並且匯編失敗。在這里是取得標號_start 的地址到 r0,因為地址是相對程序的,因此ADR產生依賴於位置的代碼,在此例中被匯編成:add r0, pc, #0。因此該代碼可以在和標號相對位置不變的情況下移動;假如這段代碼在 0x30000000 運行,那麼 adr r0, _start 得到 r0 = 0x3000000c;如果在地址 0 運行,就是 0x0000000c 了。
通過這一點可以判斷程序在什麼地方運行。U-boot中那段relocate代碼就是通過adr實現當前程序是在RAM中還是flash中,下面進行簡要分析。

② arm9讀寫TF卡C語言源碼,

不知道你的這個是否帶操作系統,如果是linux應該是這樣的,首先要支持TF的驅動程序,當tf能正常工作後,就可以採用mount之類的命令載入tf到系統的某個目錄里。這樣就可以把tf當做一個普通的盤符或目錄來使用。

如果不帶操作系統,可參考附件

③ 求arm如何進入省電、停止模式,最好是源代碼

在啟動代碼裡面的嘛,自己寫個小程序就行了啊!在初始化的時候!

④ 國內arm源地址

1)阿里源:

deb http://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse

2)清華源:

# 默認注釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消注釋

deb https://mirrors.tuna.tsinghua.e.cn/ubuntu-ports/ bionic main restricted universe multiverse

 deb-src https://mirrors.tuna.tsinghua.e.cn/ubuntu-ports/ bionic main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.e.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse

 deb-src https://mirrors.tuna.tsinghua.e.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.e.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse

 deb-src https://mirrors.tuna.tsinghua.e.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.e.cn/ubuntu/ bionic-security main restricted universe multiverse

⑤ linux怎樣編譯libusb源碼arm

最先用avr寫。包括啟動程序,內核,文件系統。 如果uboot已經寫進去了,那麼以後可以配置好uboot和nfs, 直接啟動到uboot狀態,通過uboot的命令和網路進行燒寫內核和fs。

⑥ linux for arm源代碼在哪裡可以下載

kernel.org可以下到源碼,至於要for arm, 需要配置一下內核就可以了,這也就是內核的配置與裁剪工作了;配置內核的工作可以自己做,當然也可以從平台的提供商那裡獲取

⑦ 求一linux-arm下的HelloWorld小程序源碼

#include <stdio.h>
#include <stdlib.h>
void main()
{
printf("hello world !");
}

這個c程序,哪個機上的c或gcc都應能通過。

編譯未通過原因是什麼?找不到頭文件?路徑,庫的路徑等環境變數設對了沒有?

⑧ 各位大大們: 小弟最近在學習ARM列印機驅動開發,不知該如何入手啊誰有這方面的源碼,我高分送出

根據39碼規則,用vb6控制列印機列印條形碼的函數
Public Function PrintBarCode( _
ByVal strBarCode As String, _
Optional ByVal intXPos As Integer = 0, _
Optional ByVal intYPos As Integer = 0, _
Optional ByVal intPrintHeight As Integer = 10, _
Optional ByVal bolPrintText As Boolean = True _
)
Dim intOldScaleMode As ScaleModeConstants
Dim intOldDrawWidth As Integer
Dim fntOldFont As StdFont
Dim strBC As String
Dim x As Integer
Dim y As Integer
Dim intHeight As Integer
Dim intIndex As Integer
Dim I As Integer, j As Integer, K As Integer ' 循環控制變數

'llp 將字元串 strBarCode 對應的條形碼輸出到預設列印機
' 參數說明:
' strBarCode - 要列印的條形碼字元串
' intXPos, intYPos - 列印條形碼的左上角坐標(預設為(0,0),坐標刻度為:毫米)
' intHeight - 列印高度(預設為一厘米,坐標刻度為:毫米)
' bolPrintText - 是否列印人工識別字元(預設為true)
' "0"-"9","A-Z","-","%","$"和"*" 的條碼編碼格式,總共 40 個字元
Static strBarTable(39) As String
' 初始化條碼編碼格式表

strBarTable(0) = "001100100" ' 0
strBarTable(1) = "100010100" ' 1
strBarTable(2) = "010010100" ' 2
strBarTable(3) = "110000100" ' 3
strBarTable(4) = "001010100" ' 4
strBarTable(5) = "101000100" ' 5
strBarTable(6) = "011000100" ' 6
strBarTable(7) = "000110100" ' 7
strBarTable(8) = "100100100" ' 8
strBarTable(9) = "010100100" ' 9
strBarTable(10) = "100010010" ' A
strBarTable(11) = "010010010" ' B
strBarTable(12) = "110000010" ' C
strBarTable(13) = "001010010" ' D
strBarTable(14) = "101000010" ' E
strBarTable(15) = "011000010" ' F
strBarTable(16) = "000110010" ' G
strBarTable(17) = "100100010" ' H
strBarTable(18) = "010100010" ' I
strBarTable(19) = "001100010" ' J
strBarTable(20) = "100010001" ' K
strBarTable(21) = "010010001" ' L
strBarTable(22) = "110000001" ' M
strBarTable(23) = "001010001" ' N
strBarTable(24) = "101000001" ' O
strBarTable(25) = "011000001" ' P
strBarTable(26) = "000110001" ' Q
strBarTable(27) = "100100001" ' R
strBarTable(28) = "010100001" ' S
strBarTable(29) = "001100001" ' T
strBarTable(30) = "100011000" ' U
strBarTable(31) = "010011000" ' V
strBarTable(32) = "110001000" ' W
strBarTable(33) = "001011000" ' X
strBarTable(34) = "101001000" ' Y
strBarTable(35) = "011001000" ' Z
strBarTable(36) = "000111000" ' -
strBarTable(37) = "100101000" ' %
strBarTable(38) = "010101000" ' $
strBarTable(39) = "001101000" ' *
If strBarCode = "" Then Exit Function ' 不列印空串
' 保存列印機 ScaleMode

intOldScaleMode = Printer.ScaleMode
' 保存列印機 DrawWidth

intOldDrawWidth = Printer.DrawWidth
' 保存列印機 Font

Set fntOldFont = Printer.Font

Printer.ScaleMode = vbTwips
' 設置列印用的坐標刻度為緹(twip=1)
Printer.DrawWidth = 1
' 線寬為 1
Printer.FontName = "宋體"
' 列印在條碼下方字元的字體和大小
Printer.FontSize = 10

' 要列印的條碼字元串
strBC = UCase(strBarCode)
' 將以毫米表示的 X 坐標轉換為以緹表示

x = Printer.ScaleX(intXPos, vbMillimeters, vbTwips)
' 將以毫米表示的 Y 坐標轉換為以緹表示

y = Printer.ScaleY(intYPos, vbMillimeters, vbTwips)
' 將以毫米表示的高度轉換為以緹表示

intHeight = Printer.ScaleY(intPrintHeight, vbMillimeters, vbTwips)

' 是否在條形碼下方列印人工識別字元
If bolPrintText = True Then
' 條碼列印高度要減去下面的字元顯示高度
intHeight = intHeight - Printer.TextHeight(strBC)
End If

Const intWidthCU As Integer = 35
' 粗線和寬間隙寬度
Const intWidthXI As Integer = 12
' 細線和窄間隙寬度

' 當前處理的字元串索引

' 添加起始字元
If Left(strBC, 1) <> "*" Then
strBC = "*" & strBC
End If
' 添加結束字元
If Right(strBC, 1) <> "*" Then
strBC = strBC & "*"
End If

' 循環處理每個要顯示的條碼字元
For I = 1 To Len(strBC)
' 確定當前字元在 strBarTable 中的索引
Select Case Mid(strBC, I, 1)
Case "*"
intIndex = 39
Case "$"
intIndex = 38
Case "%"
intIndex = 37
Case "-"
intIndex = 36
Case "0" To "9"
intIndex = CInt(Mid(strBC, I, 1))
Case "A" To "Z"
intIndex = Asc(Mid(strBC, I, 1)) - Asc("A") + 10
Case Else
Exit Function
'MsgBox "要列印的條形碼字元串中包含無效字元!"
'當前版本只支持字元
'0'-'9','A'-'Z','-','%','$'和'*'"
End Select

' 是否在條形碼下方列印人工識別字元
If bolPrintText = True Then
Printer.CurrentX = x
Printer.CurrentY = y + intHeight
Printer.Print Mid(strBC, I, 1)
End If
For j = 1 To 5
' 畫細線
If Mid(strBarTable(intIndex), j, 1) = "0" Then
For K = 0 To intWidthXI - 1
Printer.Line (x + K, y)-Step(0, intHeight)
Next K
x = x + intWidthXI
' 畫寬線
Else
For K = 0 To intWidthCU - 1
Printer.Line (x + K, y)-Step(0, intHeight)
Next K
x = x + intWidthCU
End If
' 每個字元條碼之間為窄間隙
If j = 5 Then
x = x + intWidthXI * 3 - 10
Exit For
End If

' 窄間隙
If Mid(strBarTable(intIndex), j + 5, 1) = "0" Then
x = x + intWidthXI * 3 - 10
' 寬間隙
Else
x = x + intWidthCU * 2 - 20
End If
Next j
Next I
' 恢復列印機 ScaleMode
Printer.ScaleMode = intOldScaleMode
' 恢復列印機 DrawWidth
Printer.DrawWidth = intOldDrawWidth
' 恢復列印機 Font
Set Printer.Font = fntOldFont

End Function

⑨ 如何用qt-4.8.5源代碼配置arm版本qt

下面是編譯選項,自己可以修修改改

./configure -opensource -embedded arm
-xplatform qws/linux-arm-gnueabi-g++ -no-webkit -qt-libtiff -qt-libmng
-qt-libjpeg -qt-libpng -no-qt3support -nomake demos -nomake docs -nomake
examples -little-endian -host-little-endian -no-xcursor
-no-mouse-linuxtp -qt-mouse-tslib -I/usr/local/tslib/include
-L/usr/local/tslib/lib -fast -lrt -confirm-license

PS:
解壓包的
mkspecs/linux-arm-gnueabi-g++ 目錄下需要配置一下你的 linux-arm-gnueabi-g++
路徑,最好是設置成絕對路徑,否則可能你配置的交叉編譯器沒有添加到環境變數裡面不好~ (如果配置了環境變數的話,那就沒必要設置了)

我的給你參考一下,就是原配了~
#
# qmake configuration for building with arm-linux-gnueabi-g++
#

MAKEFILE_GENERATOR = UNIX
TARGET_PLATFORM = unix
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

# modifications to g++.conf
QMAKE_CC = arm-linux-gnueabi-gcc
QMAKE_CXX = arm-linux-gnueabi-g++
QMAKE_LINK = arm-linux-gnueabi-g++
QMAKE_LINK_SHLIB = arm-linux-gnueabi-g++

# modifications to linux.conf
QMAKE_AR = arm-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabi-obj
QMAKE_STRIP = arm-linux-gnueabi-strip

load(qt_config)

接下來是QT CREATE配置

工具-->選項--->構建和運行

1. 編譯器: 點擊添加: "名稱"隨意
"編譯器路徑" **/arm-none-linux-gnueabi-g++
找到你的編譯器,我這里是用ARM的
其他不填也行.

2.Qt Versions: 點擊添加:找到通過源碼編譯好的qmake文件. 例如:/usr/local/Qt-4.8.6/bin/qmake

3.構建套件: 點擊添加: "名稱"隨意, 重點是 "編譯器"跟"QT版本", 分別選擇剛剛添加的兩項.
調試器:如果是桌面環境那就選桌面的, 如果是在嵌入式中的,那不要也可以..

熱點內容
新建文件夾2免費手機 發布:2024-05-18 12:56:13 瀏覽:363
自己在家搭建伺服器有水冷散熱嗎 發布:2024-05-18 12:47:27 瀏覽:648
舊版的安卓手機怎麼使用微信 發布:2024-05-18 12:46:36 瀏覽:466
我的世界伺服器開多久 發布:2024-05-18 12:45:32 瀏覽:592
vba獲取網頁表格資料庫資料庫資料庫 發布:2024-05-18 12:23:24 瀏覽:699
騰訊伺服器為什麼卡頓 發布:2024-05-18 12:02:12 瀏覽:305
如何知道密碼鎖有沒有nfc 發布:2024-05-18 11:58:09 瀏覽:961
單片機c語言模塊化編程 發布:2024-05-18 11:53:16 瀏覽:644
win7xp共享列印機拒絕訪問 發布:2024-05-18 11:51:00 瀏覽:847
zkeys金屬伺服器怎麼使用 發布:2024-05-18 11:49:31 瀏覽:581