Jump to content

Recommended Posts

I got a bankswitching linker error

 

Building...

 

Failure

Internal Error: Trying to add bank switching for var that has no memory allocated:'' ('gbl_simportsB',0x10000CB3)

 

 

compiler option -d _TEST_

in dac.h

#ifdef    _TEST_

extern    uchar           simportsA;
extern    uchar            simportsB;
#define pwrDACchip        simportsA.0
#define pwrDigReceiver    simportsA.1
#define deviceButton        simportsA.2
#define recvIRport        simportsB.0
#define recvSigport        simportsB.1
#define RC5led        simportsB.2
#define lcdBacklight        simportsB.3
#define deviceDecoder_A1    simportsB.4
#define deviceDecoder_A2    simportsB.5

#else

extern volatile bit        pwrDACchip;
extern volatile bit        pwrDigReceiver;
extern volatile bit    recvIRport;
extern volatile bit        recvSigport;
extern volatile bit     RC5led;
extern volatile bit    lcdBacklight;
extern volatile bit     deviceDecoder_A1;
extern volatile bit     deviceDecoder_A2;
extern volatile bit     deviceButton;

#endif // _TEST_


in main.c


#ifdef    _TEST_
uchar    simportsA;
uchar    simportsB;

// ports below defined as simports.bits in dac.h
#else
volatile bit    pwrDACchip@PORTA.0;
volatile bit    pwrDigReceiver@PORTA.1;
volatile bit        deviceButton@PORTA.2;
volatile bit       recvIRport@PORTB.0;
volatile bit    recvSigport@PORTB.1;
volatile bit    RC5led@PORTB.2;
volatile bit       lcdBacklight@PORTB.3;
volatile bit        deviceDecoder_A1@PORTB.5;
volatile bit        deviceDecoder_A2@PORTB.6;
#endif // _DEBUG

 

The ports above are just (still) random asigned ports but that code is ignored because of #ifdef

 

I bypassed this isue by defining the individual simportsA and simportsB bits as individual variables like

 

uchar pwrDACchip= 0;

uchar pwrDigReceiver= 0;

uchar recvIRport= 0;

uchar recvSigport= 0;

etc.

Edited by fred
Link to post
Share on other sites
I changed  #else to #elif which is used in standard include files aswell.

 

unfortunately it doesn't seems to make any difference

 

 

Maybe you have a different reference than i do but that is still wrong in mine ...

You can either do:

#ifdef _TEST_
#endif

#ifndef _TEST_
#endif

OR

#if defined(_TEST_)
#elif defined(!_TEST_)
#else
#endif

But you can not mix the two types.

Link to post
Share on other sites

Fred,

I got a bankswitching linker error

 

Building...

 

Failure

Internal Error: Trying to add bank switching for var that has no memory allocated:'' ('gbl_simportsB',0x10000CB3)

You should never get to see Internal error messages. They indicate that something is not being handled correctly inside the compiler or linker and need to be reported ;)

This one is a known problem, see:bug report here.

 

This problem has been fixed and will available in the next release.

If you don't think its the same problem let us know.

 

Regards

Dave

Link to post
Share on other sites

@dave

 

Not 100% sure but it's probably the same thing.

 

I'm getting away to use that (var.bit) construction in macro's because it's giving me a bit too much problems.

 

Have to wait for that next release before using it again. :P

 

 

 

@Picxie

don't know where the #else is for then

 

I don't seem to have any problems with this construction anyway

#ifdef _TEST_

#warning "ifdef _TEST_"

#else

#warning "else"

#endif

 

and system.h is using it... ;)

Link to post
Share on other sites
Not according to K and R.

 

K&R is ANSI 89 is it not? which is pretty antiquated,

but since you showed me yours i'll show you mine ;)

 

Both the O'Reilly C and C++ Pocket Refs as well as my

great 'ol C++ Black Book. Normally only refer to my C

pocket ref though for PIC stuff, less standard PC library

references.

Edited by emte
Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...