Other Parts Discussed in Thread: C2000WARE
Tool/software:
Hi,
I have problems accessing the addres of variables which are marked with the byte_peripheral attribute inside a struct.
This part compiles without issues:
typedef unsigned long bp_32 __attribute__((byte_peripheral));
bp_32 var = 1;
bp_32 *varPtr = &var; // points to var
But if I encapsulate the variable in a struct, this does not work anymore:
struct {
uint32_t val1;
bp_32 val2;
} aStruct;
bp_32 *structVal1Ptr = &aStruct.val1; // works fine
bp_32 *structVal2Ptr = &aStruct.val2; // fails
The error message I'm getting in the last line is "Illegal use of intrinsic: __byte_peripheral_32" which is also a bit strange since I'm using the attribute. Guess that the compiler is just doing some kind of search/replace of the attribute.
This is quite in my way as I sometimes want to access the address of some registers which in this case does not work if they are marked with byte_peripheral.
Here is an example which also fails:
volatile bp_32 *perRegPtr = &CanbRegs.CAN_IF3UPD;
I'm using version 22.6.1 LTS from the latest C2000 Ware version 5.02.00.00.
Do you have a tip how I can get this working?
Thanks a lot and best regards,
Oliver