From 5c18758b126b123776914ddb7f9ef35165dbe991 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 18 Feb 2018 18:30:28 +0000 Subject: [PATCH] + based on a patch by Christo Crause create a define for the selected controller type (FPC_MCU_...), resolves #33191 git-svn-id: trunk@38284 - --- compiler/options.pas | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/compiler/options.pas b/compiler/options.pas index d88a357f6b..ddcfb2adac 100644 --- a/compiler/options.pas +++ b/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