|
最近数据存EEPROM带ECC,考虑到使用寿命,按规格书要求4字节存1个参数,搞出了这个写法。
- #include <stdio.h>
- #include <stdint.h>
- typedef struct
- {
- uint8_t __attribute__((aligned (4))) a;
- uint8_t __attribute__((aligned (4))) b;
- uint8_t __attribute__((aligned (4))) c;
- }Aligned_Struct;
- int main()
- {
- Aligned_Struct demo;
- printf("0x%X 0x%X 0x%X", (uint32_t)&demo.a, (uint32_t)&demo.b, (uint32_t)&demo.c);
- return 0;
- }
复制代码
规格书写寿命脚注:
The Write cycle endurance is defined for groups of four data bytes located at addresses [4*N, 4*N+1, 4*N+2, 4*N+3] where N is an integer.
|
|