cpuinfo.pas 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. {
  2. Copyright (c) 1998-2002 by the Free Pascal development team
  3. Basic Processor information for the Xtensa
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. Unit CPUInfo;
  11. {$i fpcdefs.inc}
  12. Interface
  13. uses
  14. globtype,
  15. systems;
  16. Type
  17. bestreal = double;
  18. bestrealrec = TDoubleRec;
  19. ts32real = single;
  20. ts64real = double;
  21. ts80real = type extended;
  22. ts128real = type extended;
  23. ts64comp = comp;
  24. pbestreal=^bestreal;
  25. { possible supported processors for this target }
  26. tcputype =
  27. (cpu_none,
  28. cpu_lx106,
  29. cpu_lx6
  30. );
  31. Type
  32. tfputype =
  33. (fpu_none,
  34. fpu_soft,
  35. fpu_libgcc
  36. );
  37. Type
  38. tcontrollertype =
  39. (ct_none,
  40. ct_esp8266,
  41. ct_esp32_d0wd,
  42. ct_esp32_d2wd,
  43. ct_esp32_sOwd
  44. );
  45. tcontrollerdatatype = record
  46. controllertypestr, controllerunitstr: string[20];
  47. cputype: tcputype; fputype: tfputype; abi: tabi;
  48. flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
  49. end;
  50. Const
  51. { Is there support for dealing with multiple microcontrollers available }
  52. { for this platform? }
  53. ControllerSupport = true;
  54. {# Size of native extended floating point type }
  55. extended_size = 12;
  56. { target cpu string (used by compiler options) }
  57. target_cpu_string = 'xtensa';
  58. { calling conventions supported by the code generator }
  59. supported_calling_conventions : tproccalloptions = [
  60. pocall_internproc,
  61. pocall_safecall,
  62. pocall_stdcall,
  63. { same as stdcall only different name mangling }
  64. pocall_cdecl,
  65. { same as stdcall only different name mangling }
  66. pocall_cppdecl,
  67. { same as stdcall but floating point numbers are handled like equal sized integers }
  68. pocall_softfloat,
  69. { used for interrupt handling }
  70. pocall_interrupt
  71. ];
  72. cputypestr : array[tcputype] of string[8] = (
  73. '',
  74. 'LX106',
  75. 'LX6'
  76. );
  77. fputypestr : array[tfputype] of string[10] = (
  78. 'NONE',
  79. 'SOFT',
  80. 'LIBGCC'
  81. );
  82. { We know that there are fields after sramsize
  83. but we don't care about this warning }
  84. {$WARN 3177 OFF}
  85. embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
  86. (
  87. (controllertypestr:''; controllerunitstr:''; cputype:cpu_none; fputype:fpu_none; abi: abi_default; flashbase:0),
  88. (controllertypestr:'ESP8266'; controllerunitstr:'ESP8266'; cputype:cpu_lx106; fputype:fpu_none; abi: abi_xtensa_call0; { flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024 }),
  89. (controllertypestr:'ESP32_D0WD'; controllerunitstr:'ESP32_D0WD'; cputype:cpu_lx6; fputype:fpu_none; abi: abi_xtensa_windowed; flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024),
  90. (controllertypestr:'ESP32_D2WD'; controllerunitstr:'ESP32_D2WD'; cputype:cpu_lx6; fputype:fpu_none; abi: abi_xtensa_windowed; flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024),
  91. (controllertypestr:'ESP32_S0WD'; controllerunitstr:'ESP32_S0WD'; cputype:cpu_lx6; fputype:fpu_none; abi: abi_xtensa_windowed; flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024)
  92. );
  93. { Supported optimizations, only used for information }
  94. supported_optimizerswitches = genericlevel1optimizerswitches+
  95. genericlevel2optimizerswitches+
  96. genericlevel3optimizerswitches-
  97. { no need to write info about those }
  98. [cs_opt_level1,cs_opt_level2,cs_opt_level3]+
  99. [{$ifndef llvm}cs_opt_regvar,{$endif}cs_opt_loopunroll,cs_opt_tailrecursion,
  100. cs_opt_stackframe,cs_opt_nodecse,cs_opt_reorder_fields,cs_opt_fastmath,cs_opt_forcenostackframe];
  101. level1optimizerswitches = genericlevel1optimizerswitches;
  102. level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches +
  103. [{$ifndef llvm}cs_opt_regvar,{$endif}cs_opt_stackframe,cs_opt_tailrecursion,cs_opt_nodecse];
  104. level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches + [cs_opt_scheduler{,cs_opt_loopunroll}];
  105. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
  106. type
  107. tcpuflags =
  108. (
  109. CPUXTENSA_REGWINDOW
  110. );
  111. tfpuflags =
  112. (
  113. FPUXTENSA_DUMMY
  114. );
  115. const
  116. cpu_capabilities : array[tcputype] of set of tcpuflags =
  117. (
  118. { cpu_none } [],
  119. { cpu_lx106 } [],
  120. { cpu_lx6 } [CPUXTENSA_REGWINDOW]
  121. );
  122. fpu_capabilities : array[tfputype] of set of tfpuflags =
  123. (
  124. { fpu_none } [],
  125. { fpu_soft } [],
  126. { fpu_libgcc } []
  127. );
  128. Implementation
  129. end.