arm源码
① 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版本", 分别选择刚刚添加的两项.
调试器:如果是桌面环境那就选桌面的, 如果是在嵌入式中的,那不要也可以..