This problem is so bizarre I thought not to post here as I must be doing something obviously wrong, although I cannot myself figure out what.
I have a "for" loop that erroneously never ends when an array variable of type "mic_array_frame_time_domain" is accessed inside the loop. When I comment out the variable's access the loop ends as expected. I can also force the loop to end by putting a test of the index inside the loop and breaking on the desired index value. I can access and modfiy other variables in the loop with no problem.
This is occurring in code I have based on the low resolution delay example (AN00219), modified to work with different hardware and different parameters. The basic problem looks as follows (with "nSamp" the index and "current" the variable showing the bizarre behavior):
Code: Select all
while(1)
{
mic_array_frame_time_domain * current = mic_array_get_next_time_domain_frame(c_ds_output, DECIMATOR_COUNT, buffer, audio, dc);
for(uint8_t nMic = 0; nMic < MIC_ARRAY_NUM_MICS; nMic++)
{
for(uint8_t nSamp = 0; nSamp < (uint8_t)FRAME_SIZE; nSamp++)
{
c_audio <: current->data[nMic][nSamp]; // send the audio data out over the channel.
}
}
}
// etc. ...
This is running in a region marked unsafe.
My flag settings are XCC_FLAGS = -O2 -g -report.
The variable is typedef-ed in lib_mic_array.h:
Code: Select all
typedef struct {
long long alignment; /**<Used to force double work alignment. */
#if MIC_ARRAY_WORD_LENGTH_SHORT
int16_t data[MIC_ARRAY_NUM_MICS][1<<MIC_ARRAY_MAX_FRAME_SIZE_LOG2];/**< Raw audio data*/
#else
int32_t data[MIC_ARRAY_NUM_MICS][1<<MIC_ARRAY_MAX_FRAME_SIZE_LOG2];/**< Raw audio data*/
#endif
mic_array_metadata_t metadata[(MIC_ARRAY_NUM_MICS+3)/4]; /**< Frame metadata*/
} mic_array_frame_time_domain;
I would be grateful if anyone could suggest something to pursue.
Sincerely,
Bill