onguard icon indicating copy to clipboard operation
onguard copied to clipboard

Compiling for Raspberry Pi

Open JonnyTech opened this issue 3 years ago • 1 comments

Is the project able to work with ARMHF for Raspberry Pi?

Very simple test code:

program ogtest;
uses
  sysutils,onguard,ogutil;
const
  CKey:TKey=($DE,$AD,$BE,$EF,$CA,$FE,$BA,$BE,$FA,$CE,$FE,$ED,$B1,$6B,$00,$B5);
var
  regcode:TCode;
begin
  InitRegCode(CKey,'RegStr',EncodeDate(2022,12,31),regcode);
  writeln(BufferToHex(regcode,SizeOf(regcode)));
end.

Compiles OK for Linux x86-64:

Target OS: Linux for x86-64
Compiling ogtest.pp
Compiling onguard.pas
Compiling ogutil.pas
Compiling ogconst.pas
Writing Resource String Table file: ogconst.rsj
onguard.pas(949,2) Note: User defined: Make sure we have some FreeBSD and MacOSX support too at some point 
onguard.pas(954,3) Note: Local variable "RegKey" not used
onguard.pas(957,3) Note: Local variable "Drive" not used
Linking ogtest.x86_64-linux
4302 lines compiled, 0.4 sec, 688000 bytes code, 373712 bytes data
3 note(s) issued

But intel assembler and MaxStructSize errors for Linux ARMHF:

Target OS: Linux for ARMHF
Compiling ogtest.pp
Compiling onguard.pas
onguard.inc(58,3) Error: Illegal assembler style specified "INTEL"
Compiling ogutil.pas
onguard.inc(58,3) Error: Illegal assembler style specified "INTEL"
ogutil.pas(71,32) Error: Illegal expression
ogutil.pas(77,29) Error: Identifier not found "MaxStructSize"
ogutil.pas(77,66) Error: Can't evaluate constant expression
ogutil.pas(266,1) Fatal: There were 5 errors compiling module, stopping
Fatal: Compilation aborted

Does Illegal assembler style specified "INTEL" mean that it cannot work with ARM?

Also, looking for MaxStructSize in the FPC sounce (trunk) yields no results.

JonnyTech avatar Jan 21 '21 16:01 JonnyTech

In onguard.inc, commenting out ASMMODE INTEL seems to compile:

{$IFDEF FPC}
 {$MODE OBJFPC}{$H+}
 {.$ASMMODE INTEL}
{$ENDIF}
Target OS: Linux for ARMHF
Compiling ogtest.pp
Compiling onguard.pas
Compiling ogutil.pas
Compiling ogconst.pas
Writing Resource String Table file: ogconst.rsj
onguard.pas(949,2) Note: User defined: Make sure we have some FreeBSD and MacOSX support too at some point 
onguard.pas(954,3) Note: Local variable "RegKey" not used
onguard.pas(957,3) Note: Local variable "Drive" not used
Linking ogtest
4299 lines compiled, 0.4 sec, 748000 bytes code, 274944 bytes data
3 note(s) issued

Is this safe?

JonnyTech avatar Jan 21 '21 16:01 JonnyTech