Forum > Other OS

help needed - m68k embedded based on 3.2.2

<< < (3/3)

PascalDragon:

--- Quote from: parc_de on February 21, 2022, 07:34:23 am ---
--- Quote from: FPK on February 20, 2022, 09:41:06 pm ---
Yes, compiler/systems/t_embed.pas creates no linker script for m68k, see line 259+.

--- End quote ---

So, this answer seems to indicate, that it is possible to get it working ? Do you have an example how such a linker script may look like for this simple example - so I could build it by hand or at least get a starting point ?

--- End quote ---

As a first step you could copy the part inside the {$ifdef i386} … {$endif i386} as a {$ifdef m68k} … {$endif m68k} and work from there. To speed things up you can simply compile the compiler from within Lazarus by opening compiler/ppc68k.lpi and then using compiler/m68k/pp instead of compiler/ppcross68k to compile your main program (as long as you only work inside t_embed you shouldn't need to recompile the RTL).

parc_de:

--- Quote from: PascalDragon on February 21, 2022, 01:51:43 pm ---
As a first step you could copy the part inside the {$ifdef i386} … {$endif i386} as a {$ifdef m68k} … {$endif m68k} and work from there. To speed things up you can simply compile the compiler from within Lazarus by opening compiler/ppc68k.lpi and then using compiler/m68k/pp instead of compiler/ppcross68k to compile your main program (as long as you only work inside t_embed you shouldn't need to recompile the RTL).

--- End quote ---

Ok, I deinstalled all old versions (Linux Mint  19) and downloaded the newest Lazarus packages. I downloaded the 3.3.1 trunc source code and yes indeed, I could create a pp binary and this seems to be a more interactive environment to work with.

I created the {$ifdef m68k} … {$endif m68k} sections in the source code and the test.elf looks now very different - but the application is still not included. So a small step is done - the application is still not in the test.elf ...

Any further tips for the next steps / documentation to read ?

Thanks,

Marten

PascalDragon:

--- Quote from: parc_de on February 21, 2022, 09:16:25 pm ---I created the {$ifdef m68k} … {$endif m68k} sections in the source code and the test.elf looks now very different - but the application is still not included. So a small step is done - the application is still not in the test.elf ...

Any further tips for the next steps / documentation to read ?

--- End quote ---

Because nothing is calling the main function (aka PASCALMAIN) yet. You need to find out how the system you want to start on transfers control to your code (e.g. on i386 one can use the Multiboot specification which is covered by rtl/embedded/i386/multiboot.pp, on the Pi the firmware loads the code at either $8000 (ARM) or $80000 (Aarch64) and then starts executing from there) and then you need to add a function with public name _START (cause that is used as entry at the first line of the link script) which in turn jumps to PASCALMAIN. You can look at the above mentioned multiboot.pp or rtl/embedded/aarch64/raspi3.pp for an inspiration how to do this.

parc_de:

--- Quote from: PascalDragon on February 22, 2022, 09:41:15 am ---
Because nothing is calling the main function (aka PASCALMAIN) yet. You need to find out how the system you want to start on transfers control to your code (e.g. on i386 one can use the Multiboot specification which is covered by rtl/embedded/i386/multiboot.pp, on the Pi the firmware loads the code at either $8000 (ARM) or $80000 (Aarch64) and then starts executing from there) and then you need to add a function with public name _START (cause that is used as entry at the first line of the link script) which in turn jumps to PASCALMAIN. You can look at the above mentioned multiboot.pp or rtl/embedded/aarch64/raspi3.pp for an inspiration how to do this.

--- End quote ---

THAT was the information: _START. Adding _START at the beginning of my new runtime library code (prtl0.s) solved most of the problems. The generated code was there in the test.elf output - though relocated for a wrong address, but thats a progress.

Thank you !

PascalDragon:

--- Quote from: parc_de on February 22, 2022, 01:48:37 pm ---The generated code was there in the test.elf output - though relocated for a wrong address, but thats a progress.

--- End quote ---

I think you can control that with the . = 0x100000 at the start of the SECTIONS block of the linker script. If that works you could in theory use the imagebase global instead of a hard coded value. This variable is set by -WBxxx (though you'll need to allow that option for system_m68k_embedded (in compiler/options.pas at around line 2756)).

Navigation

[0] Message Index

[*] Previous page

Go to full version