KwikNet Porting Kit for Blackfin
and a Single-threaded OS


 The KwikNet Sample Program
 Building the KwikNet Library
 Building the KwikNet Sample Program
 Creating a Project from Scratch


To use KwikNet with the Analog Devices, Inc. VisualDSP++ IDDE there are a number project settings which must be made. These include, but are not limited to, header file include paths, library search paths and Link Description File options.

KwikNet Porting Kit for Blackfin includes VisualDSP++ 4.0 project files configured for an ADSP-BF537 processor. You can easily build and run any of the KwikNet Sample Programs for a target like the ADSP-BF537 EZ-KIT Lite. If you are using a prior version of the VisualDSP++ tools or if your target processor is not an ADSP-BF537, please refer to Creating a Project from Scratch.

As a prerequisite, you must install both KwikNet and the Treck TCP/IP stack before proceeding. Prior to launching the IDDE, you must set environment variable TRKPATH to contain the location of your Treck installation directory. The prebuilt KwikNet Sample Program project files have been configured with the Treck files installed in directory \TRECK on the same drive as the KwikNet installation. If your Treck files are installed in a different location, you will have to modify the prebuilt sample projects or create your own projects.

The KwikNet TCP/IP Sample Program in installation directory ...\KNT713\TOOLUU\SAM_TCP will serve as a good starting point when you are ready to create your own project. Note that the project provided by KADAK uses relative file and directory paths so that as long as the KwikNet directory structure is retained, the project directory SAM_TCP can be easily duplicated (and presumably renamed) within subdirectory TOOLUU.

 The KwikNet Sample Program

A VisualDSP++ project for the KwikNet TCP/IP Sample Program is installed in your KwikNet installation directory. If you have installed KwikNet in directory C:\KNT713, the KwikNet TCP/IP Sample Program project file will be C:\KNT713\TOOLUU\SAM_TCP\KNSAMPLE.DPJ. Assuming that you have already installed VisualDSP++ 4.0, KwikNet Porting Kit for Blackfin and the Treck TCP/IP stack, begin by launching the VisualDSP++ IDDE.

Make sure that you have selected an ADSP-BF537 target as your debug target and platform as shown below.



Open the project file for the KwikNet Sample Program as shown below.



The project consists of the following files:

KN_BOARD.C KwikNet board support for Blackfin boards
KNCONSOL.C KwikNet console I/O services
KNRECORD.C KwikNet message logging services
KNSAMOS.C KwikNet Sample Program OS interface for Blackfin processors with no OS
KNBF5XXS.C Blackfin ADSP-BF5xx UART I/O support
KNBF5XXT.C Blackfin ADSP-BF5xx Core Timer Clock support
KNSAMPLE.C TCP/IP client/server sample program
KNSAMPLE.LDF Link Description File
The size and location of all memory segments have been specified to accommodate the memory requirements of the KwikNet sample programs.

 Building the KwikNet Library

Prior to building the KwikNet TCP/IP Sample Program, you must build the KwikNet Library. The library and the features to be included in it are specified in the KwikNet Network Parameter File which you can edit using the KwikNet Configuration Manager. The TCP/IP Sample Program Network Parameter File KNSAMLIB.UP is located in directory TOOLUU\SAM_TCP.

A make file is used to build the KwikNet Library. The make file is generated from the KwikNet Network Parameter File. To allow the KwikNet Library to be built without having to leave the IDDE environment, KADAK has provided script file KNMKLIB.TCL which resides in the same directory as the VisualDSP++ project file. The script generates the make file and invokes the Microsoft NMAKE utility to use it to build the KwikNet Library. You will have to modify the script file KNMKLIB.TCL if you wish to use a different make utility. Run the script from the IDDE as shown below.


  • KNMKLIB.TCL requires that environment variable TRKPATH be set to point to your Treck installation directory.
  • KNMKLIB.TCL contains relative file path information. The script may need to be modified if it is not run from one of the KwikNet Sample Program directories.
  • To build the KwikNet Library without using the script, read the section below, Creating a Project from Scratch.



When the script for the TCP/IP Sample Program completes, there will be one library file, KN713IP.DLB, in the TOOLUU\LIB directory. If you edit your Network Parameter File, you must run the KNMKLIB.TCL script again to regenerate your KwikNet Library.

 Building the KwikNet Sample Program

The KwikNet Sample Program requires access to the INCLUDE directory of your Treck installation. The VisualDSP++ IDDE project for the KwikNet Sample Program has been configured to search directory \TRECK\INCLUDE of the current drive for the required header files. If your Treck installation is on a different drive or has a different path, you will have to adjust the include path setting of the KwikNet Sample Program project before building the sample.

Build the sample program as shown below. A notification message may pop up indicating that the project settings have changed. To acknowledge the message, if and when it pops up, click on the Yes button. The output window will display progress messages as the various sample program modules are compiled, assembled and linked. The output window will appear as illustrated below once the sample program has been successfully built.




The program may or may not be automatically loaded by the simulator, depending on your VisualDSP++ preference settings.

 Creating a Project from Scratch

To create a VisualDSP++ project to use KwikNet, proceed as described in this section. It is recommended that you start with an existing project such as that used to build the KwikNet TCP/IP Sample Program. It will be assumed, for purposes of illustration, that the KwikNet Porting Kit for Blackfin is installed in directory C:\KNT713 and that the Treck TCP/IP stack is installed in directory C:\TRECK.

Before creating your VisualDSP++ project, use the KwikNet Configuration Builder to create your KwikNet Network Parameter File as described in Chapter 2 of the KwikNet TCP/IP Stack User's Guide. Alternatively, use the builder to edit the Network Parameter File KNSAMLIB.UP provided with the KwikNet TCP/IP Sample Program. If you are creating a new Network Parameter File, be sure to select the Blackfin ADSP-BF5xx target and the Blackfin single threaded OS operating system as shown in the following snapshots. Selecting KwikNet Simple Heap as the Memory Allocation scheme will direct KwikNet to allocate memory from a fixed size region of memory instead of using calls to the C runtime library. Refer to the KwikNet TCP/IP Stack User's Guide for the memory allocation requirements of KwikNet.



The Network Parameter File KNSAMLIB.UP is used to generate the Network Library Make File KNSAMLIB.MAK. If your Network Parameter File changes, you must regenerate the Network Library Make File, rebuild the KwikNet Library and rebuild your application.

Create a new project as shown below.




Open the Project Options window as shown below. Specify your target processor (in this case, the ADSP-BF537) and enter the path to the INCLUDE directory of your Treck installation. If necessary, specify directory paths for other KwikNet options used by your application.




The following table outlines the locations of the various header files relative to the installation directory. If you are creating your project in a subdirectory of the KwikNet installation directory (e.g. C:\KNT713\TOOLUU\MYSAMPLE), it is best to specify paths relative to the project directory. By doing so, the entire KwikNet installation directory can be copied or moved to another directory without having to revise all of the path information in the project settings. You may also need to specify the current working directory "." in your list of includes. The table below also lists the KwikNet runtime libraries which must be added to your link options if the indicated services are used by your application.

Directory Library Services
\TRECK\INCLUDE ..\LIB\KN713IP.DLB IP related header files; TCP, UDP sockets interface; SLIP, PPP, PING, DNS, DHCP, FTP, TFTP, Telnet, SMTP. This path must be specified.
..\LIB\KN713IPS.DLB IPsec support.
..\LIB\KN713IP6.DLB IPv6 support.
\TRECK\SNMPD ..\LIB\KN713SNM.DLB Simple Network Management Protocol (SNMP) agent and services.
..\TOOLUU\DRIVERS   Board and device driver definitions. Must be included to use any of the standard KwikNet board support modules or Ethernet or serial device drivers.
..\TOOLUU\SAM_COMN   Console and sample program O/S interface. Not needed if you have created your own equivalents.

Link options must also be entered. From the table above, determine which KwikNet runtime libraries your application will require and specify the library names in the Additional options field. All KwikNet sample programs are designed to execute from SDRAM. Define linker symbol USE_SDRAM, as shown, to permit the Link Discription File to locate code and data in SDRAM. You may also wish to enable the Generate symbol map option to aid in the positioning and sizing of memory sections. Note that the L1 Memory Usage has been configured for Cache.




To guard against the possibility of invalid address faults caused by speculative load execution, set the CSYNC compiler option as shown below.


Now, add the necessary KwikNet source files (or your equivalents) to the project as shown below.



When you create a project from scratch, the VisualDSP++ IDDE will select one of the default Link Description Files from directory BLACKFIN\LDF in your VisualDSP++ installation directory. The heap storage provided by the default Link Description Files may not be sufficient for your application. Use one of the KwikNet sample Link Description Files, like KNSAMPLE.LDF, as a guide.

KwikNet Porting Kit for Blackfin provides function kn_syscall() which permits a function coded in C to execute in supervisor mode in order to perform privileged I/O operations. The function generates a software exception which causes the switch to supervisor mode. The application C function is called with the two parameters provided by the kn_syscall() caller. Function kn_iouart() in module KNBF5XXS.C provides an example of the proper use of function kn_syscall().

If you are not building for an ADSP-BF537 target, edit file C:\KNT713\TOOLUU\KNZZZCC.INC. Change all the -proc ADSP-BF537 compiler options to match your processor.

To build the KwikNet Library, make directory C:\KNT713\MAKE the current directory. Run the Microsoft NMAKE utility, or your equivalent, using the KwikNet Network Library Make File generated earlier. Define symbols TOOLSET and KPF to identify the Analog Devices toolset mnemonic (AD) and provide the path to the KwikNet Network Parameter File.

          NMAKE /f..\tooluu\sam_tcp\knsamlib.mak TOOLSET=UU TRKPATH=C:\treck

When generating the library for the KwikNet TCP/IP Sample Program, KwikNet Library KN713IP.DLB will be produced in directory C:\KNT713\TOOLUU\LIB.

Finally, build your application as described in the section titled Building the KwikNet Sample Program.

Top of page

Copyright © 2005
KADAK Products Ltd.
All rights reserved.
Last updated: September 15, 2005