OTA2_bootload is erasing memory section.

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

cross mob
BaGo_4138971
Level 3
Level 3

Hi All ,

  I'm new to the wiced SDK . I have upgraded our wiced SDK from 3.6.2 to 6.2.  In the old SKD(3.6.2) we writing our bootloader firmware version atthe location 0x004A0000. it is in the ota2_bootloader code and reading this location in the application. We are able to read it. Same thing we did in SDK 6.2, we write boot FW ver to 0x004A0000 location and try to read it. but we are getting 0 value from this location.

How new version affecting the 0x004A0000 location ? 

How we can dedug ota2_bootloader code?.

Where i should write version number?

Where i can find memory map with location address.

Please help me to understand it.

Thanks and regards,

Basava.

0 Likes
1 Solution

How we can retain RAM data after reset?

>> The RAM content can not be retained after reset.

But CYW43907 has 8KB of AON memory. The tiny bootloader resides in this area and the binary is  ~5 KB.

Besides the tiny_bootloader, the AONRAM also contains deep sleep variables.

Check the ld script ota2_app_without_rom.ld

SECTIONS

{

    .always_on_ram :

    {

        . = ALIGN(4);

        KEEP(*(.rodata.tinybl*))

        *(.deep_sleep_saved_vars.*)

    } > AONRAM

You can use the space to declare some variables as

static <variable_datatype> WICED_DEEP_SLEEP_SAVED_VAR( <variable_name> );

This might be helpful : CYW43907 Preserve a block of RAM across software reset​​

Can you modify your applicaton to look in the DCT instead of the fixed location?

View solution in original post

0 Likes
9 Replies
BaGo_4138971
Level 3
Level 3

Please suggest any solutions.

0 Likes

Hello,

The memory map of where the files are written/downloaded in WICED is declared in ota2_image_defines.mk of the respective platform directory.

Like for 43907, the memory map is defined as follows

OTA2_IMAGE_FLASH_BASE                := 0x0000000

OTA2_IMAGE_DO_NOT_WRITE_AREA_START := 0x00000000

OTA2_IMAGE_BOOTLOADER_START          := 0x00000000 #  32k  0x00008000

OTA2_IMAGE_FACTORY_RESET_AREA_BASE  := 0x00008000 #  2M - 100k  0x001E7000

# OTA2 Failsafe Application Storage

OTA2_IMAGE_FAILSAFE_APP_AREA_BASE := 0x001EF000  #  100k  0x00019000

OTA2_IMAGE_DO_NOT_WRITE_AREA_END := 0x00208000

OTA2_IMAGE_APP_DCT_SAVE_AREA_BASE    := 0x00208000  #  16k  0x00004000

OTA2_IMAGE_CURR_LUT_AREA_BASE        := 0x0020c000  #  4k  0x00001000

OTA2_IMAGE_CURR_DCT_1_AREA_BASE      := 0x0020d000 #  16k  0x00004000

OTA2_IMAGE_CURR_DCT_2_AREA_BASE      := 0x00211000 #  16k  0x00004000

# OTA2 Extraction Application Storage (start on 4k boundary)

OTA2_IMAGE_CURR_OTA_APP_AREA_BASE    := 0x00215000 # 308k 0

# File system (start on 4k boundary)

ifeq (1, $(SECURE_SFLASH))

OTA2_IMAGE_CURR_FS_AREA_BASE        := 0x00264000 # 852k  0x000D5000

else

OTA2_IMAGE_CURR_FS_AREA_BASE        := 0x00262000 # 860k  0x000D7000

endif

#App0 - Application (start on 4k boundary)

#In non-XIP case, the space of APP0 , 0x0339000 - 0x00600000 is 2.777M(0x002C7000).

#For XIP case the 2.777M space is shared with APP0_XIP binary.

#Currently APP0_XIP base is set to 0x400000. It can be adjusted according to use case.

OTA2_IMAGE_CURR_APP0_AREA_BASE      := 0x00339000

ifeq (1, $(XIP_SUPPORT))

OTA2_IMAGE_APP0_XIP_AREA_BASE := 0x00400000

endif #ifeq (1, $(XIP_SUPPORT))

# unused area is after APP0 and before The Staging Area

# Staging Area for OTA2 updates

# DO NOT CHANGE THIS LOCATION AFTER A PRODUCT HAS SHIPPED

# DO NOT CHANGE THIS LOCATION FOR AN UPDATE TO ANOTHER SDK

# (The Bootloader needs this to always be the same - bootloader does not get updated and would not know of changes between SDKs)

OTA2_IMAGE_STAGING_AREA_BASE        := 0x00600000 #  2M  0x00200000

OTA2_IMAGE_STAGING_AREA_SIZE        := 0x00200000

The memory map in WICED 3.6 might be different and the location 004A 0000 might be free to write the firmware version. Can you please attach the memory map of WICED 3.6?

Given the above memory map in WICED 6.2, we are writing the APP0 at location 0x00339000.  Depending on the size of the <app>.stripped.elf file, it appears that the memory add(0x004A 0000) is overwritten and so you are not able to access it.

Kindly compare the addresses for WICED framework in WICED 3.6 with the framework of WICED 6.2 and check if the addresses can be modified.

0 Likes

Hi Priya,

Thanks for the reply,

I have used below ota2_image_defines.mk  in 6.1version sdk.

# OTA2 image support

OTA2_SUPPORT_PLATFORM_MK_NEEDED :=1

#

#

# Constant sector size FLASH

#

SECTOR_SIZE := 4096

#

#  Sample Layout for 8MB FLASH

#

#   Sizes are on sector boundaries for this platform

#

#   +---------------------------------------+

#   | Boot loader Area | 24k  Size of build/waf.ota2_bootloader-<platform>/binary/waf.ota2_bootloader-<platform>.stripped.elf

#   +---------------------------------------+

#   | Factory Reset OTA Image | 2MB  - 64k for Failsafe App (Adjust this size to fit build/<your_application>-<platform>/OTA2_factory_reset_file.bin)

#   +---------------------------------------+

#   | OTA2 Failsafe App | 64k  Size of build/waf.ota2_failsafe-<platform>/binary/waf.ota2_failsafe-<platform>.stripped.elf

#   +---------------------------------------+

#   | DCT Save area (when updating) | 16k  (same size as normal DCT)

#   +--                                   --+

#   | Application Lookup Table (LUT) |  4k

#   +--                                   --+

#   | DCT Copy 1                      | 16k   DCT 1 & 2 must be contiguous

#   +--                                   --+

#   | DCT Copy 2                      | 16k

#   +--                                   --+

#   | OTA2 Extractor Application      | 256k  Size of build/snip.ota2_extract-<platform>/binary/snip.ota2_extract-<platform>.stripped.elf

#   +--                                   --+

#   | File system                      | ???   Adjust this size to fit future update size of build/<app><platform>/filesystem.bin

#   +--                                   --+

#   | Current Application      | ??? --\

#   +--                                   --+        >-- total 2.75MB

#   | Expansion area   | ??? --/

#   +---------------------------------------+

#   | OTA2 Staging area (downloaded image)  | 2MB  Adjust this size to max. expectation of update build/<your_application>-<platform>/OTA2_image_file.bin

# | |      (Will probably be larger than the Factory Reset Image in Update builds)

#   +---------------------------------------+

#

#  LAST KNOWN GOOD Not supported

# OTA2 FLASH Area                        Location     Size

OTA2_IMAGE_FLASH_BASE                := 0x00000000

OTA2_IMAGE_DO_NOT_WRITE_AREA_START := 0x00000000  #########  DO NOT WRITE TO THE FLASH BELOW THIS AFTER MANUFACTURE  ########

OTA2_IMAGE_BOOTLOADER_START          := 0x00000000 #  32k  0x00008000

# DO NOT CHANGE THESE LOCATIONS AFTER A PRODUCT HAS SHIPPED

# DO NOT CHANGE THESE FOR AN UPDATE TO ANOTHER SDK

# (The Bootloader needs these to always be the same - bootloader does not get updated and would not know of changes between SDKs)

# New for this SDK, use new layout

OTA2_IMAGE_FACTORY_RESET_AREA_BASE   := 0x00008000 #   2M  - 64k  0x001F0000

# OTA2 Failsafe Application Storage

OTA2_IMAGE_FAILSAFE_APP_AREA_BASE := 0x001F8000  #  64k  0x00010000

OTA2_IMAGE_DO_NOT_WRITE_AREA_END := 0x00208000  #########  DO NOT WRITE TO THE FLASH ABOVE THIS AFTER MANUFACTURE  ########

OTA2_IMAGE_APP_DCT_SAVE_AREA_BASE    := 0x00208000  #  16k  0x00004000

OTA2_IMAGE_CURR_LUT_AREA_BASE        := 0x0020c000  #   4k  0x00001000

OTA2_IMAGE_CURR_DCT_1_AREA_BASE      := 0x0020d000 #  16k  0x00004000

OTA2_IMAGE_CURR_DCT_2_AREA_BASE      := 0x00211000 #  16k  0x00004000

# DO NOT CHANGE THE ABOVE LOCATIONS AFTER A PRODUCT HAS SHIPPED

# DO NOT CHANGE THE ABOVE LOCATIONS FOR AN UPDATE TO ANOTHER SDK

# OTA2 Extraction Application Storage

OTA2_IMAGE_CURR_OTA_APP_AREA_BASE    := 0x00225000 # 256k  0x00040000

# File system

OTA2_IMAGE_CURR_FS_AREA_BASE         := 0x00265000 # 876k  0x000DB000

#App0 - Application

OTA2_IMAGE_CURR_APP0_AREA_BASE       := 0x00340000  # 2.75M 0x002C0000

# unused area is after APP0 and before The Staging Area

# Staging Area for OTA2 updates

# DO NOT CHANGE THIS LOCATION AFTER A PRODUCT HAS SHIPPED

# DO NOT CHANGE THIS LOCATION FOR AN UPDATE TO ANOTHER SDK

# (The Bootloader needs this to always be the same - bootloader does not get updated and would not know of changes between SDKs)

OTA2_IMAGE_STAGING_AREA_BASE         := 0x00600000 #   2M  0x00200000

OTA2_IMAGE_STAGING_AREA_SIZE         := 0x00200000

It's working  with 0x004A0000. I'm able to write my FW version in this loacation.

I have upgraded the SDK to 6.2version. below ota2_image_defines.mk used for it.

# OTA2 image support

OTA2_SUPPORT_PLATFORM_MK_NEEDED :=1

#

#

# Constant sector size FLASH

#

SECTOR_SIZE := 4096

#

#  Sample Layout for 8MB FLASH

#

#   Sizes are on sector boundaries for this platform

#

#   +---------------------------------------+

#   | Boot loader Area | 24k  Size of build/waf.ota2_bootloader-<platform>/binary/waf.ota2_bootloader-<platform>.stripped.elf

#   +---------------------------------------+

#   | Factory Reset OTA Image | 2MB  - 64k for Failsafe App (Adjust this size to fit build/<your_application>-<platform>/OTA2_factory_reset_file.bin)

#   +---------------------------------------+

#   | OTA2 Failsafe App | 64k  Size of build/waf.ota2_failsafe-<platform>/binary/waf.ota2_failsafe-<platform>.stripped.elf

#   +---------------------------------------+

#   | DCT Save area (when updating) | 16k  (same size as normal DCT)

#   +--                                   --+

#   | Application Lookup Table (LUT) |  4k

#   +--                                   --+

#   | DCT Copy 1                      | 16k   DCT 1 & 2 must be contiguous

#   +--                                   --+

#   | DCT Copy 2                      | 16k

#   +--                                   --+

#   | OTA2 Extractor Application      | 256k  Size of build/snip.ota2_extract-<platform>/binary/snip.ota2_extract-<platform>.stripped.elf

#   +--                                   --+

#   | File system                      | ???   Adjust this size to fit future update size of build/<app><platform>/filesystem.bin

#   +--                                   --+

#   | Current Application      | ??? --\

#   +--                                   --+        >-- total 2.75MB

#   | Expansion area   | ??? --/

#   +---------------------------------------+

#   | OTA2 Staging area (downloaded image)  | 2MB  Adjust this size to max. expectation of update build/<your_application>-<platform>/OTA2_image_file.bin

# | |      (Will probably be larger than the Factory Reset Image in Update builds)

#   +---------------------------------------+

#

#  LAST KNOWN GOOD Not supported

# OTA2 FLASH Area                        Location     Size

OTA2_IMAGE_FLASH_BASE                := 0x00000000

OTA2_IMAGE_DO_NOT_WRITE_AREA_START := 0x00000000  #########  DO NOT WRITE TO THE FLASH BELOW THIS AFTER MANUFACTURE  ########

OTA2_IMAGE_BOOTLOADER_START          := 0x00000000 #  32k  0x00008000

# DO NOT CHANGE THESE LOCATIONS AFTER A PRODUCT HAS SHIPPED

# DO NOT CHANGE THESE FOR AN UPDATE TO ANOTHER SDK

# (The Bootloader needs these to always be the same - bootloader does not get updated and would not know of changes between SDKs)

# New for this SDK, use new layout

OTA2_IMAGE_FACTORY_RESET_AREA_BASE   := 0x00008000 #   2M  - 64k  0x001F0000

# OTA2 Failsafe Application Storage

OTA2_IMAGE_FAILSAFE_APP_AREA_BASE := 0x001F8000  #  64k  0x00010000

OTA2_IMAGE_DO_NOT_WRITE_AREA_END := 0x00208000  #########  DO NOT WRITE TO THE FLASH ABOVE THIS AFTER MANUFACTURE  ########

OTA2_IMAGE_APP_DCT_SAVE_AREA_BASE    := 0x00208000  #  16k  0x00004000

OTA2_IMAGE_CURR_LUT_AREA_BASE        := 0x0020c000  #   4k  0x00001000

OTA2_IMAGE_CURR_DCT_1_AREA_BASE      := 0x0020d000 #  16k  0x00004000

OTA2_IMAGE_CURR_DCT_2_AREA_BASE      := 0x00211000 #  16k  0x00004000

# DO NOT CHANGE THE ABOVE LOCATIONS AFTER A PRODUCT HAS SHIPPED

# DO NOT CHANGE THE ABOVE LOCATIONS FOR AN UPDATE TO ANOTHER SDK

# OTA2 Extraction Application Storage

OTA2_IMAGE_CURR_OTA_APP_AREA_BASE    := 0x00225000 # 256k  0x00040000

# File system

OTA2_IMAGE_CURR_FS_AREA_BASE         := 0x00265000 # 876k  0x000DB000

#App0 - Application

OTA2_IMAGE_CURR_APP0_AREA_BASE       := 0x00340000  # 2.75M 0x002C0000

# unused area is after APP0 and before The Staging Area

# Staging Area for OTA2 updates

# DO NOT CHANGE THIS LOCATION AFTER A PRODUCT HAS SHIPPED

# DO NOT CHANGE THIS LOCATION FOR AN UPDATE TO ANOTHER SDK

# (The Bootloader needs this to always be the same - bootloader does not get updated and would not know of changes between SDKs)

OTA2_IMAGE_STAGING_AREA_BASE         := 0x00600000 #   2M  0x00200000

OTA2_IMAGE_STAGING_AREA_SIZE         := 0x00200000

Please let me know in which location i can write my FW version and why?

How we can configure this memory map?

Regards,

Basavanagowda.

0 Likes

Hi Priya,

Please let me know, is it good idea to  write our FW  version  in APP0 location OR we can write it in any other memory.

Is there any other location is dedicated to write user data,like FW version and some configuration data?

AS you mentioned in the reply, I need to consider <app>.stripped.elf file size to write my FW version number.

I'm trying to write 0x004a0000 location and my app0 is starting from 0x00340000. So, i'm writing my FW version number after around 1.375 Mb space.

i checked my bin file is around 1.24 Mb size. Its never going to over write that location and you mentioned <app>.stripped.elf  file will write to the APP0 location.

Please let me know which file is going to write here(please check the attachment).

I'm using "make snip.pers-BCM943909WCD1_3.B1-ThreadX-NetX_Duo-debug ota2_download" string to build and load the project.

wiced prj.PNG

Thanks,

Basava.

0 Likes

Hello Basava,

Please refer WICED application framework and manufacturing image in CYW943907AEVAL1F for understanding the WICED application framework. You can also refer the  43xxx_Wi-Fi\doc\WICED-Application-Framework-April-2013.pdf for the same.

The <app>.stripped.elf image is your application elf file.

If you are building the snip.pers-BCM943909WCD1_3.B1-ThreadX-NetX_Duo-debug ota2_download snip, your application stripped.elf file wrtten at  OTA2_IMAGE_CURR_APP0_AREA_BASE is the 43xxx-Wi-Fi\build\snip.pers-BCM943909WCD1_3.B1-ThreadX-NetX_Duo-debug\binary\snip.pers-BCM943909WCD1_3.B1-ThreadX-NetX_Duo-debug.stripped.elf file. You need to check the size of this file.

Is it mandatory for your application to write the FW version at 0x004A 0000 address. Can it be stored in DCT? Kindly refer this document for information about DCT :43xxx_Wi-Fi\doc\WICED-DCT.pdf.

WICED has a sample application for reading and writing DCT. The app is snip.dct_read_write.

Hi Priya,

Thank you for the reply.

I have checked my 43xxx-Wi-Fi\build\snip.pers-BCM943909WCD1_3.B1-ThreadX-NetX_Duo-debug\binary\snip.pers-BCM943909WCD1_3.B1-ThreadX-NetX_Duo-debug.stripped.elf file size its around 700kbytes only.  As i mentioned above my APP0 starts from 0x00340000 and I'm writing my version in 0x004A0000 location. So, elf files is never going to overwrite it. 

Is there other things i need to consider here?

Thank you for the DCT suggestion, I will look into it.

Thanks,

Basava.

0 Likes

Hi,

is it 0x004A0000  location is belongs to Flash memory range or RAM memory?

0 Likes
BaGo_4138971
Level 3
Level 3

Hi Priya,

How we can retain RAM data after reset? 

I will update SRAM memory location with my version value in the bootloader code and i want access it from application.

So, after reset, i mean once the boot loader jump to application it should not erase the specified (0x004A0000)RAM location. How we can do this?

Location 0x004a0000 is belongs to SRAM.

Please let me know the steps.

Thanks,

Regards.

0 Likes

How we can retain RAM data after reset?

>> The RAM content can not be retained after reset.

But CYW43907 has 8KB of AON memory. The tiny bootloader resides in this area and the binary is  ~5 KB.

Besides the tiny_bootloader, the AONRAM also contains deep sleep variables.

Check the ld script ota2_app_without_rom.ld

SECTIONS

{

    .always_on_ram :

    {

        . = ALIGN(4);

        KEEP(*(.rodata.tinybl*))

        *(.deep_sleep_saved_vars.*)

    } > AONRAM

You can use the space to declare some variables as

static <variable_datatype> WICED_DEEP_SLEEP_SAVED_VAR( <variable_name> );

This might be helpful : CYW43907 Preserve a block of RAM across software reset​​

Can you modify your applicaton to look in the DCT instead of the fixed location?

0 Likes