Code Monkey home page Code Monkey logo

sdcc-examples's Introduction

SDCC examples

Build Status

This repository includes code examples to use with SDCC, an open source compiler for 8-bit microcontrollers. These examples can help beginners to get started and to solve problems like which headers to include, which parameters to use when compiling, etc.

Structure

The examples are structured by microcontroller architecture. For a particular architecture, the examples can be followed in order as a tutorial. The basic concepts explained on the first examples are not explained again on more advanced ones.

On each example folder there is a Makefile so you can compile the example by simply running make. The actual compiler command will be shown so you can learn about the options passed to the compiler.

There are README files on each example with explanations of the code and indications on the hardware required to test it.

The architectures included are:

  • pic14/: PIC16F microcontrollers which have a 14-bit instruction bus, hence pic14. Examples for PIC16F886, but small modifications needed to use other PICs. As of this writing, the pic14 port of SDCC is unstable and could even be considered as broken (be warned!).
  • pic16/: PIC18F microcontrollers which have a 16-bit instruction bus, hence pic16. Examples for PIC18F2550, but small modifications needed to use other PICs. As of this writing, the pic16 port of SDCC is unstable but it can be used carefully.

Requirements

To compile these examples SDCC is required. gputils is also required for PIC ports.

Installation on Linux

There are packages of both SDCC and gputils on repositories of distributions like Debian and Ubuntu. Despite being an easy way to install them, the packages are usually outdated and installing the latest stable versions is strongly recommended. These instructions are for Ubuntu 12.04 LTS, 14.04 LTS and 16.04 LTS, but the process should be very similar for other distros, hopefully just changing the dependencies installation.

Installing dependencies

Before intalling gputils and SDCC, these dependencies are needed: $ sudo apt-get install bison flex g++ libboost-dev texinfo (probably similar packages for other distros)

gputils installation

gputils needs to be compiled before installing. Needs to be installed before SDCC.

  • Go to gputils source files page
  • Download the latest stable version and extract it. Be careful not to download Release Candidate (RC) files.
  • Inside gputils-x.x.x folder, run ./configure && make && sudo make install.
  • If everything went fine, check that gpasm -v works and returns the version number you expect.

SDCC installation

Up to SDCC 3.4.0, the precompiled version of SDCC worked fine on Ubuntu 12.04 LTS and 14.04 LTS, but from 3.5.0 on, SDCC needs to be compiled because the precompiled files depend on GLIBCXX_3.4.20 which is not available on those Ubuntu versions.

  • Go to SCCC source files page.
  • Download the latest stable version and extract it. Be careful not to download Release Candidate (RC) files.
  • Inside sdcc-x.x.x folder, run ./configure && make && sudo make install.
  • If everything went fine, check that sdcc -v works and returns the version number you expect.

Installation on Windows

gputils installation

  • Go to gputils files page
  • Download the latest stable version. Be careful not to download Release Candidate (RC) files.
  • Just execute the exe file and follow the installer.
  • If everything went fine, check that gpasm -v works and returns the version number you expect.

SDCC installation

  • Go to SCCC source files page: 32-bit or 64-bit.
  • Download the latest stable version. Be careful not to download Release Candidate (RC) files.
  • Just execute the exe file and follow the installer.
  • If everything went fine, check that sdcc -v works and returns the version number you expect.

Continuous Integration (automatic tests)

This repository is tested automatically on Travis-CI using the latest 3 SDCC and latest 2 gputils releases to make sure that every example is built without errors on those SDCC and gputils combinations (SDCC and gputils are downloaded and installed on the Travis instance automatically). The generated code is not tested (e.g. simulator), but at least this makes sure that the examples can be compiled.

Other tutorials

On the SDCC Wiki you can find other tutorials that can help you.

Collaboration

Any kind of collaboration like more examples, more architectures, corrections, comments, etc. are very welcome. Feel free to open an issue or fork and pull request.

sdcc-examples's People

Contributors

diegoherranz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdcc-examples's Issues

Relocation "_cinit"

Everytime I compile the program (7 segment). I get this message
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)

I use windows 8.1 and I've installed gputils.Is this a bug or is my system causing this troble?????
screenshot 9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.