| |
|
|
KwikNet Porting Kit for Blackfin and a Single-threaded OS |
|
Contents
Introduction
The KwikNet Sample Program
Building the KwikNet Library
Building the KwikNet Sample Program
Creating a Project from Scratch
|
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. |
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.UPis located in directoryTOOLUU\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.TCLwhich 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 fileKNMKLIB.TCLif you wish to use a different make utility. Run the script from the IDDE as shown below.Notes:
KNMKLIB.TCLrequires that environment variableTRKPATHbe set to point to your Treck installation directory.KNMKLIB.TCLcontains 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 theTOOLUU\LIBdirectory. If you edit your Network Parameter File, you must run theKNMKLIB.TCLscript again to regenerate your KwikNet Library.
The KwikNet Sample Program requires access to the
INCLUDEdirectory of your Treck installation. The VisualDSP++ IDDE project for the KwikNet Sample Program has been configured to search directoryof 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. \TRECK\INCLUDEBuild 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.
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
and that the Treck TCP/IP stack is installed in directory C:\KNT713. C:\TRECKBefore 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
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. KNSAMLIB.UP
The Network Parameter File
KNSAMLIB.UPis used to generate the Network Library Make FileKNSAMLIB.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
INCLUDEdirectory 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.
), 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 C:\KNT713\TOOLUU\MYSAMPLEin 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.DLBIP related header files; TCP, UDP sockets interface; SLIP, PPP, PING, DNS, DHCP, FTP, TFTP, Telnet, SMTP. This path must be specified. ..\LIB\KN713IPS.DLBIPsec support. ..\LIB\KN713IP6.DLBIPv6 support. \TRECK\SNMPD..\LIB\KN713SNM.DLBSimple Network Management Protocol (SNMP) agent and services. ..\TOOLUU\DRIVERSBoard 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_COMNConsole 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 symbolUSE_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
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 BLACKFIN\LDF, as a guide. KNSAMPLE.LDFKwikNet Porting Kit for Blackfin provides function
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_syscall()in module kn_iouart()provides an example of the proper use of function KNBF5XXS.C. kn_syscall()If you are not building for an ADSP-BF537 target, edit file
. Change all the C:\KNT713\TOOLUU\KNZZZCC.INCcompiler options to match your processor. -proc ADSP-BF537To build the KwikNet Library, make directory
the current directory. Run the Microsoft NMAKE utility, or your equivalent, using the KwikNet Network Library Make File generated earlier. Define symbols C:\KNT713\MAKETOOLSETandKPFto 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 KPF=..\tooluu\sam_tcp\knsamlib.upWhen generating the library for the KwikNet TCP/IP Sample Program, KwikNet Library
will be produced in directory KN713IP.DLB. C:\KNT713\TOOLUU\LIBFinally, 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