[fpc-devel] How can I distribute code in two different memory areas? (.section)

Sergei Gorelkin sergei_gorelkin at mail.ru
Mon Jun 17 08:20:29 CEST 2013


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



More information about the fpc-devel mailing list