I have used the CYG_HAL_TABLE mechanism before with success, but I am
now running into an alignment problem with a new application. This is
on an ARM architecture.
I have an object defined as:
typedef struct
{
....
} CYG_HAL_TABLE_TYPE MY_TYPE;
I then declare the HAL table array as:
CYG_HAL_TABLE_BEGIN( _MY_LABEL_, _my_name_ );
CYG_HAL_TABLE_END( _MY_LABEL_END_, _my_name_ );
I then place two instances of the object into the HAL table array:
MY_TYPE my_instance1 CYG_HAL_TABLE_QUALIFIED_ENTRY(_my_name_, 2) =
{
....
};
MY_TYPE my_instance2 CYG_HAL_TABLE_QUALIFIED_ENTRY(_my_name_, 3) =
{
....
};
I then iterate the table using:
MY_TYPE *p;
for (p=&(_MY_LABEL_[0]); p!=&(_MY_LABEL_END_); p++)
{
}
This fails due to alignment issues:
The _MY_LABEL_ is not at the same address as the first element in
the array (my_instance1) due to alignment issues. The iteration then
fails. _MY_LABEL_ is aligned on a 4 byte boundary and the array
elements are aligned on 16 byte boundaries. Is there any way to make
this work?
Jay