cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6

RiKw_4278376
New Contributor II

I am trying to follow code example "CE224285 – PSoC 6 MCU External Flash Access in XIP Mode with QSPI".

I'm using the PDF instructions on Github. My target hardware is a PSoC 6 BLE Pioneer Kit (CY8CKIT-062-BLE).

When I attempt to run the program using "Program (KitProg3)" it complains

Unexpected command line argument: sflash_restrictions

The OpenOCD Debugging > ... Program (KitProg3) > Debugger window looks like this.

CE224285-Program-Debugger.png

When I use "Program (KitProg3)" to run it, I get this. (Just FYI, I'm using ModusToolbix 1.1.)

CE224285-failed-sflash_restrictions.png

What am I doing wrong?  Should I be using a different example to understand PSoC 6 XiP?

0 Likes
1 Solution
Rakshith
Moderator
Moderator

Hi RiKw_4278376,

The config options are correct. I am suspecting that some stray characters are present in the config options which might be the reason that you are getting the error. Can you please re-type the commands and see if that fixes your issue?

I am sorry but I do not understand why you are reading from the device. The Read command reads the flash data of the device and then writes it to a file.

To program the device you need to click on the Program icon.

Can you please elaborate your query?

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

View solution in original post

7 Replies
Rakshith
Moderator
Moderator

Hi RiKw_4278376​,

I am unable to reproduce your error. Can you please copy and paste the entire Config Options?

Also, can you try programming the device using Cypress Programmer and see if that works?

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
RiKw_4278376
New Contributor II

By "Config Options", are you referring to "Properties for <name>_mainapp"?  There are a *lot* of different panels; presumably their contents are saved in various XML files in the ".metadata " directory as well as the "design.modus" file. Do you want specific XML files instead?

I tried Cypress Programmer. This is new to me. I attempted to programmed the flash with the built ELF file. However, I have no evidence that I am doing it correctly.  I've tried offsets 0x10000 and 0x0 with apparently identical results. (See log below.)  Offsets like: 0x10000000 result in messages about 'no flash bank found for address 0x2......'.  I have a terminal window (via PuTTY) connected to the port; when I program the flash, there is no change in that window.  That is, I have no evidence that the program flashed onto the chip is running.

Program settings which produce the "least" amount of errors are:
* File:  C:/Users/.../.../.../CE224285_PSoC6_QSPI_XIP_mainapp/Debug/CE224485_PSoC6_QSPI_XIP_mainapp.elf

* Offset: 0x0

* Reset Chip: (checked)

The log from Cypress Programmer:

Info : [CyBridge] Start API initialization

Info : [CyBridge] Connected - KitProg3 CMSIS-DAP BULK-12070A21022A7400

Info : [CyBridge] Hardware initialization complete (861 ms)

Info : Selected Device: CY8CKIT-062-BLE-12070A21022A7400

Info : ** Probe-config: kit_CY8CKIT_062_BLE.cfg

Info : Open On-Chip Debugger 0.10.0+dev-2.2.0.249 (2019-09-10-10:57)

Info : Licensed under GNU GPL v2

Info : For bug reports, read

Info : http://openocd.org/doc/doxygen/bugs.html

Info : debug_level: 2

Info : C:/Program Files (x86)/Cypress/Cypress Programmer

Info : ./openocd

Info : C:/Program Files (x86)/Cypress/Cypress Programmer/BT

Info : 12070A21022A7400

Info : 1:4

Info : 0

Info : swd

Info : soft

Info : off

Info : 0

Info : adapter speed: 1500 kHz

Info : serial:    12070A21022A7400

Info : transport: swd

Info : rst type:  soft

Info : efuse:     off

Info : sflash restrict: 0

Info : adapter speed: 1000 kHz

Info : ** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable

Info : cortex_m reset_config sysresetreq

Info : cortex_m reset_config vectreset

Info : none separate

Info : SFlash programming disallowed, see 'sflash_restrictions' command

Info : init_target

Info : tcl server disabled

Info : Listening on port 4445 for telnet connections

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 : VTarget = 3.294 V

Info : kitprog3: acquiring PSoC device...

Info : clock speed 1000 kHz

Info : SWD DPIDR 0x6ba02477

Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints

Info : psoc6.cpu.cm0: external reset detected

Info : ***************************************

Info : ** Silicon: 0xE207, Family: 0x100, Rev.: 0x23 (B2)

Info : ** Detected Device: CY8C6347BZI-BLD53

Info : ** Detected Main Flash size, kb: 1024

Info : ** Flash Boot version 1.20.1.42

Info : ** Chip Protection: NORMAL

Info : ***************************************

Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints

Info : psoc6.cpu.cm4: external reset detected

Info : Listening on port 3333 for gdb connections

Info : Open On-Chip Debugger

Info : init_target

Info : kitprog3: acquiring PSoC device...

Info : target halted due to debug-request, current mode: Thread

Info : xPSR: 0x21000000 pc: 0x00001f34 msp: 0x08047790

Info : ** Device acquired successfully

Info : ** psoc6.cpu.cm4: Ran after reset and before halt...

Info : target halted due to debug-request, current mode: Thread

Info : xPSR: 0x61000000 pc: 0x1600400c msp: 00000000

Info : flash 'psoc6' found at 0x10000000

Info : flash 'psoc6' found at 0x14000000

Info : flash 'psoc6' found at 0x16000000

Info : flash 'psoc6_efuse' found at 0x90700000

Info : #0 : psoc6_main_cm0 (psoc6) at 0x10000000, size 0x00100000, buswidth 4, chipwidth 4

Info : #1 : psoc6_work_cm0 (psoc6) at 0x14000000, size 0x00008000, buswidth 4, chipwidth 4

Info : #2 : psoc6_super_cm0 (psoc6) at 0x16000000, size 0x00008000, buswidth 4, chipwidth 4

Info : #3 : psoc6_efuse_cm0 (psoc6_efuse) at 0x90700000, size 0x00000400, buswidth 1, chipwidth 1

Info : #4 : psoc6_main_cm4 (virtual) at 0x10000000, size 0x00000000, buswidth 0, chipwidth 0

Info : #5 : psoc6_work_cm4 (virtual) at 0x14000000, size 0x00000000, buswidth 0, chipwidth 0

Info : #6 : psoc6_super_cm4 (virtual) at 0x16000000, size 0x00000000, buswidth 0, chipwidth 0

Info : #7 : psoc6_efuse_cm4 (virtual) at 0x90700000, size 0x00000400, buswidth 1, chipwidth 1

Info : cyp status: OK

Info : cyp_get_mpn

Info : ** Detected device PN: CY8C6347BZI-BLD53 SiliconID: E207 Revision: 23 FamilyID: 100 DIE: PSoC6ABLE2

Info : true

Info : program_device "C:/Users/rickk/mtw/p6xip-pioneer/CE224285_PSoC6_QSPI_XIP_mainapp/Debug/CE224285_PSoC6_QSPI_XIP_mainapp.elf" "0"

Info : ** Program image C:/Users/rickk/mtw/p6xip-pioneer/CE224285_PSoC6_QSPI_XIP_mainapp/Debug/CE224285_PSoC6_QSPI_XIP_mainapp.elf offset:0 **

Info : kitprog3: acquiring PSoC device...

Info : target halted due to debug-request, current mode: Thread

Info : xPSR: 0x21000000 pc: 0x00001f34 msp: 0x08047790

Info : ** Device acquired successfully

Info : ** psoc6.cpu.cm4: Ran after reset and before halt...

Info : target halted due to debug-request, current mode: Thread

Info : xPSR: 0x61000000 pc: 0x1600400c msp: 00000000

Info : ** Programming Started **

Info : auto erase enabled

Info : Padding image section 1 at 0x1000a670 with 400 bytes (bank write end alignment)

Info : [100%] [################################] [ Erasing     ]

Info : [100%] [################################] [ Programming ]

Info : [100%] [################################] [ Erasing     ]

Info : Some SFlash rows were skipped during erase, see 'sflash_restrictions' command

Info : [100%] [################################] [ Programming ]

Info : Some SFlash rows were skipped during programming, see 'sflash_restrictions' command

Info : no flash bank found for address 0x18000000

Info : wrote 43520 bytes from file C:/Users/rickk/mtw/p6xip-pioneer/CE224285_PSoC6_QSPI_XIP_mainapp/Debug/CE224285_PSoC6_QSPI_XIP_mainapp.elf in 1.794976s (23.677 KiB/s)

Info : ** Programming Finished **

Info : cyp status: OK

Info : cyp_get_mpn

Info : ** Detected device PN: CY8C6347BZI-BLD53 SiliconID: E207 Revision: 23 FamilyID: 100 DIE: PSoC6ABLE2

Info : true

Info : reset run

BTW, the run above is after reinstalling ModusToolbox 1.1. I was concerned that the earlier image that I was using was corrupted.  However, when I once again try to program via "... Program (KitProg3)", it still complains about "Unexpected command line argument: sflash_restrictions".

0 Likes
Rakshith
Moderator
Moderator

Hi RiKw_4278376,

By 'entire Config Options' I meant all the debugger config options that is present in the screenshot that you have shared -

pastedImage_0.png

Also, can you please share the screenshot of Cypress Programmer. I suggested Cypress Programmer to you because you can directly program the device with your hex file. I am not understanding why the offsets need to be set manually.

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
RiKw_4278376
New Contributor II

Oh I see.  "... Program (KitProg3)" -> Debugger -> Config options:

--------

-s "${cy_tools_path:openocd}/scripts"

-s "${workspace_loc}/P6_QSPI_XIP_config/GeneratedSource"

-s “${workspace_loc}/P6_QSPI_XIP_mainapp/GeneratedSource”

-c "source [find interface/kitprog3.cfg]"

-c "source [find target/psoc6.cfg]"

-c "psoc6 sflash_restrictions 1”

-c "if [catch {program {${workspace_loc:/P6_QSPI_XIP_mainapp/${config_name:P6_QSPI_XIP_mainapp}/P6_QSPI_XIP_mainapp_final.elf}}} ] { echo {** Program operation failed **} } else { echo {** Program operation completed successfully **} }"

-c "reset_config srst_only;reset run;psoc6.dap dpreg 0x04 0x00;shutdown"

--------

Update: I had to reinstall ModusToolbox 1.1 due to some suspected flakiness I was seeing. In the process, I had to reimport the example.  The above Config options are from the new import.  Having done that, it is now failing in a different way.  I now get this message:

--------

    Unexpected command line argument: if

--------

The "if" is in the command after "psoc6 sflash_restrictions 1".  This makes me think something is happening to the options parser.

Cypress Programmer:  Below is an image snapped after File -> Read : "Read Device to File".

pastedImage_0.png

The written target of "Read Device to File", "cyppgm-readlog.hex" has lots of hexadecimal digits.

The snap below shows the first several lines.

pastedImage_1.png

0 Likes
Rakshith
Moderator
Moderator

Hi RiKw_4278376,

The config options are correct. I am suspecting that some stray characters are present in the config options which might be the reason that you are getting the error. Can you please re-type the commands and see if that fixes your issue?

I am sorry but I do not understand why you are reading from the device. The Read command reads the flash data of the device and then writes it to a file.

To program the device you need to click on the Program icon.

Can you please elaborate your query?

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

View solution in original post

RiKw_4278376
New Contributor II

I finally got the example to work. I suspect that stray characters in the config options were indeed the problem.

To complicate matters:

  1. I've changed my ModusToolbox 1.1 platform from Windows 10 to macOS. However, my early runs on macOS showed the same problem, i.e., "Unexpected command line argument: sflash_restrictions". In my original tests on macOS, I copied and pasted the Config options updates from the PDF instructions. In my most recent test, I stayed away from the beginning and ending characters of the text lines (but manually entered those plus newlines), and copied in the remaining intervening text. This seems to have done the trick.
  2. To confuse matters, on Windows 10, I suddenly had a rash of errors of the following form:
       Couldn't reserve space for cygwin's heap, Win32 error 487
    I thought this was the source of the problem, until I saw the sflash_restrictions error on macOS as well.  The Cygwin problem was not consistent. A source code file which failed to compile would later compile successfully just by retry. With enough retries, everything would compile. Apparently, this is related to Cygwin MSYS. Many reports have it relate to invocation of Git; in this context, there is an extended discussion on StackOverflow, which recommends upgrading to a later version of Git. What I saw corresponds to an old LPCExpresso IDE build error from 2016 (which references a report from 2012). Cygwin points to software that non-transparently installs hooks into various parts of the system; they list several packages known to do this, including many anti-virus and firewall packages.

To be clear, item 1 above fixed my problem. Item 2 was unrelated to the sflash_restrictions problem, but was a major time-sink and probably related to the tools that come with MCUExpresso 1.1 on Windows.

Rakshith
Moderator
Moderator

Hi RiKw_4278376,

Glad your issue is resolved.

Hope your found a resolution for the cygwin error mentioned in point 2. If not please create another thread so that we can track the issue and it would be helpful for others in the community.

Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
Top labels