Skip to main content
MFawzy
Associate III
July 14, 2021
Question

constant data structure can't be watched

I have a project which use STM32H743ZI, and i have a data structure

#define APP_MODULE_MAJOR (INT8U)0x01 /*!< Major version of the APP module */
#define APP_MODULE_MINOR (INT8U)0x01 /*!< Minor version of the APP module */
#define APP_MODULE_CUSTOM (INT8U)0x01 /*!< Custom version of the APP module */
static const INT8S APP_s8ModuleNameString[] = "APP";
static const INT8S APP_s8ModuleDescriptionString[] = "APP";
const STD_strModuleInfoType APP_objstrModuleInfoType =
{
 .objstrVersion = {APP_MODULE_MAJOR, APP_MODULE_MINOR, APP_MODULE_CUSTOM},
 .u32ModuleID = APP_MODULE_ID,
 .ps8ModuleNameString = APP_s8ModuleNameString,
 .ps8ModuleDescriptionString = APP_s8ModuleDescriptionString
};/*<! APP module information instance */

and when trying to watch any of its members, i'm getting error in watcher

Failed to execute MI command:

-data-evaluate-expression *((APP_objstrModuleInfoType).ps8ModuleDescriptionString)

Error message from debugger back end:

Missing ELF symbol "APP_objstrModuleInfoType".

0693W00000BdfiQQAR.pngi checked the optimization setting and there is no optimization, so why Am I getting this error?

This topic has been closed for replies.

3 replies

Uwe Bonnes
Chief
July 14, 2021

Why do you want to watch const expressions. The compiler will not write to them. And the compiler will reuse constant values.

MFawzy
MFawzyAuthor
Associate III
July 14, 2021

Actually, it is a long story but I wanted to make it simple.

Anyway, the story is that I'm trying to parse the ELF file to display the information. and for some reason this data structure members' addresses are set to zero. and I want to get the stored value in the u32ModuleID which currently has address zero (it is wrong address).

so when i wanted to check what is wrong, i found that even the STMCubeIDE can't watch the same structure. so i want to know why this data structure members' addresses are set to zero

MFawzy
MFawzyAuthor
Associate III
July 14, 2021

The Issue that the structure is optimized even the optimization level is none, Any ideas?