[fpc-devel] How can I distribute code in two different memory areas? (.section)
Michael Ring
mail at michael-ring.org
Tue Jun 18 12:33:22 CEST 2013
pdecsub.pas looks like the place to look for, there I also found the
declarations for the other keywords that work with procedures/functions.
I am still not understanding enough of the inner workings of the
compiler so if anybody feels the urge to implement this please go ahead
;-) , for me this would be something for the longterm to try to do it
myself, first I would like to get support for pic32mx done, this burns
more under my fingernails and I am still not atb the end of the learning
curve there.
Michael
Am 17.06.13 15:54, schrieb Pierre Free Pascal:
> Maybe the section keyword that was introduced for embedded systems for variables
> (see compiler/pdecvar.pas unit, look for _SECTION and try_consume_sectiondirective)
> should be extended to function/procedure header parsing.
>
>
> procedure reset; assembler; nostackframe; public name'_reset'; section '.reset,"ax", at progbits';
> would then do all you want.
>
> Pierre Muller
>
>> -----Message d'origine-----
>> De : fpc-devel-bounces at lists.freepascal.org [mailto:fpc-devel-
>> bounces at lists.freepascal.org] De la part de Jeppe Græsdal Johansen
>> Envoyé : lundi 17 juin 2013 08:54
>> À : FPC developers' list
>> Objet : Re: [fpc-devel] How can I distribute code in two different memory
>> areas? (.section)
>>
>> Den 17-06-2013 08:20, Sergei Gorelkin skrev:
>>> 16.06.2013 23:39, Michael Ring пишет:
>>>> I had some time this weekend (while beeing grilled by the sun on my
>>>> balcony) to work on another
>>>> thing that did not work correct and that I did not understand (Now I
>>>> do, I least I hope ;-)
>>>>
>>>> As said before in this thread, I wanted to distribute Code in two
>>>> different memory areas because
>>>> this needs to be done so that pic32 startup code works correctly.
>>>>
>>>> But when I linked my binary the elf-file had always a startup address
>>>> somewhere in the wrong memory
>>>> area.
>>>>
>>>> This is what I tried:
>>>>
>>>> procedure reset; assembler; nostackframe; public name'_reset';
>>>> asm
>>>> .section ".reset,\"ax\", at progbits"
>>>> la $k0, _startup
>>>> jr $k0 //Jump to startup code
>>>> nop
>>>> .text
>>>> end;
>>>>
>>> In general, the custom section support in compiler needs a lot of
>>> improvement...
>>>
>>> Try the following, maybe it could work:
>>>
>>> procedure anyname; assembler; nostackframe;
>>> asm
>>> .section ".reset,\"ax\", at progbits"
>>> .globl _reset
>>> _reset: // <-- correct name here
>>> la $k0, _startup
>>> jr $k0
>>> nop
>>> .text
>>> end;
>>>
>>>
>>> Regards,
>>> Sergei
>> I agree that it needs some work. Having a way to specify the section
>> with a procedure directive would largely be preferable I think. Such a
>> directive could also be interesting for variables and typed constants
>>
>> Also, I think
>> .section ".reset"
>> should work just fine in most cases
>> _______________________________________________
>> fpc-devel maillist - fpc-devel at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
More information about the fpc-devel
mailing list