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

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
OlPe_282281
Level 2
Level 2
Welcome! 10 replies posted 5 replies posted

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!

0 Likes
1 Solution
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received

Hi,

You should connect Pin in this way to the status Register in order to read the pin status via status register:

pastedImage_0.png

View solution in original post

0 Likes
2 Replies
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received

Hi,

You should connect Pin in this way to the status Register in order to read the pin status via status register:

pastedImage_0.png

0 Likes
OlPe_282281
Level 2
Level 2
Welcome! 10 replies posted 5 replies posted

Ah, damn - the pin wasn't connected properly .... Thanks!

0 Likes