NetBurner 3.5.0
PDF Version |
|
As an alternative to NBEclipse, you can use the command line tools to build your NetBurner projects. In fact, all the example programs are built and tested internally with command line tools. You will find a makefile in each example folder, so any of the examples can be used as a demonstration of how to use command line tools. Windows, Mac and Linux are supported. The command line tools can also be used to invoke the NetBurner tools from the development environment of your choice.
Command | Description |
---|---|
make | Build a project using the makefile in the project directory |
make -j | Make using multiple cores to speed up the process |
make load | Build project and load into device |
make -j load | Build project with multiple cores and load into device |
make clean | Delete a project's libraries and object files |
There are a number of environment variables that can be set to effect the command line build when you do a make. For example, you can specify the target device IP address in which to download the application with a make -j load.
On the command line, typing "set <variable>" will display the current value. Typing "set <variable>=<value>" will set the environment variable. For example, "set DEVIP" will display the current target IP address. Typing "set DEVIP=10.1.1.1" will set DEVIP to the specified IP address.
Command | Description |
---|---|
DEVIP | Causes a make with the "load" parameter to download to the specified IP address |
PLATFORM | Specifies the NetBurner platform to build for |
NNDK_ROOT | Specifies the location of your NetBurner development tools installation |
TOOLCHAINPATH | Specifies the location of the GCC tools path, such as the compiler |
For example, to reference a standard NetBurner tools installation (also see "\nburn\setenv.bat" for an example):
The easiest way to create a new project is to copy an existing one and modify it:
\NetBurner\Projects
\nburn\examples\web\SimpleHtml
\NetBurner\Projects\HelloWorld\obj\release\SimpleHtml.bin
(and also .s19 for SREC platforms). There are many files and folders under the obj folder, including the compiled libraries and object files.
We named our project HelloWorld, but are running SimpleHtml at this point. To customize the project:
The example makefile is shown below:
Changing the NAME from SimpleHtml to HelloWorld will create the image file as HelloWorld.bin (and .s19)
The CPP_SRC is a list of all .cpp files to build. In this case there is only one, but if there were more it would look like:
If you have .c source files you can add them with C_SRC in the same manor.
The html related lines auto-generate a cpp file from the code in the project's html directory.
The final line calls the boilerplate makefile which includes the platform specific make instructions. While you can drill down into the details, this type of makefile structure makes creating projects much easier since you only need to list the source files of your project.
A fully functional application with the web server enables is actually very few lines of code:
This example just initializes the system, starts the web server, prints out some information, and loops forever with a 1 second delay. Changing the AppName to HelloWorld will change the name that shows up in the find and configuration utilities.
There can be instances in which you need to modify a NetBurner system file. This is accomplished using the Oveload feature. NBEclipse creates an overload folder automatically, but with command line it must be created manually.
\nburn\examples\Overload
Adding an overload folder to our HelloWorld project:
Once you know which file you want to overload, the path in the overload folder must exactly match the system file path. For example, if we want to overload the predef.h include file located in the \nburn\nbrtos\include
folder:
Now the project's predef.h will be used along with any changes made to it.
These are unique and powerful files used to change base-level system options. We recommend overloading items in here sparingly and using predef-overload.h
whenever possible since the predef.h
file changes between NNDK releases and it can be hard to track what overloads you need to keep when they're all mixed together with the defaults.
So, just follow the above directions using a blank predef-overload.h
file containing only the predef constants you want to change.
If a system include folder is overloaded, this folder should be added to your project include paths. Right click on the project and select project properties. Under C/C++ Build->Settings, select GNU C++ Compiler->Includes and add the overload include folder. If utilizing C code, then GNU C Compiler->Includes should also be added.
To load an application and start GDB from the command line:
make loaddebug -j
.arm-eabi-gdb -se obj/debug/<elf.file>
m68k-elf-gdb -se obj/debug/<elf.file>
target remote <ipaddress>:2159
To end the GDB session and leave the target running use detach
. To end the GDB session use quit
. The GDB command reference is located here: http://www.gnu.org/software/gdb/documentation/.
An GDB session running the SimpleHtml example on a MOD54417 is shown below. The example has been modified to add some variables that do simple counting.
Load the application. Note that the DEVIP environment variable is set to the device's IP address 10.1.1.169. The application will begin execution and wait for GDB to connect.
Start GDB:
Connect to the MOD54417 target on port 2159. This will pause the application at whatever line of code it happens to be on. For simple examples that will typically be the NBRTOS idle task.
At this point you can do whatever type of GDB commands you wish. To set a break point at the i++;
at line 29 of main.cpp and use the continue
command to executee until the break point is reached:
The list
command can be used to view the source code around the breakpoint:
Use next
to go to the next line without stepping into a function (the step
command steps into a function). GDB commands can typically use just the first letter, in this case n
:
To make changes to your code use the detach
command do that the application can resume and will be ready for your next code download:
To exit GDB, use the quit
command:
To get line numbers and function names from trap memory addresses, you can use addr2line on the command line like this:
addr2line -ifCe Release/YourProject.elf 00001111 11112222
Replace "addr2line" with the path to the appropriate program below, and replace the numbers with memory addresses you want to find.
For ColdFire based platforms, use m68k-elf-addr2line
. This is distributed in the \nburn\gcc\bin\
folder.
For ARM-based platforms, use arm-unknown-eabi-addr2line
. This is distributed in the \nburn\gcc\bin\
folder.