Recent

Author Topic: Determine platform  (Read 492 times)

LemonParty

  • Full Member
  • ***
  • Posts: 160
Determine platform
« on: March 10, 2025, 06:43:46 pm »
How to determine if code compiled for ARM and which bitness of ARM is used?

MarkMLl

  • Hero Member
  • *****
  • Posts: 8364
Re: Determine platform
« Reply #1 on: March 10, 2025, 06:46:33 pm »
unix file command.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

LemonParty

  • Full Member
  • ***
  • Posts: 160
Re: Determine platform
« Reply #2 on: March 10, 2025, 06:58:05 pm »
What conditional defines defined when compiling for ARM?

TRon

  • Hero Member
  • *****
  • Posts: 4272
Re: Determine platform
« Reply #3 on: March 10, 2025, 07:01:49 pm »
Are you asking which ones there are (they are listed here)  or actually in use (compile with -va to see for yourself) ?

PS: afaik FPC is not aware of bi-endianess at runtime in case that is what is itching your vibe.
« Last Edit: March 10, 2025, 07:06:59 pm by TRon »
Today is tomorrow's yesterday.

LemonParty

  • Full Member
  • ***
  • Posts: 160
Re: Determine platform
« Reply #4 on: March 10, 2025, 07:07:56 pm »
https://www.freepascal.org/docs-html/prog/progap7.html here is "CPUARM   Free Pascal target is an ARM 32-bit processor" but no define for ARM 64-bit processor.

Warfley

  • Hero Member
  • *****
  • Posts: 1872
Re: Determine platform
« Reply #5 on: March 10, 2025, 07:17:16 pm »
Code: Pascal  [Select][+][-]
  1. const isARM = {$IFDEF CPUARM}True{$Else}False{$EndIF};
  2. const isLE = {$IFDEF ENDIAN_LITTLE}True{$Else}False{$EndIF};

TRon

  • Hero Member
  • *****
  • Posts: 4272
Re: Determine platform
« Reply #6 on: March 10, 2025, 07:25:16 pm »
https://www.freepascal.org/docs-html/prog/progap7.html here is "CPUARM   Free Pascal target is an ARM 32-bit processor" but no define for ARM 64-bit processor.
Oh, ic. The list is not updated. It is CPUAARCH64. You can always use CPU64 and CPU32 as alternative. Like said, invoke the compiler with -va and in case not native with target CPU and platform options to see what the compiler defines (and undefines) for compilation.
« Last Edit: March 10, 2025, 07:27:44 pm by TRon »
Today is tomorrow's yesterday.

LemonParty

  • Full Member
  • ***
  • Posts: 160
Re: Determine platform
« Reply #7 on: March 11, 2025, 08:59:38 am »
Thank you. CPUAARCH64 works.

 

TinyPortal © 2005-2018