SHDesigns: Embedded Systems Design, Consulting and Developer Resources Page hits:

Softools WinIDE Tips

How to customize SofTools libraries

Softools comes with several DC libs ported to ANSI. These were built with the most common options. There may be cases that the libs may need to be modified. This howto describes various methods:

Change lib options:

If you need to make a change to one of the standard libs and the change will not effect normal use of the libs, then you can change the existing project and just rebuild the stock libs.

One example is to add HTTP_UPLOAD to the stcpip*.libs. In this case, the best change is to edit include/stcpip/dcrtcp.h. This file is included by all of the lib projects. Then open the stcpip.prj and build all models.

Add new model:

Many libs had multiple models. The TCP/IP libs have several models to include/exclude TCP, add debugging etc.

If you need a custom lib, copy one model that is close (select the model in the model dialog, hit "copy", then edit the name then click "add".) Edit the "options" on the new model and add/remove and needed defines to the C compiler options.

As an example, I took the stcpip.lib model as a base adn created a stcpip-small.lib. I added DISABLE_DNS, NO_HTTP and some other options. Then built a new custom lib. I just use that lib in projects I need to have minimal code size.

Replace one module from a lib:

Rather than building a whole new lib, sometimes it is easier to replace one module in a lib. The steps are as follows:

  1. Copy the source file to your project.
  2. Make changes needed
  3. Add the file to your project
  4. Change the linker order so the .obj for the source file is before the original lib

This source file will then replace the equivalent in the libary. Note, you will likely need to add the include directories and the defines from the original lib project (i,e for one of the network libs, add include/stcpip to the include path and USING_ETHERNET=1 define.)

Note: only a complete source file can be replaced. Copying a single function to your code will not work as the linker can not bring in part of one source and part of another.

Create new project from the lib project:

This is easy, but it has a pitfall. Copy the .prg file for the lib to a new file and rename it. Then add the needed options and build the lib. The problem with this is that it uses the same directories and output file names as the old lib. You would need to change the project to use diferent directories for the .obj and a different .lib file.

Copy the entire lib source to a separate directory:

This is best for changes that are specific to a single project. Copy the entire source/project to a subdir on a project. Build a new lib and change the output path to store locally.

An example is the port if the DC SPI.LIB. This needs to be built differently for each use as the serial port, rate, chip select pin and clock polarity will likely need to be changed.

This also has an advantage, if you install new ST libs, you will have your original modified source. It is best to keep custom libs in subdirectories of the project that needs them.

Additional Information: Rabbit Libraries Home Page - SHDesigns Home Page