View previous topic :: View next topic |
Author |
Message |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
How to add a NOP at 0x000? |
Posted: Thu Feb 11, 2016 11:55 am |
|
|
I make a research a month ago here and found a post where is explained how to add a NOP at 0x000 but I'm not able to find it now.
As far I remember it was to lines one that tell to the compiler that the code must start at 0x002 and also the reset vector.
the second line insert the NOP itself, something like
_________________ Electric Blue |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1345
|
|
Posted: Thu Feb 11, 2016 12:10 pm |
|
|
The #build directive handles moving the reset vector (and interrupt vector table). You'll have to do that before the #ROM will work. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Thu Feb 11, 2016 12:23 pm |
|
|
I have to ask why you need to do this ?
Jay |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Thu Feb 11, 2016 12:25 pm |
|
|
I found the post!
https://www.ccsinfo.com/forum/viewtopic.php?p=54131
and the code that make the trick is...
Code: |
// Tell compiler to put reset code at address 0x0002,
// instead of at 0x0000, as is normally done.
#build(reset=0x0002)
#ROM 0 = {0xFFFF} // Insert NOP at address 0
|
_________________ Electric Blue |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Thu Feb 11, 2016 12:28 pm |
|
|
temtronic wrote: | I have to ask why you need to do this ?
Jay |
Some chips have a silicon bug that unexpectedly reset the PIC in certain conditions, and because I'm have some troubles with unexpected resets I adding this code in order to discard that possibility. _________________ Electric Blue |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19497
|
|
Posted: Thu Feb 11, 2016 1:41 pm |
|
|
CCS will automatically add that fix for chips that are affected. In the device editor you can turn the fixes for particular errata on and off. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Thu Feb 11, 2016 1:48 pm |
|
|
so you are proposing making the reset vector 4 byte space look like THIS??
0: NOP
1: NOP
2,3: GOTO <main>
OMG - i suppose this will work with ZEROS on 16f/18f but what on earth is
it supposed o FIX????????
Last edited by asmboy on Thu Feb 11, 2016 1:54 pm; edited 1 time in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19497
|
|
Posted: Thu Feb 11, 2016 1:54 pm |
|
|
There was about one model of one processor perhaps 10 years ago, that gave a problem if there wasn't a NOP there. It was only one revision.
What puzzles me, is that the post he points to, explains exactly how to apply the fix. So why the question?. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19497
|
|
Posted: Thu Feb 11, 2016 3:43 pm |
|
|
As I said, this fix is automatically done for you.
If you create a project using the 6720, and compile it, you will see at the top of the list file:
Code: |
*
00000: NOP
00002: GOTO 0006
.................... #include <main6720.h
|
Went back 5 years, and all the compilers do it.
When that post was made, the 6720 A4, was new out, and the fix had only just been published. Unless using a ten year old compiler, or somebody has turned the fix off, there is no need to do this.
In the device editor, it is 'put NOP at 0000', and is ticked for this chip. |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Fri Feb 12, 2016 7:05 am |
|
|
Ttelmah wrote: | CCS will automatically add that fix for chips that are affected. In the device editor you can turn the fixes for particular errata on and off. |
I didn't know that.
Quote: | What puzzles me, is that the post he points to, explains exactly how to apply the fix. So why the question?. |
Who are you talking to? _________________ Electric Blue |
|
|
|