Installing Sdcc

Pic

Linux

Recipes

Magyar English

linux pic sdcc debian

Howto install "sdcc" over Debian Etch

Basically there are two possibility:

  1. debian repo használata
  2. forrásból való telepítés

1.  Installing using a debian repo

This is the most simple solution using a package manager.
Its main drawback: the support for newer PICs might be missing

In order to install sdcc we need to issue the command:

apt-get install sdcc

Tha package manager will download and install the program (and other requirements such as gputils) for us.

2.  Installing from source code

During this setup, the loginname is pic,
the name of the machine is mobix!

2.1  Preactions to installation

I have chosen installing from source code, bacause it is easy to maintain as a normal user. Before we move to install, I prefer to check two things.

  1. creating the local bin folder, and setting it up
  2. creation of the project folder (we will do everything under this folder)

So issue the next command and check its output:

pic@mobix:~$ set|grep PATH
PATH=/home/pic/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
    for i in ${CDPATH//:/'      '};
    if [ "${INFOPATH: -1:1}" == ':' ]; then
        infopath=${INFOPATH}${infopath};
        if [ ${INFOPATH:+set} ]; then
            infopath=$INFOPATH;
    [ -z "$classpath" ] && classpath=$CLASSPATH;
        manpath=$MANPATH;
    PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
pic@mobix:~$ 

In case you cannot find the "/home/pic/bin" folder (of cource, you need to search for your login name instead of pic), issue the following commands:

pic@mobix:~$ mkdir ~/bin
pic@mobix:~$ export PATH=$HOME/bin:$PATH
pic@mobix:~$ echo PATH=$HOME/bin:$PATH >> ~/.bashrc

One more additional command, creation of the working folder:

pic@mobix:~$ mkdir projects

So we reached the most important stuff.

2.2  Installing gputils

Enter project folder:

pic@mobix:~$ cd projects

Download most recent gputils from svn:

pic@mobix:~/projects$ svn co https://gputils.svn.sourceforge.net/svnroot/gputils/trunk/gputils gputils_svn
A    gputils_svn/configure
A    gputils_svn/Makefile.in
A    gputils_svn/include
A    gputils_svn/include/ansidecl.h
A    gputils_svn/include/getopt.h
A    gputils_svn/include/libiberty.h
A    gputils_svn/include/stdhdr.h
A    gputils_svn/gplink
A    gputils_svn/gplink/parse.y
A    gputils_svn/gplink/Makefile.in
A    gputils_svn/gplink/lst.c
A    gputils_svn/gplink/script.c
A    gputils_svn/gplink/cod.c
.
.
.
A    gputils_svn/libgputils/gpsymbol.c
A    gputils_svn/libgputils/gpcod.c
A    gputils_svn/libgputils/gpcoffopt.h
Checked out revision 554.

Configure it for the current user:

pic@mobix:~/projects$ cd gputils_svn/
pic@mobix:~/projects/gputils_svn$ ./configure --prefix=$HOME
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
.
.
.
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands


gputils-0.13.6 is now configured for

  Build:                i686-pc-linux-gnu
  Host:                 i686-pc-linux-gnu
  Source directory:     .
  Installation prefix:  /home/pic
  C compiler:           gcc -g -O2

Compile and install in one step (since we install for our user only, we do not need to be root):

pic@mobix:~/projects/gputils_svn$ make install
Making install in libgputils
make[1]: Entering directory `/home/pic/projects/gputils_svn/libgputils'
if gcc -DHAVE_CONFIG_H -I. -I. -I..  -I../include -DHEADER_PATH=\"/home/pic/share/gputils/header\" 
-DLKR_PATH=\"/home/pic/share/gputils/lkr\" -DLIB_PATH=\"/home/pic/share/gputils/lib\" -DPUB_PATH=\"@GPUTILS_PUB_PATH@\"  
-Wall -pedantic -g -O2 -MT gparchive.o -MD -MP -MF ".deps/gparchive.Tpo" -c -o gparchive.o gparchive.c; \
        then mv -f ".deps/gparchive.Tpo" ".deps/gparchive.Po"; else rm -f ".deps/gparchive.Tpo"; exit 1; fi
.
.
.
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/pic/projects/gputils_svn'
make[1]: Leaving directory `/home/pic/projects/gputils_svn'
pic@mobix:~/projects/gputils_svn$

From this point the gputils is ready for the job, lets look what to do next.

2.3  Installing sdcc

Step back into the project folder:

pic@mobix:~/projects/gputils_svn$ cd ..

Download most recent version of sdcc from svn:

pic@mobix:~/projects$ svn co https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc sdcc_svn
A    sdcc_svn/sdcc_vc_in.h
A    sdcc_svn/main_in.mk
A    sdcc_svn/configure
A    sdcc_svn/Makefile.in
A    sdcc_svn/debugger
A    sdcc_svn/debugger/mcs51
A    sdcc_svn/debugger/mcs51/symtab.c
A    sdcc_svn/debugger/mcs51/configure
A    sdcc_svn/debugger/mcs51/simi.c
A    sdcc_svn/debugger/mcs51/Makefile.in
A    sdcc_svn/debugger/mcs51/cmd.c
A    sdcc_svn/debugger/mcs51/symtab.h
A    sdcc_svn/debugger/mcs51/configure.in
A    sdcc_svn/debugger/mcs51/sdcdbsrc.el
.
.
.
A    sdcc_svn/support/Util/pstdint.h
A    sdcc_svn/support/Util/dbuf_string.h
A    sdcc_svn/install-sh
Checked out revision 5292.

Use the "--enable-doc" switch only,
if you have lyx and latex2html
already installed on your system.

Configure it for the current user:

pic@mobix:~/projects$ cd sdcc_svn/
pic@mobix:~/projects/sdcc_svn$ ./configure --prefix=$HOME --disable-mcs51-port\
--disable-gbz80-port --disable-z80-port --disable-avr-port --disable-ds390-port\
--disable-ds400-port --disable-xa51-port --disable-hc08-port --disable-ucsim\
--disable-packihx --disable-sdcdb --enable-doc
checking for gawk... gawk
checking version of the package... 2.8.5
.
.
.
config.status: creating config.h
config.status: executing depfiles commands

sdcc 2.8.5 is now configured for

  Build:
  Host:
  Source directory:     .
  C compiler:           gcc
  CFLAGS:               -pipe -ggdb -g -O2

  ENABLED Ports:
    avr                 no
    ds390               no
    ds400               no
    gbz80               no
    hc08                no
    mcs51               no
    pic                 yes
    pic16               yes
    xa51                no
    z80                 no

  Disable packihx:      1
  Disable ucsim:        1
  Disable device lib:   0
  Disable sdcpp:        0
  Disable sdcdb:        1
  Enable documentation: 1
  Enable libgc:         0

  Install paths:
    binary files:       ${prefix}
    include files:      ${datarootdir}/sdcc/include
    library files:      ${datarootdir}/sdcc/lib
    documentation:      ${datarootdir}/doc/${PACKAGE}

    prefix:             /home/pic
    datadir:            ${datarootdir}
    datarootdir:        ${prefix}/share

  Search paths (incomplete, see manual for all search paths):
    binary files:       $SDCC_HOME/bin
    include files:      /share/sdcc/include
                        path(argv[0])/../share/sdcc/include
                        /home/pic/share/sdcc/include
    library files:      $SDCC_HOME/share/sdcc/lib/<model>
                        path(argv[0])/../share/sdcc/lib/<model>
                        /home/pic/share/sdcc/lib/<model>

pic@mobix:~/projects/sdcc_svn$ 

4. For optimal results We might modify the "/home/pic/projects/sdcc_svn/device/lib/pic/Makefile.common" file. Find the next line, and change to your type (16fXXX):

ARCH   ?= 877

The supported PICs by the pic16 port can be found in the "/home/pic/projects/sdcc_svn/device/lib/pic/pics.all" file. In case of compile error, you might uncomment the wrong type in this file.

Compile the compiler:

pic@mobix:~/projects/sdcc_svn$ make
for lib in support/makebin support/cpp; do make -C $lib; done
make[1]: Entering directory `/home/pic/projects/sdcc_svn/support/makebin'
gcc -Wall -pipe -ggdb -g -O2  -I. -I../.. -I./../../support/Util -I.  -c -o makebin.o makebin.c
mkdir -p ../../bin
gcc  -o ../../bin/makebin makebin.o
make[1]: Leaving directory `/home/pic/projects/sdcc_svn/support/makebin'
make[1]: Entering directory `/home/pic/projects/sdcc_svn/support/cpp'
gawk -f ./opt-gather.awk ./sdcpp.opt  > tmp-optionlist
/bin/sh ./move-if-change tmp-optionlist optionlist
echo timestamp > s-options
gawk -f ./opt-functions.awk -f ./opth-gen.awk \
               < optionlist > tmp-options.h
/bin/sh ./move-if-change tmp-options.h options.h
echo timestamp > s-options-h
gcc -c    -g -O2 -Wall   -DHAVE_CONFIG_H    -I. -I./libcpp -I./libcpp/include -I./libiberty -I. sdcpp.c -o sdcpp.o
.
.
.
make[1]: Entering directory `/home/pic/projects/sdcc_svn/support/librarian'
gcc -Wall -pipe -ggdb -g -O2 -Wall  -I. -I../.. -I./../../support/Util -I. -c sdcclib.c -o sdcclib.o
gcc  -o ../../bin/sdcclib sdcclib.o
make[1]: Leaving directory `/home/pic/projects/sdcc_svn/support/librarian'

This might last longer depending on your computer

Configure and compile pic and pic16 libraries:

pic@mobix:~/projects/sdcc_svn$ cd device/lib/pic
pic@mobix:~/projects/sdcc_svn/device/lib/pic$ ./configure
checking for gpasm... gpasm
checking for gplink... gplink
checking for gplib... gplib
checking for rm... rm -f
checking for cp... cp
checking for mv... mv
checking for ls... ls
checking for sed... sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for mkdir... mkdir -p
checking for rmdir... rmdir
checking whether make sets $(MAKE)... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating Makefile.common
config.status: creating libdev/Makefile
config.status: creating libsdcc/Makefile
config.status: creating libm/Makefile
pic@mobix:~/projects/sdcc_svn/device/lib/pic$ make all
.
.
.

This might last longer depending on your computer

pic@mobix:~/projects/sdcc_svn/device/lib/pic$ cd ../pic16/
pic@mobix:~/projects/sdcc_svn/device/lib/pic16$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gpasm... /home/pic/bin/gpasm
checking for gplink... /home/pic/bin/gplink
checking for gplib... /home/pic/bin/gplib
checking for style of include used by make... GNU
checking dependency style of '/home/pic/projects/sdcc_svn/device/lib/pic16//../../../bin/sdcc'... none
checking dependency style of '/home/pic/bin/gpasm'... none
configure: creating ./config.status
config.status: creating Makefile
config.status: creating debug/Makefile
config.status: creating libc/Makefile
config.status: creating libdev/Makefile
config.status: creating libio/Makefile
config.status: creating libm/Makefile
config.status: creating libsdcc/Makefile
config.status: creating startup/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
pic@mobix:~/projects/sdcc_svn/device/lib/pic16$ make
.
.
.

This might last longer depending on your computer

Install the compiler (do not need to be root!):

pic@mobix:~/projects/sdcc_svn/device/lib/pic16$ cd /home/pic/projects/sdcc_svn/
pic@mobix:~/projects/sdcc_svn$ make install
make -f main.mk install
make[1]: Entering directory `/home/pic/projects/sdcc_svn'
make[1]: Leaving directory `/home/pic/projects/sdcc_svn'
make[1]: Entering directory `/home/pic/projects/sdcc_svn/device/lib'
if [ "`grep pic ../../ports.build | grep -v pic16`" = pic ]; then \
          make PORT=pic objects-pic14; \
        fi
make[2]: Entering directory `/home/pic/projects/sdcc_svn/device/lib'
.
.
.
make[1]: Leaving directory `/home/pic/projects/sdcc_svn/device/include'
make[1]: Entering directory `/home/pic/projects/sdcc_svn/support/librarian'
/usr/bin/install -c -d /home/pic/bin
/usr/bin/install -c ../../bin/sdcclib `echo /home/pic/bin/sdcclib|sed 's,x,x,'`
strip `echo /home/pic/bin/sdcclib|sed 's,x,x,'`
make[1]: Leaving directory `/home/pic/projects/sdcc_svn/support/librarian'
pic@mobix:~/projects/sdcc_svn$   

So, we have just installed sdcc! We might start to work with our brand new compiler.

Have good work with it!

Page last modified on 2008.12.19. 17:47:12

Copyright Alex 2007-2015