Page 1 of 1

Should I read ARMv5 manuals before v7?

Posted: Fri Feb 14, 2025 2:14 pm
by eekee
I don't know ARM assembly language, but I want to learn. I have several ARMv7 devices I want to use, and I have both ARMv7 and v5 manuals. Seeing the difference in size between v5 and v7 manuals, I started to read the v5 manuals in the hope of getting a foundational understanding without giving myself too much of a headache. Is this a good idea, or I am I likely to confuse myself? :)

Having written that, I've found some of the gadgets I want to use are ARMv6, though ARMv7 is my primary target. I don't know. I don't really know how compatible these versions are with each other.

Re: Should I read ARMv5 manuals before v7?

Posted: Fri Feb 14, 2025 4:38 pm
by xenos
I am not an ARM expert, but to my experience v5 and v7 are quite different. There are some similarities, like in the layout of paging structures, but also differences, like the allowed page sizes, execution levels, interrupts... Many registers and functions have been added. From a user / application point of view, the differences are probably small (such as general purpose registers and assembly instructions), but for system programming they are more significant.

Re: Should I read ARMv5 manuals before v7?

Posted: Fri Feb 14, 2025 5:50 pm
by eekee
Thanks. I'm starting with more user than systems programming, just a native forth, so perhaps I'll be all right. Plus I don't think my #1 target has paging or privilege levels anyway. I ought to check that.

I've just noticed the assembler I want to use is ARMv4; lovely! :) But i was planning on modifying it anyway. It's only 600 lines of forth, excluding comments.

Re: Should I read ARMv5 manuals before v7?

Posted: Fri Feb 14, 2025 11:09 pm
by nullplan
As far as I know the major differences are:
  1. Handling of misaligned storage access. v7 handles it like x86 (gracefully, but with a possible performance reduction), but v5 does something weird or it is just completely undefined.
  2. Advanced atomics. v6 introduced ldrex and strex, and v7 added them to thumb mode.
  3. Coprocessor 15. v6 introduced the standard coproc 15, which can be used to store a thread pointer, can be used to create a memory barrier, and is an endless bag of tricks beyond that. v5 doesn't have it at all. Oh, and v7 also added the "dmb" instruction, so you no longer have to go through coproc 15 for a memory barrier.
That last one is important because it affects whether you can have multiple processors. But apparently there were multi-CPU ARMv5 development boards at some point. No clue how they handled some of these things.

Re: Should I read ARMv5 manuals before v7?

Posted: Sun Feb 16, 2025 12:41 pm
by eekee
Thanks nullplan. I was expecting to have to watch out for alignments, and I'd just as soon do it for performance as for necessity, so that makes no difference. Almost all of the ARM devices I expect to be able to target are single-core, so I guess I'll need only the most basic of atomics, if that. (I haven't ruled out cooperative multitasking which renders the question moot anyway.)