Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Illegal types for operands: 'unary *'" Error

Status
Not open for further replies.

Jodi999

Programmer
Feb 24, 2004
10
US
I get the following error:

Illegal types for operands: 'unary *'

From the following C code:

unsigned int Add(unsigned int Aoperand, unsigned int Asize)
{
SET_PKA_PKCP_REG_A(Aoperand, Asize); //error points here
}

where:

#define PKA_CONTROL_REG_ADDR 0x01006000

#define PKA_PKCP_FUNCTION_REG_ADDRESS ((unsigned int)(PKA_CONTROL_REG_ADDR + 0x8C))

#define PKA_PKCP_REG_A_ADDRESS ((volatile unsigned int)(PKA_CONTROL_REG_ADDR + 0x80))

#define PKA_RAM_ADDR 0x01004000

#define PKA_RAM_BYTE_OFFSET(v_addr) ((UINT32)(v_addr) - PKA_RAM_ADDR)

#define SET_PKA_PKCP_REG_A(v_addr, dw_len) *PKA_PKCP_REG_A_ADDRESS = ( ((dw_len) << 16) | PKA_RAM_BYTE_OFFSET(v_addr) )

(I think I included all necessary parts, but if anyone sees that I'm missing something, please respond so.)
 
After preprocessing, you have something like this.
Code:
unsigned int Add(unsigned int Aoperand, unsigned int Asize)
{
*((volatile unsigned int)(0x01006000 + 0x80)) = ( ((Asize) << 16) | ((UINT32)(Aoperand) - 0x01004000) ); 
}
Did you really want this?
Code:
#define PKA_PKCP_REG_A_ADDRESS ((volatile unsigned int[COLOR=red]*[/color])(PKA_CONTROL_REG_ADDR + 0x80))
 
I thought that resolved my error, but it didn't. I'm still getting 'Illegal types for operands: 'unary *', and don't know why.
 
Does this clears your issue?

test.c

#define UINT32 unsigned int

#define PKA_CONTROL_REG_ADDR 0x01006000

#define PKA_PKCP_FUNCTION_REG_ADDRESS ((unsigned int *)(PKA_CONTROL_REG_ADDR + 0x8C))

#define PKA_PKCP_REG_A_ADDRESS ((volatile unsigned int *)(PKA_CONTROL_REG_ADDR + 0x80))

#define PKA_RAM_ADDR 0x01004000

#define PKA_RAM_BYTE_OFFSET(v_addr) ((UINT32 )(v_addr) - PKA_RAM_ADDR)


#define SET_PKA_PKCP_REG_A(v_addr, dw_len) *PKA_PKCP_REG_A_ADDRESS = ( ((dw_len) << 16) | PKA_RAM_BYTE_OFFSET(v_addr) )



unsigned int Add(unsigned int Aoperand, unsigned int Asize)
{
SET_PKA_PKCP_REG_A(Aoperand, Asize); //error points here
}

gcc -c test.c

Adrian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top