...SDCC is mentioned often as a replacement for mc8.
[...]
However, both MacPorts and the SDCC SourceForge page (http://sdcc.sourceforge.net/) seem to suggest I stick with mc8:
- SourceForge: 'Microchip PIC16 and PIC18 targets are unmaintained.'
- MacPorts: 'Work is in progress on supporting the Microchip PIC16 and PIC18 targets'
Am I missing something? These two statements are contradictory, but neither one of them is "encouraging" re using sdcc - at least wrt PIC16.
ah, an unmantained compiler is better than the microchip one.
of course.
"Unmantained" simply means that no one is changing it. What's already there still is what it was when the last person touched it. It may not be perfect, but if it's still better for the same price (free), use it.
If 'gcc' is a btter choice for 8-bit platforms, where can I find that?
GCC doesn't work for PIC. It does work for AVR. Different instruction sets. One is designed to be "C-friendly", so it's easy to port GCC to it. The other is "silicon-friendly", originally meant to be programmed only in assembly (as I understand), and backwards-compatibility means that it can't change now. It works so much differently that a GCC port to that would cease to be GCC altogether.
Since the PicKit programmer doesn't have a Linux driver
They have. I'm using it (on Kubuntu) for quite a while now. They might need some tweaking with the udev rules, and the PicKit seems to be a bit picky with the USB ports, but it works. (Although I upgraded to an ICD4 a while ago).
I love how Linux guys always use diminutives, "some", "little" "a bit"... which in the great majority of cases means "a lot", "take the poison", "search for a window in the 27th floor"
I didn't know about the Linux driver for PicKit. I must have missed it, or it must be a new development, or maybe it only supports the older ones while I have a newer one. Anyway, the thing about tweaking udev rules is also something I have experience with, for a different project, and it's not particularly pleasant. I still prefer an independent GPIO-based programmer for the Raspberry Pi:
https://wiki.kewl.org/dokuwiki/projects:pickleRead the documentation of course, set it up like it says, and it "just works". (at least it did for me)
The vast majority of Linux (desktop) uses are no more customized than Windows is, and there are tools built into the GUI package (no matter which of several you end up with) to do just that. No need to go fumbling around the internals. If you do, then DavidAlfa has a point, but it's the exact same for Windows too, so...
...code becomes nonportable...
For a lot of things, that's important, but sometimes it's not. For most of what I do at home, it's not.
I don't copy code verbatim and "watch it work", which implies frustration to me when the "magic block of text" doesn't "just work". Instead, I understand the logic and what it's actually doing, and rewrite it for the new platform. Sometimes it's similar or even identical, sometimes not. It also helps me remember the context of what I was thinking/doing when I wrote it the first time, which is a big deal too.
Where portability clearly becomes important is when you're not married to any particular platform - like maybe a library, or you're using a dev board that you already have, to get a jump-start before the real hardware comes in - and so the same code verbatim does indeed have to compile successfully and bug-free to several different chips.
My projects are more serial than that, stopping at the "generic block diagram" stage until I have the real hardware, and then I implement it directly for that specific platform.
[joke]
#if PLATFORM_1
//complete standalone code for platform 1
#elif PLATFORM_2
//complete standalone code for platform 2
...
#else
#error Platform not supported
#endif
[/joke]
what i don't like in XC8 is the linker, it's prone to fail when there is less than one code page available and it still doesn't recognize code spaces that have been added in recent parts (the memory access partition feature) but hey, every version has a small
Ah yes, I had a project that needed that too. I think it was using the pro version, as my company at the time wanted to port an existing product from 8051 to PIC and bought "the good tools". (as you should at that level) Even so, it was quite a challenge to convince the linker to put this here and that there, keep all of this empty, etc. According to the (lack of good) documentation (at the time at least), it really wants to just do what it wants and say, "See? Your code is 'running' just like you said!"
Adding to the challenge was the need to field-update the entire program, without a chance of bricking it (from the customer's perspective), when the fully-optimized binary was already more than half of Flash. I ended up with kind of an odd architecture, with multiple partial downloads, the "bootloader" never fully releasing control, and the application being more like an Arduino's init() and loop() functions where loop() doesn't contain the loop but is instead called once per loop from somewhere else, etc. But it worked!
...and then our 8051 supplier told us about a new chip that would significantly undercut the PIC again ("You couldn't have told us sooner?!"), so we didn't actually sell my version.
Oh well, they did say I could take the PIC code home and use it, so I guess that's a plus.