Installing SDCC on Debian or Ubuntu


This blog revision covers 3.6.9-10221 but should work for any fairly close version number.  I’m using a vanilla Debian Stretch on x86_64 architecture.

I’m specifically excluding PIC processors at this time, they have additional prerequisites and include non-free code.  I also do not cover the additional regression tests for the Z80.


sudo apt install build-essential libboost-all-dev bison flex texinfo


Go to and select a version under “SDCC Source Code (sdcc-src)”   note: the current snapshot may not be functional software and may not even build.

Or download the version I used with:

cd ~/Downloads
sdccver="20180206-10225"; wget -O sdcc.$sdccver.tar.bz2$sdccver.tar.bz2/download#

Unpack with:

tar -xvjf sdcc.$sdccver.tar.bz2


./configure --disable-pic14-port --disable-pic16-port



Check for errors in the above, it should be clean but building can sometimes go wrong.  If you find errors, run make clean, fix the problem and re-run make.


sudo make install

Check the version to make sure it’s the one you installed with:

sdcc -v

That’s it!

Stop by and visit at irc://


DIY Charging a Craftsman C3 Lithium Ion battery pack

C3 Battery
To charge DieHard / Craftsman C3 lithium-ion battery packs apply 21V across the + and – terminals. (rounded end = +, opposite = -)

C3 Connector C3 batteries come in several variations and each one has different requirements to allow charging.   Most variants will need a 22K resistor between the left terminal (when looking with the curve away from you) and the + terminal.

Be sure to use a current limited supply to avoid the possibility of damaging your pack or starting a fire should the internal protection circuit fail.

My model was a 315.PP2025 (130211023) rated 19.2V, 48watt hours purchased in mid 2016 and required the 22K resistor between the left terminal and the + terminal to charge without cutting off after 30 seconds.

22K is red red black black brown for 1% 5 band resistors, and red red orange gold for 5% 4 band resistors.

C3 Circuit For charging in the house, I’ve got a 24V 0.5A wall wart (more of a brick) power supply and an LM317 regulator in a TO220 package.  I used three 10 ohm resistors in parallel to spread the heat out so that I could use 1/4 watt resistors without getting them too hot.  (The LM317 will get too hot to touch, be careful.)  The circuit is to the left and limits current to 375mA which, for my 48W pack, is a nice gentle 6 hours charge from empty and generates no heat in the pack that my IR thermometer can detect.  The LM317 will go up to 1.5A with a big heat sink and seven 5.6 ohm 1/4 watt resistors in parallel, but be careful to not charge packs that are below 5V at this high rate.  The 1.5A charger will fill the big 48W pack in 1 hour 40 minutes.

The 375mA charge rate is safe for even deeply discharged batteries that won’t charge in the Craftsman charger.