2022-09-02 06: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:
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
2022-09-02 06:51 AM
I have forgotten to say:
STM32L431RC
STM32CubeIDE 1.10.0