- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Introduction to DCT on 43907
Summary:
We already provided a good document for how to use DCT functions, this topic here is just to have a simple implement.
My test and description are based on 43907 board.
- What is DCT
The content was described in the document, just copy it here. The DCT stores System and Application data persistently so that the device can use the information between power cycles. The layout of the data is extremely important,and may change between SDKs.
- DCT Layout
Normal DCT area
# DCT1
NORMAL_IMAGE_DCT_1_AREA_BASE := 0x00008000 # 16k (0x00004000)
# DCT2
NORMAL_IMAGE_DCT_2_AREA_BASE := 0x0000C000 # 16k (0x00004000)
OTA2 DCT area
OTA2_IMAGE_APP_DCT_SAVE_AREA_BASE := 0x00208000 # 16k 0x00004000
OTA2_IMAGE_CURR_DCT_1_AREA_BASE := 0x0020d000 # 16k 0x00004000
OTA2_IMAGE_CURR_DCT_2_AREA_BASE := 0x00211000 # 16k 0x00004000
Talking to two DCT area:
There are two DCT areas defined in the FLASH, designated as DCT1 and DCT2. When there are changes to the DCT, we use these in a flip-flop arrangement, copying the “current” DCT to the opposite area with the changes requested, then indicating that the “new” area is the “current” area. Then we mark the “old” area as not in use. This ensures that if power is lost in any part of the update procedure, there is a viable DCT area upon power up.
Description in the function API:
* Validate and return the current DCT address
* - determine the SDK version of the DCT
* - determine which DCT is valid and most recent
* - update the DCT to DCT_BOOTLOADER_SDK_CURRENT if needed
* - return section to the current DCT address
* - if both DCTs invalid, create a valid DCT to use
Because every time we flashed the image into DCT1 area, and maybe the new image will have different sdk_ver,
so we need a check and compare flow, the logics are:
- Presume use_dct1=WICED_TRUE, then check if dct1 and dct2 area has valid sdk version.
- If two areas have same SDK version, check initial write flag.
- If dct1_sdk_version < dct2_sdk_version, make use_dct2 TRUE.
- Below code is to backup DCT info to the other area before modification.
- DCT structure
If you read our DCT document in detail, you will find below structure is implemented and modified along with the SDK release. DCT structure will be divided into three areas:
- From dct_header to dct_version, DO NOT MOVE.
- From the end of dct_version to the end of platform_dct_data_t, it is for handling additional requests.
- The area after the end of platform_dct_data_t, it should be
DCT_APP_SECTION that is used often in different applications.
wiced_result_t wiced_dct_write( const void* data, dct_section_t section, uint32_t offset, uint32_t data_length )
/*
* There are 3 parts to updating the data (other than platform_dct_header_t and platform_dct_version_t which
* are handled in the function wiced_dct_finish_new_dct() above)
* 1) Data before the (section_start + offset) of the new data
* A) Some new data is between dct_header and dct_version
* B) Some new data is between dct_version and the end of platform_dct_data_t
* C) Some new data is after platform_dct_data_t
* 2) the new data (section_start + offset) size: data_length
* A) Some new data is between dct_header and dct_version
* B) Some new data is between dct_version and the end of platform_dct_data_t
* C) Some new data is after platform_dct_data_t
* 3) Data after the (section_start + offset+ data_length) of the new data, up to the end of PLATFORM_DCT_COPY1_SIZE
* A) Some new data is between dct_header and dct_version
* B) Some new data is between dct_version and the end of platform_dct_data_t
* C) Some new data is after platform_dct_data_t
*
* The code here is generic enough to handle all three cases without having to be maintained B^)
*
*/
If you have interests, please add more logs and test if the logic can match all your requests, and check if there exist bugs, thanks.
- Two ways to be familiar with DCT usages.
One is command_console:
Add below define into the makefile of the application like apsta.mk;
Add include in the file command_console_commands.h:
Add to COMMAND table:
After compiling and download we can get the results:
The other is DCT_read_write APP:
snip.dct_read_write-CYW943907AEVAL1F-debug download download_apps
we have very detailed instructions in the released sdk also, the name is
/43xxx_Wi-Fi/doc/WICED-DCT.pdf

- Subscribe to RSS Feed
- Mark Article as New
- Mark Article as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Do you have document to increase the DCT size? 16KB is too small.

- Subscribe to RSS Feed
- Mark Article as New
- Mark Article as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Hello:
Actually, I didn't do a test to change the DCT area, I think if you didn't upgrade between different sdk releases or different product image version release, it should be ok for the test by changing the address.
and didn't find detailed document also, only get the info:
# DO NOT CHANGE THE ABOVE LOCATIONS AFTER A PRODUCT HAS SHIPPED
# DO NOT CHANGE THE ABOVE LOCATIONS FOR AN UPDATE TO ANOTHER SDK