goyousalukis Posted June 24, 2006 Report Posted June 24, 2006 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 Quote
stryd_one Posted June 24, 2006 Report Posted June 24, 2006 Is that a compile error or linking/assembling? Quote
Thomas Posted June 24, 2006 Report Posted June 24, 2006 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). Quote
mess Posted June 24, 2006 Report Posted June 24, 2006 Hi,have you added the extra C libary for pointers:http://www.ucapps.de/mios/mios_libsdcc_v2_5_0.zip?bye,Michael Quote
stryd_one Posted June 25, 2006 Report Posted June 25, 2006 That is definitely the answer, by the way. Worked for me the other day. It seems the pointers are required for the arrays. Quote
goyousalukis Posted June 25, 2006 Author Report Posted June 25, 2006 Thanks everyone..I'll give it a shot.Justin Quote
goyousalukis Posted June 26, 2006 Author Report Posted June 26, 2006 That was it...perhaps that file should be incuded in the skeleton app?Thanks againJustin Quote
stryd_one Posted June 26, 2006 Report Posted June 26, 2006 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. Quote
stryd_one Posted June 30, 2006 Report Posted June 30, 2006 You can find documentation on how to alter the linker script for larger variables (including big arrays), as a part of the doco for using the 4620:http://www.midibox.org/dokuwiki/doku.php?id=application_development#cHope this helps. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.