Question:
How to define a structure by pm specification and how to define only a “pm” bus access to structure variable while accessing structure member functions.
Answer:
Below is an example of memory space specification keywords in struct statements.
struct s {int x; int y; int z;};
static pm struct s mystruct={10,9,8};
Please Note that the pm specification is not used in the structure definition. The pm specification
is used when defining the variable mystruct.
The PM qualifier does the following:
1.It puts the variable into the seg_pmda input section by default.
2.The compiler assumes that the variable is placed in a different memory block from non-PM variables, meaning that there should be no block conflict when accessing them concurrently.
3.It tells the compiler that the variable can be accessed using the PM bus, but it does not force it.
For a struct, the PM qualifier does apply to every component of the struct.
In practice, the compiler tends to use PM accesses for accesses through pointers and for array accesses with a variable index, but not for direct accesses to global variables and their components.
Hence, PM accesses can be triggered by passing a pointer to the global struct instead of accessing the struct directly.