Page 1 of 1

EFFS-AppUpdate example

Posted: Wed Aug 14, 2013 1:51 pm
by khoney
FYI for everyone,

The EFFS-AppUpdate example does not work for the Nano54415, and it looks like it wouldn't work for the MOD54415 either. Note that in the supplied example under EFFS->EFFS-AppUpdate, the fileup.cpp file has a flash base address definition. This definition needs to be changed for either of the 54415 platforms (see the memory maps in the docs/Platform folder).

Also note that for the Nano, if you want the flash to not update if the .s19 file has the same code as what is already installed, further modifications to the file will be necessary because the code does a memcmp comparison of flash with RAM to compare the compressed applications. This does not work on the Nano because it has SPI flash. I would expect it to work on the MOD54415 platform, though.

Hopefully, Netburner will modify this file so that it will more easily support all of their modules.

Re: EFFS-AppUpdate example

Posted: Thu Aug 15, 2013 1:05 pm
by Forrest
Hello,

This example used a hard coded flash value, which broke it when it came to the 5441X products, as they use a different flash address for the application location. I just fixed the app so that it uses a defined extern which points to the base flash address for apps regardless of the platform. Here's the diff if you want to fix your version:

Code: Select all

index ab575d2..42fb4f6 100644
--- a/examples/StandardStack/EFFS/EFFS-AppUpdate/fileup.cpp
+++ b/examples/StandardStack/EFFS/EFFS-AppUpdate/fileup.cpp
@@ -47,6 +47,7 @@
 #include "fileup.h"
 
 extern const char* PlatformName;     
+extern DWORD FlashAppBase;
 
 char fat_read_buffer[256];
 #define tmp_buffer_size (256)
@@ -112,11 +113,7 @@ struct FlashStartUpStruct
     unsigned long dwStructSum     ;
 };
 
-/* The Flash application must start at address 0xFFC08000. The code block should follow. 
- * The entire file size is guarenteed to be less than dwSrcBlockSize+24, so we can malloc 
- * that space when we start.
- */
-#define BASE_FLASH_ADDR 0xFFC08000
+
 
 
 /* This function can be used to update the application in the flash memory of a NetBurner
@@ -166,7 +163,7 @@ int UpdateFromFat( F_FILE* fp, BOOL bUpdateEvenIfCurrent )
    DWORD maxlen;
    BOOL bAlloced = FALSE;
    CopyTo = user_flash_buffer;
-   addr = BASE_FLASH_ADDR;
+   addr = (DWORD)(&FlashAppBase);
    maxlen = 8192;
    cur_pos = 0;
 
@@ -216,7 +213,7 @@ int UpdateFromFat( F_FILE* fp, BOOL bUpdateEvenIfCurrent )
    {
       if ( !bUpdateEvenIfCurrent )
       {
-         PBYTE pbis = ( BYTE* )BASE_FLASH_ADDR;
+         PBYTE pbis = ( BYTE* )(&FlashAppBase);
          PBYTE psb = CopyTo;
          if ( memcmp( pbis, psb, cur_pos ) == 0 )
          {