The Difficulty of ARM Assembly

You can talk about almost anything that you want to on this board.

Moderator: Moderators

User avatar
Dwedit
Posts: 4251
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: The Difficulty of ARM Assembly

Post by Dwedit » Mon Feb 11, 2019 9:36 pm

Either at the end of a section (like the .text section), or where you put in .pool to manually force a literal pool at that location. Usually a compiler generating ASM functions will stick a literal pool at the end of every function.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
Drew Sebastino
Formerly Espozo
Posts: 3503
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: The Difficulty of ARM Assembly

Post by Drew Sebastino » Mon Feb 11, 2019 11:14 pm

Just out of curiosity, what ARM assemblers for x86 machines are available? I only found FASMARM, but I figure there has to be more than that.

User avatar
Dwedit
Posts: 4251
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: The Difficulty of ARM Assembly

Post by Dwedit » Mon Feb 11, 2019 11:47 pm

GCC cross compilers for ARM (such as DevKitARM) include the GNU Assembler.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
Sogona
Posts: 184
Joined: Thu Jul 23, 2015 7:54 pm
Location: USA
Contact:

Re: The Difficulty of ARM Assembly

Post by Sogona » Thu Feb 14, 2019 10:10 pm

I have to say that I've grown to appreciate RISC more in the past year or so. My computer achitecture class is teaching 32-bit MIPS and I got a crash course on ARM thumb-0 in one of my classes last year. I like ARM a bit more though in that its instructions seem more similar to 6502, which I guess you could say is my native assembly language. Is there a general consensus on which is superior (MIPS/ARM) in terms of its application for embedded systems?

It makes me interested in thinking about what something like 65xx or Z80 would look like if it had been extended to 32/64 bit, before the whole RISC/CISC debate was really a thing.

User avatar
koitsu
Posts: 4216
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: The Difficulty of ARM Assembly

Post by koitsu » Thu Feb 14, 2019 11:11 pm

Sogona wrote:It makes me interested in thinking about what something like 65xx or Z80 would look like if it had been extended to 32/64 bit, before the whole RISC/CISC debate was really a thing.
Off-topic, but: you're probably unaware of the ill-fated 65832 (obviously CMOS): https://downloads.reactivemicro.com/Ele ... asheet.pdf

Every time I read that preliminary data sheet I get sad. Still limited to 3 registers (1 "main" register + 2 indexing-only), no native mul/div, blah blah. The additional addressing modes are not "super" helpful either. It really wasn't a CPU that the 90s would have benefit from, so it doesn't surprise me the 65816 was where it pretty much ended. 68K and x86 "won". And since then, we've been "stuck" with x86 and PC architecture, the latter of which at this point is *makes cat vomit noises*.

lidnariq
Posts: 9027
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: The Difficulty of ARM Assembly

Post by lidnariq » Thu Feb 14, 2019 11:44 pm

Sogona wrote:Is there a general consensus on which is superior (MIPS/ARM) in terms of its application for embedded systems?
I mean, honestly, most ISAs are equally ok for embedded systems. 8051s clocked at 100MHz were typical a decade ago..

Currently there seem to be more ARM licensees than any other ISA, but that's just a comment about mindshare, not suitability. Personally, I hope we see more RISC-V cores.
koitsu wrote:with x86 and PC architecture, the latter of which at this point is *makes cat vomit noises*.
So you've played with Sun's and/or SGI's x86-based offerings?

User avatar
koitsu
Posts: 4216
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: The Difficulty of ARM Assembly

Post by koitsu » Fri Feb 15, 2019 1:38 am

lidnariq wrote:with x86 and PC architecture, the latter of which at this point is *makes cat vomit noises*.
So you've played with Sun's and/or SGI's x86-based offerings?
To clarify: I'm not particularly fond of x86 (I stopped bothering to follow it with the introduction of the 486, and it seems I picked a good time to bow out, for my own sanity. A lot of present-day x86 code I can't even read due to all the extensions and ridiculousness, throw things like LOCK RMW instruction prefixes on top of the mix for SMP and I'm like "yeah, I'm done". Then you got the IDT, the GDT and LDT, MSRs, PAE, SMM/SMI, VT, *plus* all the nuances of x64... Yeah, no thanks. I sadly ever had the opportunity to play with PowerPC or Alpha at the time, though to be fair those are both RISC.

But I'm *really* not fond of PC architecture in general at this stage. I would classify it as quite possibly the longest-running hack-kludge tech project that humanity has ever kept going. There was a point in the mid-90s where a single person could just about understand the architecture -- now, we're so far from it that nobody can -- yet nearly all (and I do mean ALL!) the legacy support still in place for numerous reasons. Can you even remember all the bus types at this point (I can remember most of them, even wonky crap like MGA). We've learned a lot over the past ~40 years, but from all the corporate committees driving "standards" that are an abomination (APICs, ACPI, TPM, and UEFI all come to mind. I'd almost include USB but that's really not PC-specific) I don't think anyone in PC-land will ever stop and say "we should really just start over" because that'd a huge undertaking and would be killing the cash cow.

For example, if you've ever used a Sparc, there's a lot of things there that architecture-wise felt like no-brainers and just worked -- concepts like OpenBoot and having a native serial console from the get go.

For this reason, I think overall, ARM architecture (obviously also RISC) is at least a breath of fresh air. Admittedly I don't follow it to the level I should, but that may change for me given some things I can't really talk about (professional reasons).

calima
Posts: 1056
Joined: Tue Oct 06, 2015 10:16 am

Re: The Difficulty of ARM Assembly

Post by calima » Fri Feb 15, 2019 2:37 am

What is superior is determined like you'd think, money. How much per cpu, per board, per coder, are there ready libraries so you need less coding...

ARM is popular, but it used to be that MIPS was cheaper for a certain cpu level. Then your use case may need a specific accelerator/DSP/whatever, which limits choices. I've recently done both MIPS and POWER things, PPC is nice too, even if it's not used much in embedded anymore.

psycopathicteen
Posts: 2911
Joined: Wed May 19, 2010 6:12 pm

Re: The Difficulty of ARM Assembly

Post by psycopathicteen » Fri Feb 15, 2019 4:42 pm

I looked up ARM Cortex-M0 instruction set and I was disappointed that indexed addressing only has a 5-bit offset, but then I realized that you get "6-bit" range when using 16-bit loads/stores, and "7-bit" range with 32-bit loads/stores, which is enough for object memory slot accessing.

Oziphantom
Posts: 786
Joined: Tue Feb 07, 2017 2:03 am

Re: The Difficulty of ARM Assembly

Post by Oziphantom » Fri Feb 15, 2019 9:51 pm

koitsu wrote:But I'm *really* not fond of PC architecture in general at this stage. I would classify it as quite possibly the longest-running hack-kludge tech project that humanity has ever kept going. There was a point in the mid-90s where a single person could just about understand the architecture -- now, we're so far from it that nobody can -- yet nearly all (and I do mean ALL!) the legacy support still in place for numerous reasons.
This is not true, lots of instruction sets have been dropped over the years, they are up to the point of dropping some SSE instructions, so I would think that 8086-MMX would all be dropped as well. The "drivers" offer support for such instructions in that they emulate them on modern CPUs. There was an interesting talk by an AMD engineer at one of the security conferences going on about CPU errata and patching. Where he mentioned "we are finally dropping XXX set of instructions" sadly I've not been able to find in a search. I think it was also the same talk where Apple biged-up their Hunt For Red October levels of security for iCloud.

Also if you want to look at the very current PC landscape, ARM PCs are making another stab. In you can get a HP Envy X2 with either a snapdragon ARM processor or an Intel processor. The rumors keep circling for ARM macs.

However RISC is basically dead, although RISC-V is making a comeback, and The Raspberry Pi foundation just became a silver tier member, so RISC-V 'pi' might be in the works which would be nice. I think RISC-V has a shot, as people love free and the pure open source nature of it has the Linux diehards in a froth.

For a 32bit 6502, the Mega65's version of the 4510 has 24 and 32bit extension, however it is still a "6502", not sure if it also adds the Z register.

PPC is rubbish and it shocking how it is still being used..

MIPS was good but it is now very old and ARM has kept marching towards CISC and has SIMD cores, so bang for buck I imagine ARM will slaughter MIPS. I'm not sure that a PSP will really out do a DS in terms of CPU power, yes the PSP is more powerful but I don't think its 3.5x as powerful for its 3.5x clock rate.

psycopathicteen
Posts: 2911
Joined: Wed May 19, 2010 6:12 pm

Re: The Difficulty of ARM Assembly

Post by psycopathicteen » Fri Feb 15, 2019 9:58 pm

I looked at RISC-V and what's up with the weird scrambled immediate encoding?

Oziphantom
Posts: 786
Joined: Tue Feb 07, 2017 2:03 am

Re: The Difficulty of ARM Assembly

Post by Oziphantom » Fri Feb 15, 2019 10:34 pm

To get more speed, you need more instructions per fetch, so it has a pile of options to encode things smaller and add extra instructions on the tail.. its still RISC of cause ;) There is some info on how it works conceptually and compared to ARM and am64 here https://www.youtube.com/watch?v=Ii_pEXKKYUg

tepples
Posts: 21841
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: The Difficulty of ARM Assembly

Post by tepples » Sat Feb 16, 2019 7:00 am

psycopathicteen wrote:I looked at RISC-V and what's up with the weird scrambled immediate encoding?
Immediate operand values on RISC-V are scrambled to reduce multiplexers (muxes) inside the CPU, so that a particular operand (destination or first source) can always appear in the same bit position within the opcode. Each mux adds die area and gate delay. Die area increases power consumption and reduces area that can be used for data cache. Gate delay reduces maximum clock rate.

psycopathicteen
Posts: 2911
Joined: Wed May 19, 2010 6:12 pm

Re: The Difficulty of ARM Assembly

Post by psycopathicteen » Sat Feb 16, 2019 11:29 am

I found this page with an explanation. What's also interesting is that bit 31 is always the sign bit.

https://stackoverflow.com/questions/394 ... g-variants

psycopathicteen
Posts: 2911
Joined: Wed May 19, 2010 6:12 pm

Re: The Difficulty of ARM Assembly

Post by psycopathicteen » Sat Feb 16, 2019 9:10 pm

koitsu wrote:
Sogona wrote:It makes me interested in thinking about what something like 65xx or Z80 would look like if it had been extended to 32/64 bit, before the whole RISC/CISC debate was really a thing.
Off-topic, but: you're probably unaware of the ill-fated 65832 (obviously CMOS): https://downloads.reactivemicro.com/Ele ... asheet.pdf

Every time I read that preliminary data sheet I get sad. Still limited to 3 registers (1 "main" register + 2 indexing-only), no native mul/div, blah blah. The additional addressing modes are not "super" helpful either. It really wasn't a CPU that the 90s would have benefit from, so it doesn't surprise me the 65816 was where it pretty much ended. 68K and x86 "won". And since then, we've been "stuck" with x86 and PC architecture, the latter of which at this point is *makes cat vomit noises*.
Wow, only one extra instruction. They could've used the WDM instruction as an extension to another set of 256 instructions, and did useful stuff like ALU instructions with index registers, and register-register ALU instructions.

Post Reply