Need Some Advise to Begin Programming on Arm (With Linux) Platform

Need some advise to begin programming on ARM (with linux) platform

For a virtual machine that can emulate a ARM platform try QEMU. You can install a ARM-based Debian Linux distribution and tinker around with it. A google search on ARM, QEMU and Debian will get you started.

Also: Don't worry to much about the ARM CPU. You will use linux, so all the low-level stuff is already done for you. It's much more important to learn how the linux boot process works. How to install stuff ect. You will rarely (if ever) notice that you're running on a ARM device. The big difference to a PC running linux is, that the ARM will be a lot slower.

If you're looking for a real piece of hardware to play around with I suggest that you take a look at the beagleboard (www.beagleboard.org). It's cheap (around $150) and runs (among other things) various linux distributions.

With the beagleboard you'll get the whole linux cross compilation experience if you want (be warned: you'll pull your hair out).

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.

ARM Development on Linux

It's always the same, no matter which eval board you have: STM32 discovery, LPCXpresso, TI Launchpads. They are very cheap, but the recommended IDEs are limited: Their code size is limited, Windows only, or they are bound to a specific Linux distribution.

In my experience the choice depends on your long-term goals:

  • Do you want to share code with AVR 8-bit (or PIC32, Renesas RX 32, ...)?
  • Is it a mid-term/long-term goal to have a build system based on make?
  • Do you need tab-completion and/or an integrated debugger?
  • Do you want to try other eval boards in the future (without being forced to install yet another IDE)?

or do you just want to get this one up and running quickly. In that case I would use one of the recommended IDEs to get an impression.

On the other hand, all 32-bit microcontrollers I have used (Cortex-M0/3/4, PIC32, Renesas RX) can be programmed with gcc. As far as I know Code Red, Mentor, and MPLABX use gcc (or a modified gcc).

So there is always the possibility to use Eclipse with a Makefile project, and gcc.
I have tried it twice, but it did not work well for me, because I share libraries between the different targets, and I found it difficult to pass around the defines in Eclipse.

So my IDE is Makefile, Emacs, and gcc, and I have switched completely to using C++: This might be another advantage of using gcc.

Both possibilities (Eclipse with Makefile project or just editor with make) are not "off the shelf": They require time, patience, and your favourite Internet search engine.

Update

I am not aware of a complete tutorial on how to setup a GCC + make based environment, so I simply describe the basic steps I did it some years ago (with some changes).

  • Get a binary distribution of GCC for ARM from https://launchpad.net/gcc-arm-embedded

The following steps are STM32 specific:

  • Get one of the discovery boards, for example the STM32 value line Discovery.

  • Get a flash utility: I am using stlink (git clone https://github.com/texane/stlink.git). This includes a GDB backend as well.

  • There are various examples available, search for "stm32vl discovery blink" (I cannot recommend one here, the one I used has vanished)

As an alternative (or follow-up): Get the Peripheral firmware examples

  • You will find a GNU ld compatible linker script in Project/Examples/GPIOToggle/TrueSTUDIO/stm32_flash.ld

  • You will find a GNU as compatible startup in Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/TrueSTUDIO/startup_stm32f10x_ld_vl.s

  • You will find all other required library include files and sources in the .zip archive as well

  • Look at the GPIOToggle project (Project/Examples/GPIOToggle)

  • Write a Makefile to compile, link, and flash

how to port intel based linux application to ARM platform

On the Ubuntu Linux host you may use just a default ARM toolchain:

sudo apt-get install gcc-arm-linux-gnueabi

To build your linux applications you just have to use the same tools,
but prefixed with:

arm-linux-gnueabi-

For example, to build a simple helloworld.c:

arm-linux-gnueabi-gcc -o helloworld helloworld.c

You can also set some ARM-related flags to optimize your build or to specify your target platform. Here some examples of important ARM GCC flags, depending on the target ARM CPU:

ARM 11:    -mtune=arm1136j-s -mfpu=vfp -mfp=vfp -march=armv6 -mfloat-abi=softfp
Cortex A8: -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -Wl,--fix-cortex-a8
Cortex A9: -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp

Note, that your target ARM CPU may require another options, for example if it doesn't support NEON instructions. GCC compilers from CodeSourcery may also need another options set - just read the docs from CodeSourcery for a particular GCC version.

Advice needed for ARM Cortex M3 beginner

I'm also a software developer originally. I used a couple of different kits, but the one I found most easy to use and did most with is mbed. You can literally get it up and running in five minutes from opening the box. No need to install any IDEs from the CD, no need for the JTAG dongles, no need to pour over datasheets - just write the code, compile and run.

Yes, some complain that it's "tied" to the online compiler. But I only heard that from people who did not actually try it. And it's just not true - you can still use any other toolchain that can produce binaries for LPC1768: IAR, Keil, CodeSourcery, Yagarto, or your own toolchain. I did not myself yet find a case for that, but it's certainly possible.

Probably the biggest disadvantage of mbed is that it does not expose the JTAG interface and so you cannot debug interactively. So far I did not find this critical but it might be important if you do a lot of low-level work.

What do I need for development for an ARM processor?

Options for environments

  • Install Linux in the QEMU system emulator. It can emulate a variety of ARM-based chipsets.
  • Get an emulator for a specific ARM-chipset like a game handheld. Gameboy Advance is fun to play with. NoCash GBA and VisualBoy Advance are two great GBA emulators.

Toolchains

You will need a toolchain. A toolchain is a collection of low-level tools like an assembler, a linker, a compiler, an archiver and a bunch of other usefull stuff. Even more, you want a cross-toolchain, which means that the toolchain runs on one system, but builds executables for another architecture. This way you can build applications that run on ARM-devices, but on your x86-based PC. It's faster and more convenient.

If you run Windows, DevkitPro is a fairly good choice. For Unix/Linux/BSD variants, you have CodeSourcery's free toolchains, and the GCC toolchain from gnuarm.com. There are several others, but you don't need more options.

Documentation

Get the specification for your ARM CPU of choice at infocenter.arm.com. One reference you need no matter the CPU is the ARM Architecture Reference Manual (Often abbreviated ARMARM). I'm hosting an older version, which covers the ARM architecture and instruction set version up to ARMv4T, here, but you will find the current and later versions on infocenter.arm.com as well. If you go for GBA, notice that the CPU is an ARM7TDMI, with the instruction set version ARMv4T.

The ARMARM contains tips and examples for usual nitty-gritty system coding, tips on how to proceed on certain design issues, as well as a reference of both the ARM instruction set, Thumb instruction set and co-processors like MMUs, MPUs, DSPs and FPUs.

If you stick with QEMU, that's pretty much all you need, since the Linux kernel handles everything. QEMU also has user-mode emulation (with a C-library stub). If you go for one of the GBA emulators, here's a nice reference over the GBA hardware and hardware registers: CowBiteSpec. Also make sure to check out http://www.gbadev.org/.

Nintendo DS is probably an option as well, but I don't know of any decent emulators for that handheld yet. Good luck to you :-)

EDIT: Here's a trivial example of some GBA code I wrote years ago: GBA Color fill 240x160 16-bit example



Related Topics



Leave a reply



Submit