STM32CubeIDE: Different size of enum in "variables" and "expressions" views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-09-02 6:42 AM
Hello
I am debugging my project and I found a behaviour I can't understand.
I have a global struct (appModbusSlave). I can see it in "expressions". That structs has different kind of variables inside. One of them is a enumeration called "estado" (type MODBUS_SLAVE_ESTADO). Compilator gives it a size of two bytes (its address is 0x2000b544 and the next variable address is 0x2000b546).
When I send a pointer of that variable to a function, I can see the struct in "variables" view.
The point is that enum called "estado" has a size of 4 bytes (it begins en 0x2000b544 and the next begins in 0x2000b548.
You can see that:
- in "expressions" view (outside the function) "key_n_block" has a value of 65535
- in "variables" view (inside the function) "key_n_block" has a value of 0.
Due to that, the program doesn't work properly
Is this a problem of the compiler? Is a problem of the code? Should I use "packed" attribute in?
Best regards
Best regards
- Labels:
-
STM32CubeIDE
-
STM32L4 series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-09-02 6:51 AM
I have forgotten to say:
STM32L431RC
STM32CubeIDE 1.10.0
