Hello World program/debug configuratio

Hi,
I’m following the Onethinx Getting Started Guide and trying to runt he Hello World example.
The guide says ’ To program or debug, go to the ‘play’ or ‘bug’ icon of the ModusToolbox toolbar. You may have to select a program/debug configuration first.’
What program/debug configuration should I use?

I am trying GDBopenOCD on project HelloWorld_mainapp and I’m getting the output below.
Thanks

Open On-Chip Debugger 0.10.0+dev-2.1.0.99 (2019-02-01-05:23)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1500 kHz
adapter speed: 1000 kHz
** Auto-acquire enabled, use “set ENABLE_ACQUIRE 0” to disable
cortex_m reset_config sysresetreq
cortex_m reset_config vectreset
adapter_nsrst_delay: 200
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 = 4.981 V
Info : kitprog3: acquiring PSoC device…
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0xe000ed00
Polling target psoc6.cpu.cm0 failed, trying to reexamine
Info : SWD DPIDR 0x6ba02477
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0xe000ed00
Examination failed, GDB will be halted. Polling again in 100ms
Polling target psoc6.cpu.cm0 failed, trying to reexamine
Info : SWD DPIDR 0x6ba02477
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0xe000ed00
Examination failed, GDB will be halted. Polling again in 300ms
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : SWD DPIDR 0x6ba02477
Info : SWD DPIDR 0x6ba02477
Info : AP write error, reset will not halt
Info : SWD DPIDR 0x6ba02477
Info : SWD DPIDR 0x6ba02477
in procedure ‘program’

Info : SWD DPIDR 0x6ba02477
** Program operation failed **
Polling target psoc6.cpu.cm0 failed, trying to reexamine
Info : SWD DPIDR 0x6ba02477
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0xe000ed00
Examination failed, GDB will be halted. Polling again in 700ms
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : SWD DPIDR 0x6ba02477
Info : SWD DPIDR 0x6ba02477
Info : SWD DPIDR 0x6ba02477
Info : SWD DPIDR 0x6ba02477
Error: DP initialisation fail

ed

Can you post us your launch settings? It seems you’re trying to debug M0+ which is locked.

Make sure you have: -c "set ENABLE_CM0 0" in your launch configuration.

\rolf

Thanks Rolf,
Please explain how I send my launch settings? Is it just this taken from the debugger (Kitprog3) config options:
-s “{cy_tools_path:openocd}/scripts" -s "{workspace_loc}/HelloWorld_config/GeneratedSource”
-c “source [find interface/kitprog3.cfg]”
-c “source [find target/psoc6.cfg]”
-c “if [catch {program {{workspace_loc:/HelloWorld_mainapp/{config_name:HelloWorld_mainapp}/HelloWorld_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”
-c “set ENABLE_CM0 0”

As you see I added the line you gave me with no chnage.

Can you put the ’-c “set ENABLE_CM0 0”‘ before [find target… like this:

...
-c "source [find interface/kitprog3.cfg]"
-c "transport select swd"
-c "set ENABLE_CM0 0"
-c "source [find target/psoc6.cfg]"

Thank you Rolf for your further help. Unfortunatly that did not make any differance.
Does it make any differnace that my kitprog is a 2 upgraded to 3?
what could I check next?
Thanks.

Can you send me a screenshot of the available ‘debug configurations’?

To go to the debug configuration click the down arrow next to the ‘bug’ icon:
Schermafbeelding 2019-12-18 om 12.15.25 >> Debug Configurations…
What configurations are listed at the left pane (under the ‘type filter text’ box)?

Hi Rolf,
I tried removing and reinstalling Modustoolbox and also a Kitprog3, I noticed the real kitprog 3 has pins in the oposite order to kitprog2 upgraded to 3. Using the kitprog 3 the Onethinx board did not light up at all. I seem to have gone backwards, now I get:

Error in final launch sequence
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
localhost:3333: No connection could be made because the target machine actively refused it.
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
localhost:3333: No connection could be made because the target machine actively refused it.
localhost:3333: No connection could be made because the target machine actively refused it.!

The screen shot you asked for is attached.

image|587x500

Do you have the red board like this?


If yes, what upgrade to KitProg3 did you do?

According your last information: “localhost:3333: No connection could be made because the target machine actively refused it.” it seems another OpenOCD instance is already running (and not yet closed). Try to terminate the debugger task over here: DEBUG
Schermafbeelding 2019-12-18 om 13.13.15

The message “Error: unable to find CMSIS-DAP Device” means the KitProg isn’t connected or hijacked by another program.

Hi Rolf,
I used Cyprogrammer to upgrade the firmware on the Kitprog2 to Kitprog3.
Now I uninstalled cyprogrammer in case it was using port 3333 and rebooted because I could not see another way to stop the debugger.

The Kitprog3 is blue, and the kitprog2 which has been upgraded to 3 is red like yours.

Cyprogrammer may be installed, as long as it’s not connected to the programmer (better close it).

I advise the red programmer which delivers 5V to the dev.kit at the Vtarg pin.

The “HelloWorld Debug” should be the configuration to choose for debugging.

Let me know if this works with this configuration:

-s "${cy_tools_path:openocd}/scripts"
-s "${workspace_loc}/HelloWorld_config/GeneratedSource"
-c "source [find interface/kitprog3.cfg]"
-c "transport select swd"
-c "set ENABLE_CM0 0"
-c "set ENABLE_ACQUIRE 0"
-c "source [find target/psoc6.cfg]"
-c "puts stderr {Started by GNU MCU Eclipse}"
-c "init; reset init"

Hi Rolf,
I’m using another laptop and this one does not suffer the poer 3333 refusal. I seem to get further with error:

Error in final launch sequence
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
Remote replied unexpectedly to ‘vMustReplyEmpty’: PacketSize=3fff;qXfer:memory-map:read+;qXfer:features:read+;qXfer:threads:read+;QStartNoAckMode+;vContSupported+
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
Remote replied unexpectedly to ‘vMustReplyEmpty’: PacketSize=3fff;qXfer:memory-map:read+;qXfer:features:read+;qXfer:threads:read+;QStartNoAckMode+;vContSupported+
Remote replied unexpectedly to ‘vMustReplyEmpty’: PacketSize=3fff;qXfer:memory-map:read+;qXfer:features:read+;qXfer:threads:read+;QStartNoAckMode+;vContSupported+

and log window:
Started by GNU MCU Eclipse
Open On-Chip Debugger 0.10.0+dev-2.1.0.99 (2019-02-01-05:23)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1500 kHz
Warn : Transport “swd” was already selected
swd
0
0
adapter speed: 1000 kHz
** Auto-acquire enabled, use “set ENABLE_ACQUIRE 0” to disable
cortex_m reset_config sysresetreq
adapter_nsrst_delay: 200
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 = 4.955 V
Info : kitprog3: acquiring PSoC device…
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Error: DP initialisation failed
Info : kitprog3: acquiring PSoC device…
Info : SWD DPIDR 0x6ba02477

Failed to acquire PSoC 6 device in Test Mode

** SFlash SiliconID: 0xE2072200
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0x16002008
Error: mem2array: Read @ 0x16002004, w=4, cnt=1, failed
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0x16002008
Error: mem2array: Read @ 0x16002004, w=4, cnt=1, failed
** psoc6.cpu.cm4: Ran after reset and before halt…
target halted due to debug-request, current mode: Thread
xPSR: 0xa1000000 pc: 0x10000738 msp: 0x0803ef98
Started by GNU MCU Eclipse

Hi Rolf,
I’ll try VSCode and let you know how I get on.

Hi Hallam,

I’m sorry for the far from smooth experience you have. Would you appreciate Skype support to get you up-and-running quickly?

Regards,
Rolf