CSP development requires a number of tools which are located in the "bin" directory. It is possible to run all tools from the command prompt, but this would be very inefficient. A makefile can automate the task of developing CSP pages.
Each example directory has its own makefile. Most of the makefiles are similar in the way they use tools for translating the CSP files.
All Barracuda Embedded Web Server examples send information, warning, and error messages to HttpTrace.txt when using the standard host build.
Most of the example directories contain the following subdirectories:
|make||The make directory.|
|vcMake||VC++ project files.|
|src||Common host and target Source code.|
|csp||HTML files with CSP tags.|
|All temporary data is put here, including the host/target libraries.|
In addition to the directories above, all examples include files from ../misc/standalone, which contain common startup code for the examples.
The src directory contains code that is common to both target and host. Some of the examples can be used without any modifications, but some examples require that you make small changes to the code in the src directory as the code use file system operations and standard I/O operations.
The makefiles are designed such that they can create libraries for host development and for target code. The makefiles are based on GNU make. Windows users can compile using VC++ or Cygwin. All tools required are included in the bin directory and you do not need to install Cygwin if using VC++.
You can also use the makefiles as a template when either creating a new build or extending one of the examples. The makefiles are designed such that they automatically compile all code in the "src" directory and compile all CSP files in the "csp" directory using CspCompile. The makefiles create two libraries, which you can link with your target code. You can, for example, execute the makefiles from within a target IDE or from your makefiles creating the target code.
Please note that that there are many ways to create a build structure for CSP. You can use our makefiles as a template when creating a Barracuda build structure, but you should also consider incorporating the Barracuda host tools into your own build environment. See the CSP Tools page for more information on the tools used by the makefiles.
Barracuda can run on the following host platforms:
We provide a GNU makefile which you can run from a command window for these platforms. For example, the Native Windows API is compiled from within the VC++ IDE.
Open a console window in the make directory "examples/introduction/make".
You should see the following if you type make plat=posix, and press ENTER.
The following two initial messages are printed since we have not set build=debug|release and not set io to one of the io types:
*********** Building release *********** No io. Setting default: io=ezip
The variables are optional, except for plat which must be set to one of the supported platforms. Examples:
Type the following command in the shell:
This will build the host test program using the DiskIo. The DiskIo and the NetIo are useful during development. The ZipIo is typically used for deployment.
The following command starts the demo program:
You must setup the VC++ environment before you can use any of the workspace files. The VC project files require that the VCINSTALLDIR environment variable is set.
Using the VC++ IDE is very simple; you open the workspace for VC++ .NET and build the example code from within the IDE. The workspace includes a special VC++ wrapper project for running the external makefile. Any errors generated from the external makefile show up within the environment, and you can click on the error message and the file will be loaded.
You can run the example web-server program from within the IDE when you have successfully built the example.
You can run the example program from the command prompt or from within the VC++ IDE.
The example program will not print out anything and might appear to be frozen. This is a server and nothing is printed out. Open your browser and type in http://127.0.0.1:9357 when the example program is running. The IP address 127.0.0.1 is your local loopback address. The example code is configured to use port 9357, thus the port number must also be specified in the URL.
You can set breakpoints directly in the CSP files if your compiler and debugger support the #line directive. See the CspCompiler for more information on this flag.
You build the target libraries by using the makefile in the make directory. See Using Command Line Tools for an introduction.
Please note that you must replace TINC=../../../builds/standalone/Windows/Target.mk above with the path to your target platform.
You must write some support code for your target build before you can use the Barracuda libraries and the example code.