Another Getting Started Thread

Hello people!

I’ve spent several days searching and reading everything I can find about getting started with ARM (particularly Cortex M3), of course including reading the information posted here. However I still have several questions/doubts about getting started with ARM. I only have experience with AVRs (definitely not an expert too), but I’ve found the need for more processing power.

The biggest question I have is regarding the startup scripts, linker files and makefiles which I have zero experience with. Is there a detailed guide/tutorial about how I can write them? I’ve seen example startup scripts and linker files and I have no idea what does what!

I’ve seen several ARM guides for beginners but virtually none talk about linkers etc in detail. Most of them point to using versions available online, and caution that certain modifications need to be made for different purposes.

Not knowing how these important components work (therefore unable to troubleshoot effectively) makes me feel really helpless! At this point, I’m just trying to learn as much as possible so I can make a more informed decision about going into ARM. I would really appreciate it if anyone can just point me in the right direction.

Thank you!

Hi Crappinni

I’ve recently just started off using the AT91SAM7XC512, my first ARM project. I started off “blind” with a background in AVRs like you.

First, what microcontroller are you using?

Second, I think you are thinking too far ahead, with both AT91 and LPC1700 microcontrollers, I was able to find vendor provided startup code, linker scripts, and a collection of driver APIs, and so far I don’t think I modified any of them. I just took one example, made sure I was able to build via makefile, and then understood how to modify that makefile to suit my own project. It is also important to know where the files should be located.

I’ve also noticed that in all of the examples, the linker scripts and startup code do not change, and they are not meant to be changed unless you really need to and know what you re doing. The makefiles I’ve found simply let you list all the files to compile and where to find them, and it would automatically find them and compile them.

I was able to get a DOGM LCD working within hours of just starting. So my advice to you is to just find the files provided by your vendor and don’t touch what you don’t understand. The example files should work great even if you don’t understand what’s going on.

It is highly unlikely that you will need to ever troubleshoot the linker script or startup code if they are provided by the vendor.

I have a small database of projects around the web that really helped, check it out http://frank.circleofcurrent.com/mcu_proj_db/

Hello Frank,

Thanks for replying! This really makes the picture clearer for me. I wanted to learn more about ARM before I decided which microcontroller I will use so I could start programming the moment the parts arrive.

Currently, the STM32 and LPC lines seem the most popular. I prefer to stay close to the hardware and also to learn the conventional software method so I’m considering a development board or maybe even just a breakout board. I still can’t decide between STM32 and LPC though!

I use both the STM32F and LPC17xx - they have their pros and cons. The nice thing about these is that you can get started with either of them for less $ than you would for 8-bit MCU’s. The VLDicovery ($12 for STM32) and LPCXpresso ($30 for LPC1769) starter kits come with a development board with an integrated programmer/debugger. Both include free software - C compiler, IDE (Eclipse based) with source level breakpoint debugger, etc.

Thanks for replying! The LPCXpresso does look like a pretty good deal. If I’m not wrong, the debugger can be used on other targets as well which is pretty cool. I’ll probably stick to either LPC or STM32 after I purchase the first one (I have the impression switching around is rather troublesome). Are there any particularly notable pros/cons about either of them (generally, with no specific application in mind)?

Its not so much pros and cons as different features, in particular regarding built-in peripherals. For example the LPC17xx has 32-bit timers whilst the STM32 uses 16-bit timers. The STM32 has 2x 12-bit DAC’s, the LPC17xx has single 10-bit DAC. The STM32 has a true SD card interface, the LPC17xx uses SPI.

If I had to choose one over the other, I would go with the STM32 as they have a much wider range of products from <$1 devices (which can be used in place of 8-bit devices) all the way up to 176-pin BGAs with 1M Flash and 128K RAM. FYI, ST shipped over 50% of the combined total of ARM Cortex-M3 units in 2010.

That’s quite interesting! I suppose I’ll get to reading the datasheets. From what I gathered the past few days, the higher end STM32 development boards seem to be more expensive though. Has anyone tried the ET-STM32 Stamp or STM32F103 Development Board?

I think a development board with as many peripherals as possible will be more useful, what do you think? It’s always possible to scale down for the actual application if I didn’t need some of them.

If you don’t want to spend $250 on an STM3210E-EVAL (which is excellent and is supported directly by the TrueStudio IDE), then take a look at the PRIMER2 - about $70 with an STM32F103VET6. It has everything from an LCD with touchscreen to a Li-Ion battery and charger. It only works with the RIDE-7 IDE though.

Crappinni:
I think a development board with as many peripherals as possible will be more useful, what do you think?

That was what we initially thought when we started the LPC2000 work and we ended up with peripherals that we paid for but never used. However, with experience, we have found that the hybrid combinations are more useful i.e. a minimal header board optionally used in combination with a prototype / baseboard like the QuickStart / Prototype / Baseboard combinations from Embedded Artists:

http://www.embeddedartists.com/

For additional peripherals you can have a selection of the breakout boards and jumper wires that you can get from here at SparkFun

For most flexibility it is good to have unrestricted access to as many different pins as possible - at other times a pre-wired peripheral connected to dedicated pins can save a lot of time diagnosing connection problems. With a combination you can mix and match and get the best of both worlds.

May I suggest the mbed? http://www.sparkfun.com/products/9564 , it’s essentially the LPC1768 made easy

The online compiler is a blessing and a curse. It’s not the greatest editing software and there’s some closed source code involved with the provided API (but you can write or use other APIs). However, it’s awesome at letting you try out examples that other people published.

I’ve also built a base station for my mbed so I can try out every feature offered by the LPC1768

http://mbed.org/media/uploads/frank2608 … small-.jpg

details and source files at

http://mbed.org/users/frank26080115/not … e-station/

As you can see, I can test many MANY ideas using it

I saw the mbed some time ago and it got me quite interested. But the online compiler is really quite a deterrent to some people, including me, although most of the time there will be an internet connection available so the online compiler shouldn’t even be much of a hassle. The mbed does give me a feeling I’m one step detached from the hardware though. Somehow I just prefer to get my hands dirty and do all the work!

Now I’m checking out the evaluation board rmteo1 suggested. $250 is a pretty steep but I wouldn’t mind paying a one time fee for an awesome board. The LPCXpresso seems pretty good too but why’s it so much more affordable?

Also, I never knew certain eval/dev boards only support certain IDEs though! I intend to use only free software, will this be a problem?.

Don’t use the online compiler then, NXP provides the APIs and startup code and the linker scripts and makefiles for GNU, so just setup WinARM or YAGARTO and you are good to go.

The JTAG debugger on the LPCXpresso is crippled on purpose, just so you are aware.

As far as I can tell, if the vendors provide APIs, startup code, linker scripts, and makefiles that are GNU compatible, then there’s nothing stopping you from using GNU compilers and OpenOCD to do everything. So far I know Atmel provides their “at91lib” for their ARM chips and NXP has LPC17xx CMSIS for their LPC17xx series, something similar is definitely available for Stellaris and STM32 and other brands.

You are correct that the mBED does detach you from the hardware in that it will not, for example, allow you to do debugging by setting breakpoints, etc. That said, it is designed for use by novices who want to work with state-of-the-art hardware and I would recommend it over alternatives such as Basic Stamp (PIC) or Arduino (AVR). The online compiler is not a dealbreaker, IMO. One nice feature of mBED though is that the .BIN files generated by the compiler can run bare-metal on the MCU without having to re-compile, etc.

The LPCXpresso at $30 is much less expensive than the $250 STM3210E-EVAL because it contains just the debugger /programmer and the MCU. The STM3210E-EVAL has a graphic TFT LCD, switches, LED’s and many other external peripherals.

Let me explain what I mean about IDE’s supporting certain boards. I will use TrueStudio for the STM3210E-EVAL as an example. The commercial version of TrueStudio supports several types hardware debuggers - the free version only supports the ST-LINK debugger (you will need to purchase the ST-LINK for $25 as the STM3210E-EVAL does not have an on-board debugger). TrueStudio also provides source code examples for all the hardware peripherals on the STM3210E-EVAL. Most importantly, drivers for peripherals are provided allowing you to get started very quickly. For example, to write a text string (MESSAGE1) to the TFT LCD:

LCD_DisplayStringLine(Line0, (uint8_t *)MESSAGE1);

expands to:

/**
  * @brief  Displays a maximum of 20 char on the LCD.
  * @param  Line: the Line where to display the character shape .
  *   This parameter can be one of the following values:
  *     @arg Linex: where x can be 0..9
  * @param  *ptr: pointer to string to display on LCD.
  * @retval None
  */
void LCD_DisplayStringLine(uint8_t Line, uint8_t *ptr)
{
  uint16_t refcolumn = LCD_PIXEL_WIDTH - 1;

  /* Send the string character by character on lCD */
  while ((*ptr != 0) & (((refcolumn + 1) & 0xFFFF) >= LCD_Currentfonts->Width))
  {
    /* Display one character on LCD */
    LCD_DisplayChar(Line, refcolumn, *ptr);
    /* Decrement the column position by 16 */
    refcolumn -= LCD_Currentfonts->Width;
    /* Point on the next character */
    ptr++;
  }
}

You can use the STM32F3210E-EVAL with any other tool chain but obviously a lot more work will be needed on your part.

Thanks for all the replies!

A lot of useful information here. How’s the JTAG for the LPCXpresso crippled though? I haven’t seen anyone else talking about that! I’m looking for more details about it now since it seems like a wonderful product. At that price, it seems possible for me to build another JTAG debugger and still have a the total cost come under what other development boards cost.

The pairing between STM3210E-EVAL and TrueStudio seems very convenient but it might be too much for me! I intend to use only freely available software to keep costs down (plus they usually have a larger community in case I need help).

So the mbed can be used with a separate GNU compiler as well. That’s another option to consider! Sadly I wouldn’t be able to connect a JTAG debugger without defacing the pretty board and I know I eventually would like to get the full ARM experience.

Anyway, are there any websites which have reviews of such development boards? That would be very helpful!

The LPCXpresso IDE can build an executable of any size with full code optimization, and it supports a download limit of 128KB after registration.

You can build a binary of any size, but remember the JTAG link they give you only works with their software since it’s proprietary

I own an AVR Dragon and still haven’t needed to actually use JTAG debugging yet. I have an Bus Blaster V1 for JTAGing with my AT91SAM7 and so far all I’ve done is use the flash write_image command, haven’t touched GDB yet.

Ok thanks! It’s still quite difficult for me to follow with all the different JTAG adapters and such. I’ve never tried JTAG debugging as well but breakpointing sounds really good, especially when 100 different things could be going wrong. Way better than making it print lines.

Anyway, I was considering simply making a circuit board that breaks out every single pin, making it a DIP so I could breadboard it. I have some experience etching boards and with surface mount soldering. Are there any potential problems though? It seems all that’s needed to run (bare minimum) is an oscillator, some decoupling capacitors and a few resistors. Although I’m still not sure which go where.

Etching my own breakout board will make it really cheap! But I haven’t considering the cost of a JTAG debugger.

I have a Bus Blaster V1, which is the cheapest one I know of thus far, it’s sold out permantently but the V2 will be out in a few days, which will probably be the cheapest one on the market yet.

If you think you can solder well, this design will let you have plenty of fun http://code.google.com/p/micropendousx/

PCBs are cheap at ITead Studio http://iteadstudio.com/store/index.php? … Path=19_20 where you can get 10 made for $28 , and my last order took only 12 days from order submission to get to my house

Thanks for sharing the PCB prototyping website! I’ve been looking around for one too!

The micropendousx project seems quite an overkill though. Most of the applications I can think of wouldn’t require a USB connection to a computer since I prefer to build autonomous robots etc. The first thing I intend to do after blinking an LED is program it to replace my AVRs in my autonomous quadrotor which only communicates via serial once in a while.

I found a blog online with getting started tutorials on using the BlueBoard LPC1768-H. They’re seem quite detailed so far, and the BlueBoard seems to be a simple breakout board with just basic components. That’s what I’m looking for! I couldn’t find an equivalent for STM32 though.

About the JTAG adapters, I still haven’t caught up with the terminology. All I know is OpenOCD is used on the software side and a supported hardware JTAG debugger is needed to work with it. I still haven’t gotten to reading all about the JTAG interface, how OpenOCD works etc. But from what I can tell, if the hardware is supported by OpenOCD, just setup, connect and everything else will be a breeze?

I use Futurlec boards for STM32 development.

http://www.futurlec.com/STM32_Development_Board.shtml

The stamp has more flash and goodies, but is smaller.

http://www.futurlec.com/ET-STM32_Stamp.shtml

Excellent prices, but plan ahead as shipping can take up to 4 weeks.

I use the Olimex ARM-USB-OCD jtag. Ok, use is a misnomer, I have tested it, but have not required it in daily usage… I use codesourcery gcc toolchain with Programmers Notepad2, but if I were to go commercial full time I would look for something like Rowley Crossworks toolkit which supports several jtag types including the olimex one.

I am a bit disappointed in not finding more, new stm32 dev boards. Has the 17xx series overshadowed it already?

After several days of searching, it does indeed seem the LPC17xx series is more popular in the hobby community (even more so if I consider mbed). The development boards for LPC17xx series appear to be aimed at hobbyists (don’t look intimidating, non-green soldermask!) compared to the STM32 ones. I don’t have the numbers but it even appears LPC17xx boards are more affordable as well.

I’ve looked at the Olimex JTAG debuggers but they’re really expensive! Do they have some special features to justify the price? At first, after seeing the price, I thought all of them cost that much so I went and looked for instructions to build one instead. Fortunately I was wrong.