The free software that comes with the Silabs kits includes two main components: a free version of the Keil compiler, and the Silabs IDE. All the Silabs chips (well, not all, but all the C8051Fxxx) are flash based, and they can be erased and reprogrammed on the fly thousands of times. Some (all?) chips can even write to flash from within the program running in flash (for non-volatile run-time-defined parameter storage for instance), kind of like whacking oneself in the head….
In addition to these two tools, the kits also come with full documentation on the processors and the kits, and one or more configuration utilities.
Personally I had been using an early version (1985?) of the Keil compiler for a long time. It has served me well. In spite of its quirks, it has produced code that works, and as far as I can tell, it does not have bugs, other than the funky (by today's standards) DOS heritage. After a quick, short-lived experiment with a recent version of Keil (2007), I switched to SDCC (details below).
The free Keil compiler that comes with the Silabs package is crippled, in that it is limited to 1k of code or something like that, and does not contain the floating point math library (including the math library would blow the 1k limit pretty quickly anyhow). On the other hand, the Keil compiler is THE reference for the 8051.
Older Silabs packages had an older version of the Keil compiler which allowed 4k of code. Then Silabs came out with some very small chips that had less than 4k and as little as 1k of code space, and Keil found out a lot of people could create useful code with 4k or less so they had to shut that down. The current demo linker starts linking at 1k from the bottom of flash, so chips with just 1k of flash cannot be programmed with the Keil demo at all (shut that down too.) The older Keil demo that shipped a few years ago did not have that 1k guard.
I bet that when Keil realizes that some creative people can make useful applications run in 1k of code, the free demo compiler will be reduced to 512 bytes… So if you have a version of the Keil demo compiler that supports more than 1k, keep it, or move to SDCC (see below).
The most recent versions of the Silabs IDE do not even contain the Keil demo compiler, it has to be downloaded separately, directly from the Keil web site. One more reason to move directly to SDCC…
The free SDCC compiler is fully supported by the Silabs IDE, and the header files for all the Silabs chips are included with the default SDCC distribution, so download, click install and you can start coding with SDCC faster than you can say “Keil”.
SDCC does not come with a lot of documentation. Actually, come to think of it, it comes with absolutely no useful documentation. Good thing is, you mostly don't need it. If you want to learn 8051 C, go to the Keil web site and look for the C51 manuals http://www.keil.com/support/man_c51.htm. Remember, the code is the same, the library functions are the same, the only difference is the handling of SFRs, which for the most part you don't need to worry about since that's done in the headers that come with SDCC.
The Thunderbolt monitor is the first project I do with SDCC. It was painless. Overcoming the FUD around switching compiler was the hardest part.
Please note that I used SDCC version 2.6.0 for this project. As of September 2010, the most recent stable release of SDCC is 2.9.0. I have not kept track of the changes since 2.6.0, and I still use it. As a matter of personal choice, I am reluctant to automatically upgrade compilers, unless I know exactly what problem I wanted to fix and make sure it is fixed in the new version. With embedded systems, newer is definitely not always better. Some gotchas I have observed with this version are documented below. The SDCC web site still has the older versions available for download, but just for safety, you may want to keep a copy of the download file for future reinstall. If you can no longer get v2.6.0, ask me, I keep a copy around :)
The differences between Keil and SDCC are mostly in the Special Function Register declarations (the header files), so for instance, my original Keil code compiled with no modification under SDCC.
I noticed one instance where SDCC (v2.6.0 specifically) worked differently from Keil. I have written an awful lot of C programs, but I have never read K&R, so I do not know the gospel, and I could not tell who is right (which is why I said “worked differently”), but it seems to me in that instance, Keil did what was intuitively correct, while SDCC did not.
SDCC is very actively developed, so that “difference” may actually have been resolved by now. SDCC has much better warnings (actually useful, as opposed to “I have crashed, good luck figuring out why” you get from Keil).
SDCC presents the listing files (.lst extension) in a much more useful way. The assembly code is listed just below the line of C code that produced it. Keil shows the assembly at the bottom of the listing, with line number references to the C code, which is very hard to read.
Another difference is that even the Keil professional compiler ($5,000, we tried it at work) really is a set of DOS programs that reluctantly and only partially work under Windows. The Keil linker only knows about 8.3 file names and will crash if there is something like “Documents and Settings” in the path for instance. Keil creates and puts stuff in a C:\autoexec.bat file without telling you (there is no mention of it anywhere, save for a post in an on-line forum dated 2002.) That confused the heck out of us for a while, and was the straw that broke the Camel's back as far as I was concerned. Even after the Keil compiler was uninstalled using the uninstall script that came with it, the autoexec.bat file had not been cleaned up and the previous compiler (which we wanted to upgrade) was unusable until the autoexec.bat file was manually cleaned up.
On the other hand, SDCC is a true Windows command line application.
SDCC does not support float type in printf() and sprintf() statements out-of-the-box. It seems it is only a matter of recompiling the compiler with the right compile options. It can be done under gcc + cygwin under Windows. Please note that the float type is fully supported in the math library.
Because of Keil's limitation with filenames (remember that it is a DOS program), you typically cannot place your projects in your My Document folder, because the path to that folder uses names that do not follow the 8.3 convention. Therefore, when using Keil, it is usually necessary to place your project files directly from the top of the C:\ drive.
For simplicity, I initially followed the same principle with the SDCC projects, so that it would be easy to switch between SDCC and Keil if there were any need to.
Not only there has not been a need to, but I recently upgraded my main laptop to Windows 7 from Windows XP (a generally smooth upgrade if you want my opinion, even though I did like XP, and still do, as it is still running on several machines here). However, Windows 7 has been having problems with the file locations because it is a little more rigorous about keeping files where they should be, and most programs do not have write/erase permissions outside the My Documents folder, so I have moved my SDCC projects under the My Documents folder of Windows 7 and all is good. I hope that by now Keil has fixed their problem with 8.3 filenames, but I have no desire to find out, Keil is out as far as I am concerned.
This is based on SDCC version 2.6.0. By default, SDCC will be installed under C:\Program Files (x86)\SDCC.
In the Silabs IDE, go to Project→Tool Chain Integration and select tool vendor: SDCC. The default paths for the Assembler, Compiler and Linker executables are incorrect because 64-bit Windows 7 places 32-bit programs in the “Program Files (x86)” folder rather than the normal “Program Files” folder. You can therefore make the following changes:
You can leave all the command line flags at their defaults…
The Silabs IDE is a slick piece of code, which includes text editing, incremental compilation support, flash upload and real time, non-intrusive debugging via JTAG (on the larger chips) or a slick 2 wire interface (C2) on the smaller chips like the F330. Functionality of the loader/debugger is exactly the same via the JTAG or C2 interfaces.
The Silabs IDE is also very actively developed by Silabs, and new versions come up often. I recommend checking their web site often and try to keep the most current version to make sure you get support for the newest chips. However, new versions often affect previous features in a negative way. The download version of the IDE has always been named mcu_ide.exe. There is no version information in the file name. So, make sure you keep a copy of whatever version of the IDE you download by renaming it something like mcu_ide-vx.x.x.exe instead of simply deleting it after you have installed the program. Otherwise, they are all named mcu_ide.exe and a newer download will overwrite the older version. By keeping the old version, you always have the capability to go back if you need a feature that has been removed. I wish I had done that from the beginning, as I have a few development kits that are unusable because the files supporting them are not in the current IDE and I did not keep a copy of the old version.
About the hardware, Silabs has a number of JTAG/C2 adapters. The Toolstick Base adapter ($18) works with the Toolstick modules (~$10), but you can buy a ~$10 JTAG adapter that allows to use the Toolstick Base with regular JTAG interface for the larger chips that don't come on a Toolstick. This is a little clunky, but it works, I use it. They also have a regular JTAG/C2/USB adapter, and an older JTAG/C2/Serial adapter. I have all of them. They cost about $50.
Sometimes, the IDE looses track of the JTAG/C2/USB box (does not connect). This tends to happen on laptops that are plugged in and out of their docking station. That seems to confuse either the program, or Windows, or both. We do that a lot on some machines. When that happens, reinstalling the Silabs IDE (or upgrading, that's a good opportunity to do it) usually fixes the problem. You don't need to uninstall, just reinstall on top, you won't loose anything.
Update: When you install the IDE, it also installs a number of undocumented programs in the C:\Silabs\MCU\Utilities directory. The names are fairly explicit as to what these programs do, but there is not much documentation that I have found, so try those at your own risk.
If you run different versions of the IDE on different machines, and move the JTAG adapter between machines, the IDE will want to reprogram the JTAG firmware. It only takes a click and a few seconds, but if you switch machines, you really want the same IDE version on all.
The Silabs IDE comes with a tool called Configuration Wizard (sometimes it is a separate download). This slick tool will generate the setup instructions for the hardware, such as the oscillator, ports, UART, ADC, and so on. It is a little clunky, but very useful when you start a project with a brand new chip, and very useful if you are not familiar with the 8051 Special Function Registers. It allows you to get the chip setup without having to read all the manual. I said it is clunky because if you use it, you pretty much have to keep using it when you make changes, because it creates undocumented C code (does not write your configuration inputs to the file in comments, as I would have expected.) You can save the configuration file, or print it (highly recommended), and if you do, then you can find out what you did (at what frequency does the CPU run, how is the UART or ADC configured, and so on). On the other hand, if you start from a working example from the Silabs installation (which is what I did for this project), you can probably ignore the configuration wizard. You will have to get familiar with the 8051 architecture anyhow eventually. I wish Silabs would provide configuration files for the Configuration Wizard with their demo programs.
Using either Keil or SDCC, you will probably never have to learn a single line of assembly because C extensions allow you to use all the bit oriented functions. The only assembly instruction that the compiler will not generate is NOP. In-line assembly is not supported anyhow, but you could have assembly modules in a project otherwise written in C. I have done it a couple of times at the beginning because I was not sure the compiler was doing what I wanted. Keil can generate assembly (it does not by default), and SDCC always produces assembly files, so a good way to learn 8051 assembly is by looking at the output from the compiler.
Silabs also makes an Ethernet controller or two (CP2200 series). They are intended to work with their larger chips, but since they only require 18 IOs or so, they work with even smaller chips (as long as they have at least 32k of flash). When you buy one of the kits with the Ethernet kit AB4, you get a software pack that includes a “free” TCP/IP stack (made by CMX/Micronet). The Silabs package comes with a TCP/IP Configuration Wizard and is intended to work only with the Keil compiler. Using the demo Keil compiler with the TCP/IP stack is made possible because the Keil demo compiler is smart about the TCP/IP library, and even though the total code size vastly exceeds 1k, it will let you write simple programs that use the TCP/IP stack. Pretty spiffy.
However, the TCP/IP wizard and Library only work with the Keil compiler, so if you want to do anything that requires more than 1k of custom code (excluding the TCP/IP stack), you need to fork $5,000 for the Keil compiler.
Then the TCP/IP stack only comes as a library, and support from Silabs on the TCP/IP stack is minimal, so if you need any help with the TCP/IP stack, or access to the source code, or using a different compiler, you need to send a very, very large check to CMX, the amount of which depends on what option(s) you want (you want fries with that?), how many projects you want to develop and so on (this pricing strategy is generally referred to as “value pricing”), the cost will be anywhere upwards of $15,000 and usually much more.
Googling TCP/IP, CP2200 and 8051 will eventually lead you to the free Open Source uIP TCP/IP stack, which has been ported to the 8051 and CP2200. It is full featured, but this is not a ready-to-run program for the faint of heart. I have the source code and if/when I get this running with one of the Silabs chip, I will post it on this web site.
In conclusion, Silabs tools and SDCC make for a very nice platform, and if you want to do real microcontroller programming in C, this would be a very good place to start, continue and finish. Keep in mind the Silabs product line starts with the C8051F300, which has 11 pins and runs at up to 25 MHz, and goes up to the C8051F120 which has 100 pins and runs at up to 100 MHz clock. All chips run roughly 1 clock/instruction (for most single byte instructions). I am not aware of any other 8 bit processor running at 100 MIPS.