Tools Required to Learn Arm on Linux X86 Platform

Learning ARM assembly

Obtain an evaluation version of of one of the arm software toolkits which will include a debugger/software emulator. If you're willing to spend a few hundred dollars, obtain an arm eval board (Keil sells a few). You can test your code on the board via a JTAG interface and see what happens on real hardware.

These should get your going in the right direction

Disclosure: I work for ARM.

What is a good embedded platform to use to teach yourself assembly language?

AVR is not the best instruction set. I would save it for a second or third instruction set. But eventually you may end up there as the arduino is incredibly popular and has good support through the community (although asm is exception not the rule in that world).

right now you can get a msp430 board for $4.30, basically TI is eating the cost to give these things away. msp430 is a good instruction set to learn.

The armmite pro is not a bad, arduino sized, board but uses an arm instead of avr. arm and thumb are good instruction sets.

There are emulators for pretty much everything, if or if not, writing an emulator is a very good way to learn how things work. If nothing else I normally recommend writing a disassembler.

Also an instruction set with a C compiler is good in that you can write some C code, play with the optimization, and see what kind of assembler is output, and learn different things about assembler. At first learn some tricks for efficiency and performance, later you will be able to outperform the compiler, or at least be on par. all of the ones mentioned have some sort of C compiler, avr and msp have ways to get gcc working, arm and thumb are supported by the mainline compilers. Llvm is automatically a cross compiler so you do not have to compile a compiler to get started, the msp430 backend to llvm is experimental but should work or be close, the arm and thumb backends are fine (use -m32 in clang to avoid 64 bit integers on a 64 bit host).

The stellaris chips formerly luminary micro, now ti (texas instruments) are good, thumb/thumb2 only. The mbed is actually pretty good other than the blue leds (give me migraines) you dont need to commit to a sandbox, plug in the usb, it mounts like a file system, copy your .bin file to the flash, press the reset button and it runs your program.

sparkfun.com is your friend, developer tools, and there is a long list of micrcontroller based boards, from all the players. the msp430 board I mentioned is about $5 something there, the armmite pro, many flavors of arduino, I recommend the lilly pad, it is about the same price as the arduino pro, but already has the header soldered on to use with the little usb to serial thing which you will want to purchase as well. stellaris is not represented at sparkfun, but many sub $50 boards are.

The msp430 boards, armmite pro, arduino boards, stellaris, mbed and others need power which is usually through the usb cable or for some get the ftdi based usb to serial thing

If you go the emulator route, qemu has support for a number of instruction sets, arm/thumb. there are gameboy and nds emulators out there. the ideas nds emulator, in source form comes with arm cores for both the arm9 and arm7, I have not tried to extract and use them on their own though. If you want to go old school there are tons of 6502 and z80 emulators out there, and some compilers believe it or not, certainly assembler.

The last assembler I would learn is x86, horrible instruction set and with the variations and microcoding you are not going to outperform the compiler across the board, yes your computer at that moment, but all x86 computers it is not worth the time. Other instruction sets are more important to know (arm, thumb, thumb2, avr).

Best platform for learning embedded programming?

"embedded programming" is a very broad term. AVR is pretty well in that category, but it's a step below ARM, in that it's both simpler to use, as well as less powerful.

If you just want to play around with ARM, buy a Nintendo DS or a Gameboy Advance. These are very cheap compared to the hardware inside (wonders of mass production), and they both have free development toolchains based off of gcc which can compile to them.

If you want to play around with embedded linux, BeagleBoard is looking to be a good option, only $150 and it has a ton of features.

Personally I think AVR is best for the smaller-sized 8-bit platforms, and ARM is best for the larger, more powerful 32-bit based platforms. Like many AVR fans, I don't like PIC. It just seems worse in pretty much every way. Also avoid anything that requires you to write any type of BASIC.

How Can I Assemble ARM and Flash to STM32 in Linux?

Be aware that Keil uses ARM's own compiler version 5 or 6 (current releases of Keil MDK support both v5 being ARM's legacy ARMCC, and 6 is based on clang/llvm). If you are following a course, and the course material is based on a different toolchain, you may encounter difficulties - or worse your tutor may not be able to mark your work. Just a consideration before you go off-piste.

Linux solutions are likely to be GNU toolchain based. An ARM GNU toolchain for Cortex-M can be found at: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm.

Flashing STM32 may either be done through a JTAG/SWD debugger usually using OpenOCD, or via the on-chip bootloader using a tool such as http://manpages.ubuntu.com/manpages/bionic/man1/stm32flash.1.html. Your hardware debugger vendor may have their own Linux driver, so worth checking. Mbed compatable boards present as a USB mass-storage device and can be flashed simply by copying the image file drive.

Building and flashing on Linux is only half the battle however; you will presumably want to debug your code too. GDB with OpenOCD or a proprietary driver will of course work, but raw GDB is not a pleasant experience, and you might want to have a more "visual" debug solution. IDEs such as STM32CubeIDE integrate the toolchain, flashing and debugging - but is specific to STM32.

Profiling tools for Linux and performance monitoring counters for ARM

ARMv7-A profile, which is targeted for hosting a rich OS has similar performance counters like Intel . It looks like you have looked into v7-M profile which is targeted for micro-controller environments. Most of the recent ARM cores that runs Linux, like Cortex-A9 are from this profile.

Perf already supports performance counters on ARM architecture, same with oprofile.

ARM company also provides a eye-candy eclipse based environment called DS-5 Streamline as well with lots of extra features to help you analyze performance issues.

What are the documents of reference for the X86 and ARM assembly?

As mentioned in the comments, the answer to your question is complicated because manufacturers produce manuals for their processors. In addition x86 is furhter complicated because there are generally separate documentation manuals for 32 bit and 64 bit processors (I'm not familiar enough with ARM to comment here).

Intel x86 (both 32 and 64 bit) can be found here: Intel® 64 and IA-32 Architectures Software Developer Manuals

AMD x86 documents: All processors and AMD64 Architecture
and Software Manuals. There are a lot of resources here and you will probably need to filter it a little depending on exactly what you are looking for.

ARM makes reference manuals available by ARM architecture: ARM Architecture

Assembly Language Programming

Each processor architecture tens to have its own "assembly language", and each platform (operating system, firmware, etc.) may have different system calls to handle operations for you (so things like initiating IO, etc.).

As such, there's no such thing as "DOS Assembly" or "Linux Assembly", but instead combinations like "x86 Assembly for DOS platform", "ARM Assembly for Linux platform", "x86 Assembly for Linux", even "68K Assmebly for Atari ST" and "68K Assembly for Commodore Amiga" - the instructions are specific to the processor, and the calls are specific to the platform.

Taking a move instruction as an example, for Intel x86 processors, it's simply mov; for Motorola 68K Processors, it'd be move.l (to move a long), and on ARM, it'd be ldr.

How to start off with ARM processors?

Several good resources are described in the answers to this related question:

  • https://stackoverflow.com/questions/270078/resources-for-learning-arm-assembly

In addition, Hitex has "Insider's Guides" for a few different microcontrollers based on ARM processors (free, but requires registration):

  • http://www.hitex.com/index.php?id=download-insiders-guides&L=1

Most of them (if not all) are free downloads (I think they're sponsored by the microcontroller manufacturers). They're more geared to the microcontrollers rather than just the ARM specifics, but they do include some of the ARM details and they're great overviews of the micros and the peripherals in the micros.



Related Topics



Leave a reply



Submit