CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Why does the compiler insert a NOP at the beginning of a fcn

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dtemplar



Joined: 16 Feb 2004
Posts: 5

View user's profile Send private message

Why does the compiler insert a NOP at the beginning of a fcn
PostPosted: Mon Feb 16, 2004 4:31 am     Reply with quote

Rolling Eyes

I have my code somewhat like this:

#org 508, 520 auto=on
void _fcn()
{
#asm
code1
code2
...
#asm
}

and I get this disassembly:

0x508 NOP
0x50A code1
0x50C code2
0x50E ...

Now my question is what's the NOP doing there?

tnx.
Ttelmah
Guest







Re: Why does the compiler insert a NOP at the beginning of a
PostPosted: Mon Feb 16, 2004 5:07 am     Reply with quote

dtemplar wrote:
Rolling Eyes

I have my code somewhat like this:

#org 508, 520 auto=on
void _fcn()
{
#asm
code1
code2
...
#asm
}

and I get this disassembly:

0x508 NOP
0x50A code1
0x50C code2
0x50E ...

Now my question is what's the NOP doing there?

tnx.

It is making it work!...
If you read the 'errata' sheet for some chips like the 18Fxx2, there is a fault, for which the 'bodge round' (from MicroChip), is to require the insertion of an 'FFFF' (which executes as a 'NOP', but is not a normal NOP instruction), as the first instruction for any call or goto destination.
There is a similar bodge required for table read operations.
The fix is only needed if your code uses addresses beyond 0x4000 (if not, you can turn the bodge off with the device editor).
The compiler inserts the fix for all chips where the fault is known.
When the compiler first appeared for some of these chips, there were continuous 'oddities', and while a lot of them were faults with the compiler, a few were faults with the chip. When this fix appeared, the reliability of the code improved massively.

Best Wishes
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Mon Feb 16, 2004 7:19 am     Reply with quote

This error which is readily apparent in any code that crosses the 4000
address and should have resulted in a recall of all these chips. As Ttelmah
says CCS have patched it. This error points out very serious quality and testing failures at Microchip and without the pain inflicted by a costly recall I don't see why the situation will change going forward. In future the purchasers of Microchip parts could again pay in full for a defective part and pay again for updates to compilers to cover it over. Now there is no such thing as perfection but this addressing flaw is way too big an error to have been merely dumped in errata. What's next for errata " shift instructions don't work in xxxx devices". My problem with the 4000 error was that everybody but Microchip lost time and money on it.
dtemplar



Joined: 16 Feb 2004
Posts: 5

View user's profile Send private message

PostPosted: Mon Feb 16, 2004 9:06 pm     Reply with quote

Thanks guys!
Razz
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group