Forum Discussion
Altera_Forum
Honored Contributor
15 years agoException Handler for misaligned data memory access
Hi All, I'm after some help... Does anybody have available or point me in the direction of a worked example of an exception handler which processes NIOS2_EXCEPTION_MISALIGNED_DATA_ADDR excepti...
Altera_Forum
Honored Contributor
15 years agoGCC generate the code to do multiple bus cycles to access misaligned data for members of 'packed' structures and structure members with alignment constraint, however it won't let you define a 'pointer to packed int'.
The following does work (retyped):typedef struct { int v; } __attribute__((packed)) packed_int;
struct foo {
char x;
packed_int y;
};
int bar(foo *z)
{
packed_int *p = &z->y;
return p->v;
}