newcdb Silicon Labs EC2 Silicon Labs EC2 Silicon Labs EC2


  • Read / Write microprocessors Flash memory
  • Source level debugging
  • Aims to support all Silicon Labs CIP-51 core processors

Quickstart Guide

So you can't wait...

Please note I have only tested with a subset of the Silicon Labs processors and since I figured out the protocol by looking at the data on the port it may not work 100% with other devices but It should not be too hard to fix. See supported devices for a list of devices known to work and their support status. In general other devices in the same family group as a supported device should work without problems.

If you have a micro that isn't listed as tested i suggest you run ec2test-any --port=USB or ec2test-any --port=/dev/ttySx. If it all passes then you are good to go otherwise send me copy of the output and we can try and figure out what is wrong. I may need to get you to run a few tests but we should be able to solve any issues that crop up -- Ricky

If your micro passes all the tests and is not listed as tested please send me a copy of the of the ec2test-any results and I'll add it to the tested list.

Getting the correct EC2 / EC3 firmware installed

Ec2drv requires firmware within a specific range that may change between versions. If it complains that the version is incompatible you can get a new version from here. Follow the instructions here to update your debuggers firmware. The toolstick used the EC3 firmware as far as I know.

I don't think it is possible to turn the debugger into a brick by updating the firmware. I have written it to all zeros etc and it suffered no ill effects as soon as I wrote a proper version back it came back to life. For an EC3 you may have to unplug and replug the USB before replacing firmware if you load a bad image into it because the last step of the process is to run the image leaving the bootloader.

Writing to flash memory

The command line tool to do this is called ec2writeflash and it supports many options which you can list with --help.

	ec2writeflash --port=/dev/ttyS0 --hex test.ihx

This will erase only the flash sectors affected by the write. If you want to erase the entire device before writing add the --eraseall switch as below. The eraseall switch will also clear and protection bits set in the processor which is not done without the eraseall switch.

	ec2writeflash --port=/dev/ttyS0 --eraseall --hex test.ihx

You can use the eraseall switch without writing a file too to just erase the device.

	ec2writeflash --port=/dev/ttyS0 --eraseall

Binary file writing is also supported

	ec2writeflash --port=/dev/ttyS0 --start=0x0000 --len=0x200 --bin test.bin

Reading flash memory

The command line tool to do this is called ec2readflash and it supports many options which you can list with --help.

To read from flash and write to an intel hex file:

	ec2readflash --port=/dev/ttyS0 --start=0x0000 --len=0x200 --hex test.ihx

To read from flash and write to an binary file:

	ec2readflash --port=/dev/ttyS0 --start=0x0000 --len=0x200 --bin test.bin

To read from flash and dump to the console:

	ec2readflash --port=/dev/ttyS0 --start=0x0000 --len=0x200 --console

You can use the console option in conjunction with --hex or --bin if desired.

What processor is the adapter connected to?

	ec2device /dev/ttyS0


	ec2device USB

# for example:

[root@localhost ec2tools]# ec2device USB
EC3 firmware version = 0x09
device  : C8051F020
mode    : JTAG

If the above does not match your processor exactly, please contact us at :
We need your help to discover if any sub device id's exsist in the silicon

What EC3 adapters are connected to the PC

This command interogates all USB debug adaptors (EC3)'s for their serial numbers etc and printes a able of them out

[root@localhost ec2tools]# ec3adapters
List of Silicon Labs USB debug adapters found:
port            Device                  Manufacturer
USB:EC300123456 USB Debug Adapter       Silicon Laboratories
USB:EC300123457 USB Debug Adapter       Silicon Laboratories

Anywhere where you have entered USB as the device you can enter USB:EC300123456 or whatever port ec2adapters reports it found an EC3 at.
This means you can have multiple USB debug adapters in use at once.

Using newcdb with ddd

This is really beyond the scope of this quick start quide and will get its own one once it becomes mre stable. but basically enter the command

	ddd --debugger newcdb
when ddd starts up you can enter
	set target SL51
	set target port USB
	set target connect
	file test

replace test with the name of the file you want to debuf. (the .cdb file minus the extention). you can now run / step through if everything works. You can of course replace USB with a comms device if you have an EC2 instead of the EC3. Most of the instructions in the sdcc manual regarding sdcdb should be applicable to newcdb.

if you don't enter the set target lines newcdb currently defaults to using s51 the 8051 simulator. Currently s51 must be installed for newcdb to run but if you've installed sdcc then you should already have s51 installed anyway. if newcdb has errors connecting to the simulator on startup before you try changing the target( ie hangs) quit out and make sure there are no other instances of s51 running. if there are kill them and try again.