问题
It is my understanding that ARMv7 processors, such as the Cortex-A9, are mostly backwards-compatible with code for older ARM architecture versions. However, I've read reports of segfaults trying to run ARM9 code on a Cortex-A8, for example.
What parts of ARMv4/5/6 (ARM7TDMI/ARM9/ARM11) code will not work on an ARMv7 processor? What features or architectural characteristics exist in these older ARM architecture versions that can cause a program built for these versions to fail on ARMv7?
回答1:
For application code the principal problem is unaligned memory accesses. Before ARMv4 and configurable on ARMv4 to ARMv6 a LDR load from an unaligned address would in the read data being rotated, and other memory access act as if least significant 2 bits are zero.
回答2:
Compiling for arm instructions armv4 should work all the way through.
The real problem with your question other than not doing your own research on the topic (took you far longer to avoid looking into it than to look into it) is that the majority of the code that you may wish to port from one platform to the next has to do with the peripherals not the instruction set. Most of your code will not port not due to the instruction set but because of the timers, and uarts, and video and usb controllers and such. These are not wintel boxes they dont attempt to be reverse compatible.
The question you linked really has no meat to it since the OP didnt put any code down didnt do any work on the topic, at least not publicly at stackoverflow, it could be a simple case of bad code and have nothing to do with the processor cores, or it could be a case of peripherals that arent there and accessing those, one would expect a hang or crash.
来源:https://stackoverflow.com/questions/19608570/what-parts-of-armv4-5-6-code-will-not-work-on-armv7