Hi,

c18 uses #pragma to define the section for the following code.
Do we have __attribute__(section) or something like that in SDCC?

If you can control the section for a function, you can play with the gplink
linker script to place any "single function section" anywhere you want.

Sebastien

Le 30/08/2011 11:07, Kustaa Nyholm a écrit :
> On 8/30/11 01:23, "Mario" <marbar...@gmail.com> wrote:
>
>> Just as described at section 3.6.
>> I have managed to make it work partially, for example, I can decide
>> the address in the RAM of variables only when they are globally
>> defined.
> How could you define the address of a local variable? Conceptually
> it is in the stack and the address varies from invocation to
> invocation. 
>
>
>> But I had to find out about this by myself, because the
>> manual did not mention this.
> Well in view of what I wrote to me that is obvious.
>
>> The way I had to do it:
>>    unsigned char __data  myChar;
> Isn't that what was in the manual?
>
>> But if I place the __data __at 0x30 part before the unsigned char
>> part, it will work anyway. The manual does not mention about this
>> either.
> So? It is the nature of C that the order everything in definitions
> is not fixed and does not always follow human logic. I don't think
> the manual needs to spell out all the variations. I guess you could
> write that as 'unsigned __at 0x30 char __data myChar'?
>
>
>> I tried this example literally from the manual:
>>    __code __at (0x7ff0) char Id[5] = ²SDCC²;
>>
>> But when compiling it throws:
>>    error 9: FATAL Compiler Internal Error in file 'glue.c' line
>> number '937' : !"Initialized char-arrays are not yet supported, assign
>> at runtime instead."
>>    Contact Author with source code
> This a limitation of the (current) compiler implementation, maybe could
> have been mentioned in the manual, on the otherhand this maybe specific
> to the backend/processor you are targeting and the error pretty
> much spells out the situation and the remedy. Good enough for me.
>
>
>> What I want to do now is to make a function start exactly at a certain
>> address in code memory but I find no way how to do it.
> Zafi showed you a workaround. Again this I do not see this as a
> documentation issue, if the compiler does not support some non standard
> feature I do not see that needs to be documented. There are endless
> number of non standard features the compiler does not support.
>
> In a rare occasion this (placing a function at a fixed address) is
> a legitime and reasonable requirement but no compiler (documentation)
> (writer) can fore see all the corner cases.
>
>> I tried also to create a *var = "with-text", with its data located in
>> RAM memory, but no luck, it is always stored somehow at code memory.
> Makes sense to me as ANSI C defines string literals as unmodifiable.
> Why would you want them to be in RAM (which typically is more scarce
> than ROM in small processors and placing them in the RAM would
> still require a copy in ROM)?
>
> br Kusti
>
>
>> On Mon, Aug 29, 2011 at 3:10 AM, Kustaa Nyholm
>> <kustaa.nyh...@planmeca.com> wrote:
>>> On 8/29/11 00:00, "Mario" <marbar...@gmail.com> wrote:
>>>> Is this a currently working feature? can someone provide me some piece
>>>> of code where absolute addressing actually works?
>>> I'm not sure what you re talking about with 'absolute addressing',
>>> please show some code...
>>>
>>> br Kusti
>>>
>>>
>>>
>>> -------------------------------------------------------------------------
>>> -----
>>> EMC VNX: the world's simplest storage, starting under $10K
>>> The only unified storage solution that offers unified management
>>> Up to 160% more powerful than alternatives and 25% more efficient.
>>> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
>>> _______________________________________________
>>> Sdcc-user mailing list
>>> Sdcc-user@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>>>
>> --------------------------------------------------------------------------
>> ----
>> Special Offer -- Download ArcSight Logger for FREE!
>> Finally, a world-class log management solution at an even better
>> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
>> download Logger. Secure your free ArcSight Logger TODAY!
>> http://p.sf.net/sfu/arcsisghtdev2dev
>> _______________________________________________
>> Sdcc-user mailing list
>> Sdcc-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>>
>
> --
> Kustaa Nyholm
> Research Manager, Software
> Research and Technology Division
> PLANMECA OY
> Asentajankatu 6
> 00880 HELSINKI
> FINLAND
>
> Please note our new telephone and fax numbers!
> Tel: +358 20 7795 572 (direct)
> Fax: +358 20 7795 676
> GSM: +358 40 580 5193
> e-mail: kustaa.nyh...@planmeca.com
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better 
> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> download Logger. Secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to