Application DCT changes on reset

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
NaFi_2915566
Level 3
Level 3
First like received First like given

I defined a structure within our application DCT and increased DCT size accordingly.

There are no write commands for the application DCT area.

I added multiple lock/read/print/unlock cycles to make it is not an unlock

Problem:

  • the DCT contents are loaded correctly when I load the code via JTAG but some parts are changed after a reset. 
  • the changed values are always changed to the same values,which points to another part of the code overwriting application DCT
  • we have code that writes to DCT_WIFI_CONFIG_SECTION to update wifi credentials

Questions:

  1. are there any other changes needed besides updating dct.ld?  Based on where the the overwrite is happening, it s past the old DCT.
  2. read_lock / read_unlock should not change the contents, right?

dct.ld increased from 16k to 64k:

MEMORY

{

/*    DCT1_FLASH                 (rx)  : ORIGIN = 0x0, LENGTH = 16K */

    DCT1_FLASH                 (rx)  : ORIGIN = 0x0, LENGTH = 64K

}

application_dct.h (some names are obscured)

#define DCT_SCHEMA_VERSION     1

#define DCT_CONFIG_FILE_SIZE   (20*1024)

#define DCT_WIFI_FILE_SIZE     (2*1024)

pragma pack (1)

typedef struct

{

   //overall content

   uint32_t schemaVersion;                       // BUILD

   uint32_t dummyTop[7];                         // FFS

  

   // configuration.json

   uint32_t configJsonSize;                      // redundant size of string

   uint32_t dummyConfigJson[7];                  // FFS

   char     configJsonStr[DCT_CONFIG_FILE_SIZE]; // BUILD

  

   // wifi.json

   uint32_t wifiJsonSize;                        // redundant size of string

   uint32_t dummyWifiJson[7];                    // FFS

   char     wifiJsonStr[DCT_WIFI_FILE_SIZE];     // BUILD

} ...Dct_t;

#pragma pack ()

} ...Dct_t;

#pragma pack ()

application_dct.c

DEFINE_APP_DCT(...Dct_t)

{

   .schemaVersion   = DCT_SCHEMA_VERSION,

   .dummyTop        = {0,1,2,3,4,5,6},

   .configJsonSize  = 6,

   .dummyConfigJson = {0,7,8,9,0xA,0xB,0xC},

   .configJsonStr   = "config",

   .wifiJsonSize    = 4,

   .dummyWifiJson   = {0,0xD,0xE,0xF,1,2,3},

   .wifiJsonStr     = "wifi"

};

application

   ...Dct_t *...Dct=NULL;

during startup,the application runs the following code three times

   // First check DCT to see if it has a valid file

   wResult = wiced_dct_read_lock( (void**) &...Dct, WICED_TRUE, DCT_APP_SECTION, 0, sizeof( ...Dct_t ) );

   if ( wResult == WICED_SUCCESS)

   {

         WPRINT_APP_DEBUG( ( "APP DCT\n" ) );

         WPRINT_APP_DEBUG( ( " schemaVersion   : %lu\n",datablizzard2Dct->schemaVersion ) );

         DEBUG_HEX_DUMP    ( " dummyTop        :",datablizzard2Dct->dummyTop,7);

         WPRINT_APP_DEBUG( ( " configJsonSize  : %lu\n",datablizzard2Dct->configJsonSize ) );

         DEBUG_HEX_DUMP    ( " dummyConfigJson :",datablizzard2Dct->dummyConfigJson,7);

         WPRINT_APP_DEBUG( ( " configJsonStr   : %.10s\n",datablizzard2Dct->configJsonStr ) );

         WPRINT_APP_DEBUG( ( " wifiJsonSize    : %lu\n",datablizzard2Dct->wifiJsonSize ) );

         DEBUG_HEX_DUMP    ( " dummyWifiJson   :",datablizzard2Dct->dummyWifiJson,7);

         WPRINT_APP_DEBUG( ( " wifiJsonStr     : %.10s\n",datablizzard2Dct->wifiJsonStr ) );

      // done with DCT, close it

      wResult = wiced_dct_read_unlock( ...Dct, WICED_TRUE );

      if ( wResult != WICED_SUCCESS)

      {

         WPRINT_APP_ERROR( ( "%s wiced_dct_read_unlock failed: %u\n", __FUNCTION__, wResult) );

      }

      else

      {

         WPRINT_APP_DEBUG( ( "%s wiced_dct_read_unlock done\n", __FUNCTION__) );

      }        

   }  

the attached log file shows the correct DCT being printed 3 times.

then following a reset, some of the values are changed.

0 Likes
1 Solution
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

To increase the DCT, 3 files need to be modified,

1. In the DCT.ld (/43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/GCC/dct.ld) where the DCT1_FLASH LENGTH needs to be modified based on the required length.

2. In the waf_platform.h (/43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/WAF/waf_platform.h) file where the PLATFORM_DCT_COPY1_SIZE needs to be modified

3. The memory address bases need to be modified according to the memory requirement in either normal_image_defines.mk(/43xxx_Wi-Fi/platforms/CYW943907AEVAL1F/) or the OTA2_image_defines.mk based on the ota2 or production use-case.

View solution in original post

3 Replies