Jump to content

Recommended Posts

Posted

can anyone tell me why I get an error with this:

void send_word(unsigned char stuff[], unsigned int length) __wparam
{
	unsigned int i = 0;
	for (i = 0;i < length; i++)
		IIC_SPEAKJET_TransmitByte(stuff[i]);
}
I get this error:
error: missing definition for symbol "__gptrget1", required by "_output\main.o"
The error occurs due to the reference to the array in the transmit function. If I replace it with:
		IIC_SPEAKJET_TransmitByte(141);

no errors.

Thanks for any help!

Justin

Posted

void send_word(unsigned char stuff[], unsigned int length) __wparam

{

unsigned int i = 0;

for (i = 0;i < length; i++)

IIC_SPEAKJET_TransmitByte(stuff);

}

I cannot interpret this errors, but in your function are at least two:

Rewrite the functionheader to

void send_word(unsigned char* stuff, unsigned char length)

0. _wparam is not needed (but this is not an error),

1. Arrays in C are assigned to function via pointer (to the first element)

2. SDCC does not allow arrays longer than 256 element, nor does it allow 16bit-Integers as index for arrays.

Look for an older thread I started. I noticed this too.

SDCC is not ANSI-SDCC, think about it as a more or less C-Style programming language. And avoid 16bit-Integers whenever possible (if you don't need numbers above 256 or below -128)! It would blow up your resuilting asm-code significantly (up to doubled size).

Posted

I think there's a good argument for and against adding the file to the skeleton... Using that library can increase your code size - although it should only add in the parts that are needed by your code, so if you include the library, but don't use it, it should make no difference to the final code size.

Personally I would almost always use the lib so I think it would be best included in the skeleton. Of course that means making alterations to the linker. I have some other suggestions for improvement to the linker script specifically for C projects, so I will suggest both of these when I discuss that.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...