We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Well, this is really for Cortex-M0. I using uVision 5 and JLink to trouble shoot. When I try to view the value of some variables, I got cannot evaluate. All of the variables are global and they are defined like this:
typedef struct { __IO uint16_t DATA[16]; } CH4_DATA_TypeDef; #define P9235_RAM_BASE (0x20000000UL) #define CH4_DATA_BASE (M0_RAM_BASE + 0x06C0) //32 byte max #define ADC_DATA ((CH4_DATA_TypeDef *) CH4_DATA_BASE )
Does any one know why I can not view the value of DATA[16] by just put it in waatch window?
Thanks.
All of the variables are global and they are defined like this:
No, they're not, because that does not define any variable. That only defines one type and several macros.
But by doing this, space in data memory is assigned to this label and this address can be accessed by that label. Can I treat them as variable?
space in data memory is assigned to this label No, it's not. You're just pointing to that space, but you're not reserving it for that use in any way. That method provides no information to the linker that this memory is occupied by this data.
Nor is there really any "label". That's a preprocessor macro you've defined, nothing more.
If you want it to be treatable as a variable, you'll have to actually define one. Either an actual varable, or a cont pointer, i.e.:
some_type actual_variable; some_type * const const_pointer = (some_type *) ADDRESS;
You wouldn't be an assembler programmer who only recently started to convert to C, would you?