(Using SDCC on Windows)

This chapter summarises and explains how to use the SDCC on Windows platforms.


Installing SDCC

Download our installer package .

Run the installer

The package contains

Obtaining the Particle Base System

Download the Particle Base System Snapshot. You can also obtain the sources from SVN. (Ask your local guru)

If you download the snapshot, we recommend for the first time:

Compiling a project

Compiling the demo program

We assume you want to compile the demo program and already followed the instructions above. If you renamed your folder and/or your program sources, you have to modify the Makefile in build subfolder.

Run the following commands in your MSYS shell: (assuming you are still in the same directory as above) $ cd demo/build
$ make
Then the project will be build. You will find the demo.hex in your current folder (MinGW: /c/projects/ParticleBaseSystem/demo/build, Windows: C:\projects\ParticleBaseSystem\demo\build).

Compiling your own project

To compile your project with the make tool you have to adapt the Makefile found in the build folder of the demo program with a text editor that supports UNIX line breaks.

Change the following items:

set the path to your program source (relative or absolute path, seen from your projects directory)
add other .c sources that your program needs, separated by spaces (relative or absolute paths)
set the path to the particle base system folder
set your board version
set your sensorboard or leave blank if you do not want it
enable the options that affect the stack like SDJS or ACK
enable the optional parts that do not affect the stack like RTC

Run the command $ make in the build directory to compile your project.

If you want to build the separate flash loader, enter $ make loader

If you want to remove the generated binary files, assembler files and dependency information (.d files), enter $ make clean

File structure and concepts


The Particle Base System has the following file structure:

Concepts behind the structure

The sources and dependencies follow the following principles:

The modularized Particle Base System does not need to reside in the project tree like the earlier versions. Also all binaries are located only in the build directory of the project so it is easy to "clean" from generated binaries. This enables the developer to handle base system and application separate.

You can also find two VCG files in the ParticleBaseSystem/particle/doc directory that display the dependencies. (requires xvcg or AISee)

Using MinGW and MSYS

MinGW and MSYS enriches and extens a Windows environment with many powerful GNU tools and allows us to run the SDCC which was designed on UNIX/LINUX systems by emulating such an environment.

MSYS shell vs. cmd.exe shell

There are some differences between the MSYS shell and the build-in cmd shell from Microsoft:

Important and useful commands

MSYS offers a set of feature rich command line tools. Except the shell internal commands, these tools can also be used in the cmd shell. To get information about the behaviour and valid command line parameters of a command, enter $ [command] --help

Common tools are:

changes the current working directory; nearly the same as Windows' cd, but does not allow the "shortcut" cd.. (without space between cd and ..) and calling cd without parameters does not show the current directory but changes to your home directory
copies files and directories
shows the differences between two (text) files or even whole directories
closes the current shell ([Ctrl]+[d] does the same)
find a file
searches a string or regex in a file, directory or stream
interprets Makefiles to build whole projects
moves and renames files and directories (there is no dedicated rename command)
shows the content of a file or a stream page by page; better replacement for Windows' more command (guess where the name comes from ...)
lists the content of a directory and shows file attributes; powerful replacement for Windows' dir
creates a directory
shows the absolute path of the current working directory
deletes files and directories
stream editor, allows manipulation of files and streams
packs or extracts files to/from archives