I don't really see how you can avoid the constant being in the program area, but personally I would simply do this, below, although admittedly this would pull in some string manipulation library routines. Whatever you do, the "Hello\n" string is going to have to be stored somewhere that is not volatile in the first instance.
buf="Hello\n"; Another way might be to declare "Hello\n" as a constant, set up a pointer to that constant and then dereference the pointer into volatile memory using a loop, incrementing the pointer each time around, until the null string terminator is encountered, but you're probably not going to save much program space over the library routine that does the same job. You could use some inline assembly language of course... On Thursday 20 November 2008 13:44:32 Vaclav Peroutka wrote: > > ---------------------------------------- > > > > TRISB_bits.TRISB6 = 0; // SCK > > Hello, I just found that direct TRISB6 = 0; works properly. Even if I would > like TRISBbits.TRISB6 = 0; as it is done for PIC16 port. Is there any plans > to synchronize it ? > > I have another question. In SDCC manual I did not find it but maybe > somebody can help me. I currently initialize strings like that: main() { > __data unsigned char buf[10]; > > buf[0] = 'H', buf[1] = 'e'; buf[2] = 'l', buf[3] = 'l', buf[4] = 'o'; > buf[5] = 0x0d; buf[6] = 0x00; SendString( buf); > } > > Is there any more clever way how to initialize buffer with "Hello\n" in > data memory ? But I do not want to have string in program memory and use > GPTRGET. Or the way I did it is the only possible way ? > > Thank you, > Vaclav > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge Build the coolest Linux based applications with Moblin SDK & win > great prizes Grand prize is a trip for two to an Open Source event anywhere > in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Sdcc-user mailing list > Sdcc-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sdcc-user -- Richard. PGP Key-id: 0x5AB3D350 Giving up on assembly language was the apple in our Garden of Eden: Languages whose use squanders machine cycles are sinful. The LISP machine now permits LISP programmers to abandon bra and fig-leaf. -- Epigrams in Programming, ACM SIGPLAN Sept. 1982 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user