0
votes

How to verify if executable is compiled for ARM 9 or ARM11? I have compiled application as follows:- arm-linux-gnueabihf-gcc -march=armv4t -mfloat-abi=hard -mfpu=vfp -marm -Wall sample.c -o sample

where a sample is C-program of simple Hello-world.

Here is the objdump -f output,

Attribute Section: aeabi 
File Attributes 
Tag_CPU_name: "7-A" 
Tag_CPU_arch: v7 
Tag_CPU_arch_profile: Application 
Tag_ARM_ISA_use: Yes 
Tag_THUMB_ISA_use: Thumb-2 
Tag_FP_arch: VFPv3-D16 
Tag_ABI_PCS_wchar_t: 4 
Tag_ABI_FP_denormal: Needed 
Tag_ABI_FP_exceptions: Needed 
Tag_ABI_FP_number_model: IEEE 754 
Tag_ABI_align_needed: 8-byte 
Tag_ABI_align_preserved: 8-byte, except leaf SP 
Tag_ABI_enum_size: int 
Tag_ABI_HardFP_use: SP and DP 
Tag_ABI_VFP_args: VFP registers 
Tag_ABI_optimization_goals: Aggressive Speed 
Tag_CPU_unaligned_access: v6
1
seems it is of arm11...can u tell me how to compile it for arm9 ?RICHA SHARMA
en.wikipedia.org/wiki/List_of_ARM_microarchitectures. arm9 is an armv4t. arm11's are armv6t. But will execute armv4t instructions all day long. fpa was around in the arm7 days, not the vfp. According to that wikipedia page the vfp came in the arm10 days. so your guess is consistent despite the information being readily avaiable, no reason to ask stackoverflow.old_timer
how do you compile for arm9 well, do you have a floating point unit or not on the arm9 you plan to use? They are fairly rare anyway until recently, so probably not, pretty much everything runs the armv4t instructions thumb or arm (not cortex-ms of course) so no reason to change that. You could just compile for armv4t with soft float and other than the fact that much of the code is chip specific and wont run anyway, the instruction set at least will port all the way through the family tree.old_timer
changing the command line options is not going to re-write your software for a different chip (peripherals, etc). If this is all running on top of an operating system well you have half a chance.old_timer
I have compiled using flag armv4t arm-linux-gnueabihf-gcc -march=armv4t -mfloat-abi=hard -mfpu=vfp -marm -Wall sample.c -o sampleRICHA SHARMA

1 Answers

0
votes

This is a wiki post. The ARM has many different architectures with each supporting several CPUs.

See: List of ARM CPUs at wikipedia.

Gcc supports two concepts of targeting ARM generated code.

  1. Target an architecture using -march.
  2. Target a specific CPU using -mcpu.

What is an architecture?

An architecture has an instruction set (possible assembler) that is 95-100% identical between CPUs in that architecture. Sometimes there are added instructions like a divide, more/extended floating point registers, etc. However, the intent is that a compiler can easily output code that will run on this set of CPUs (same architecture) with relative ease. Each new architecture tries to be backwards compatible with previous architectures.

The main difference is that system registers may be quite different between CPUs even in the same architecture. So system/OS software will be quite different.


How to verify what CPU your binary targets?

You can use tools like objdump or readelf. Any output like 7-A or ARMv7-A is an architecture reference and you need to either know or consult a table to find which specific CPUs are supported. The ARM naming can be confusing as an ARM7 is quite different than ARMv7; notice the 'v'.