Jump to content


Unexpected Type in Array Reference


  • You cannot reply to this topic
1 reply to this topic

#1 Jonathan

    Member

  • Members
  • PipPip
  • 25 posts

Posted 05 June 2009 - 11:28 AM

I keep getting an Unexpected type in array reference error when trying to compile hardware for the third line of the following code:

for ( i = 0; i < 6; i++ ) {
co_stream_read( testInStream, &buffer[i], 1 );
add_short.symbol[i] = buffer[i];
hash_entry.symbol[i] = buffer[i];
}

Both add_short.symbol and buffer are co_uint8 arrays. I don't understand.

#2 RalphBodenner

    Advanced Member

  • Admin
  • PipPipPip
  • 348 posts

Posted 10 June 2009 - 10:19 AM

Hi Jonathan,

This error is related to the limitations on support for structs in the Impulse C compiler, but the message is not terribly lucid about the source of the problem.

From the section "Constraints for Hardware Processes" in the CoDeveloper User Guide:

Limited support for C structs
Structs are supported in C hardware processes, with the following restrictions:
· Structs may not be assigned to other structs
· Structs (or arrays of structs) cannot be used as parameters to co_* functions
· Structs may not be used in global variables/arrays
· Hardware primitive functions cannot have struct parameters or return values
· Structs cannot be autoinitialized
· Structs cannot contain fields that are themselves structures, pointers, or arrays
· Bit fields are not supported
· Pointers to structures are not supported

As a workaround, I would suggest flattening the array into a wide unsigned integer type, or storing it outside a struct.

Regards,
Ralph
Ralph Bodenner
Impulse Accelerated Technologies, Inc.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users