I’m looking at learning to work with basic ARM7 controllers, specifically the LCP2101 from NXP (I just want something basic and cheap).
My experience is with the ATMEL assembly language, and I know some JAVA. What I want advice on is what language would be best for me when learning this controller. All the googling on it hasn’t helped me much. Does NXP have its own assembly instruction set and simulator software? Is it possible to program in assembly, and is it a good idea? Or should I just take the plunge and learn C?
What is a good design environment/simulator to start with? And can you point me out to some good resources on C programming for this MCU? I imagine each manufacturer has their own programming quirks.
leon_heller:
I use CrossWorks, the debugger/simulator is very good.
Leon
I've used GCC and Codevision on AVRs. Looking at ARMs, on CrossWorks' vendor site, I saw the below and wondered if they are "reselling" the public domain GCC or referring to it or what. If they use GCC as it says, then their product price is for their IDE and libraries. The compiler support would be from the public domain.
If you read the history of the ARM architecture, you’ll find that the originators very much expected assembly language to be used. You’ll also discover that a lot of computing can be done with few instructions, but it takes a lot of bit twiddling.
Does that mean you should use assembly language? No, assembly language should be used where you have to manipulate registers and stacks, but using it to write application code would be making your life hard unecessarily.
Do you need to know ARM assembly language? No, but if you want to step gdb through your code after it has been optimized, then knowing assembly language will be very useful because stepping gdb on C source statements is misleading.
I think C is the best language for doing embedded stuff with the LPCxxxx range of microcontrollers. If you already know Java, then C should not be so hard to learn. I usually work with just a text editor and a Cygwin console with Makefiles (no IDE).
read Jim Lynch’s ARM tutorial (google for it). This is excellent material with very nice and simple examples to get you started. The tutorial focuses especially on development using Eclipse.
subscribe to the LPC2000 yahoo mailing list: http://tech.groups.yahoo.com/group/lpc2000/ Just lurking there teaches you a lot. There’s also a file archive with lots of examples.
Oh I’ll definitely learn the assembly. The programs I want to write have a lot of “bit-banging,” with tons of conditionals and complex branching paths. I’ve read that the AVRs are actually more efficient at this kind of stuff, but I really need the ARM’s power for its floating point math capabilities and the six big timers.
I assume all ARMs have the same assembly instruction set. What would really help me out is just a master list of all the instructions.
bertrik:
resources
That’s what I’m talking about! I’ll leaf through these.
mtwieg:
Oh I’ll definitely learn the assembly. The programs I want to write have a lot of “bit-banging,” with tons of conditionals and complex branching paths. I’ve read that the AVRs are actually more efficient at this kind of stuff, but I really need the ARM’s power for its floating point math capabilities and the six big timers.
Ehm, the ARM7 core in the LPC21xx range doesn't have hardware floating point math. It does have a hardware integer multiplier (takes > 1 cycle though) but no hardware divider. If you compile something to use floating point or divides, I think the compiler will automatically link software routines for that.
Bitbanging is reasonably efficient because the LPC2101 has ‘fast I/O’.
I’m new to the ARMs too, though not at all to embedded. I’m looking at the LPC2000 micros.
As I’m understanding it now, there’s no way to program these things with JTAG (using the GNU toolchain) … I have to jack into the JTAG and the UART on chip if I want to do debug and programming? That seems lame! Is that right? It seems like a painful misuse of my UART.
If I’m laying out a board from the ground up, what’s the recommended way of connecting for debug and programming? Pin out both the JTAG and a level converted serial so I can JTAG with my amontec puck as well as talk over (for example) COM1 for programming?
Thanks for the rudimentary help. I’m excited to get these things up and running
ryansturmer:
I’m new to the ARMs too, though not at all to embedded. I’m looking at the LPC2000 micros.
As I’m understanding it now, there’s no way to program these things with JTAG (using the GNU toolchain) … I have to jack into the JTAG and the UART on chip if I want to do debug and programming? That seems lame! Is that right? It seems like a painful misuse of my UART.
Of course you can program parts with JTAG. OpenOCD works with the GNU tools, and it can program and debug ARM chips from NXP and others. BUT, if you should disable the JTAG pins in your code, you will have a problem with using JTAG to re-program your parts. You can get around that situation by forcing the bootloader to remain in control after a hard reset, and then take over via JTAG to re-program. The one situation where can not do that is if your code enables CRP (Code Read Protection), because the bootloader will disable the JTAG pins. Then you need the serial port to be able to erase the part for re-programming.
dshuman:
Of course you can program parts with JTAG. OpenOCD works with the GNU tools, and it can program and debug ARM chips from NXP and others.
Whew! Ok, that’s more sensible… I had read that early on, NXP hadn’t released the protocol for writing flash via the JTAG, and the only toolchain that could use the JTAG to flash programs was rowley (they JTAGged a bootloader into RAM that allowed for flashing over the JTAG port) That information I assume now is wildly out of date.
Thank you for clearing that up!
Having said that, my last question is regarding this Amontec USB JTAG dongle… is that a worthwhile tool for a newcomer using linux and the GNU toolchain? There’s this olimex $20.00 gadget that’s financially more attractive, but I’ve been in situations before where I’ve bought (or built) a cheap-o parallel programmer, and could have saved myself a lot of headache and hassle screwing around with it if I had just ponied up the extra dough for a more polished puck. Is that the case here?