PIC Microcontroller Operating System

Coder404 picture Coder404 · May 1, 2012 · Viewed 13.1k times · Source

I heard it is possible to write an Operating System, using the built in bootloader and a kernel that you write, for the PIC microcontroller. I also heard it has to be a RTOS.

  1. Is this true? Can you actually make an operating system kernel (using C/C++) for PIC?
  2. If yes to 1, are there any examples of this?
  3. If yes to 1, would you need any type of software to create the kernel?
  4. Is Microchip the only company that makes PIC microcontrollers?
  5. Can the PIC microcontroller be programmed on a mac?

Thanks!

Answer

Nathan Wiebe picture Nathan Wiebe · May 2, 2012
  1. Yes, you can write your own kernel (I have written 2 of my own). Yes you can write it in C for PIC. If you want pre-emptive scheduling, then you're going to have a real tough time avoiding assembly completely when writing the context switch. On the other hand, you can easily write a cooperative kernel purely in C (I have done this myself). (Note that creating an operating system is not a simple task... I'd get your feet wet in pure C first, then USE an OS or two, then try creating one.)

  2. An excellent example of this is FreeRTOS. It has preexisting ports (i.e. MPLAB projects that run without any modification on the Explorer16 demo board) for PIC24F, PIC33F, and PIC32MX (as well as 20-some odd other official ports for other vendors' devices). PIC18F is supported but it's not pretty...

  3. You only need MPLAB to create the kernel (free from Microchip). It can work interchangably with C and assembly. Depending on the processor, there are free versions of their C30 and C32 compilers to go with MPLAB.

  4. PIC is a type of microcontroller, and is a trademark of Microchip. Many other companies make microcontrollers and call them something else (e.g. AVR, LPC, STM32).

  5. Yes, the new version of MPLAB X is supported on Mac, Linux and Windows.