2 Replies Latest reply on Apr 11, 2019 5:36 AM by OlPe_282281

    Unused pieces of the design have been optimized out ... Linker Error

    OlPe_282281

      Hello,

       

      today I tried a simple example to read a pin into status register and failed at build time.

       

      *** ERROR L127: UNRESOLVED EXTERNAL SYMBOL

          SYMBOL:  Status_Read

          MODULE:  .\DP8051\DP8051_Keil_951\Debug\main.obj (MAIN)

      *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL

          SYMBOL:  Status_Read

          MODULE:  .\DP8051\DP8051_Keil_951\Debug\main.obj (MAIN)

          ADDRESS: 100075DH

      Program Size: data=14.0 xdata=96 const=40 code=1950

      The command 'LX51.exe' failed with exit code '2'.

       

      Well, the Fitter tells

       

      ADD: mpr.M0037: information: Unused pieces of the design have been optimized out. See the Tech mapping section of the report file for details.

       

      where the report file doesn't give any new/more informations to me. In deed, the generated Status.c contains

       

      #if !defined(Status_sts_sts_reg__REMOVED) /* Check for removal by optimization */

      ...

      uint8 Status_Read(void)

      {

          return Status_Status;

      }

      ...

       

      where cyfitter.h holds:

      /* Status */

      #define Status_sts_sts_reg__REMOVED 1u

       

      All this explains the problem faced me but doesn't solve it since is problem is related to code generation stage ...  A documentation search also doesn't brought more clearity.

       

      So, where is a check mark and documentation about those optimization? Optmization on hardware level is a good thing (obvioulsy happened here) but the software is forgotten - how to fix it?

       

      Thanks!