Access Violation on QEMU (ARM) lazarus / 32-Linux ---------------------------------------------------------------------- Tesla2k · 2018-07-07 14:55 Hello, I am developing a software for my Raspberry Pi, with cross compilation from Windows. On the Pi the software runs without problems. To make testing easier I want to use QEMU to emulate the pi. I downloaded the package from https://sourceforge.net/projects/rpiqemuwindows/ But I get an access violation when starting the app: Code: [Select]An unhandled exception occurred at $0002F1EC: EAccessViolation: Access violation   $0002F1EC This also happens when I try it with a newly created empty app. I have intalled the stable version of Lazarus with fpcupdeluxe. Why does it work on the real raspberry and not in QEMU? How can I fix it? Thank You ---------------------------------------------------------------------- sash · 2018-07-07 19:24 Since you didn't provide any code I could only guess there are some missing / wrong version libraries inside virtual image os. It's a good practice to wrap critical and suspicious places with try-except block, to know what and when goes wrong. Also, inspect your executable for missing library dependencies with Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ldd your_executable ---------------------------------------------------------------------- Tesla2k · 2018-07-08 14:42 It is just an empty project, so no code written at all. I checked the executable with ldd. All there were no missing libraries ---------------------------------------------------------------------- marcov · 2018-07-08 15:30 Then QEMU bug is most likely. IS there a list of know problems for the architecture that you use? ---------------------------------------------------------------------- Tesla2k · 2018-07-13 16:00 Quote from: marcov on July 08, 2018, 05:30:48 pmThen QEMU bug is most likely. IS there a list of know problems for the architecture that you use? I found a Bug list for ARM. There are some entries resulting in an acces violation. But I don't know wether they are connected to my problem https://bugs.launchpad.net/qemu/+bugs?field.tag=arm If its a bug it must be something only Lazarus does. X and every programm installed with raspian which I tried works. ---------------------------------------------------------------------- Tesla2k · 2018-07-13 16:03 I made some more test: 1. I console programm with just writeln works 2. As soon as I add 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 uses Classes; the error occurs. Here is a backtrace from gdb Code: [Select]Starting program: /home/pi/project1 Program received signal SIGILL, Illegal instruction. 0x00010750 in SYSTEM_$$_BARRIER () (gdb) bt #0  0x00010750 in SYSTEM_$$_BARRIER () #1  0x0001a0c8 in SYSTEM_$$_READWRITEBARRIER () #2  0x0008bd6c in SYSUTILS$_$TMULTIREADEXCLUSIVEWRITESYNCHRONIZER_$__$ $_CREATE$$TMULTIREADEXCLUSIVEWRITESYNCHRONIZER () #3  0x0005cf0c in CLASSES_$$_COMMONINIT () #4  0x00066418 in CLASSES_$$_init$ () #5  0x00031f90 in fpc_initializeunits () #6  0x00010184 in main () at project1.lpr:71 ---------------------------------------------------------------------- Laksen · 2018-07-13 16:07 What parameters did you give to qemu? ---------------------------------------------------------------------- Tesla2k · 2018-07-13 16:23 Quote from: Laksen on July 13, 2018, 06:07:07 pmWhat parameters did you give to qemu? qemu-system-arm.exe  -redir tcp:2222::22 -M versatilepb -cpu arm1176 -hda 2012-07-15-wheezy-raspbian.img -kernel kernel-qemu -m 192 -append "root=/dev/sda2" ---------------------------------------------------------------------- Thaddy · 2018-07-13 16:28 Are you by any chance using the VideoCore? Because that is not supported by QEMU. I ran into that while developing the OpenVG port. Usually I develop on the pi itself (even Pi1) ---------------------------------------------------------------------- Tesla2k · 2018-07-13 18:25 Quote from: Thaddy on July 13, 2018, 06:28:32 pmAre you by any chance using the VideoCore? Because that is not supported by QEMU. I ran into that while developing the OpenVG port. Usually I develop on the pi itself (even Pi1) I don't think so. This is my whole testprogramm Code: Delphi  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1; {$mode objfpc}{$H+} uses Classes; begin end.         I don't know gdb so well, but it seems that the dmb command is the problem: Code: [Select]Dump of assembler code for function SYSTEM_$$_BARRIER: => 0x00010750 <+0>:     dmb     sy    0x00010754 <+4>:     bx      lr ---------------------------------------------------------------------- Laksen · 2018-07-14 09:46 You need to compile a new compiler and your program for armv6z. ARM1176 is an ARM6 core but often labelled as armv7l which is some marketing designation that doesn't exist ---------------------------------------------------------------------- Thaddy · 2018-07-14 09:52 Quote from: Laksen on July 14, 2018, 11:46:22 amYou need to compile a new compiler and your program for armv6z. ARM1176 is an ARM6 core but often labelled as armv7l which is some marketing designation that doesn't exist Ahum: he didn't mention his Raspberry Pi version. That makes a huge difference. later RPi 2's and 3 are definitely ARMv7+: ARM Cortex-A7 x4 , resp. ARM Cortex-A53 x4 and 3 also support AARCH64. I suspect he has a 2 or 3. The 1 (and the zero family) are ARM1176 and armv6. The later models, except the zero, are as above. A properly configured QEMU should have no problems (except it has no proper VideoCore IV simulation.) ---------------------------------------------------------------------- Laksen · 2018-07-14 09:54 Quote from: Thaddy on July 14, 2018, 11:52:56 amQuote from: Laksen on July 14, 2018, 11:46:22 amYou need to compile a new compiler and your program for armv6z. ARM1176 is an ARM6 core but often labelled as armv7l which is some marketing designation that doesn't exist Ahum: he didn't mention his Raspberry Pi version. The qemu commandline explicitly selects arm1176 ---------------------------------------------------------------------- Thaddy · 2018-07-14 10:03 Then he has indeed a higher version of the Pi and needs to specify the proper processor to emulate. The other option is to rebuild an fpc compiler for ARMv6. That generates code that is compatible wit all three flavors.