Close

A "page" written on the matter a while back...

A project log for operation: Learn The MIPS (PIC32MX1xx/2xx/370)

Having been exclusive to a certain uC-line for over a decade, it's time to learn something new (and port commonCode!)... Enter MIPS

eric-hertzEric Hertz 06/26/2015 at 12:080 Comments

This is a repost of some thoughts from my "page" of a few months back: https://hackaday.io/page/884-whats-this-a-page-pic32-contemplations

Mainly a reminder regarding this link: A pretty decent write-up on LD (linker) scripts and PIC32s

Currently contemplating PIC32's...

PICs have always seemed a bit backwards to me... They've so many peripheral-features, come in so many packages, have so many different architectures (8-bit 16-bit...), Yet (if I understand correctly) there's *very little* open-source support for 'em.

I'm sorry, being stuck with Windows for developing for a microcontroller seems utterly-ridiculous to me. And more...

But, there's the PIC32...

And, somewhere, I read it's designed around a MIPS core.

Now somehow that appeals to me...

Maybe it's something to do with a project of a few months back... I tried to see what I could do with an old Cable (TV) Box that had an unknown processor in it. Thought maybe I could install linux on it, if I tried hard enough (apparently no one else has?). Or something, I dunno. But I spent a few weeks (months?) at it, and learned a lot about JTAG and MIPS. At the end I couldn't figure out the memory-mapping stuff, that was a bit beyond my reverse-engineering-skills. But, I was able to blink the two LEDs, and was pretty proud of that. (the UART was a no-go).

I do know that MIPS has been around long enough that certainly I could eventually find a resource that resonates with my learning-style...

Ages and ages ago, as part of my undergraduate-research I developed a system around an Atmel ARM-7...

I'd been doing AVRs for a while at that point, so thought this particular ARM7 (with internal FLASH and RAM) was going to be like working with an AVR... Boy was I wrong.

I got it working... I mean, really, it *worked*... The code I wrote *worked*, on the system I developed.

But even after designing a 4-layer PCB and ordering and soldering all those parts and *running* the system with my code... there was one thing I could never wrap my head around...

Basically, memory-mapping. (again).

That blasted thing was running my code straight off the FLASH memory... which seemed fine to me... That's how AVRs do it! ...Until it came to my attention that the FLASH was slowing my (what was it, 100MHz?) system to slower than my AVR projects. Quite literally, the FLASH embedded in this chip rated for 100MHz was *slower* than the FLASH embedded in AVRs.

Fine, move that code to SRAM!

How?

The Linker, of course!

Right, I fought that danged thing for ages, just *barely* grasping its functionality, let alone its obscure language. In the end, I honestly thought it'd be easier to write the code to do the transfer by hand, in assembly.

A little wiser (probably not much) now, I realize that maybe doing that transfer (from FLASH to SRAM) by hand would be difficult, since all the jumps, etc, (in my C-compiled code, meant to run from FLASH) probably couldn't be guaranteed to be relative, etc.

So, MIPS... no easier, really... Plausibly more complicated with its virtual-memory mapping (does ARM do that? I never got that far).

On the plus side, apparently some dude has a pretty decent write-up on using mips-gcc with PIC32's, including a pretty decent explanation of the linker-script.

It looks to be a *significant* amount of more work to get a PIC32 running than an AVR... no header-files, no linker-script, etc... but at least there's a resource, and a little more learning-experience.

It's a contemplation, anyhow.

OTOH, now that ARMs are everywhere, is this a worthwhile endeavor?

Well, for one thing, some PIC32s (yes 32-bit processors) apparently come in DIP packages, but no 40-pin?!! And *several* variants, to boot. Plausibly even drop-in-replaceable with some of my old AVR projects(?)

And, some of those may only be a handful of bucks ($3 for a 40MHz 32 bit processor/FLASH/RAM?! and it doesn't require fine-pitch soldering?!)

I'm kinda intrigued.

Contemplations forgotten:

How'm I gonna program this thing...? Research suggests OpenOCD via JTAG might be feasible... Took quite a bit of Googling to find anything even *remotely* to the affirmative. (Burried under tons of pages of people *asking* whether it was possible to program via JTAG met with little conclusive besides "there's a brief mention in the data-sheet"... Most of which, apparently, are on microchip's site...) This search reminded me, too, of another reason I'd avoided PICs for so long... I didn't have a programmer, and I certainly wasn't 'bouts to buy one for experimenting with just a handful of chips... but if JTAG'll do it... we'll see!

Discussions