How dump external flash on CY8PROTO-062-4343W board?

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

cross mob
NoCl
Level 1
Level 1
5 sign-ins First reply posted First question asked

Is there a way to dump external flash memory on CY8PROTO-062-4343W dev kit with opencd? (may be with another tool)

 

For example I can dump internal flash, but I see read error in case of access to external flash:

 

/ModusToolbox/tools_2.2/openocd/bin/openocd -s /ModusToolbox/tools_2.2/openocd/scripts -s libs/TARGET_CY8CPROTO-062-4343W/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource -c "source [find interface/kitprog3.cfg]; source [find target/psoc6_2m.cfg]; psoc6 allow_efuse_program off; psoc6 sflash_restrictions 1;" -c "init; flash banks ; detect_smif; flash read_bank psoc6_smif0_cm0 flash_dump.bin 0x0 0x80000; shutdown;"

 

Open On-Chip Debugger 0.10.0+dev-4.1.0.1058 (2020-08-11-11:50)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
adapter speed: 2000 kHz
adapter srst delay: 25
adapter srst pulse_width: 25
** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
cortex_m reset_config sysresetreq
Info : Using CMSIS loader 'CY8C6xxA_SMIF' for bank 'psoc6_smif0_cm0' (footprint 14672 bytes)
Warn : SFlash programming allowed for regions: USER, TOC, KEY
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : KitProg3: FW version: 1.1.158
Info : KitProg3: Pipelined transfers disabled, please update the firmware
Info : VTarget = 3.283 V
Info : kitprog3: acquiring the device...
Info : clock speed 2000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints
***************************************
** Silicon: 0xE453, Family: 0x102, Rev.: 0x12 (A1)
** Detected Device: CY8C624ABZI-S2D44
** Detected Main Flash size, kb: 2048
** Flash Boot version: 3.1.0.378
** SFlash version: 292144
** Chip Protection: NORMAL
***************************************
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for psoc6.cpu.cm0 on 3333
Info : Listening on port 3333 for gdb connections
Info : starting gdb server for psoc6.cpu.cm4 on 3334
Info : Listening on port 3334 for gdb connections
#0 : psoc6_main_cm0 (psoc6_2m) at 0x10000000, size 0x00000000, buswidth 0, chipwidth 0
#1 : psoc6_work_cm0 (psoc6_2m) at 0x14000000, size 0x00000000, buswidth 0, chipwidth 0
#2 : psoc6_super_cm0 (psoc6_2m) at 0x16000000, size 0x00000000, buswidth 0, chipwidth 0
#3 : psoc6_efuse_cm0 (psoc6_2m_efuse) at 0x90700000, size 0x00000400, buswidth 1, chipwidth 1
#4 : psoc6_main_cm4 (virtual) at 0x10000000, size 0x00000000, buswidth 0, chipwidth 0
#5 : psoc6_work_cm4 (virtual) at 0x14000000, size 0x00000000, buswidth 0, chipwidth 0
#6 : psoc6_super_cm4 (virtual) at 0x16000000, size 0x00000000, buswidth 0, chipwidth 0
#7 : psoc6_efuse_cm4 (virtual) at 0x90700000, size 0x00000400, buswidth 1, chipwidth 1
#8 : psoc6_smif0_cm0 (cmsis_flash) at 0x18000000, size 0x04000000, buswidth 4, chipwidth 4
#9 : psoc6_smif0_cm4 (virtual) at 0x18000000, size 0x04000000, buswidth 0, chipwidth 0

### SMIF region #0 - Erase Size: 0x40000, Program Size: 0x200
set SMIF_BANKS {1 {addr 0x18000000 size 0x04000000 psize 0x200 esize 0x40000}}
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0x18000000
Error: error reading to flash at address 0x18000000 at offset 0x00000000
Error: Read error
Info : psoc6.dap: powering down debug domain...

0 Likes
1 Solution
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @NoCl

Can you please try the following command and let me know if that works? - 

openocd -s "../scripts" -f "interface/kitprog3.cfg" -c "set SMIF_BANKS { 1 {addr 0x18000000 size 0x00100000 psize 0x100 esize 0x1000} }" -f "target/psoc6_2m.cfg" -c "init; reset init; cmsis_flash init; dump_image c:/path/to/bin/file/bin_file.bin 0x18000000 0x00100; shutdown"

Rakshith_0-1625820472267.png

Hope this helps,

Thanks and Regards,
Rakshith M B

View solution in original post

5 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @NoCl

Can you please let me know if you have programmed any code into the device before trying to read the SMIF data?

SMIF data cannot be directly read using Cypress Programmer or OpenOCD. To read the SMIF data, the correct QSPI configuration data needs to be written into the flash and a pointer needs to be provided in the TOC2. This is done in the PSoC 6 MCU: External Flash Access in XIP Mode.

Can you please try programming this code example and then try to read the SMIF memory using Cypress Programmer?

Please ensure that you have the following highlighted settings selected - 

Rakshith_0-1625510211757.png

Thanks and Regards,
Rakshith M B
0 Likes
NoCl
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hello @Rakshith . Yes I can erase/programm external memory with help of openocd, ModusToolbox  and from embedded application. 

My goal is to create dump of data from external memory (data was written by my embedded application).

About Cypress Programmer: yes, Programmer can read external memory (HEX-file was saved with content of ALL memory banks).

Is there a way to dump specified region of ext mem to bin?

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @NoCl

Can you please try the following command and let me know if that works? - 

openocd -s "../scripts" -f "interface/kitprog3.cfg" -c "set SMIF_BANKS { 1 {addr 0x18000000 size 0x00100000 psize 0x100 esize 0x1000} }" -f "target/psoc6_2m.cfg" -c "init; reset init; cmsis_flash init; dump_image c:/path/to/bin/file/bin_file.bin 0x18000000 0x00100; shutdown"

Rakshith_0-1625820472267.png

Hope this helps,

Thanks and Regards,
Rakshith M B
NoCl
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hello @Rakshith . It works. 

Thanks a lot!

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

That's great! Thank you for providing an update on the thread!

Thanks and Regards,
Rakshith M B
0 Likes