Forum > FPC development

Trouble compiling fpc for mipsel-embedded

(1/2) > >>

ermok:
Hello. I have hard time with fpc target mipsel embedded for microchip pic32 mcus on windows machine.
I have tried several things, building from trunk, using fpcupdeluxe and even some random sources from github. Tried many different binutils but so far no luck.
I'm completly aware there is no mcu specific files or startup asm and thats totally okey, i can write them by mself, actually i prefer low level bare metal programming anyway where i can manipulate registers my own way. For years i've been using mikroe compilers but they do not longer update pascal compilers and i really dont want to go back to C hell. So im hoping FPC is my savior.

Ermo.

ccrause:
What errors do you get?

A quick look at cpuinfo.pas and embedded/MakeFile suggest that controller units are expected, but I cannot find the corresponding units. I would expect building the rtl for mipsel-embedded should fail, but perhaps someone more knowledgeable than me knows how to build this target...

ccrause:
According to the latest trunk test results mipsel-embedded does indeed fail to build due to a missing file: /rtl/embedded/mipsel/startup.s

It would appear as if there was no follow-up to this partial commit, which would explain the missing startup and cpu files.

Here is a bug report describing this issue. Apparently there was a licensing incompatibility with the startup code.  Perhaps you can help by providing a patch for the startup code  ;)

ermok:
Alright, now I understand the problem.
Yes, I can provide startup code, and I really prefer Pascal-style startup code (a separate startup.pas or startup.inc file), and ideally, an easy way to override it from userland.
But to do that, I need a working compiler so I can write, test, and debug it. I'm not sure I can write this blindly.

ccrause:
I tried to get something working by following the wiki instructions, but I had trouble finding a suitable binutils suite that followed the conventions of the compiler generated assembler script.  The ChipKit link was empty, building from the mentioned git project gave errors (even if I went back to the suggested 2013 version. Then I installed Microchip's XC32 compiler, but the binutils as tool did not support the -mabi option! I then build the latest binutils release (2.44) for mipsel and adapted some of the compiler settings (changed subarch from pic32mx to m4k, since vanilla binutils does not understand -mpic32mx) and so forth.

Download binutils from https://sourceware.org/pub/binutils/releases/binutils-2.44.tar.xz, then ../configure --target=mipsel-none-elf --disable-multilib --disable-werror --disable-nls --prefix=/opt/mips

Not sure what toolchain you are using, I hope it is compatible with the tweaks I made.  If not, please advise which toolchain you use, if it is open source I can test it.

The patched FPC is here: https://gitlab.com/ccrause/fpc-source/-/tree/mipsel-embedded?ref_type=heads

You are welcome to look at the basically empty startup and controller units in rtl/embedded/mipsel/ folder.  I assume a bit of assembler code is required to configure the interrupts.  I don't know mipsel controllers, so couldn't come up with even a most basic startup routine.  Look at the other architectures for examples of how one can structure the startup code.

Finally we need the controller units, I can ask Michael Ring for his units, it would save a bit of effort.

Navigation

[0] Message Index

[#] Next page

Go to full version