'-align' option Question
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello,
I have some open points regarding the usage of ‘-align’ option (I set it in Configuration/ Advanced Settings options for a project):
Question 1: Is this ‘-align’ setting affecting only the storage units inside of a struct Or Is it also overriding the alignment value checked in “Target processor type” options?
Question 2: How is the alignment inside a struct - forced with a bitfield_t xxx :0 construct- interpreted? see sample code below start at next: a)byte; b) int c) as specified by ‘-align’ d) alignment option for the mcu ?
Settings used: -Char 8bits signed, Short 16bits, Int 16bits. - Endianess: Little endian. -Alignment: 32 bits. -Target OS: no-predefined-os. Advanced setting used: -align 8
Sample Code: typedef unsigned int bitfield_t;
union sfrByte_t { int value; struct { bitfield_t bit0 : 3; bitfield_t xxx :0; bitfield_t bit1 : 1; bitfield_t bit7 : 1; } byteFields; } ; union sfrByte_t sfrByte;
void f () { unsigned short var1; sfrByte.value = 0x5A; var1 = sfrByte.byteFields.bit1;
}
void main() { f(); }
Thank you for your kind support, Daniel
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Options at Command Line Only에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!