[SOLVED] trunk bug for mipsel raised exception internally - Access violation lazarus / 64-FPC development ---------------------------------------------------------------------- Key-Real · 2024-04-22 08:49 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ ./compiler/ppcrossmipsel test.pas -Fu./rtl/ps1 -Fu./rtl/inc -Tps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -CfnoneWarning: Source OS Redefined!Free Pascal Compiler version 3.3.1 [2024/04/22] for mipselCopyright (c) 1993-2024 by Florian Klaempfl and othersTarget OS: PlayStation 1 for MIPSELCompiling test.pastest.pas(1,6) Error: Compilation raised exception internallyFatal: Compilation abortedAn unhandled exception occurred at $00000000004EE58A:EAccessViolation: Access violation  $00000000004EE58A  push,  line 1935 of symdef.pas  ideas? host linux x86_64 ---------------------------------------------------------------------- Key-Real · 2024-04-22 09:46 If some body is inspired to fix this, so he will trow an internal error number as common clone https://gitlab.com/Key-Real/source ---------------------------------------------------------------------- Key-Real · 2024-04-22 13:47 https://gitlab.com/freepascal.org/fpc/source/-/issues/40750 ---------------------------------------------------------------------- nickysn · 2024-04-22 14:05 You should compile the compiler with debug info and try to get a better stack trace. When you build the compiler, add these options to the make command: OPT="-O- -CR -glv -dEXTDEBUG" CROSSOPT="-O- -g-" ALLOW_WARNINGS=1 These debugging options are a little aggressive, but they might be useful when debugging the compiler for a new (and unstable) platform. ---------------------------------------------------------------------- Key-Real · 2024-04-23 08:44 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ ./compiler/ppcrossmipsel test.pas -Fu./rtl/ps1 -Fu./rtl/inc -Tps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -Cfnone -n -vutWarning: Source OS Redefined!Compiler: /home/key-real/vip- code/source/compiler/ppcrossmipselUsing executable path: /home/key- real/vip-code/source/compiler/Using unit path: ./rtl/ps1/Using unit path: ./rtl/inc/Using unit path: ./compiler/Using library path: ./rtl/ps1/Using library path: ./rtl/inc/Using library path: ./compiler/Using object path: ./rtl/ps1/Using object path: ./rtl/inc/Using object path: ./compiler/Searching file test.pas... found(PROGRAM)  Registering new unit SYSTEM(PROGRAM)  Load from PROGRAM (implementation) unit SYSTEM(SYSTEM)   Loading unit SYSTEMUnitsearch: system.ppuSearching file system.ppu... not foundSearching file SYSTEM.PPU... not foundUnitsearch: system.ppSearching file system.pp... not foundSearching file SYSTEM.PP... not foundUnitsearch: system.pasSearching file system.pas... not foundSearching file SYSTEM.PAS... not foundUnitsearch: ./rtl/ps1/system.ppuSearching file ./rtl/ps1/system.ppu... foundPPU Loading ./rtl/ps1/system.ppu(SYSTEM) PPU Name: ./rtl/ps1/system.ppu(SYSTEM)   PPU Time: 2024/04/23 10:36:02(SYSTEM)   PPU Flags: 4224(SYSTEM)   PPU Crc: 81615BB2(SYSTEM)   PPU Crc: 3FC14DEF (intfc)(SYSTEM)   PPU Crc: DE388206 (indc)(SYSTEM)   Number of definitions: 2958(SYSTEM)   Number of symbols: 7783(SYSTEM)   PPU Source: ./rtl/ps1/system.pp time 2024/04/22 08:41:06(SYSTEM)   PPU Source: systemh.inc not found(SYSTEM)   PPU Source: sysosh.inc not available(SYSTEM)   PPU Source: rtldefs.inc not available(SYSTEM)   PPU Source: filerec.inc not available(SYSTEM)   PPU Source: textrec.inc not available(SYSTEM)   PPU Source: innr.inc not available(SYSTEM)   PPU Source: cpuh.inc not available(SYSTEM)   PPU Source: ../mips/cpuh.inc not available(SYSTEM)   PPU Source: currh.inc not available(SYSTEM)   PPU Source: ustringh.inc not available(SYSTEM)   PPU Source: setjumph.inc not available(SYSTEM)   PPU Source: ../mips/setjumph.inc not available(SYSTEM)   PPU Source: rttih.inc not available(SYSTEM)   PPU Source: objpash.inc not available(SYSTEM)   PPU Source: varianth.inc not available(SYSTEM)   PPU Source: dynarrh.inc not available(SYSTEM)   PPU Source: compproc.inc not available(SYSTEM)   PPU Source: heaph.inc not available(SYSTEM)   PPU Source: threadh.inc not available(SYSTEM)   PPU Source: dynlibh.inc not available(SYSTEM)   PPU Source: resh.inc not available(SYSTEM)   PPU Source: excepth.inc not available(SYSTEM) PPU Source: system.inc not available(SYSTEM)   PPU Source: sysos.inc not available(SYSTEM)   PPU Source: mips.inc not available(SYSTEM)   PPU Source: ../mips/mips.inc not available(SYSTEM)   PPU Source: generic.inc not available(SYSTEM)   PPU Source: set.inc not available(SYSTEM)   PPU Source: ../mips/set.inc not available(SYSTEM) PPU Source: genset.inc not available(SYSTEM)   PPU Source: gencurr.inc not available(SYSTEM)   PPU Source: sstrings.inc not available(SYSTEM)   PPU Source: int64p.inc not available(SYSTEM)   PPU Source: ../mips/int64p.inc not available(SYSTEM)   PPU Source: int64.inc not available(SYSTEM)   PPU Source: astrings.inc not available(SYSTEM)   PPU Source: ustrings.inc not available(SYSTEM)   PPU Source: aliases.inc not available(SYSTEM)   PPU Source: rttidecl.inc not available(SYSTEM)   PPU Source: dynarr.inc not available(SYSTEM)   PPU Source: objpas.inc not available(SYSTEM)   PPU Source: except.inc not available(SYSTEM)   PPU Source: variant.inc not available(SYSTEM)   PPU Source: rtti.inc not available(SYSTEM)   PPU Source: setjump.inc not available(SYSTEM)   PPU Source: ../mips/setjump.inc not available(SYSTEM)   PPU Source: sysheap.inc not available(SYSTEM)   PPU Source: heap.inc not available(SYSTEM)   PPU Source: thread.inc not available(SYSTEM)   PPU Source: threadvr.inc not available(SYSTEM)   PPU Source: dynlib.inc not available(SYSTEM)   PPU Source: sysfile.inc not available(SYSTEM)   PPU Source: text.inc not available(SYSTEM)   PPU Source: file.inc not available(SYSTEM)   PPU Source: typefile.inc not available(SYSTEM)   PPU Source: isotmp.inc not available(SYSTEM)   PPU Source: sysdir.inc not available(SYSTEM)   PPU Source: sysres.inc not available(SYSTEM) Finished loading unit SYSTEMSearching file test.pas... foundSearching file test.pas... foundSearching file test.pas... found(PROGRAM)  Registering new unit FPINTRES(PROGRAM)  Load from PROGRAM (implementation) unit FPINTRES(FPINTRES) Loading unit FPINTRESUnitsearch: fpintres.ppuSearching file fpintres.ppu... not foundSearching file FPINTRES.PPU... not foundUnitsearch: fpintres.ppSearching file fpintres.pp... not foundSearching file FPINTRES.PP... not foundUnitsearch: fpintres.pasSearching file fpintres.pas... not foundSearching file FPINTRES.PAS... not foundUnitsearch: ./rtl/ps1/fpintres.ppuSearching file ./rtl/ps1/fpintres.ppu... not foundSearching file ./rtl/ps1/FPINTRES.PPU... not foundUnitsearch: ./rtl/ps1/fpintres.ppSearching file ./rtl/ps1/fpintres.pp... not foundSearching file ./rtl/ps1/FPINTRES.PP... not foundUnitsearch: ./rtl/ps1/fpintres.pasSearching file ./rtl/ps1/fpintres.pas... not foundSearching file ./rtl/ps1/FPINTRES.PAS... not foundUnitsearch: ./rtl/inc/fpintres.ppuSearching file ./rtl/inc/fpintres.ppu... not foundSearching file ./rtl/inc/FPINTRES.PPU... not foundUnitsearch: ./rtl/inc/fpintres.ppSearching file ./rtl/inc/fpintres.pp... foundSearching file test.pas... foundtest.pas(1,6) Error: Compilation raised exception internallyFatal: Compilation abortedAn unhandled exception occurred at $0000000000570E35:EAccessViolation: Access violation  $0000000000570E35  push,  line 1936 of symdef.pas  $00000000007C68FE  AddUnit,  line 204 of pmodules.pas  $00000000007C7634  CheckAddUnit,  line 384 of pmodules.pas  $00000000007C72FF  loaddefaultunits,  line 426 of pmodules.pas  $00000000007CE667  proc_program,  line 2837 of pmodules.pas  $00000000004E1779  compile_module,  line 488 of parser.pas  $0000000000517559  continue,  line 269 of ctask.pas  $00000000005177BF  processqueue,  line 334 of ctask.pas  $000000000043E12F  Compile,  line 310 of compiler.pas  $0000000000401496  $main,  line 308 of pp.pas  $000000000043372D  SysEntry,  line 332 of system.pp ---------------------------------------------------------------------- nickysn · 2024-04-23 14:03 From the debug log it seems like the compiler is trying to load the fpintres unit. Have you compiled this unit? ---------------------------------------------------------------------- Key-Real · 2024-04-23 15:56 Yes, Finally! the system and the fpintres units have to be precompiled! I would wish me a reasonable error message from the compiler to avoid all this discussion ---------------------------------------------------------------------- Antero · 2024-07-06 19:50 Is there a FPC cross compiler, that: 1) Runs on a PC (Windows, either 32- or 64-bit) 2) produces MIPS binaries (I hope I could run these on Mediatek MT7621 / MT7621A CPU). Can I download such FPC cross compiler from somewhere, or do I need to compile it myself ? Are there instructions, how to compile it, if it is not available as a pre-compiled binary ? ---------------------------------------------------------------------- Key-Real · 2024-07-07 16:19 I'm working on the port of FPC for the Playstation 1. So i can only guarantee for the R3000A CPU. ---------------------------------------------------------------------- PascalDragon · 2024-07-07 19:40 Quote from: Antero on July 06, 2024, 09:50:21 pmIs there a FPC cross compiler, that: 1) Runs on a PC (Windows, either 32- or 64-bit) 2) produces MIPS binaries (I hope I could run these on Mediatek MT7621 / MT7621A CPU). Can I download such FPC cross compiler from somewhere, or do I need to compile it myself ? Are there instructions, how to compile it, if it is not available as a pre-compiled binary ? We don't provide a prebuilt cross compiler for MIPS from Windows. But you can easily built it yourself assuming you have suitable binutils available: ensure that the latest release is installed (currently 3.2.2)download the source of the current development version (trunk aka main aka (currently) 3.3.1in the directory of the extracted source execute the following:Code: [Select]make all FPMAKEOPT="-T " CPU_TARGET=mips OS_TARGET= BINUTILSPREFIX= make install FPMAKEOPT="-T " CPU_TARGET=mips OS_TARGET= INSTALL_PREFIX=C:\Where\To\Install Whereby is the number of CPU cores your system has is the operating system you want to compile for (for MIPS this would be mainly either linux or embedded is the prefix of the binutils, e.g. if the binaries have the name mips-elf-as.exe and so on then it would be mips-elf- This will generate a Big Endian 32-bit cross compiler. If you need Little Endian you need to use mipsel instead of mips. And if you need 64-bit you need to use mips64 or mipsel64. Please note that FPC currently only supports the following MIPS sub architectures, so you'll have to check whether the CPU you want to target is supported: MIPS1MIPS2MIPS3MIPS4MIPS5MIPS32MIPS32R2PIC32MX You can pass that to the make all using CROSSOPT=-Cp. If you can't find suitable binutils for you can also compile inside WSL if you have a suitable Windows version. ---------------------------------------------------------------------- Key-Real · 2024-07-07 20:11 Be WARNED! I can only speak of MIPS1. The Assembler Writer of the Trunk generates wrong code. It doesn't handle the ReadAfterWrite MIPS1 issue! This means if You do, lets say, a Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ld [destReg], [mem addr]You can not read from this [destReg] direct after this load. You have to insert a Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i nop of an other suitable Instruction. I fixed this, but my port is not jet in the Trunk because I'm still working on it.