Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1241 PIC16: Global variable not generated

open
nobody
PIC16
5
2013-07-16
2006-11-18
Goofy
No

when I compile the following code, ep_bdt is not generated. I have to add the dummy function below to make it works.
It seems really strange : such a global variable could be used in an other module, so it has to be generated even if not used in the current module.

command used : sdcc -mpic16 -p18f4455 -c file.c

SDCC version : SDCC : pic16 2.6.1 #4471 (Nov 12 2006) (UNIX)

#include <pic18fregs.h>

/* Buffer descriptors Table */
volatile int __at (0x400) ep_bdt[32];

void dummy_function(void)
{
ep_bdt[0]; // makes the compiler happy !
}

Discussion

  • Maarten Brock
    Maarten Brock
    2010-07-30

    • labels: --> pic16 target
     
  • I'd like to point out (as the reporter of 3037423) that this problem doesn't always appear; I was only able to reproduce it when the variable:
    - is an array, and
    - is positioned with __at
    as well as being unreferenced in the defining file

     
  • Maarten Brock
    Maarten Brock
    2011-09-18

    • summary: Global variable not generated --> PIC16: Global variable not generated
     
    • Category: --> PIC16