Writing filesystem image to flash, non-FTDI debugger?

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

cross mob
user_108962310
Level 4
Level 4
10 likes received 10 likes given 5 likes given

Are there any extensible existing solutions for writing the filesystem.bin to the external flash?

I am trying to port to the 6.1.0 SDK, but resolving the issue of the Wifi FW & CLM blob is a blocking issue.

I have both a JLink and an STLink debugger, but it looks like I cannot use either for this take.

My hardware uses an SWD connection, which does not appear to be an option with the JLink setup with OpenOCD.

As as far as I can tell, there is no SDK support for using an STLink.

Is there any existing method or tool in the SDK to write the images to the flash, without needing an FTDI debugger and the full JTAG port?

One minor detail is that I would like to retain the ability to define the headers as needed, since I have a large serial flash chip and will be using one section for data storage (used to be the FS section, now will be APP2 probably so FS index can be used for Wifi FW).

0 Likes
1 Solution
user_108962310
Level 4
Level 4
10 likes received 10 likes given 5 likes given

Yes, the issue was resolved once I did some more work on it.

Note that my issue was bigger than JUST the definition of the platform: I also needed a way to get the filesystem onto the flash without an FTDI debugger present.

This is the latest version of the SDK, 6.1.0 .

So my implementation is a bit roundabout:
1) Build any project for my platform using `RESOURCES_LOCATION ?= RESOURCES_IN_WICEDFS` in the platform makefile
2) This causes the build system to generate filesystem.bin in the build/ directory; this BIN contains the wifi FW for the platform and the CLM blob.
3) Use `./tools/text_to_c/bin_to_resource_c.pl` to convert filesystem.b into a C file of the binary data.
4) Author a custom app that includes the filesystem.c file. (Note: I couldn't get the definition as an extern to work, so I ended up having to #include the C file)

5) The custom app constructs the headers directly by filling out a `app_header_t headers[DCT_MAX_APP_COUNT]` array, and then flashing it to sector 0 of the flash. This includes correct size provisioning for the filesystem-as-a-variable.

6) In the section corresponding to DCT_FILESYSTEM_IMAGE_INDEX, the filesystem variable is written out to the flash section.

7) Contents of the DCT_FILESYSTEM_IMAGE_INDEX are read back and verified against the filesystem-as-a-variable data.

AFTER that:

😎 I had the filesystem in place in the flash, but the system was still not working, I hit a timeout in `wwd_bus_sdio_download_firmware`, line 827 of wwd_bus_protocol.c

9) Upon review, I found that platform definitions now require `#define USES_RESOURCE_FILESYSTEM` in the `platform_config.h`

10) After adding that macro and doing the above preparation for the sflash, the platform can load correctly and start the radio for a project with the same RESOURCES_IN_WICEDFS macro.

This wasn't easy. But was necessary, since it meant the difference between a 1MB chip and a 1.5MB .

To address steps 1-7, at some point in the future I plan to write a program that runs a softAP and webserver or simple TCP that will let me remotely edit the sflash header, write any contents by streaming, and then retrieve a BIN of the flash.

Maybe this could be a community effort? Or Cypress could get an intern to do it? That would be a great intern project

View solution in original post

5 Replies