Using TCPUpdate - Update a device behind a firewall

Post your example source code and application notes to share with others
Post Reply
User avatar
Forrest
Posts: 283
Joined: Wed Apr 23, 2008 10:05 am

Using TCPUpdate - Update a device behind a firewall

Post by Forrest »

NetBurner TCPUpdate Application Note
How to update a NetBurner device that is behind a firewall



TCPUpdate Overview

TCPUpdate is a NetBurner utility that allows you to update a NetBurner device across a network connection. It can be used to update a device on your network, behind a corporate network firewall, and over the Internet. If you are familiar with the Autoupdate utility, then you are already ready to use TCPUpdate.

TCPUpdate works by creating an additional task that your application will be running. This task will monitor the network traffic for an incoming connection on port 20034. The task should run at a lower priority then your UserMain, and should not add much overhead.

Running TCPUpdate

NetBurner Code

The first step is to add the ability to accept incoming TCPUpdate transmissions to your application. You will need to add an include file that allows you to call the TCPUpdate function initialization. In the include section, ensure that the following code exists:

Code: Select all

	#include <autoupdate.h>
If you are already using AutoUpdate, that code will already be in place. Next, add the StartTcpUpdate(int priority) function into your UserMain initialization section. Your init section should now look something like:

Code: Select all

 	InitializeStack();
	if (EthernetIP == 0)
		GetDHCPAddress();
	OSChangePrio(MAIN_PRIO);
	EnableAutoUpdate();
   StartTcpUpdate(MAIN_PRIO-3);
	StartHTTP();



When setting the priority that StartTcpUpdate should run at, ensure that you do not have any other tasks running at that same priority. These priority numbers is flexible, but ensure that it is a higher priority then any user tasks that do not include UCOS blocking functions. Be aware that you must update your NetBurner device locally, through AutoUpdate (local network) or MTTTY (serial) before you will be able to use TCPUpdate the first time.

Firewall Settings

If the NetBurner device is located behind a firewall, you may need to set up port forwarding on the firewall to your device. On your firewall, turn on port forwarding. Set it up so that all traffic on port 20034 is forwarded to port 20034 on the local IP address of the NetBurner device. If you are unsure of how to do this on your firewall, or do not have administrative rights to make these changes, ask the person who set up the firewall to make these changes for you.

Run TCPUpdate

Now that the device is running the TCPUpdate enabled code, and your firewall settings are established, you can now update the device with the TCPUpdate utility. Navigate to C:\Nburn\pcbin and run the TCPUpdate application. Input your device’s IP address, and check the “Reboot when complete” option.

You will now need to input your new application code. If you are using NBEclipse to develop your application, then your application file will be located in c:\nburn\nbeclipse\workspace\<PROJECT_NAME>. In this folder you may find a Release folder and a Debug folder. The standard build is under the Release folder. Find the <PROJECT_NAME>_app.s19 file and select it. This is the application that will be loaded on the board.

Once all options are filled in, click the update button to reprogram your NetBurner module. The board will accept the code, reboot, and load the new application into flash.
Forrest Stanley
Project Engineer
NetBurner, Inc

NetBurner Learn Articles: http://www.netburner.com/learn
Post Reply