How the DCT.bin file is mode

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

cross mob
Anonymous
Not applicable

Hi All:

     When the target of waf_bootloader-NoOS-NoNS-BCM943362WCD4-SDIO has been made, the DCT.bin file has been made in the same time. But I can'n find the resource files are related to DCT.bin.

0 Likes
1 Solution

Hi Rodger,

DCT is Device Configuration Table, used to store configuration, like AP list (SSID, password), or custom (application) settings.

dct.bin is an intialized image of DCT, to store the default value of some configuration.

The dct.bin is built from two source files:

        1. System's DCT

              dct.c (WICED-SDK\WICED\internal)

        2. Application's DCT

              You can specify its source file in application's makefile by variable "APPLICATION_DCT".

              (You can refere to "temp_control.mk(WICED-SDK\apps\demo\temp_control)" about how to config "APPLICATION_DCT").

For more details, you can check it in makefile. Below is a simple introducation of the build flow.

==============================================================================

1. Makefile (c:\users\mudel\wiced\wiced-sdk-mfi-3.1.2\wiced-sdk)
...
$(BUILD_STRING😞 main_app $(if $(SFLASH),sflash_image) copy_elf_for_eclipse
...
main_app: build/$(CLEANED_BUILD_STRING)/config.mk $(WICED_SDK_PRE_APP_BUILDS) $(MAKEFILES_PATH)/wiced_elf.mk $(if $(SUB_BUILD),,.gdbinit)
$(QUIET)$(COMMON_TOOLS_PATH)mkdir -p $(OUTPUT_DIR)/binary $(OUTPUT_DIR)/modules $(OUTPUT_DIR)/libraries $(OUTPUT_DIR)/resources
$(QUIET)$(MAKE) -r $(JOBSNO) $(SILENT) -f $(MAKEFILES_PATH)/wiced_elf.mk $(DIR_BUILD_STRING) $(PASSDOWN_TARGETS)
$(QUIET)$(ECHO) Build complete
...

2. Wiced_elf.mk (c:\users\mudel\wiced\wiced-sdk-mfi-3.1.2\wiced-sdk\tools\makefiles)
...

LINK_DCT_FILE             := $(OUTPUT_DIR)/DCT$(LINK_OUTPUT_SUFFIX)

...

FINAL_DCT_FILE            :=$(LINK_DCT_FILE:$(LINK_OUTPUT_SUFFIX)=$(FINAL_OUTPUT_SUFFIX))

...
$(LINK_DCT_FILE😞 $(OUTPUT_DIR)/generated_security_dct.h $(WICED_SDK_DCT_LINK_SCRIPT) $(SOURCE_ROOT)WICED/internal/dct.c $(WICED_SDK_APPLICATION_DCT) $(WICED_SDK_WIFI_CONFIG_DCT_H) $(WICED_SDK_BT_CONFIG_DCT_H) $(CONFIG_FILE) | $(PLATFORM_PRE_BUILD_TARGETS)
$(QUIET)$(ECHO) Making DCT image
$(QUIET)$(CC) $(CPU_CFLAGS) $(COMPILER_SPECIFIC_COMP_ONLY_FLAG)  $(SOURCE_ROOT)WICED/internal/dct.c $(WICED_SDK_DEFINES) $(WICED_SDK_INCLUDES) $(COMPILER_SPECIFIC_DEBUG_CFLAGS)  $(call ADD_COMPILER_SPECIFIC_STANDARD_CFLAGS, ) -I$(OUTPUT_DIR) -I$(SOURCE_ROOT). -o $(OUTPUT_DIR)/internal_dct.o $(COMPILER_SPECIFIC_STDOUT_REDIRECT)
$(if $(WICED_SDK_APPLICATION_DCT),$(QUIET)$(CC) $(CPU_CFLAGS) $(COMPILER_SPECIFIC_COMP_ONLY_FLAG)  $(WICED_SDK_APPLICATION_DCT) $(WICED_SDK_DEFINES) $(WICED_SDK_INCLUDES) $(COMPILER_SPECIFIC_DEBUG_CFLAGS)  $(call ADD_COMPILER_SPECIFIC_STANDARD_CFLAGS, ) -I$(OUTPUT_DIR) -I$(SOURCE_ROOT). -o $(OUTPUT_DIR)/app_dct.o)
$(QUIET)$(LINKER) $(WICED_SDK_LDFLAGS) $(WICED_SDK_DCT_LINK_CMD) $(call COMPILER_SPECIFIC_LINK_MAP,$(MAP_DCT_FILE)) -o $@  $(OUTPUT_DIR)/internal_dct.o $(if $(WICED_SDK_APPLICATION_DCT),$(OUTPUT_DIR)/app_dct.o)  $(COMPILER_SPECIFIC_STDOUT_REDIRECT)

$(STRIPPED_LINK_DCT_FILE😞 $(LINK_DCT_FILE)
$(QUIET)$(STRIP) -o $@ $(STRIPFLAGS) $<

$(FINAL_DCT_FILE😞 $(STRIPPED_LINK_DCT_FILE)
$(QUIET)$(OBJCOPY) -O binary -R .eh_frame -R .init -R .fini -R .comment -R .ARM.attributes $< $@

...

3. Wiced_config.mk (c:\users\mudel\wiced\wiced-sdk-mfi-3.1.2\wiced-sdk\tools\makefiles)
...
WICED_SDK_DCT_LINK_SCRIPT    +=$(if $(DCT_LINK_SCRIPT),$(addprefix $($(NAME)_LOCATION),$(DCT_LINK_SCRIPT)),)
...

WICED_SDK_APPLICATION_DCT    +=$(if $(APPLICATION_DCT),$(addprefix $($(NAME)_LOCATION),$(APPLICATION_DCT)),)

...
$(CONFIG_FILE): $(WICED_SDK_MAKEFILES) | $(CONFIG_FILE_DIR)
...
$(QUIET)$(call WRITE_FILE_APPEND, $(CONFIG_FILE) ,WICED_SDK_DCT_LINK_CMD        += $(strip $(addprefix $(COMPILER_SPECIFIC_LINK_SCRIPT_DEFINE_OPTION) ,$(WICED_SDK_DCT_LINK_SCRIPT))))
...
...

4.  Memory mapping (It is also indicated which memory location this image will load/download in memory.) is specified in the linker script.
    It is MCU specified. For example:
A>  STM32F4xx.mk (c:\users\mudel\wiced\wiced-sdk-mfi-3.1.2\wiced-sdk\wiced\platform\mcu\stm32f4xx)
...
DCT_LINK_SCRIPT += $(TOOLCHAIN_NAME)/$(HOST_MCU_VARIANT)/dct$(LINK_SCRIPT_SUFFIX)
...

B>  The linker script is "dct.ld(WICED-SDK\WICED\platform\MCU\STM32F4xx\GCC\STM32F415)".

View solution in original post

12 Replies
Anonymous
Not applicable

most of the resources are fournd in resources/* folders.

0 Likes
Anonymous
Not applicable

Thanks for your help. There are tow folders,One is C:\Users\Rodger_zeng\Documents\WICED\WICED-SDK-2.4.1\WICED-SDK\Resources , the other is C:\Users\Rodger_zeng\Documents\WICED\WICED-SDK-2.4.1\WICED-SDK\build\waf_bootloader-NoOS-NoNS-BCM943362WCD4-SDIO\Resources. I didn't find related resources.

0 Likes

Hi Rodger,

DCT is Device Configuration Table, used to store configuration, like AP list (SSID, password), or custom (application) settings.

dct.bin is an intialized image of DCT, to store the default value of some configuration.

The dct.bin is built from two source files:

        1. System's DCT

              dct.c (WICED-SDK\WICED\internal)

        2. Application's DCT

              You can specify its source file in application's makefile by variable "APPLICATION_DCT".

              (You can refere to "temp_control.mk(WICED-SDK\apps\demo\temp_control)" about how to config "APPLICATION_DCT").

For more details, you can check it in makefile. Below is a simple introducation of the build flow.

==============================================================================

1. Makefile (c:\users\mudel\wiced\wiced-sdk-mfi-3.1.2\wiced-sdk)
...
$(BUILD_STRING😞 main_app $(if $(SFLASH),sflash_image) copy_elf_for_eclipse
...
main_app: build/$(CLEANED_BUILD_STRING)/config.mk $(WICED_SDK_PRE_APP_BUILDS) $(MAKEFILES_PATH)/wiced_elf.mk $(if $(SUB_BUILD),,.gdbinit)
$(QUIET)$(COMMON_TOOLS_PATH)mkdir -p $(OUTPUT_DIR)/binary $(OUTPUT_DIR)/modules $(OUTPUT_DIR)/libraries $(OUTPUT_DIR)/resources
$(QUIET)$(MAKE) -r $(JOBSNO) $(SILENT) -f $(MAKEFILES_PATH)/wiced_elf.mk $(DIR_BUILD_STRING) $(PASSDOWN_TARGETS)
$(QUIET)$(ECHO) Build complete
...

2. Wiced_elf.mk (c:\users\mudel\wiced\wiced-sdk-mfi-3.1.2\wiced-sdk\tools\makefiles)
...

LINK_DCT_FILE             := $(OUTPUT_DIR)/DCT$(LINK_OUTPUT_SUFFIX)

...

FINAL_DCT_FILE            :=$(LINK_DCT_FILE:$(LINK_OUTPUT_SUFFIX)=$(FINAL_OUTPUT_SUFFIX))

...
$(LINK_DCT_FILE😞 $(OUTPUT_DIR)/generated_security_dct.h $(WICED_SDK_DCT_LINK_SCRIPT) $(SOURCE_ROOT)WICED/internal/dct.c $(WICED_SDK_APPLICATION_DCT) $(WICED_SDK_WIFI_CONFIG_DCT_H) $(WICED_SDK_BT_CONFIG_DCT_H) $(CONFIG_FILE) | $(PLATFORM_PRE_BUILD_TARGETS)
$(QUIET)$(ECHO) Making DCT image
$(QUIET)$(CC) $(CPU_CFLAGS) $(COMPILER_SPECIFIC_COMP_ONLY_FLAG)  $(SOURCE_ROOT)WICED/internal/dct.c $(WICED_SDK_DEFINES) $(WICED_SDK_INCLUDES) $(COMPILER_SPECIFIC_DEBUG_CFLAGS)  $(call ADD_COMPILER_SPECIFIC_STANDARD_CFLAGS, ) -I$(OUTPUT_DIR) -I$(SOURCE_ROOT). -o $(OUTPUT_DIR)/internal_dct.o $(COMPILER_SPECIFIC_STDOUT_REDIRECT)
$(if $(WICED_SDK_APPLICATION_DCT),$(QUIET)$(CC) $(CPU_CFLAGS) $(COMPILER_SPECIFIC_COMP_ONLY_FLAG)  $(WICED_SDK_APPLICATION_DCT) $(WICED_SDK_DEFINES) $(WICED_SDK_INCLUDES) $(COMPILER_SPECIFIC_DEBUG_CFLAGS)  $(call ADD_COMPILER_SPECIFIC_STANDARD_CFLAGS, ) -I$(OUTPUT_DIR) -I$(SOURCE_ROOT). -o $(OUTPUT_DIR)/app_dct.o)
$(QUIET)$(LINKER) $(WICED_SDK_LDFLAGS) $(WICED_SDK_DCT_LINK_CMD) $(call COMPILER_SPECIFIC_LINK_MAP,$(MAP_DCT_FILE)) -o $@  $(OUTPUT_DIR)/internal_dct.o $(if $(WICED_SDK_APPLICATION_DCT),$(OUTPUT_DIR)/app_dct.o)  $(COMPILER_SPECIFIC_STDOUT_REDIRECT)

$(STRIPPED_LINK_DCT_FILE😞 $(LINK_DCT_FILE)
$(QUIET)$(STRIP) -o $@ $(STRIPFLAGS) $<

$(FINAL_DCT_FILE😞 $(STRIPPED_LINK_DCT_FILE)
$(QUIET)$(OBJCOPY) -O binary -R .eh_frame -R .init -R .fini -R .comment -R .ARM.attributes $< $@

...

3. Wiced_config.mk (c:\users\mudel\wiced\wiced-sdk-mfi-3.1.2\wiced-sdk\tools\makefiles)
...
WICED_SDK_DCT_LINK_SCRIPT    +=$(if $(DCT_LINK_SCRIPT),$(addprefix $($(NAME)_LOCATION),$(DCT_LINK_SCRIPT)),)
...

WICED_SDK_APPLICATION_DCT    +=$(if $(APPLICATION_DCT),$(addprefix $($(NAME)_LOCATION),$(APPLICATION_DCT)),)

...
$(CONFIG_FILE): $(WICED_SDK_MAKEFILES) | $(CONFIG_FILE_DIR)
...
$(QUIET)$(call WRITE_FILE_APPEND, $(CONFIG_FILE) ,WICED_SDK_DCT_LINK_CMD        += $(strip $(addprefix $(COMPILER_SPECIFIC_LINK_SCRIPT_DEFINE_OPTION) ,$(WICED_SDK_DCT_LINK_SCRIPT))))
...
...

4.  Memory mapping (It is also indicated which memory location this image will load/download in memory.) is specified in the linker script.
    It is MCU specified. For example:
A>  STM32F4xx.mk (c:\users\mudel\wiced\wiced-sdk-mfi-3.1.2\wiced-sdk\wiced\platform\mcu\stm32f4xx)
...
DCT_LINK_SCRIPT += $(TOOLCHAIN_NAME)/$(HOST_MCU_VARIANT)/dct$(LINK_SCRIPT_SUFFIX)
...

B>  The linker script is "dct.ld(WICED-SDK\WICED\platform\MCU\STM32F4xx\GCC\STM32F415)".

MudeL_51
Employee
Employee
10 replies posted 5 replies posted First solution authored

BTW, "dct.c  (WICED-SDK\WICED\internal)" will refer to a lot of MACRO.

You can specify thier value in "wifi_config_dct.h" as we usually do, and config it in application's makefile as below:

WIFI_CONFIG_DCT_H  := wifi_config_dct.h

For example, you can specify the MACRO "SOFT_AP_SSID" to define a default Soft AP SSID in "wifi_config_dct.h", and in "dct.c  (WICED-SDK\WICED\internal)", it will use it to initialize an array.

...

    .wifi_config.soft_ap_settings    = {{sizeof(SOFT_AP_SSID)-1,   SOFT_AP_SSID},   SOFT_AP_SECURITY,   SOFT_AP_CHANNEL,   SOFT_AP_PASSPHRASE_LENGTH, SOFT_AP_PASSPHRASE},

...

Anonymous
Not applicable

Now, I want to create a project of IAR to build DCT.bin

0 Likes

Hi Rodger,

You can copy the source file "dct.c (wiced-sdk\wiced\internal)" and related header files which included in the "dct.c" in your project.

For the linker script, you can refer to "dct.icf (WICED-SDK\WICED\platform\MCU\STM32F2xx\IAR)", but need to adjust the memory map according to your project.

0 Likes
Anonymous
Not applicable

Hi Mudel,

Good for you.

I'll try as what you said.

0 Likes
Anonymous
Not applicable

Hi Mudle,

I have built a project to create the dct.bin. The project has 3 resource file,as "dct.c", "startup_stm32f2xx.s" and "systerm_stm32f2xx.c".But It's not have main function, So the project linking failed. Please, how to do for it?

thanks.

0 Likes
Anonymous
Not applicable

I want to add the main function in 'dct.c',example"void main(void){      }". And then the linking is OK.

But I don't know it is right or wrong?

Thanks

0 Likes

Hi Rodger,
In dct.c (wiced-sdk\wiced\internal), you can see below codes:

#if defined ( __IAR_SYSTEMS_ICC__ )
4__root int wiced_program_start(void)
{
    /* in iar we must reference dct structure, otherwise it may not be included in */
    /* the dct image */
    return initial_dct.dct_header.write_incomplete;
}
#endif /* if defined ( __IAR_SYSTEMS_ICC__ ) */

you only need to enter the project options "Linker" -> "Libary" -> "Override default program entry",
then modify the "Entry symbol" to "wiced_program_start".

You don't need these two files:
startup_stm32f2xx.s
systerm_stm32f2xx.c

0 Likes
Anonymous
Not applicable

Thanks very much.

0 Likes
Anonymous
Not applicable

Thanks very much.

0 Likes