What is the best way to place strings in absolute code memory? In my 
programs, I put a header section that contains copyright info and other 
stuff that our in-house programming software uses to determine which 
hardware it is programming. In assembly it looks like this...

INFO CODE    0x0100
     dt    "Copyright © 2012My Company, Inc.", 0x0D, 0x0A
     dt    "SuperX Module v.1.0.0 Built 07/14/2012 12:00:00", 0x0D,0x0A
     END

Apparently, something like this is not supported:
    static __code unsigned char __at(0x0100) info[] =
       "Copyright blah blah\n"
       "SuperX Module.....";

(I imagine that even if the above was supported, it would use the PIC's 
"packed" string storage... DA instead of DT... which I can't use, anyway.)

So we have to go to assembly. By trial and error, I have concluded that 
__asm / __endasm and __asm__ need to be inside of a method, i.e. cannot 
be global. So I created a dummy method that looks like this (in a file 
by itself)...

void info(void)
{
     __asm
     org 0x0100
     dt    "Copyright © 2012My Company, Inc.", 0x0D, 0x0A
     dt    "SuperX Module v.1.0.0 Built 07/14/2012 12:00:00", 0x0D,0x0A
     __endasm;
}

However, the ORG statement causes a linker error: 'multiple sections 
using address 0x100'. If I comment out the ORG, the code is not absolute 
and I cannot figure out any compiler options to place it absolutely. If 
I add an org statement within the first method in my main file, things 
seem to link ok (seems less than ideal).

Is this really the best way to do this?

Thanks
-drew

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to