Installation

Linux or Mac OS X could be used as a development platform. The following packages should be preinstalled:

  • bison
  • byacc
  • flex
  • libelf
  • libfuse

On Ubuntu, you can install it by command:

sudo apt-get install bison byacc flex libelf-dev libfuse-dev

Download GNU C compiler zip package (ie for LINUX) from :

Unpack and install the compiler:

sudo unzip pic32-tools-*.zip -d /usr/local

Get RetroBSD sources from repository:

git clone https://github.com/RetroBSD/retrobsd.git

Source roadmap:

bin User commands
etc Template files for /etc
include System include files
lib System libraries
libexec System binaries
sbin System administration commands
share Shared resources
src Sources of commands and libraries
sys Kernel sources
tools Build tools and simulators

Build

To compile the kernel and build a filesystem image, run:

cd retrobsd
make cleanall
make

A resulting root filesystem image is in file `filesys.img`. A kernel is in file `unix.hex` in your target board subdirectory.

By default, the system is configured for the Max32 board. To select another target board, edit a top-level Makefile and change a TARGET value under section “Select target board”:

    TARGET ?= $(UBW32)       # for the UBW32 board with USB console
    TARGET ?= $(UBW32UART)   # for the UBW32 board with UART console
    TARGET ?= $(MAXIMITE)    # for the Maximite board
    TARGET ?= $(EXPLORER16)  # for the Explorer 16 board
    TARGET ?= $(STARTERKIT)  # for the PIC32 USB or Ethernet Starter Kit
    TARGET ?= $(MAX32)       # default
    TARGET ?= $(MAX32ETH)    # for the MAX32 with Ethernet Shield support
    TARGET ?= $(DUINOMITE)   # for the Duinomite board
    TARGET ?= $(DUINOMITEUART)   # for the Duinomite with UART console
    TARGET ?= $(PINGUINO)    # for the Pinguino-Micro board
    TARGET ?= $(DIP)         # for the DIP board
    TARGET ?= $(MMBMX7)      # MikroElektronika multimedia board for MX7

You can also change a desired filesystem size and swap area size, as required. Default is:

    FS_KBYTES   = 16384
    SWAP_KBYTES = 2048

Filesystem image

You need to put a filesystem image on a SD card. On Windows, use Win32DiskImager utility. On Linux, run:

sudo dd if=filesys.img of=/dev/XYZ

Here `XYZ` is a device name of SD card, as recognized by Linux (sdb in my case)

Or, you have to set in the top-level Makefile (provided sdb is your sdcard device name under LINUX)

SDCARD          = /dev/sdb

and then

make installfs

Install kernel

Kernel image should be written to PIC32 flash memory. The procedure depends on a board used.

Max32 board:

Use avrdude utility from MPIDE toolchain.

cd sys/pic32/ubw32
AVRTOOLS=/Applications/Mpide.app/Contents/Resources/Java/hardware/tools
$AVRTOOLS/bin/avrdude -C$AVRTOOLS/etc/avrdude.conf -c stk500v2 -p pic32 \
    -P /dev/tty.usbserial-* -b 115200 -v -U flash:w:unix.hex:i

Here you need to change AVRTOOLS path and tty name according to your system.

UBW32 board:

Use a pic32prog utility. Attach UBW32 board to computer via miniUSB connector J8. Press and hold PRG button, then press RESET button. Boot loader mode will start (blue, yellow and red LEDs lighting, white and green LEDs blinking). Run:

sudo pic32prog sys/pic32/ubw32/unix.hex
Maximite:

Use the bootload program for Windows: Maximite_Update_V2.7B.zip

Explorer 16 board:

There is an auxiliary PIC18 chip on the Explorer 16 board, which can be used as a built-in programmer device. You will need a PICkit 2 adapter to install a needed firmware, as described in this article (section “Hack #2: Lose the PICkit 2, Save $35”). This should be done only once. Then, you can use a pic32prog utility and a USB cable to install a kernel:

sudo pic32prog sys/pic32/explorer16/unix.hex
PIC32 Starter Kit:

Use PICkit 2 adapter and software to install a boot loader from file `sys/pic32/starter-kit/boot.hex`. This should be done only once. Then, you can use a pic32prog utility and a USB cable to install a kernel:

sudo pic32prog sys/pic32/starter-kit/unix.hex

Run RetroBSD

Install SD card into the board and press RESET button. RetroBSD will start and print a root prompt on a console port. Enter “root” as login name, and use empty password:

2.11 BSD Unix for PIC32, revision 470 build 1:
     Compiled 2012-02-05 by vak@Cobra.local:
     /Volumes/Users/vak/Project/retrobsd/trunk/sys/pic32/max32
phys mem  = 128 kbytes
user mem  = 96 kbytes
root dev  = (0,0)
console: port UART1
sd: port SPI4, select pins D3, D4
sd0: type I, size 16384 kbytes, speed 13 Mbit/sec
root size = 16384 kbytes
swap dev  = root, offset 65
swap size = 2048 kbytes
/dev/sd0: 236 files, 6665 used, 9654 free
Starting daemons: update 

2.11 BSD UNIX (pic32) (console)

login: root
Password:
Welcome to RetroBSD!
erase, kill ^U, intr ^C
# _

Simulator

You can use a MIPS32 simulator to develop a debug a RetroBSD software, without a need for hardware board. By default, a simulator is configured to imitate a Max32 board. To build it:

cd tools/virtualmips
make

Run it:

cd retrobsd/tools/virtualmips
./pic32

Configuration of simulated board is stored in file `pic32_max32.conf`.