Upload firmware via TCP/IP


I’m trying to figure out how to upload my image.bin file through a TCP/IP connection. I’m far enough along I can receive files & save them in the file system. I just don’t know where to save the firmware file to make my board boot from it. Can anyone point me in the right direction?

Digi ESP for NET+OS
Version: 1.3.0
Build id: 10192007 NET+OS 7.3
ConnectCore 9P 9215

Have a look round the src/bsp/fsintf directory, especially fwdl.c.

That file handles FTP uploads, including image updates, so should give you a convenient entry point. (Think it was there in 7.3)

Thanks, but I can’t find that directory or that file. I’m looking in c:
etos73 and in my project directory. Is there somewhere else I should try?

The directory src\bsp\fsintf was not introduced until NET+OS V7.4, so you are unlikely to find it in V7.3.

More important question, are you developing through Digi ESP (the IDE) or through the GNU command line interface. The answer to this will help me tell you where you should be looking.

I’m using Digi ESP.

Look in the following directory in your installation tree:

look for file ftpsvrfs.c

Within ftpsvrfs.c look for function FSStoreImageToFlash(). This the code that the ftp server uses to store images to FLASH. Hopefully what is done therein will help you.

When I call FSStoreImageToFlash (pData, lLen, “image.bin”, 0) it returns NAFTPS_SUCCESS.

Is there anything special I have to do after that? I was under the impression the next time I powered up the board, it would load the firmware I just saved automatically. It isn’t. What am I missing?


With NetOS 7.4 and digi ESP I have found the simplest method to use is to base your project on the standard Digi code.

If you simply do File/New/NetOS Project, and follow the Wizard ensuring that you include the Web server and the FTP server, you will get an outline project that supports Firmware upload of both image.bin (for the main application), and rom.bin (for the bootloader). This upload works on bot FTP or you can use a web browser to do it via HTTP.

Once you have got this working correctly you can then pull your existing code into the project. This is the simplest way to do it and all the had work is done for you unless you want to do anything really special.

Alternatively you could just build a project in this manner and then review exactly how it works to get some ideas of where you have problems with the code you are currently using.

There is also a little application the allows you to merge the rom.bin and image.bin into a sigle upload that will update both the bootloader and the application at the same time. This is very usefull if you want to load the application at a non standard address.