Jump to content

Inline Assembly 'bra' Won't Link


Recommended Posts

Bug description:

Inline assembly: bra won't link

 

Steps to reproduce:

The following example code will compile, but not link:

 

void blink(void)
{
asm
{
	btfss _porta,2
	bra	lab1
	bsf	_porta,3
	bsf	_porta,4
lab1:
	bsf _porta,7
}
}

 

The linker gives the following error:

failure

Error: ID referenced doesn't exist yet, original ID:0x0000011A

in Function: 'blink(void)' in File: 'tryout.obj'

 

Substituting the bra with a goto allows the code to link. If _asm is used, the goto is optimised to a bra.

 

 

Expected behaviour:

The code links.

 

Is the problem 100% reproduceable: Yes

 

 

IDE version: 6.70

Compiler: BoostC

Compiler version: 6.70

Target device: PIC18F2450

OS: Windows 2000 SP4

Link to post
Share on other sites

That should be "_lab1" should it not?

Well if the variable is defined in C anyway, you do not indicate if its defined in asm or not ...

 

On related behaviour, does it still fail to link if you give it the relative numerical address instead

of a variable label?

Link to post
Share on other sites

emte,

That should be "_lab1" should it not?

Well if the variable is defined in C anyway, you do not indicate if its defined in asm or not ...

lab1 is an inline assembly label (defined within the asm braces) rather than a variable, and so should be referred to as lab1 in any assembly branch instructions.

 

On related behaviour, does it still fail to link if you give it the relative numerical address instead

of a variable label?

If you mean replace 'bra lab1' with 'bra $+6' then no, this will not compile.

Link to post
Share on other sites

BenvK,

Bug description:

Inline assembly: bra won't link

Yes this is a problem, its now on our bugs list.

Best to use goto for now.

 

Regards

Dave

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...