CMSIS (or: how I was all wrong)
So it turns out I had CMSIS all wrong. Beginning honest to goodness embedded programming is challenging enough without tricking yourself into believing things that just aren't true. Maybe what I'm going to write is all wrong too. I'll look back at this in a year and laugh, or I'll say "hey I guess I got that right". We'll see.
So it is beginning to look like vendor independence on the Cortex platform is a bit of a fool's quest. CMSIS will give you conformity along the base Cortex items like the NVIC and SysTick timer, and make it easier to set up your clocks and all that, but once you go beyond that you are pretty much looking at vendors playing by their own rules for on-board peripherals. If I want to control TIMER0 on my NXP chip I am going to both need to use a different memory address to reference it, and different registers to control it than if I were using an ST or TI chip.
I guess the best practice here is to just work as close to the hardware as you can. I will still avoid using driver libraries, and commenting your code enough will help you easily port it to another platform since most peripherals tend to work similiarly. It's easy enough to figure out (and I'm just working from memory so this is probably wrong):
LPC_SC->PCONP |= ( 1<<0x01 ) // Enable TIMER0 peripheral
and translate that into the appropriate TI or ST register. Whereas it might not be as easy to convert (and I'm just making this up)
EnablePeripheral(TIMER0); // Enable TIMER0 peripheral
across chips if you're using StellarisWare or some other proprietary library. I'm sure you'll be abstracting all those calls into your own function anyway, you might as well just get low and dirty and poke at some registers yourself.
Unless you plan to stick with ST or TI or NXP forever, I guess. I don't really have the desire to learn driver library after driver library.













