0
\$\begingroup\$

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.

\$\endgroup\$
16
  • 2
    \$\begingroup\$ 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/… \$\endgroup\$ Jun 25, 2021 at 20:24
  • 2
    \$\begingroup\$ 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. \$\endgroup\$ Jun 25, 2021 at 20:27
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – marcelm
    Jun 25, 2021 at 20:31
  • 3
    \$\begingroup\$ @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.) \$\endgroup\$ Jun 25, 2021 at 20:45
  • 2
    \$\begingroup\$ @MarcusMüller Well, if it helps Foad achieve Zen :) \$\endgroup\$
    – marcelm
    Jun 25, 2021 at 21:05

3 Answers 3

4
\$\begingroup\$

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.

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

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

\$\endgroup\$
4
  • 1
    \$\begingroup\$ 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). \$\endgroup\$ Jun 25, 2021 at 23:56
  • \$\begingroup\$ @MarcusMüller correct me if I'm wrong, but PK2CMD does work with PICKit2 programmers, doesn't it? \$\endgroup\$
    – Foad
    Jun 26, 2021 at 7:12
  • 1
    \$\begingroup\$ @Foad, I can chime in. I use the PK2CMD with an original Microchip PICKit2 all the time. To me it wasn't a hassle to get it running, but that depends on the experience of the user of course. It requires compilation IIRC, there's no apt/yum package you can just install. \$\endgroup\$
    – anrieff
    Jun 26, 2021 at 9:06
  • \$\begingroup\$ @anrieff the more compile`ted it will be the more I will enjoy ;) can you be kind to point me towards some tutorials, or maybe you can share instructions on your blog or Github? \$\endgroup\$
    – Foad
    Jun 26, 2021 at 9:12
0
\$\begingroup\$

Try to avoid using SDCC compiler as it doesn't support all available microcontrollers. XC8 compiler, including PK2CMD can be downloaded from the official Microchip website.

For XC8 compiler, click here.

For PK2CMD, click here.

Read the accompanied documentation before attempting to do anything.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.