cyberjok
Member level 1
ARM some registers are only word accessible...
so any idea to make compiler(IAR) access 0x0x40090120 ONLY base on word type?
- - - Updated - - -
(unsigned int *)0x0x40090120 = (unsigned int *)(&x_temp);
-----
- - - Updated - - -
a solved idea as follow shows; but it is not simple...
Code C - [expand] 1 2 3 4 5 6 struct { unsigned x1: 3; unsigned x2: 13; } x @ 0x0x40090120; //0x40090120 ONLY WORD ACCESSIABLE x.x2 = 2; // NOW ARM will enter hard fault handler;
so any idea to make compiler(IAR) access 0x0x40090120 ONLY base on word type?
- - - Updated - - -
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 typedef struct { unsigned x1: 3; unsigned x2: 13; } x_t; x_t x_temp; x_temp = (x_t *)0x0x40090120; x_temp.x2 = 2;
(unsigned int *)0x0x40090120 = (unsigned int *)(&x_temp);
-----
- - - Updated - - -
a solved idea as follow shows; but it is not simple...
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 typedef struct { unsigned x1: 3; unsigned x2: 13; } x_t; x_t x_temp; (unsigned int *)(&x_temp) = (unsigned int *)0x0x40090120 ; x_temp.x2 = 2; (unsigned int *)0x0x40090120 = (unsigned int *)(&x_temp);
Last edited by a moderator: