Browse Source

* don't load the controller unit if the currently compiled unit *is* the controller unit (which might happen if one compiles the controller unit as part of a program)

Sven/Sarah Barth 3 years ago
parent
commit
c3f27a2f1c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      compiler/pmodules.pas

+ 2 - 1
compiler/pmodules.pas

@@ -410,7 +410,8 @@ implementation
         { CPU targets with microcontroller support can add a controller specific unit }
         if ControllerSupport and (target_info.system in (systems_embedded+systems_freertos)) and
           (current_settings.controllertype<>ct_none) and
-          (embedded_controllers[current_settings.controllertype].controllerunitstr<>'') then
+          (embedded_controllers[current_settings.controllertype].controllerunitstr<>'') and
+          (embedded_controllers[current_settings.controllertype].controllerunitstr<>current_module.modulename^) then
           AddUnit(embedded_controllers[current_settings.controllertype].controllerunitstr);
 {$pop}
 {$ifdef XTENSA}