Unable to view variable's value in ModusToolbox Debug mode

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

cross mob
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dears,

I have problem with debugger in Modus toolbox. I reed another threads about debugging and setting optimization level in Modus Toolbox IDE.

I am not able to see variables in structure during debug. 

I hope that I successfully disable all optimizations using manually editing Makefile:

CYFLAGS= -Os             or -O0

CONFIG=Custom

I would like to evaluate variable value (st and his member st->frame_size )

Instead of Value in Debug/Expression window I got error report "st->frame_size Error: Multiple errors reported.\ Failed to execute MI command: -var-create - * st->frame_size Error message from debugger back end: value has been optimized out\ Unable to create variable object"

I am also not able to see variables tmp32 (and of course whole st struct). For both variables I got only "<optimized out>".

But I could see another variables for example C, M without any problem.

What else could be wrong ?

------- here is portion of code -------

struct SpeexEchoState_ {
int frame_size;
int window_size;
int M;
int cancel_count;

...

}

typedef struct SpeexEchoState_ SpeexEchoState;

.... and in one function ...

for (chan = 0; chan < C; chan++)
{
    filter_dc_notch16(in+chan, st->notch_radius, st->input+chan*st->frame_size, st->frame_size, st->notch_mem+2*chan, C);

for (i=0;i<st->frame_size;i++)
{
    spx_word32_t tmp32;
    >>> BREAKPOINT >>> tmp32 = SUB32(EXTEND32(st->input[chan*st->frame_size+i]), EXTEND32(MULT16_16_P15(st->preemph, st->memD[chan])));

------- end of code -------

Thanks in advance

Radim

 

0 Likes
1 Solution
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi Radim:

Could you help to check below setting?Untitled.png

I found two differences in your configuration.

Untitled1.png

Best Regards,

Colin 

View solution in original post

17 Replies
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi @ravo :

This problem seems caused by the debugger setting of eclipse.

I'm checking the error: Failed to execute MI command.

If any progress, I will discuss with you.

Regard,

Colin

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Colin,

Yes I thing that there could be something wrong in ModusToolbox / Eclipse.

I also tried another suggestions for GCC compiler, e.g pragma, volatile and it does not help me.

#pragma GCC push_options
#pragma GCC optimize ("O0")

{ ... code ... }

#pragma GCC pop_options

or using directive "volatile"

volatile SpeexEchoState *st;

So still same "unusable" results. And it is really frustrating me...  I am using ModusToolbox IDE (after several years with PSOC Creator, and I still found only problems, not well documented... ) for specific PSOC62 family with bigger memory there is no option to use Creator IDE instead of Modus Toolbox.

So I will appreciate if any one have some suggestions how to properly disable optimization of variables in ModusToolbox.

Regards

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dears,

I also created Debug configuration called "Custom" - with path ${cy_prj_path}/build/CY8CPROTO-062-4343W/Custom/mtb-example-psoc6-usb-audio-device-freertos.elf, as shown in image:

ravo_1-1658314895145.png

and of course Run Configuration

ravo_0-1658314730776.png

But when you start custom/debug launcher (yellow highlighted the new one) from QuickPanel

ravo_2-1658315333447.png

Then after starting this Custom Launch - it was not downloaded correct binary image from Custom folder but still from Debug folder. In Console log when starting debugger it reports "Info : All data matches, Flash programming skipped" - It look like that Debugger still look for Debug folder instead if you change to another folder name.

I found workaround - when I manually copied Custom folder to Debug folder it is working. But it is not perfect solution.

Cypress/Infineon could you verify where is all stored path settings for each configuration and if it is really ok ?

Regards

Radim

0 Likes
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi Radim:

For this issue, please try to modify the "CONFIG=custom" (Default is "CONFIG=Debug") in the Makefile of project.

Untitled.png

Best Regard,

Colin

0 Likes
lock attach
Attachments are accessible only for community members.
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Colin,

Yes I already changed CONFIG property in Makefile as I wrote in first post in this thread 

----
I hope that I successfully disable all optimizations using manually editing Makefile:

CYFLAGS= -Os             or -O0
CONFIG=Custom
----

and it does not help. When I launch debugger than it compares the uC flash memory prior to program binary and if it is different than latest build (and in this scenario "custom" is different from "debug: config) than IDE flash debug ELF binary file from debug folder instead custom folder.

In attachment is complete Makefile (I was unable to attach file as plain text here - Valid file types are: jpg, gif, png, json, doc, pdf, xls, docx, html, htm, xlsx, pptx, zip.) so it is in ZIP file.

Thanks in advance for your help

Radim

 

0 Likes
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi Radim:

Could you show me your debug configuration of custom like below 3 sheets? 

I've copied all the configuration from Debug to custom.

Untitled.pngUntitled1.pngUntitled2.png

I've tried to build with custom setting, and starting this Custom Launch, it works normally. The firmware is downloaded from "build\CY8CPROTO-062-4343W\custom\mtb-example-aws-iot-ota-mqtt.elf".

Best Regard,

Colin

 

0 Likes
lock attach
Attachments are accessible only for community members.
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Colin,

here are three screenshots of Custom Debug config. I verified them but it look like same, I did not found any variable which contain Debug or Custom string that could be passed as path to ELF binary.

Regards,

Radim

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

I am sending also Config options for Debugger tab:

-s "${openocd_path}/../scripts"
-s "./COMPONENT_CUSTOM_DESIGN_MODUS/TARGET_CY8CPROTO-062-4343W/GeneratedSource"
-c "source [find interface/kitprog3.cfg]"
-c "puts stderr {Started by GNU MCU Eclipse}"
-c "source [find target/psoc6_2m.cfg]"
-c "psoc6.cpu.cm4 configure -rtos auto -rtos-wipe-on-reset-halt 1"
-c "gdb_port 3332"
-c "psoc6 sflash_restrictions 1"
-c "init; reset init"

Radim

0 Likes
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi Radim:

The configurations are same with mine.

Could you inform me how you get "In Console log when starting debugger it reports "Info : All data matches, Flash programming skipped" "?

I try to laugh the Debug (.elf from Debug folder) and custom (.elf from custom folder) ,  both download the firmware into chip.

I build the project with "CONFIG=Debug" or "CONFIG=custom" separately.

Best Regard,

Colin

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Colin,

when I click on Custom launch from Quick Launch window:

ravo_1-1658396072397.png

Here is log file from Console:

ravo_2-1658396131887.png

Full log here:

Started by GNU MCU Eclipse
Open On-Chip Debugger 0.11.0+dev-4.3.0.1746 (2021-09-16-07:59)
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
Warn : SFlash programming allowed for regions: USER, TOC, KEY
Info : Using CMSIS-DAPv2 interface with VID:PID=0x04b4:0xf155, serial=051416D001060400
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands 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: 2.30.1155
Info : KitProg3: Pipelined transfers enabled
Info : VTarget = 3.288 V
Info : kitprog3: acquiring the device (mode: reset)...
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 3332
Info : Listening on port 3332 for gdb connections
Info : starting gdb server for psoc6.cpu.cm4 on 3333
Info : Listening on port 3333 for gdb connections
Info : SWD DPIDR 0x6ba02477
Info : kitprog3: acquiring the device (mode: reset)...
psoc6.cpu.cm0 halted due to debug-request, current mode: Thread
xPSR: 0x41000000 pc: 0x00000190 msp: 0x080ff800
** Device acquired successfully
** psoc6.cpu.cm4: Ran after reset and before halt...
psoc6.cpu.cm4 halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0000012a msp: 0x080ff800
Started by GNU MCU Eclipse
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
Info : New GDB Connection: 1, Target psoc6.cpu.cm4, state: halted
Warn : Prefer GDB command "target extended-remote :3333" instead of "target remote :3333"
semihosting is enabled
Warn : No RTOS could be auto-detected!
Warn : No RTOS could be auto-detected!
Info : All data matches, Flash programming skipped
Info : SWD DPIDR 0x6ba02477
psoc6.cpu.cm4 halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1000dbf4 msp: 0x080ff758, semihosting
Info : psoc6.cpu.cm4: bkpt @0x10002325, issuing SYSRESETREQ
Info : SWD DPIDR 0x6ba02477
psoc6.cpu.cm4 halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x10002324 msp: 0x080ff800, semihosting
Info : psoc6.cpu.cm0: external reset detected
===== arm v7m registers
(0) r0 (/32): 0x40200000
(1) r1 (/32): 0x0000000e
(2) r2 (/32): 0x40200200
(3) r3 (/32): 0x10002000
(4) r4 (/32): 0x10002325
(5) r5 (/32): 0x00000020
(6) r6 (/32): 0x00000081
(7) r7 (/32): 0x080034b0
(8) r8 (/32): 0x00000081
(9) r9 (/32): 0x208088d6
(10) r10 (/32): 0x060042a0
(11) r11 (/32): 0x40462800
(12) r12 (/32): 0x0000000a
(13) sp (/32): 0x080ff800
(14) lr (/32): 0xffffffff
(15) pc (/32): 0x10002324
(16) xPSR (/32): 0x61000000
(17) msp (/32): 0x080ff800
(18) psp (/32): 0x01021174
(20) primask (/1): 0x00
(21) basepri (/8): 0x00
(22) faultmask (/1): 0x00
(23) control (/3): 0x00
(42) d0 (/64): 0x3fed906bcfcf59d7
(43) d1 (/64): 0xbc5a626331000000
(44) d2 (/64): 0x77e7ffd53f6ff767
(45) d3 (/64): 0xababed74bff7b575
(46) d4 (/64): 0xbcf7ff71bbe7efed
(47) d5 (/64): 0xbfe7ff75bfefff75
(48) d6 (/64): 0xffd803619eefbf65
(49) d7 (/64): 0xffcefe4affcefe4a
(50) d8 (/64): 0xbff7fe7593e7ff75
(51) d9 (/64): 0xb76fff753b75fed5
(52) d10 (/64): 0xb766ff319fe7ff75
(53) d11 (/64): 0x77e2fd55bee7f377
(54) d12 (/64): 0xf787ff753ee7fd75
(55) d13 (/64): 0xbde7ff75bfef7f25
(56) d14 (/64): 0xffeffff4afe7ff75
(57) d15 (/64): 0xbfa77f75ffcffe77
(58) fpscr (/32): 0x00000000
===== Cortex-M DWT registers

So when I manually copy content of Custom subfolder to Debug subfolder than Debugger program correct ELF file, and debugger is working with no problem...

ravo_3-1658396276852.png

Regards

Radim

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Colin,

here is one update. If I delete Debug subfolder... so in build folder \mtw\USB_DAC_PROTO_FreeRTOS\build\CY8CPROTO-062-4343W is only Custom subfolder.

When I tried tu execute launch Custom then after compilation I got error message:

ravo_0-1658400195575.png

I hope that it will help you to identify problem. From this error message it is clear that it is still using the debug sub-folder instead custom sub-folder.

Where is defined final launch sequence ?

Best Regards

Radim 

 

 

 

0 Likes
lock attach
Attachments are accessible only for community members.
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi Radim:

Could try to create a new project following the attached steps?

I create a new project and modify the setting, and debug it normally from custom.

I attached the steps, the console of build and launch custom.

Best Regards,

Colin 

0 Likes
lock attach
Attachments are accessible only for community members.
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Colin,

Yes I do the same way as you suggest - starting from clean demo project USB_Audio_Device_FreeRTOS for CY8CPROTO-062-4343W kit.

Created new build config, copy from debug config, set as Active...

Than I modified MakeFile with Config=custom property.

The build process is ok, it create custom folder and populated files in this folder.

But when I start debugger USB_Audio_FreeRTOS_Custom Custom - duplicated from Debug (KitProg3_MiniProg4) - then the process still look for Debug folder as shown in this warning:

ravo_0-1658465991706.png

I attached USB_Audio_FreeRTOS_Custom Custom - duplicated from Debug (KitProg3_MiniProg4).launch file and inside is still wrong values:

<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value="${cy_prj_path}/build/CY8CPROTO-062-4343W/Debug/mtb-example-psoc6-usb-audio-device-freertos.hex"/>

<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value="${cy_prj_path}/build/CY8CPROTO-062-4343W/Debug/mtb-example-psoc6-usb-audio-device-freertos.elf"/>

what was changed only and is ok now is parameter <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="${cy_prj_path}/build/CY8CPROTO-062-4343W/Custom/mtb-example-psoc6-usb-audio-device-freertos.elf"/>

I don't know what I am doing in bad way.

Regards

Radim

0 Likes
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi Radim:

Could you help to check below setting?Untitled.png

I found two differences in your configuration.

Untitled1.png

Best Regards,

Colin 

ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Colin,

thanks for this info. I also find these two stringAttribute's that has bad values in launch file. But I must have been blind when I checked custom config settings and miss Startup tab, there are exact these two variables. I just tested now and confirm that changing these values will help me.

I think that it will be more helpful if Duplicate function will change appropriated values which needs to be associated to new config. Maybe it is suggestion to improve duplicate functionality.

Best Regards

Radim

0 Likes
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Dear Radim:

How about the optimization level issue?

In custom building mode, setting CFLAGS and CXXFLAGS = -O0 are the lowest optimization level.

You can also set VERBOSE = 1, then you can display full command-lines when building.

Best Regard,

 Colin

0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Colin,

thanks for all. Sorry for later answer... I am now able to use Custom configuration. And I am able to view variables in debugger. It is working good now.

But there are of course some issues when using #ifdef in code, end especially with DEFINES in makefile and if #define is in header files. Then Eclipse did not show correctly active/inactive part of source code. But i must edit Paths and Symbols in project Options.

ravo_0-1660637015190.png

Regards

Radim

0 Likes