Tod has several blogs about the NetBurner on his blog site and is always adding more. A few specific entries are:
- A mocking (isolation) framework for embedded use, including a how-to screencast.
- Unit Testing on the Netburner. Including a how-to screencast.
- Ajax and the NetBurner Round 2 (a more sophisticated approach to doing AJAX)
- Setting the Build Preference to Auto save Files
- Using Galileo and the STL (Standard Template Library of C++)
- One that applies to both Visual Studio and Eclipse regarding Version Numbering
However, we highly recommend using the link above to Ajax and the NetBurner Round 2. The blog post has links to the updated source code as well as a video tutorial on using the new code. This later version was built with the Galileo version of Eclipse and the NNDK 24rc1 beta01
A screencast of an Ajax benchmark. Running the Ajax request every 100 ms.
A tip on using SQLMetal and LINQ for Sql Sever Compact Editions (SSCE) - nothing to do with NetBurner.
The following three tips use the Microsoft Media Player ActiveX control. Depending on your browser and security settings you may need to authorize the control to run. Allow some time for the videos to load.
A screencast demonstration of the new NBEclipse IDE that is used with NNDK 2.0 is available. This screencast is in .wmv format and can by played back with Windows Media Player. It is approximately 20 minutes long and takes 11 MB. The narration track volume is on the low side so turn up your volume. The screencast shows how to convert an existing DevC++, or command line Make project into a NBEclipse project. How to make a configuration file for running and debugging over TCP. It also demonstrates various features of the IDE including how to load new plug-ins. I have only played with NBEclipse for a few days but I thought the lessons I learned from converting some projects might help others.
A screencast of 9 NBEclipse tips. After having used the new IDE for a couple of weeks, I have a few tips to share. I'm now working with RC2. Approximately 14 minutes long.
A screencast on memory issues and the Eclipse IDE. More details on examining the vmargs flags for optimizing memory usage, using performance monitor to get an idea of what's going on. Approximately 5 minutes long. Note when I quit NBEclipse that the 250MB of memory is freed up, confirming that it was NBEclipse using all the memory not some other windows application.
Here is an example of how to embed multiple web pages on a single page using the <object> tag.
TIPS:
Summary:
How to disable update capability from Ethernet port.From a forum post by Paul Breed. A shutdown hook function serves two purposes, it allows you to reject an update, and it also allows you to cleanup any "active" processes before rebooting.
Usage:
#include "Autoupdate.h";
int MyShutdown()
{
return 0; /* return 0 to not allow update */
return 1; /* Return 1 to allow update */
}
Then in initialization add the following call BEFORE you call
EnableAutoUpdate()
/*PLEASE NOTE no () at the end of MyShutdown */
update_shutdown_func =MyShutdown;
You can also add a password to protect IPSETUP and Autoupdate as
well....
/* First write your test function */ int TestPassword(const char* name, const char* passwd) { if (name and password is ok)return 1; else return 0; /* Then in initialization link to the function */ update_authenticate_func = TestPassword; ipsetup_authenticate_func= TestPassword; }
Summary:
The Netburner can wait for the Maximum Segment Size(MSS) number of bytes before doing a write. If you send very small packets this may cause too much delay.From a forum post by Paul Breed. Usage: Using setsockoption you can enable send fewer than MSS bytes as a single write. With the socket (fd) returned from when you set up the communication channel do the following:
#include <tcp.h> setsockoption( int fd, SO_NONAGLE);This tells TCP to send immediately not wait for an ACK. The SO_NOPUSH option, does the opposite and tells TCP to hold off on the send until a full MSS sized packet is available. In effect setting SO_NONAGL turns SO_NOPUSH off. When SO_NOPUSH is active it will send data for the following 3 reasons:
- It has to send an ACK packet to acknowledge data coming the other way.
- The amount of data accumulated to be sent is greater than or equal to the MSS. MSS can vary but typically is 512 bytes for a distant destination or about 1460 bytes for a local connection.
- SO_NOPUSH is turned off and there is data waiting to be sent
The Problem
If you use proper <!DOCTYPE...> headers in your HTML files, Firefox (any maybe other browsers) won't load your css style sheets.You'll get an error that states the .css file has a MIME type of "text/plain" not "text/css". You can remove the DOCTYPE and the error becomes a warning and the stylesheets load. However this puts certain browsers in the wrong mode (quirks mode, comaptability mode etc) when the DOCTYPE isn't correct.
The Solution
Harald Johnsen of Eltek Energy solved this problem by modifying the source code for comphtml.exe. He has uploaded the new file to the files section of the yahoo groups. Someone from NetBurner posted and said they would fix this in 1.99. Until then you have to take three steps.
- 1. Get the new comphtml.exe (you may need to log into the Yahoo Groups first) and rename the NetBurner version (just to be safe) and put this version in the nburn/pcbin folder to replace the existing one.
- 2. UpdateNburn/include/htmlfiles.h by replacing the existing file_type enum with this one
enum file_type { eTypeText,
eTypeHtml,
eTypeJpg,
eTypeGIF,
eTypeClass,
eTypePNG,
eTypeJar,
eTypeOther,
eTypeMPEG,
eTypeCSS,
eTypeXML,
eTypeJS,
eTypeWBMP };
case eTypePNG:
SendHeader( sock, "image/png", fr->siz );
break;
case eTypeJar:
SendHeader( sock, "application/x-zip-compressed", fr->siz );
break;
case eTypeXML:
SendHeader( sock, "text/xml", fr->siz );
break;
case eTypeCSS:
SendHeader( sock, "text/css", fr->siz );
break;
case eTypeJS:
SendHeader( sock, "text/javascript", fr->siz );
break;
case eTypeWBMP:
SendHeader( sock, "image/wbmp", fr->siz );
break;
case eTypeText:
case eTypeOther:
default:
SendTextHeader( sock );
break;
Summary:
How to speed up TCP to the 14-18 MBit range by avoiding an extra copy of the data to send.From a forum post by Paul Breed.
Details:
Instead of using write or writeall to copy from your buffer to a intermediate buffer, then from there to the ethernet packet we take a short cut and write directly to the packet. We also gain by calculating the checksum as we go rather than after the fact.
Steps:.
- #define SPEED_TCP in predef.h and recompile the system files (In Eclipse use the NBEclipse menu Rebuild system files item.
- in constants.h set BUFFER_POOL_SIZE to 256 or larger. (In NNDK 2.0 this is already done)
- Establish your TCP connection in the usual way.
- Find out what the negotiated maximum segment size is... call the function WORD GetMSSData( int fd ) remember this number, if it is less than 1500 bytes, you need to change the way your are making the connection to maximize this value. I'll call this value connection_mss (Syncor note: in all our tests this came out to be 1460)
- Increase the maximum number of buffers you can queue up.
SetSocketTxBuffers( int fd, int n ); Where n should be 45
- Get a buffer to copy your data into......
PBYTE GetTcpTxBuffer() /* Returns a buffer that may use up to connection_mss in length */
- Copy up to connection_mss bytes of data into the buffer. While copying the data in keep a DWORD checksum of the copied data. This is the most critical step to maximize speed. If you can only copy DWORDS then your performance is maximized. If your block of data exists as a block of memory in an external device then you can call the function
- Submit this packet for transmit
int SubmitTcpBuffer4Tx( int fd, DWORD csum32bit, WORD length, PBYTE pBuffer )
If the function returns length then it was sent and you are done with that packet.If the function returns 0 it means the other side of the TCP connection has flow controlled off.You probably want to sleep for awhile in this case and try again. If the function returns <0 then there is an error on the socket. IF you got any return value other than the length passed in then the buffer is still your responsibility and you must free it. Do this by callingvoid FreeTcpTxBuffer( PBYTE pBuffer )
or by sleeping and trying again.
Now to send data...
DWORD memcpysum( void *to, const void *frm, int len );You will first have to declare it....
extern "C"
{
DWORD memcpysum( void *to, const void *frm, int len );
}
This function is written in assembly language to maximize speed.
See ucosmcfa.s for the source.
