Преглед изворни кода

+ based on a patch by Christo Crause create a define for the selected controller type (FPC_MCU_...), resolves #33191

git-svn-id: trunk@38284 -
florian пре 7 година
родитељ
комит
5c18758b12
1 измењених фајлова са 19 додато и 0 уклоњено
  1. 19 0
      compiler/options.pas

+ 19 - 0
compiler/options.pas

@@ -3352,6 +3352,8 @@ procedure read_arguments(cmd:TCmdStr);
       abi : tabi;
       fputype : tfputype;
       cputype : tcputype;
+      controller: tcontrollertype;
+      s: string;
     begin
       for cputype:=low(tcputype) to high(tcputype) do
         undef_system_macro('CPU'+Cputypestr[cputype]);
@@ -3361,11 +3363,28 @@ procedure read_arguments(cmd:TCmdStr);
         undef_system_macro('FPU'+fputypestr[fputype]);
       def_system_macro('FPU'+fputypestr[init_settings.fputype]);
 
+{$PUSH}
+{$WARN 6018 OFF} { Unreachable code due to compile time evaluation }
+      if ControllerSupport then
+        begin
+          for controller:=low(tcontrollertype) to high(tcontrollertype) do
+            begin
+              s:=embedded_controllers[controller].controllertypestr;
+              if s<>'' then
+                undef_system_macro('FPC_MCU_'+s);
+            end;
+          s:=embedded_controllers[init_settings.controllertype].controllertypestr;
+          if s<>'' then
+            def_system_macro('FPC_MCU_'+s);
+        end;
+{$POP}
+
       { define abi }
       for abi:=low(tabi) to high(tabi) do
         undef_system_macro('FPC_ABI_'+abiinfo[abi].name);
       def_system_macro('FPC_ABI_'+abiinfo[target_info.abi].name);
 
+
       { Define FPC_ABI_EABI in addition to FPC_ABI_EABIHF on EABI VFP hardfloat
         systems since most code needs to behave the same on both}
       if target_info.abi = abi_eabihf then