Getting started with ARM - Page 1
Forum section: electronics / general

author: AndyC_772
author_rank: Super Contributor
timestamp: March 22, 2013, 06:08:35 pm
content: Hi all,A couple of years ago I bought myself a PICKIT 3 with a basic development board, downloaded MPLAB and taught myself C. It was a really worthwhile exercise, and I've designed various PICs into both hobby stuff and commercial products since.Now I think it's time I upgraded to using ARM based microcontrollers from one or more of the major vendors (ST, TI or maybe NXP), but I'm struggling to locate and identify a similarly straightforward and inexpensive development package, ie. compiler, IDE and the necessary hardware to connect my PC to the target board.There are plenty of commercial tools with 4 figure price tags, of course - but since world+dog is using ARM, I can't believe that's the only option. I'm happy to pay for a basic dev board with a few interesting peripherals on it to play with, but there must be an open source IDE and compiler out there which I can use and which doesn't impose arbitrary restrictions on code size... isn't there?I'd really appreciate any pointers - especially along the lines of "look here and use this package, it's what everyone else does, can't believe you missed it".Please bear in mind I'm a hardware guy... I'm quite good at keeping the magic smoke inside the chips, but I need software to "just work"

author: brainwash
author_rank: Frequent Contributor
timestamp: March 22, 2013, 06:15:12 pm
content: E-bay is full of ARM boards with camera, touchscreen and all, for about 50$ a piece. Documentation for these is pretty hard to come by. They are ok if you have extensive ARM knowledge.Almost every smart phone in existence is ARM based. On Android you can write apps in native C.LPC line if microcontrollers are cheap, there is a thread somewhere about them.I have two Betty-TV remotes which I bought for 4 Euro a piece. Perfect ARM dev platform since they are self-contained.Stellaris Launchpad from TI.ARM Cortex-M3 STM32 F103RB-based board from Maple.ARM Cortex-M4 Freescale MK20DX128VLH5-based Teensy 3.0 from PJRCYour smart TV; network attached storage; router; DVD player. Just search for the most hackable ones.

author: AndreasF
author_rank: Frequent Contributor
timestamp: March 22, 2013, 06:22:15 pm
content: I'm using CoIDE (http://www.coocox.org/CooCox_CoIDE.htm) with my STM32F4-Discovery board. It's not completely "install and run", but the few things that do need to be done in addition to configure it are fairly easy and straight forward.

author: Bored@Work
author_rank: Super Contributor
timestamp: March 22, 2013, 08:54:10 pm
content: QuoteAll those have open source toolchains. However, the hardware vendors typically like to point you to commercial versions. Just plug the eval board name or IC number into a search engin, together with keywords like gcc, open source, toolchain, and/or Eclipse and you should find something.Biggest issues with the open source stuff are typically the programming and debugging interfaces.Alternatively, the commercial vendors often provide limited trial versions that are sometimes good enough to get started and prolific.

author: nctnico
author_rank: Super Contributor
timestamp: March 22, 2013, 09:21:03 pm
content: Quote from: AndyC_772 on March 22, 2013, 06:08:35 pmNXP processors are the easiest to program. A serial port is enough. See the schematics for the Keil evaluation boards.All ARM microcontrollers can be programmed using GCC (Codesourcery Lite which is free) and Eclipse CDT is a free IDE. There are many tutorials on how to set things up.

author: ve7xen
author_rank: Super Contributor
timestamp: March 22, 2013, 11:24:26 pm
content: Most ARMs these days have a ROM-based serial bootloader you can enable, if your dev board / schematic is configured for that. Some of ST and NXP's even have DFU-mode USB bootloaders. Most of them are well-enough supported that they can be used purely with open source. Programming isn't good enough though, debug is really useful.Thankfully at least TI and ST's dev boards include a full debug interface for just a couple pocketfuls of pennies. The ST DISCOVERY series and TI Stellaris Launchpad are $7-15 and pretty easy to use.The hardest part about getting started for me, by far, was figuring out the linker script, startup code, and how to link the libraries. The rest is easy. If you use a popular chip like the ones on most of these devboards though you can use CooCox which has pre-baked templates for this stuff.

author: TheDirty
author_rank: Frequent Contributor
timestamp: March 23, 2013, 12:05:00 am
content: Not certain how hard you looked.LPC XPressoST Discovery F3 or F4TI Stellaris LaunchpadFreescale FRDM-KL25ZAll of these are development boards with programmer/debugger built in and cheaper than a Pickit 3 on it's own.They all have crippleware compilers/IDE's if you want easy. If you want GCC, they are supported by OpenOCD (not certain about LPC Link).

author: BravoV
author_rank: Super Contributor
timestamp: March 23, 2013, 02:36:13 am
content: Just fyi, TI ide is based on popular Eclipse (open sauce) and bundled with TI's own compiler.And the Eclipse platform it self is worth considering when in the middle of crossroads on deciding the ide.The whole package is packed neatly and just install and its ready to go without any fuss. Also all full blown features includes the debugger and programmer are enabled without any restriction, and also no time limit as long you use their launchpad as target.Good enough for beginner imo, especially at 80MHz with latest ARM architecture M4F core (hardware floating point), bought 2 of them when it was dirt cheap at 5 bucks while ago.

author: brainwash
author_rank: Frequent Contributor
timestamp: March 23, 2013, 05:47:03 am
content: Without trying to soyund the same horn again, i still recommend the ti stellaris. It's a bit (lot) crippleware but the tutorials will teach you a lot of things an afterwards you can always switxh to gcc. I think just the move to Eclipse is worth it since you get much nicer breakpoints and watch expressions. Unless you are used with gdb and vi; then I stand corrected.

author: BravoV
author_rank: Super Contributor
timestamp: March 23, 2013, 05:57:01 am
content: Quote from: brainwash on March 23, 2013, 05:47:03 am+1 , this .. <those underlined words>... are the key advantages apart from the switch to GCC, like when it times to jump ship to different ARM brands/manufacturers.Really curious if anyone at TI <top management> ever thought about this strategically ?

author: AndyC_772
author_rank: Super Contributor
timestamp: March 23, 2013, 10:24:36 am
content: Thanks for the replies so far, most helpful. It sounds as though I should probably start looking specifically for details on Eclipse and GCC, and see where that takes me. Maybe the TI Stellaris Launchpad would be a good way to at least become familiar with the tool chain even if the full version is costly. CoIDE certainly looks worth investigating too.What I'm trying to achieve here is the ability to buy an ARM based processor off the shelf, design it into a product, then get it to boot and exercise all the peripherals - so whichever tool chain I take the time to get to grips with, it needs to not be a dead end. That's why I've been put off boards like the Launchpad; there's no point investing a lot of time and effort in a tool if it's going to cost a small fortune to break the tether between it and the target board.Still amazed that nobody seems to sell a basic, but fully functional, package like the Pickit...

author: M. András
author_rank: Super Contributor
timestamp: March 23, 2013, 10:46:57 am
content: if you like limited code size there is the keil free version 32k code limit, i saw a few ulink 2 on ebay for a few bucks while their official one costs more then 200bucks

author: djsb
author_rank: Super Contributor
timestamp: March 23, 2013, 11:11:03 am
content: What about beagleboard (http://beagleboard.org/#&slider1=2)? There seems to be a lively community surrounding it. I've not looked in great detail at it though.David.

author: Unknown
author_rank: Unknown
timestamp: March 23, 2013, 11:36:53 am
content: The BeagleBoard / BeagleBone contain a TI OMAP processor with clock speeds in the hundreds of MHz and ~100 MB of memory. Not exactly a competitor for an ARM Cortex M0/M3/M4 board, and not considered a micro-controller. This is a much more complex system aimed at people requiring much more muscle power and fast I/O (eg. DVI).

author: AndyC_772
author_rank: Super Contributor
timestamp: March 23, 2013, 11:51:29 am
content: I've had a quick look, and it appears at first glance to be the opposite of what I'm looking for. I'm after a general purpose development environment that I can use with a 'bare' IC on my own hardware, not just one ready-made board with a set of tools that are unique to it.

author: djsb
author_rank: Super Contributor
timestamp: March 23, 2013, 11:56:58 am
content: You are right. The BeagleBoard is totally unsuitable for learning the basics onSorry

author: brainwash
author_rank: Frequent Contributor
timestamp: March 23, 2013, 12:18:34 pm
content: Quote from: AndyC_772 on March 23, 2013, 11:51:29 amIt does not exist. Every Arm cpu has a diferent pinout, I assume.

author: AndyC_772
author_rank: Super Contributor
timestamp: March 23, 2013, 02:01:49 pm
content: Sorry djsb, it seems like we've misunderstood each other. Perhaps what I should have made clearer is that I'm looking to learn whatever (software) tools are necessary to allow me to use ARM-based microcontrollers in my own products, and not anything that's specific to one particular manufacturer's pre-built board.If I've misunderstood what a BeagleBone is, and it's actually just a target board which happens to be provided with a completely general purpose compiler and IDE that will work equally well on any other board with a related processor on it, then I apologise.@brainwash: Of course not - but I do want to be able to choose a suitable microcontroller from a manufacturer's range, design it into my board, build it, then attach my PC and program / debug the code. The key thing is that I don't want to be tied to a specific board made by someone else, or reliant on the device being pre-programmed. Think PIC and AVR, not PICAXE and Arduino.

author: lewis
author_rank: Frequent Contributor
timestamp: March 23, 2013, 03:13:39 pm
content: Mikroelektronika make some very decent dev boards and compilers for lots of microcontroller architectures including PIC and ARM. I use their C compilers for PIC and dsPIC, but haven't played with ARM yet. They are very good and pretty cheap with many library functions to get you started.Dev boards for ARM:http://www.mikroe.com/arm/development-boards/C compiler/IDE for ARM:http://www.mikroe.com/mikroc/arm/There's a discount if you buy the compiler with a dev board, but the compiler can be used for free (fully functional with all optimisations but limited to 8K code size) so it's worth a try.

author: TheDirty
author_rank: Frequent Contributor
timestamp: March 23, 2013, 03:28:48 pm
content: Quote from: AndyC_772 on March 23, 2013, 10:24:36 amI'm not understanding you. The PicKit 3 is just a basic programmer/debugger. All of these boards have that built into them and a few of them you can just cut that part off and use it standalone. All of these board allow you to use the programmer/debugger to program/debug chips on other boards exactly like the PicKit 3. Like the PicKit 3 and MicroChips compilers they all come with crippled (code size rather than optimization cripple) IDE/compilers that are directly supported. They can all be used with a GCC toolchain and OpenOCD if you want an open source toolchain.LPC and ST are the most popular and probably the best to start so you can expand later on. Buying both of these development kits will be cheaper than buying one PicKit 3.People suggesting the TI are missing the huge limitation that you can't actually buy the TI LM4F chips anywhere, yet. It's nice to play with, but it's a dead end at the moment. Also all their planned LM4F chips are high end. With the ST and LPC you have access to their CM0, CM3, CM4, and hopefully the CM0+ coming out.LPC XPressoST Discovery F3 or F4TI Stellaris LaunchpadFreescale FRDM-KL25Z

author: djsb
author_rank: Super Contributor
timestamp: March 23, 2013, 05:11:49 pm
content: It's all very confusing? I'd really like to pick up some skills on ARM myself especially if the skills are scalable to later use on for instance the rasberry PI (or indeed the beagleboard). I will be following this post with interest.PS Wished I'd had the chance to learn on a BBC Micro in the early days. Had not even heard of them until a few years ago. I know the Micro was not a Microcontroller but it did use an ARM device.

author: nctnico
author_rank: Super Contributor
timestamp: March 23, 2013, 06:09:33 pm
content: If you want skills for Raspberry PI or Beagle board then you should learn about programming for Linux. The fact these boards use an ARM CPU isn't even relevant.

author: IanB
author_rank: Super Contributor
timestamp: March 23, 2013, 06:46:09 pm
content: Quote from: djsb on March 23, 2013, 05:11:49 pmThe BBC Micro in fact dates from about 1982 and used the 6502 processor, predating ARM by several years. It was a very well designed product and it made me very sad that I couldn't afford one at the time. It was an excellent learning machine with all sorts of peripherals and expansion capabilities.The ARM based micro that followed it was the Acorn Archimedes (ARM stands for Acorn RISC Machine). It also was very well designed and had incredible performance compared to other computers of its era. As I understand it the design of the ARM chip was inspired by the simplicity and elegance of the 6502 in the earlier BBC micro.It might be possible to pick up an old Archimedes today for a song and use it to learn the ARM instruction set. Although the hardware has changed tremendously the core of the instruction set is essentially the same.

author: djsb
author_rank: Super Contributor
timestamp: March 23, 2013, 07:00:17 pm
content: Yes that was the point I was trying to make (that the core instruction set was essentially the same). If the OP is just trying to complete a particular task and program in C then surely the architecture is not that important. However if the aim is to learn ARM my approach would be to use whatever hardware is supplemented by plenty of tutorials and online examples (either online or preferably book form).I will have a look myself over the next couple of weeks as I'd like to get started on ARM myself.David.

author: lewis
author_rank: Frequent Contributor
timestamp: March 23, 2013, 07:30:58 pm
content: Quote from: djsb on March 23, 2013, 07:00:17 pmIt is ESSENTIAL to have an understanding of the underlying architecture when programming any microcontroller in my opinion. Just try to write even a moderately simple program without looking at the datasheet!

author: nctnico
author_rank: Super Contributor
timestamp: March 23, 2013, 09:04:44 pm
content: Quote from: lewis on March 23, 2013, 07:30:58 pmYes and no. Studying how the CPU works isn't very interesting when programming in C. Though you do need to know how the peripherals work. BTW the manual which describes the peripherals is often called a 'user manual'. The datasheet just sums up the possibilities and electrical / mechanical characteristics.

author: westfw
author_rank: Super Contributor
timestamp: March 23, 2013, 09:19:48 pm
content: QuoteAll of the ARMs can be programmed using some free flavor of gcc, using command-line tools or some free version of an open source development environment (Eclipse, Netbeans, etc.) Putting all the little pieces together can be a significant software task, however. If you're lucky, someone else has already put the pieces together for you.The cheap eval boards people have mentioned all come with relatively "reasonable" limited compilers; probably quite adequate for "getting started." Knowing that you CAN gnu should be enough, IMO...(And it's not at all unreasonable to pick a vendor because you like their particular IDE/compiler setup better than others, even if it costs money... "I started with the free version of TI's software. When I started to get close to its limits, I tried to install eclipse/arm-gcc, but it was a PITA and didn't have the options I had liked in TI's version (which is also eclipse based), so I decided to shell out the $500 for TI's full SW." is a perfectly reasonable chain of thought...

author: AndyC_772
author_rank: Super Contributor
timestamp: March 23, 2013, 09:32:44 pm
content: Quote from: IanB on March 23, 2013, 06:46:09 pmI actually had an Acorn A3000, and later upgraded to the much faster ARM3 based A5000, as my desktop computer while I was doing my degree. It had a version of BBC BASIC built in, which included an ARM assembler, so I used to know the instruction set very well indeed. I'm sure it's evolved since then, but coming from the 6502 it was wonderful to have so many registers to play with, and every instruction was (and presumably still is) able to be executed conditionally.A lot has changed since then, of course. I sadly had to sell the A5000 to buy a (conventional) PC, which for all its relative disadvantages did offer much better support and price/performance than the ageing Acorn. I think that was about the time I wrote my last computer program too, right up until I picked up the PIC stuff and started learning C a couple of years ago.It's C that I plan on using now, of course. Life is too short, and fast microcontrollers too cheap and readily available, to invest too much time and effort in learning the machine language of any one processor without a very good reason, IMHO.That said, I'm well aware, for example, that the memory architecture of a PIC18 is a dog's dinner. I know its performance is limited too, especially with the free compiler, but given the choice of spending my time learning to program a PIC in assembler vs learning to program a much faster - and cheaper! - processor in C, I choose the latter.Where I expect to spend the time is on learning the peripheral set of a particular MCU - how to use its timers, serial ports, clock structure, interrupts and so on, plus the associated compiler and IDE. I'm hoping not to need to spend too long on the ARM instruction set itself!I find it always helps to have an application in mind when learning something new, and I do have a PIC18 board which I'm thinking of re-doing with something like an STM32. It has about 32k of code in it, most of which is actually graphics for the LCD which are compiled in as pre-initialised structures. (This is one reason why I'm not keen on a code size limited compiler; I may find that simply porting across the code I already have will use it all up. The other reason is I'd really prefer to build my own board, in my own form factor, with my own peripherals and which will actually work as a usable product when it's done, than use an off-the-shelf dev board).

author: IanB
author_rank: Super Contributor
timestamp: March 23, 2013, 09:44:18 pm
content: Quote from: AndyC_772 on March 23, 2013, 09:32:44 pmSad that, when these days conventional PCs are so cheap and easily obtained they are practically abandonware.I recall my first slightly foolish PC purchase back around 1993--a Compaq laptop with 25 MHz processor, 640x480 VGA screen and 4 MB of memory for about £3000. I never dreamed how much prices would come down and specifications would go up in future years...

author: andyturk
author_rank: Frequent Contributor
timestamp: March 24, 2013, 03:54:30 pm
content: Quote from: AndyC_772 on March 23, 2013, 09:32:44 pmAs a long-time unix coder, I found it fairly easy to slip into ARM development with an ST Discovery board (about $10). The board actually has two mcus on it, one that runs your code and the other to implement the debugging interface. You can also use the same disco board as a debugger for an outboard mcu by removing two jumpers... and that's how I program my own boards.The painful part is getting your toolchain and debugging environment going. Most of the OEMs offer some sort of Eclipse based IDE that will give you a text editor and a toolchain in one download. If you're a fan of Eclipse (or IDEs in general), that may be a good way to go. It's probably the quickest way to get your "blinky" app working, which is key. From there, it's reasonably easy to write "real" software. You can learn the peripherals one-by-one and use the same debugging setup that works for the simple blink app.The alternative is one of the gcc based toolchains. I've had pretty good luck with Yagarto. There are binary installation packages for Windows and OS X. The most complicated aspect is the debugger, usually based on OpenOCD. It's open source and under active development, so which version you get matters. OpenOCD is critical because it runs the JTAG/SWD pins on your microcontroller and is responsible for flashing new code and debugging. Getting comfortable with it is a little frustrating, because it's mostly about writing Tcl scripts and locating the right configuration files. But once it's set up, it does stay out of your way.However, Yagarto and the other open source toolchains don't have library code for your mcu. And without a decent library, you can get lost in peripheral configuration, some of which is required before your program even runs (e.g., clock configuration). The OEMs obviously provide their own libraries, but there are open-source RTOS projects that give you essentially the same thing (along with more OS-like stuff). I use one calledChibiOS, which was written by an engineer who works at ST. The project has no official support, but they usually have the latest ST parts running quickly.Even if you don't want to use ChibiOS, keep it in mind for reference purposes. It has a fairly extensive HAL (Hardware Abstraction Layer) with support for most peripherals and Giovanni's code is quite good.

author: AndyC_772
author_rank: Super Contributor
timestamp: April 17, 2013, 07:06:45 pm
content: Time for a little update...I decided to give CoIDE a try, and I bought the smallest STM Discovery board, the STM32F051R8.First impressions were very positive. Installing GCC and the ST-Link driver went without a hitch, and I was soon working my way through the wizard creating my first project.Then it all ground to a bit of a halt. After sorting a couple of wrinkles I was able to get a simple loop to compile, and I successfully erased the demo app from the target board.Shame it wouldn't actually download or debug my code, then. The disassembly window showed the memory was full of zeroes and FF's. Looks like it might be down to a known bug in the Flash programmer