+ -
当前位置:首页 → 问答吧 → 求助:ARM 的 Linux 编程

求助:ARM 的 Linux 编程

时间:2007-05-29

来源:互联网

我对 Linux 毫无认识。如今想学习 ARM 的 Linux 编程与开发,恳请大家指点赐教。

我所使用的开发板为 RealView Versatile Platform Baseboard ARM926EJ-S. 板上 ARM 核附有 u-boot, Linux kernel 及 cramfs. 作为一个新手,我对 Linux 的编程毫无概念,实在不知如何下手。

请问:

1. Linux 编程该如何进行?若在 Windows 上开发 Linux 程序,是否可行?

2. 编程所生成的文件应该是什么样的文件格式?

3. 如何将所生成文件导入 ARM 开发板上?

4. 有必要更改厂方所提供的原始文件如 u-boot, Linux kernel 及 cramfs 吗?

5. 所生成文件与 Linux 内核文件之间有关联吗?如何在开机之时启动所编的程序?

希望大家多多指教,谢谢!      

作者: unifoxz   发布时间: 2007-05-29

我知道一些,但是也不是完全清楚,期待高手回答,呵呵      

作者: luotuo2761   发布时间: 2007-06-10

比较笼统,搜搜应该可以找到一些答案      

作者: zhouliang55   发布时间: 2007-06-11

1. Linux 编程该如何进行?若在 Windows 上开发 Linux 程序,是否可行?
  A:看看《Unix环境高级编程》。
       可以,有这样的开发环境。

2. 编程所生成的文件应该是什么样的文件格式?
A:通常是 .A   ELX

3. 如何将所生成文件导入 ARM 开发板上?
A:自己学习开发板用户手册

4. 有必要更改厂方所提供的原始文件如 u-boot, Linux kernel 及 cramfs 吗?
A:如果您喜欢DIY,自己动动也无妨!

5. 所生成文件与 Linux 内核文件之间有关联吗?如何在开机之时启动所编的程序?
A:如果程序用到了与核心相关的接口,当然就有关系了。
    学习Linux系统维护手册中启动脚本管理部分
希望大家多多指教,谢谢!

希望自己多动手,否则Linux不好玩!      

作者: 风雪狂客   发布时间: 2007-06-12

谢谢版主的解说。
经过一段时日的摸索,终于...有些小幅度的进展。可是如今又碰上思路的死结了, ...

我把 http://www.arm.com/linux/linux_download.html 所提供的映像如:u-boot_versatilepb.axf,uImage-2.6.19-arm2-versatile 及 base_linux.cramfs 都下载到板上去,内存映像文件分布如下:

Address     Name
-----------     --------
0x34000000  boot_monitor.axf
0x34040000  u-boot_versatilepb
0x34080000  uImage-2.6
0x341C0000  base_linux
0x355C0000  selftest.axf
0x35640000  mmc2flash.axf
0x35680000  nfu.axf

板子启动后,boot log 如下:
--------------------------------------------------------------------------------------------------------------------------------------

%DiskOnChip-Info, Enterring SPL                              
%DiskOnChip-Info, Transferring control to 0x07C00000                                               


ARM Versatile/PB926EJ-S Boot Monitor                                    
Version:    V2.0               
Build Date: Nov  8 2004                       
Endian:     Little                  
Running boot script - BSCRIPT.txt                                 

U-Boot 1.2.0-gb3261521-dirty (Feb 25 2007 - 02:59:39)                                                     

DRAM:   0 kB            
Flash: 64 MB            
In:    serial            
Out:   serial            
Err:   serial            
Hit any key to stop autoboot:  0                                
## Booting image at 00007fc0 ...                                
   Image Name:   Linux-2.6.19-arm2                                 
   Image Type:   ARM Linux Kernel Image (uncompressed)                                                      
   Data Size:    1187216 Bytes =  1.1 MB                                       
   Load Address: 00008000                        
   Entry Point:  00008000                        
OK  

Starting kernel ...                  

Uncompressing Linux.............................................................                                                                                
.................. done, booting the kernel.                                            
Linux version 2.6.19-arm2 (cmarinas@pc1117) (gcc version 4.1.1 (CodeSourcery ARM                                                                                
Sourcery G++ 2006q3-26)) #66 Mon Feb 26 14:04:03 GMT 2007                                                         
CPU: ARM926EJ-S [41069263] revision 3 (ARMv5TEJ), cr=00053177                                                            
Machine: ARM-Versa               
Memory policy: ECC disabled, Data cache writeback                                                
CPU0: D VIVT write-back cache                             
CPU0: I cache: 32768 bytes, associativity 4, 32 byte lines, 256 sets                                                                    
CPU0: D cache: 32768 bytes, associativity 4, 32 byte lines, 256 sets                                                                    
Built 1 zonelists.  Total pages: 32512                                      
Kernel command line: root=/dev/mtdblock0 mtdparts=armflash.0:7940k@0x1c0000(cram                                                                                
fs) mem=128M console=ttyAMA0                           
PID hash table entries: 512 (order: 9, 2048 bytes)                                                  
Console: colour dummy device 80x30                                 
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)                                                              
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)                                                            
Memory: 128MB = 128MB total                           
Memory: 127232KB available (2020K code, 438K data, 88K init)                                                            
Mount-cache hash table entries: 512                                   
CPU: Testing write buffer coherency: ok                                       
NET: Registered protocol family 16                                 
NET: Registered protocol family 2                                 
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)                                                              
TCP established hash table entries: 4096 (order: 2, 16384 bytes)                                                               
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)                                                        
TCP: Hash tables configured (establis                                    
TCP reno registered                  
JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.                                                     
io scheduler noop registered (default)                                      
CLCD: Versatile hardware, VGA display                                    
Clock CLCDCLK: setting VCO reg params: S=1 R=99 V=98                                                   
Console: switching to colour frame buffer device 80x30                                                      
Serial: AMBA PL011 UART driver                              
dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 12) is a AMBA/PL011                                                            
dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 13) is a AMBA/PL011                                                            
dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 14) is a AMBA/PL011                                                            
fpga:09: ttyAMA3 at MMIO 0x10009000 (irq                                         
smc91x.c : v1.1, sep 22 2004 by Nicolas Pitre <[email protected]>                                                           
eth0: SMC91C11xFD (rev 1) at c8866000 IRQ 25 [nowait]                                                     
eth0: Ethernet addr: 00:02:f7:00:18:d5                                      
armflash.0: Found 2 x16 devices at 0x0 in 32-bit bank                                                     
Intel/Sharp Extended Query Table at 0x0031                                          
Using buffer write method                        
cfi_cmdset_0001: Erase suspend on write enabled                                               
1 cmdlinepart partitions found on MTD device armflash.0                                                      
Creating 1 MTD partitions on "armflash.0":                                          
0x001c0000-0x00981000 : "cramfs"                                
mtd: partition "cramfs" doesn't end on an erase block -- for                                                           
mice: PS/2 mouse device common for all mice                                          
Advanced Linux Sound Architecture Driver Version 1.0.13 (Tue Nov 28 14:07:24 200                                                                                
6 UTC).      
aaci-pl041 fpga:04: ARM AC'97 Interface at 0x0000000010004000, irq 24, fifo 512                                                                              
atkbd.c: keyboard reset failed on fpga:06                                         
atkbd.c: keyboard reset failed on fpga:07                                         
ALSA device list:                 
  #0: ARM AC'97 Interface at 0x0000000010004000, irq 24                                                      
TCP cubic registered                    
NET: Registered protocol family 1                                 
NET: Registered protocol family 17                                 
VFP support v0.3: implementor 41 architecture 1 part 10 v                                                      
VFS: Mounted root (cramfs filesystem) readonly.                                               
Freeing init memory: 88K                        
INIT: version 2.85 booting                          
Mounting /tmp as tmpfs                     
Mounting /var as tmpfs                     
/etc/rcS.d/S35mountall.sh: 48: cannot create /etc/testfile: Read-only file syste                                                                                
m
Remounting /etc as writeable                           
Remounting /etc as writeable - DONE                                   
/etc/rcS.d/S35mountall.sh: 63: cannot create /root/testfile: Read-only file syst                                                                                
em  
Remounting /root as writeable
Remounting /root as writeable - DONE
Ensured writeable directories
Changes may be lost at reboot
Setting up IP spoofing protection: rp_filter.
Configuring network interfaces... eth0: link down
done.
Starting portmap daemon: portmap.
14 sound
sound device present
Attempting to start setmixer
INIT: Entering runlevel: 2
Creating the the /var/dev/ttySA* links
Starting internet superserver: inetd.

Durban - ARM Embedded Linux version 2.3.0
Tuesday 23 January 2007 @ 15:31
ARMBox001 login: root

BusyBox v0.60.5 (2006.12.13-13:23+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ #

--------------------------------------------------------------------------------------------------------------------------------------
可是...之后该做些什么,我便毫无头绪了。我在迷惑着,应用程序该如何在板上运行?应用程序是怎么与 Linux 有所联系呢?我想了好久,实在是想不通。恳请大家提点,谢谢!      

作者: unifoxz   发布时间: 2007-06-26

可以先看看linux的基础,我现也在学习      

作者: zhouliang55   发布时间: 2007-06-26