Hello,
I would like to link a variable with address in OTP memory to easily access the data in it. Let's say it is the LF LPO Trim value I want to read... How can I do this?
For given data type
typedef struct {
unsigned int hflpo_trim : 8;
unsigned int lflpo_trim : 8;
unsigned int max_hclk : 16;
}TRIM_STRUCT;
I have created variable:
const TRIM_STRUCT trim_val; #pragma DATA_SECTION(trim_val, "REG_OTP_LPO_TRIM");
Data section is defined within the .cmd file:
MEMORY
{
M_REG_OTP_LPO_TRIM (R) : origin=0xF00801B4 length=0x00000001
}
SECTIONS
{
REG_OTP_LPO_TRIM : type=NOLOAD > M_REG_OTP_LPO_TRIM
}
When building, I get an error: #10099-D program will not fit into available memory. Run placement with alignment fails for section "REG_OTP_LPO_TRIM" size 0x4 . Well, I modified the.cmd code into:
...
M_REG_OTP_LPO_TRIM (R) : origin=0xF00801B4 length=0x00000004
...
Building is successful now. But during debugging, reading of trim_val.lflpo_trim (or any other, surely non-zero OTP register) returns zero. Watching the trim_val.lflpo_trim expression returns "Memory map prevented reading 0xF00801B4".