# Linux command-line C compilers for PIC10F200

What I have

• a Raspberry Pi with Raspberry Pi OS Lite 32-bit (a port of Debian with no desktop) environment installed
• PIC10F200 microcontrollers
• a PICKit3-like programmer

I want to compile C and upload it to the microcontroller, hopefully replicating these series of tutorials. What I have found so far:

• There is the Small Device C Compiler (SDCC) for which I have found this nice tutorial. However, it doesn't seem to support the PIC10 series.
• The official Microchip's MPLAB XC8 compiler. But I have no idea if/how it can be installed on my OS and if it has a non-GUI (only command-line) version?
• There seem to be other options such as CPIK, PicCBuilder, GPUTILS, GNUPIC... but I honestly don't know what they are and if they suit the propose I'm looking for.

Things I think I need are:

• A C compiler (like gcc-avr)
• An assembler (like avra)
• A programmer (like avrdude)

I would appreciate it if you could help me know how/if I can use the above environment to program my PIC10 microcontroller.

P.S. More C compilers have been listed here and here.

• Foad, I clicked on "Documentation" on the MPLAB XC8 product page on microchip.com; there I was taken to a list where I clicked on "MPLAB XC8 C Compiler User Guide for PIC MCUs", and that document has a section "How Do I Compile on the Command-line?" microchip.com/en-us/development-tools-tools-and-software/… Jun 25, 2021 at 20:24
• Furthermore, let's be honest: if you want to learn how to program microcontrollers, please don't start with a PIC10. You get not even 400 B of RAM, and your stack is literally two deep – that's not what you'd want to learn or teach today; for the same price, some other MCUs can be had, which do have better support for C – yes, you can compile C for running on an PIC10, but that device really hasn't got the things that makes C acceptable. Jun 25, 2021 at 20:27
• I rummaged around a bit on Microchip's site, but it doesn't look like the XC8 compiler is available for ARM. They don't even seem to make x86-64 builds. Jun 25, 2021 at 20:31
• @marcelm that's probably true, but that piece of software is so little and building software for a 400B MCU is so trivial computationally that running the compiler itself on qemu-user should be straightforward. (yes, you can in this day and age run software compiled for a completely different processor as if the machine was something else, and Qemu translates the system calls. It's mind-boggling.) Jun 25, 2021 at 20:45
• @MarcusMüller Well, if it helps Foad achieve Zen :) Jun 25, 2021 at 21:05

C is probably a non starter, the PIC10 core really isn't designed for that.

I few years ago I got some pic10s and successfully managed to make an LED blinker using the linux gputils tools and a Pickit II compatible programmer. the code was in pic assembler.

• the gputils software package doesn't include a programmer, AFIK. Didn't you use PK2CMD?
Jun 26, 2021 at 7:13
• I found all the software that I needed in debian, so I suspect that I used ponyprog Jun 27, 2021 at 1:23
• I think PonyProg doesn't support PIC10, does it? 🤔
Jun 27, 2021 at 1:40
• I don't recall, I just found PK2CMD compiled from source (in january 2013), perhaps I did use that. Jun 27, 2021 at 3:28

This is not an answer to the question but a list of things I have figured out so far:

• There is picprog which sadly doesn't support the PIC10 microcontrollers. I have found a fork called ugly-pic-programmer (upicprog) by Marek Blaszkowski that should support PIC10.
• There is PK2CMD Open Source but not Free/Libre programmer originally distributed by Microchip but deprecated. The source code is available on the internet, for example here. One can compile it manually but I'm not quite sure how the libusb dependency needs to be installed. Apparently it is not compatible with the PIKit3-like programmer I have but good news is that one can program PIC10F200 according to this tutorial.
• There are gpasm and gplink assembler and linker part of the gputils package. And they do support PIC10 microcontrollers.

P.S. From here, one can install sudo apt install libusb-dev

• well, if you need to build yet another programmer to program the MCU you have: have you considered using a different target MCU just to get your feet off the ground (you can then build a programmer with that, if you want to!)? Something like the ~14€ ST Nucleo boards are very nice, they come with a detacheable programmer and a target board, and you can start right away with software you can probably directly install via apt (haven't tried it on debian, but on Fedora on x86_64 and aarch64, which your RPi probably is, it works with distro packages). Jun 25, 2021 at 23:56
• @MarcusMüller correct me if I'm wrong, but PK2CMD does work with PICKit2 programmers, doesn't it?