[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] internal compiler error:
From: |
John Dubery |
Subject: |
Re: [Gm2] internal compiler error: |
Date: |
Sat, 10 Jun 2017 13:05:49 +0000 |
Gaius,
Here are the 3 sub-modules.
Thanks,
John
DEFINITION MODULE RPiMailbox;
EXPORT QUALIFIED WriteToMbox, ReadFromMbox;
PROCEDURE WriteToMbox(Channel: INTEGER; Message: CARDINAL; VAR Error:
INTEGER);
PROCEDURE ReadFromMbox(Channel: INTEGER; VAR Result: CARDINAL; VAR
Error: INTEGER);
END RPiMailbox.
IMPLEMENTATION MODULE RPiMailbox;
VAR
(* Table 3.1 Mailbox Addresses *)
MBoxRead [2000B880H]: CARDINAL; (*Receiving mail. *)
MBoxPoll [2000B890H]: BITSET; (*Receive without retrieving.*)
MBoxSender [2000B894H]: BITSET; (*Sender information. *)
MBoxStatus [2000B898H]: BITSET; (*Information.*)
MBoxConfiguration [2000B89CH]: BITSET; (*Settings. *)
MBoxWrite [2000B8A0H]: CARDINAL; (*Sending mail. *)
CONST Clear= {31};
PROCEDURE WriteToMbox(Channel: INTEGER; Message: CARDINAL; VAR Error:
INTEGER);
VAR TempBool: BOOLEAN;
BEGIN
Error:=0;
IF Channel>15 THEN Error:=1; RETURN END; (* channel has to go into
bottom 4 bits *)
IF (Message DIV 16)*16#Message THEN Error:- 2; RETURN END; (* message
in top 28b only *)
REPEAT (* nothing *) UNTIL NOT (BITSET(Clear) IN MBoxStatus) (*({31}
IN MBoxStatus)*);
MBoxWrite:= Channel + Message*16; (* MBox value has message in top
28 bits and channel in bottom 4 *)
END WriteToMbox;
PROCEDURE ReadFromMbox(Channel: INTEGER; VAR Result: CARDINAL; VAR
Error: INTEGER);
VAR TempResult: CARDINAL; ChannelRead: INTEGER;
BEGIN
Error:=0;
REPEAT
REPEAT (* nothinbg*) UNTIL NOT (BITSET(Clear) IN MBoxStatus)
(*({31} IN MBoxStatus)*);
TempResult:= MBoxRead;
ChannelRead:= TempResult MOD 16; (* channel is bottom 4 bits *)
UNTIL Channel=ChannelRead;
Result:= (TempResult DIV 16)*16; (* top 28b only *)
END ReadFromMbox;
END RPiMailbox.
DEFINITION MODULE RPiGPIOControl;
EXPORT UNQUALIFIED FlashError, FlashNumber;
PROCEDURE FlashError;
PROCEDURE FlashNumber(Number: INTEGER);
END RPiGPIOControl.
IMPLEMENTATION MODULE RPiGPIOControl;
FROM RPiTimer IMPORT Delay;
VAR GPIOcontrol[20200000H]: ARRAY [1..6] OF BITSET;
GPIOon[2020001CH]: ARRAY [1..2] OF BITSET;
GPIOoff[20200028H]: ARRAY [1..2] OF BITSET;
GPIOinput[20200034H]: BITSET;
VAR i, j: CARDINAL;
PROCEDURE FlashError;
VAR j: INTEGER;
BEGIN
GPIOcontrol[2]:= {3*(17-10)};
FOR j :=1 TO 5 DO
GPIOon[1]:= {17};
Delay(250000);
GPIOoff[1]:= {17};
Delay(500000);
GPIOon[1]:= {17};
Delay(250000);
GPIOoff1]:= {17};
Delay(500000);
GPIOon[1]:= {17};
Delay(250000);
GPIOoff[1]:= {17};
Delay(500000);
END; (*FOR*)
END FlashError;
PROCEDURE FlashNumber(Number: INTEGER);
VAR j: INTEGER;
BEGIN
GPIOcontrol[2]:= {3*(17-10)};
FOR j:= 1 TO Number DO
GPIOon[1]:= {17};
Delay(1000000);
GPIOoff[1]:= {17};
Delay(500000);
END;
END FlashNumber;
END RPiGPIOControl.
DEFINITION MODULE RPiTimer;
EXPORT QUALIFIED Delay;
PROCEDURE Delay( Microsecs: CARDINAL);
END RPiTimer.
IMPLEMENTATION MODULE RPiTimer;
VAR Timercontrol[20003000H]: BITSET;
TimerCounter[20003004H]: CARDINAL;
PROCEDURE Delay( Microsecs: CARDINAL);
VAR initial: CARDINAL;
BEGIN
initial:=TimerCounter;
WHILE
TimerCounter < initial+Microsecs
DO (*nothing*) END;
END Delay;
BEGIN
Timercontrol:={}; (* good idea? *)
END RPiTimer.
On 10/06/17 13:39, Gaius Mulley wrote:
> John Dubery <address@hidden> writes:
>
>> Gaius,
>> I get the following error:
>>
>> In function ‘_M2_ScreenTest_init’:
>> cc1gm2: internal compiler error: in convert_loc, at
>> gm2/gm2-lang.c:822
>> Please submit a full bug report,
>> with preprocessed source if appropriate.
>> See <http://gcc.gnu.org/bugs.html> for instructions.
>>
>> when compiling:
>>
>> MODULE ScreenTest;
>> FROM SYSTEM IMPORT ADDRESS;
>> FROM RPiMailbox IMPORT
>> WriteToMbox, ReadFromMbox;
>> FROM RPiGPIOControl IMPORT
>> FlashError, FlashNumber;
>>
>> TYPE FrameBufferType=
>> RECORD
>> PhysicalWidth: INTEGER;
>> PhysicalHeight: INTEGER;
>> VirtualWidth: INTEGER;
>> VirtualHeight: INTEGER;
>> GPUPitch: INTEGER;
>> BitDepth: INTEGER;
>> X: INTEGER;
>> Y: INTEGER;
>> GPUPointer: ARRAY [1..4096] OF CARDINAL;
>> GPUSize: INTEGER;
>> END;
>> FrameBufferPtrType= POINTER TO FrameBufferType;
>>
>> VAR
>> FrameBuffer: FrameBufferType;
>> FrameBufferPtr: FrameBufferPtrType;
>> Result: CARDINAL;
>> ErrorNumber: INTEGER;
>> X, Y, i: CARDINAL;
>>
>> BEGIN
>> FrameBufferPtr:= ADDRESS (FrameBuffer);
>> WITH FrameBufferPtr^ DO
>> PhysicalWidth:=1024;
>> PhysicalHeight:=768;
>> VirtualWidth:=1024;
>> VirtualHeight:=768;
>> GPUPitch:=0;
>> BitDepth:=16;
>> X:=0;
>> Y:=0;
>> GPUPointer:=ADDRESS(0);
>> GPUSize:=0;
>> END;
>>
>> WriteToMbox(1, CARDINAL(FrameBufferPtr)+40000000H, ErrorNumber);
>> IF ErrorNumber#0 THEN FlashError; FlashNumber(ErrorNumber) END;
>> ReadFromMbox(1, Result, ErrorNumber);
>> IF ErrorNumber#0 THEN FlashError; FlashNumber(ErrorNumber) END;
>>
>> (* Display colours systematically *)
>> i:= 1;
>> FOR X:= 1 TO 1024 DO
>> FOR Y:= 1 TO 768 DO
>> INC(i);
>> FrameBufferPtr^.GPUPointer[i]:= i;
>> END;
>> END;
>>
>> END ScreenTest.
>>
>> The command was:
>> gm2 -Wextra -save-temps ScreenTest.mod
>> I can't find any relevant files in /tmp.
>> I get the same error on AMD64 and ARM.
>> On AMD64 I'm running Ubuntu 16.04, gm2 is 5.2.0, gcc is 5.4.0 20160609
>> (Ubuntu 5.4.0-6ubuntu1~16.04.4).
>> On the Raspberry Pi I'm running Raspbian. 'uname -a' gives:
>> Linux dubery2-rpi 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l
>> GNU/Linux
>> gm2 is 4.7.4 , gcc is 4.6.3 (Debian 4.6.3-14+rpi1).
>> Would you like the sub-modules? Any advice to work around this?
>>
>> Thanks,
>> John
> Hello John,
>
> many thanks for the report -
>
>> Would you like the sub-modules? Any advice to work around this?
> yes please - if possible. So I can run the compiler and inspect it as
> it fails under gdb. I'll keep the code in my non-free code test tree
> (and only look at it when debugging gm2),
>
> regards,
> Gaius
> .
>