1 Reply Latest reply on Jul 17, 2019 9:28 PM by PriyaM_16

    OTA2 getting the pieces together

    AnKo_2681891

      Hi,

      we want to get the OTA2 functionality being integrated in our product. We are using 43438 module and an external MCU as host processor connected via SDIO. We also using an external SFLASH of 8MB connected via SPI. I read the OTA2 documentation and tried to apply all nescessary steps to our project setup.

      Even though I do not fully understand how all the different pieces are pulled together to have everything at the right place in internal and external FLASH.
      I am talking about the OTA2 bootloader, the factory reset OTA2 image, the fail-save app, the DCT, filesystem and the app itself. From the doc I read that there is a special memory map that has to be defined for this combination of internal and external FLASH. (ota2_image_defines.mk plus ota2_memory_with_bootloader.ld).

      Even though I am a bit confused what part has to go at what location. I assume the following:

       

      - internal FLASH of MCU holds:

      * ota2_bootloader

      * current app

       

      - external SFLASH holds:

      * factory reset OTA2 image

      * fail-safe application

      * app lookup table

      * DCT1/2

      * OTA2 extractor app

      * filesystem

      + space reserved for saved DCT and extracted OTA image

       

      Can someone confirm that this is correct and may have an example configuration how this has to configured?

       

      Also when building, I am not sure what target to build to load all components correctly to start my system. Do I have to build/download the components separately?

      If I am using one of the target configurations that have OTA2_SUPPORT enabled I get the following error:

      "Illegal division by zero at ./tools/text_to_c/sector_count.pl line 50"

      I assume that is cause by APP0 not being defined in the make environment, but I see no hint in the OTA2 doc that this has to be done somewhere explicitly.

       

      If someone can provide some more details on how to setup OTA2 for our device combination that would be very helpful.

       

      Thanks Andreas

        • 1. Re: OTA2 getting the pieces together
          PriyaM_16

          Hello Andreas,

          Can someone confirm that this is correct and may have an example configuration how this has to configured?

          >>The memory map suggested by you for downloading the apps looks correct. You can keep the bootloader and the current application APP0 in internal flash and the rest in external flash.

           

          Also when building, I am not sure what target to build to load all components correctly to start my system. Do I have to build/download the components separately?

          >> You will have to write different set of makefiles for downloading all the components at the correct location. As you already pointed out, the location is picked from ota2_image_defines.mk file in case of CYW943907AEVAL1F. A similar file needs to be written for your platform.

          Please make a build log with VERBOSE=1 for CYW943907AEVAL1F to use as a reference and connect the dots to downoload all componets in external+ internal flash system:

          let me explain the process of creating failsafe and downloading into flash

          Please refer the file: /43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/BCM94390x_targets.mk

          Please note I have removed the secure failsafe and JLINK checks from the makefile for simpler makefile:

           

          ifeq (1,$(OTA2_SUPPORT))
          APPS_LUT_DOWNLOAD_DEP += ota2_failsafe_download
          ota2_failsafe: bootloader
          $(QUIET)$(ECHO) Building OTA2 Failsafe
          $(QUIET)$(MAKE) -r -f $(SOURCE_ROOT)Makefile $(OTA2_FAILSAFE_TARGET) -I$(OUTPUT_DIR)  SFLASH= EXTERNAL_WICED_GLOBAL_DEFINES=$(EXTERNAL_WICED_GLOBAL_DEFINES) SUB_BUILD=bootloader $(BOOTLOADER_REDIRECT)
          $(QUIET)$(ECHO) Finished Building OTA2 Failsafe
          $(QUIET)$(ECHO_BLANK_LINE)
          
          ota2_failsafe_download: ota2_failsafe download_bootloader $(if $(filter 1,$(XIP_SUPPORT)),download_XIP_bin)
          
          $(QUIET)$(ECHO) Downloading OTA2 Failsafe App ...
          
          $(QUIET)$(eval MAX_OTA2_FAILSAFE_IMAGE_SPACE := $(shell $(PERL) $(ABS_DIFFERENCE_SCRIPT) $(OTA2_IMAGE_DO_NOT_WRITE_AREA_END) $(OTA2_IMAGE_FAILSAFE_APP_AREA_BASE) ))
          $(QUIET)$(eval OTA2_FAILSAFE_IMAGE_SIZE_OVERFLOW := $(shell $(PERL) $(FILE_SIZE_OVERFLOW_SCRIPT) $(OTA2_FAILSAFE_TARGET_FILE) $(MAX_OTA2_FAILSAFE_IMAGE_SPACE) ))
          $(QUIET)$(eval $(if $(OTA2_FAILSAFE_IMAGE_SIZE_OVERFLOW), $(error OTA2 Failsafe $(OTA2_FAILSAFE_TARGET_FILE) size $(OTA2_FAILSAFE_IMAGE_SIZE_OVERFLOW) overflowed max_size $(MAX_OTA2_FAILSAFE_IMAGE_SPACE) !!!)))
          
          $(call CONV_SLASHES,$(OPENOCD_FULL_NAME)) -f $(OPENOCD_PATH)$(JTAG).cfg -f $(OPENOCD_PATH)$(HOST_OPENOCD).cfg -f apps/waf/sflash_write/sflash_write.tcl -c "sflash_write_file $(OTA2_FAILSAFE_TARGET_FILE) $(OTA2_FAILSAFE_APP_ADDRESS) $(SFLASH_APP_PLATFROM_BUS) 0 $(SFLASH_APP_BCM4390)" -c shutdown $(DOWNLOAD_LOG) 2>&1
          $(QUIET)$(ECHO) Finished Downloading OTA2 Failsafe App
          endif
          

           

          The ota2_failsafe_download is added as the target if OTA2_SUPPORT is enabled. This ota2_failsafe_download  target calls bootloader target, downloads bootloader, compiles the failsafe app and downloads it.

          You have to make sure all the components are created and downloaded to correct addresses(as defined in the ota2_image_defines.mk file) in external flash.