Friday, July 15, 2005

So a while back I found this really cool compiler called SDCC. It is an open-source C compiler for several different microcontrollers (including the Microchip PIC, one of my personal favorites).

Anyway they just made a new release a little while ago, which is good. But it is difficult to get it up and running for PIC processors on Windows. So I put together the steps I had to go through to get it up and running on a Windows machine using Cygwin. This needs to be fleshed out and made a bit clearer, but at least I've got something...

-install gputils and Cygwin. Make sure to install "make" with your Cygwin install.

-download win32 version of sdcc and main (uncompiled) version of sdcc

-unzip main version of sdcc to a temp location and copy all files and folders to SDCC install directory

-must make these makefile changes to prevent gputils from segfault'ing
device\lib\pic16\debug\Makefile...
gplib -c $(LIB) gstack\\*.o

device\lib\pic16\libc\Makefile...
LOBJS = $(patsubst %,%\\*.o,$(DIRS))

device\lib\pic16\libsdcc\Makefile...
LOBJS = $(patsubst %,%\\*.o,$(DIRS))


-also must change "Makefile.in" to "Makefile" in
SDCC\device\lib
SDCC\device\include

-Script to create headers from inc files: 1) must have gptuils folder in C:\ 2) must have this script and inc2h.pl installed in sdcc root directory
#!/bin/bash

for file in $(ls /cygdrive/c/gputils/header/p*.inc)
do
export picstring=$(echo $file | sed "s/\/cygdrive\/c\/gputils\/header\/p//; s/.inc//")
../../inc2h.pl $picstring /cygdrive/c/gputils "pic$picstring.h"
done

No comments: