CYW43907 SPI Flash Parameters and partitioning

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

We are trying to design a custom system using the CYW43907 which will have a different (maybe non-Cypress) SPI Flash on it.

  1. Where do you define what serial flash you are using?  Hard to imagine the bootloader & SDK can handle any SPI Flash.
  2. Where do you define the memory allocated to the different images?
    1. I see the addresses defined in ./platform/xxx/normal_image_defines, is this a comprehensive list
    2. "NORMAL_IMAGE_FS_AREA_BASE" is marked obsolete, who do we define which part of the serial flash is dedicated to the file system?

thank you

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

I will try to provide a rough outline for a new sflash bringup in WICED SDK for 43907, which might need some further tuning for your chosen sflash to make it completely functional.

  1. In 43xxx_Wi-Fi/platforms/CYW943907AEVAL1F/CYW943907AEVAL1F.mk, add a line GLOBAL_DEFINES += SFLASH_SUPPORT_<SFLASH-COMPANY-NAME>_PARTS
  2. Add the SFLASH_ID_<MPN> of the flash you plan to add in 43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/spi_flash/spi_flash.h and also check the flash datasheet for any additional command you might want to add in sflash_command_t structure.
  3. Now the source code for the new sflash needs to be added in 43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/spi_flash/spi_flash.c. For every instance of the source code addition, we recommend to use #ifdef SFLASH_SUPPORT_<SFLASH-COMPANY-NAME>_PARTS as defined in step 1. You can check the existing source code for the already supported SFLASH in SDK and write the same for your new sflash.
  4. If you are adding an extra command in sflash_command_t structure as mentioned in step 2, you have to modify 43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/platform_spi_flash.c in actioncode_purpose_list structure.

Hope it helps to bring up the flash of your choice!

For the second part of the question, the normal_image_defines.mk is the comprehensive list of the memory map. If you want to check the exact FS area in sflash, you can check the wiced_apps.mk file and building with VERBOSE=1 will also help in understanding that part.

View solution in original post

4 Replies
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

I will try to provide a rough outline for a new sflash bringup in WICED SDK for 43907, which might need some further tuning for your chosen sflash to make it completely functional.

  1. In 43xxx_Wi-Fi/platforms/CYW943907AEVAL1F/CYW943907AEVAL1F.mk, add a line GLOBAL_DEFINES += SFLASH_SUPPORT_<SFLASH-COMPANY-NAME>_PARTS
  2. Add the SFLASH_ID_<MPN> of the flash you plan to add in 43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/spi_flash/spi_flash.h and also check the flash datasheet for any additional command you might want to add in sflash_command_t structure.
  3. Now the source code for the new sflash needs to be added in 43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/spi_flash/spi_flash.c. For every instance of the source code addition, we recommend to use #ifdef SFLASH_SUPPORT_<SFLASH-COMPANY-NAME>_PARTS as defined in step 1. You can check the existing source code for the already supported SFLASH in SDK and write the same for your new sflash.
  4. If you are adding an extra command in sflash_command_t structure as mentioned in step 2, you have to modify 43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/platform_spi_flash.c in actioncode_purpose_list structure.

Hope it helps to bring up the flash of your choice!

For the second part of the question, the normal_image_defines.mk is the comprehensive list of the memory map. If you want to check the exact FS area in sflash, you can check the wiced_apps.mk file and building with VERBOSE=1 will also help in understanding that part.

Thanks for the first part.  Now that I know where to look it is all there.  This has been my experience with WICED for 2 weeks now.  If you know where to look it is all there but nothing I can find says "this is how you do X".

For the second part, I looked at normal_image_defines.mk and built the whole thing VERBOSE. looking at all 1500 lines, I can see how it builds the RAM image as it adds to the code but nothing on how the flash is partitioned.  Maybe I am used to embedded SDKs coming from the other direction:  you define you flash map in a linker file (place bootloader, app, FS, etc) then use those constants to start up your file system etc.  So I am trying to figure out where to define the map.

Or is it the other way around: do I just fire up the FS and the Flash map is created as the project is built?  I would think at least a FS size need to be defined but wiced_filesystem_init() does not have parameters and wiced_filesystem.h does not have a size definition.

0 Likes

I am not sure if this helps, but build/your_app_name/resources folder may give you some idea how resource is implemented on WICED.

"I just fire up the FS and the Flash map is created as the project is built?  I would think at least a FS size need to be defined but wiced_filesystem_init() does not have parameters and wiced_filesystem.h does not have a size definition." ---> Correct

The linker scripts that you were looking for can be found at 43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/GCC. To find out how the map is created, you can check the wiced_apps.mk and find the build rules for resources as mentioned below:

define BUILD_APPS_RULES

$(if $($(1)),$(eval $(1)_ENTRY_COUNT := 1),$(eval $(1)_ENTRY_COUNT := 0))

$(if $($(1)),$(eval $(1)_SECTOR_START := $(CURRENT_SECTOR)),$(eval $(1)_SECTOR_START := 0))

$(if $($(1)),$(eval $(1)_SECTOR_COUNT := $(shell $(PERL) $(SECTOR_COUNT_SCRIPT) $($(1)) 0 4096)),$(eval $(1)_SECTOR_COUNT := 0))

$(if $($(1)),$(eval $(1)_SECTOR_ADDRESS := $(shell $(PERL) $(SECTOR_ADDRESS_SCRIPT) $($(1)_SECTOR_START) 4096)),)

$(if $($(1)),$(eval CURRENT_SECTOR := $(shell $(PERL) $(SECTOR_COUNT_SCRIPT) $($(1)) $(CURRENT_SECTOR) 4096)),)

$(if $($(1)),$(eval $(1)_IS_SECURE := $(if $($(1)_SECURE), $($(1)_SECURE), 0)),    $(eval $(1)_IS_SECURE := 0))

$(eval APPS_HEADER_DEFINES += -D$(1)_ENTRY_COUNT=$($(1)_ENTRY_COUNT))

$(eval APPS_HEADER_DEFINES += -D$(1)_SECTOR_START=$($(1)_SECTOR_START))

$(eval APPS_HEADER_DEFINES += -D$(1)_SECTOR_COUNT=$($(1)_SECTOR_COUNT))

$(eval APPS_HEADER_DEFINES += -D$(1)_IS_SECURE=$($(1)_IS_SECURE))

endef

You can also check the config.mk file for waf.sflash_write-NoOS-CYW943907AEVAL1F-P103-SoC.43909.generated as a part of the build process to check the Linker script and starting ML provided for the sflash and how the FS image is downloaded.