pimmel 5 Posted September 1, 2013 Share Posted September 1, 2013 Hey gang, In addition to trying to adapt some code into an Energia library for the SI570 I2C-controlled oscillator, I also have managed to get ahold of the Adafruit LPC810 mini-kit/programmer [1], with the intent to play around and learn something about working with ARM processors. Sick of using a breadboard, I soldered up on protoboard my own version [2] of NXP's LPC800 mini-board [3] and ran through the tutorials provided by Adafruit [4]. I've also installed the Launchpad generic ARM compiler [5] so that I am not tied to an IDE like LPCXpresso [6] and have a little more insight under the hood of what is going on in the compilation/build/linking process. I found a nifty little simple blinky example that included an easy-to-modify makefile [7] and I was able to build and flash that on to the chip. So my question is, where do I go from here in the world of ARM? I don't really have a good understanding of the linker script, how/if you need to modify it, and I also really want to try and understand how to access the libraries that are included in the ROM on the die. Does anyone have any insight into that? All the LPC8xx examples I have found some to rely heavily on third party libraries that I can't follow or find, or (like in the example of the midibel stuff) are so arcane that I have a hard time trying to understand the code. I do have the data sheet and the programming manual, but they really seem to be geared for someone who has a bit of experience working with ARMs already, if not specific experience with LPC parts. All I seem to read on the googletubes is how easy it is to work with the NXP parts, not where you learn to use them So my embedded masters, do you have any hints or pointers? Thanks, Keith [1] http://www.adafruit.com/products/1336 [2] http://underwaterwhistler.blogspot.com/2013/08/lpc810-arm-processor-board.html [3] http://lpcware.com/lpc800-mini-kit [4] http://learn.adafruit.com/getting-started-with-the-lpc810/introduction [5] https://launchpad.net/gcc-arm-embedded [6] http://lpcxpresso.code-red-tech.com/LPCXpresso/ [7] http://www.midibel.com/ jbkim and jpnorair 2 Quote Link to post Share on other sites
jpnorair 340 Posted September 1, 2013 Share Posted September 1, 2013 Linker scripts for ARM are not really different than linker scripts for GNU POSIX C toolchains. The same rules apply. For linker scripting, I remember simply grok-ing linker scripting. Then I copied a generic script and made necessary modifications. The really critical areas are the "memory mapping" area and the "sections" area. Also, make sure you know how to use the KEEP directive. Here's one of my linker scripts for STM32L: https://github.com/jpnorair/OpenTag/blob/experimental/apps/app_7lan/proj_ride7/stm32l1xx_64_10.ld Anyway, the other critical differences of ARM Cortex-M vs MSP are the clock distribution network, the NVIC, and ... and ... well, those are the big two. There's no good shortcut to learning this stuff, you just need to grok, RTM, and test. If you want to look at OpenTag source for STM32L, go for it. I DO NOT use abstracted libraries when interfacing with CM3. You might also want to look at the CMSIS code. The file is core_cm3.c (and .h). I bet there's a cm0 version somewhere, too. Finally, the bible here is the ARM Cortex Mx TRM. Here's the one for CM0: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0432c/DDI0432C_cortex_m0_r0p0_trm.pdf yyrkoon, pimmel and jbkim 3 Quote Link to post Share on other sites
Rickta59 589 Posted September 1, 2013 Share Posted September 1, 2013 These lpc810's are great little chips. I'm just using the opensource arm compiler from linaro on launchpad.net. I've coded up a thin veneer using C++ templates that abstract the GPIO pins. I've got the serial stuff working and of course written some code to drive the ws2812 chips using ARM asm. Although there is a much better approach you can find on the lpcware website using the state configurable timer peripheral. Once you have a working linker script you can forget about it. It is unlikely you will mess with it. If you want to use C++ you have to make sure your ldscript includes the c++ constructor and destructor sections and that your startup code does something with those sections. For straight 'C' you don't have to worry about that stuff. You are going to spend more time overriding the interrupt isr routines. I think that the adafruit sample code is a good place to start. You can also just give in and use the lpcexpresso environment and then use all of the LPCOpenWare code. Though it seems to be kind of bloated and maybe not 100% correct. I really like these lpc8xx chips. They are fast, (30MHz using an internal oscillator with no wait states on the flash), the internal clock is fairly accurate and can easily run uart code without an external xtal. The cortex-m0+ uses a 2 cycle pipeline (meaning that it takes less time to do stuff) and it can do single instruction cycle gpio (on the cortex-m0 lpc1114fn28 it is 3 cycles to read. modify and write back) The chip packaging make them accessible to someone with a soldering iron and cheap protoboards. The SCT adds a whole new set of capabilities that aren't normally available to such a small chip. Check out the WS2812 SCT driven code on the lpc800 forum at lpcware.com. It is a great example of how to make the most of the lpc8xx chip. The only down sides to the them seem to be the availability of the chips, the lack of ADC (although it does have a comparator ) and the lack of community surrounding them. Make sure you check out all the app notes on lpcware.com. You will find ones that discuss how to access the rom routines, make sure you grab the SCT cookbook and the wizard apps that let you configure the pin switch matrix. That reminds me, the SCT wizard built into LPCXpresso will let you create state machines to load onto the chip that will run on the SCT independent of the cortex-m0+. It is almost like have two processors for the price of one. Good luck! BTW: just noticed tonight that you can actually order the lpc812 now in tssop20 (I've been checking every day for the last couple of month and they are finally available in qty now for purchase ) pimmel and yyrkoon 2 Quote Link to post Share on other sites
Rickta59 589 Posted September 6, 2013 Share Posted September 6, 2013 So if you are willing to solder some tssop20 pin chips, you can get the lpc812 now at mouser. These tssop to dip adapter boards should work with them: http://www.ebay.com/itm/20-PCS-MSOP-TSSOP-SOIC20-to-DIP20-Adapter-PCB-Board-Converter-Double-Sides-B09-/281135726601?pt=LH_DefaultDomain_0&hash=item4174fec009 -rick [Edit: added some pictures] I used a dollar store 3 led disassembled flash light taped under a hole cut in the box Mouser shipped me the chips and made a ghetto soldering lightbox: The resulting soldered chip on the adapter: bluehash and pimmel 2 Quote Link to post Share on other sites
Rickta59 589 Posted October 25, 2013 Share Posted October 25, 2013 Interesting web based tool config tool for the lpc8xx http://www.lpcware.com/tools/lpcconfig -rick pimmel 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.