4.6.1.10 Errata Option
The -merrata=type
option allows specification of
software workarounds to documented silicon errata issues. A default set of errata apply to
each device, but this set can be adjusted by using this option and the arguments presented
in the table below.
Type | # | Avoided Issue |
---|---|---|
4000 |
0 | Program memory accesses/jumps across 4000h address boundary |
fastints |
1 | Fast interrupt shadow registers corruption |
lfsr |
2 | Broken LFSR instruction |
minus40 |
3 | Program memory reads at -40 degrees |
reset |
4 | goto instruction cannot
exist at Reset vector |
bsr15 |
5 | Flag problems when BSR holds value 15 |
daw |
6 | Broken DAW instruction |
eedatard |
7 | Read EEDAT in immediate instruction after RD set |
eeadr |
8 | Don't set RD bit immediately after loading EEADR |
ee_lvd |
9 | LVD must stabilize before writing EEPROM |
fl_lvd |
10 | LVD must stabilize before writing Flash |
tblwtint |
11 | Clear interrupt registers before
tblwt instruction |
fw4000 |
12 | Flash write exe must act on opposite side of 4000h boundary |
resetram |
13 | RAM contents can corrupt if async. Reset occurs during write access |
fetch |
14 | Corruptible instruction fetch. – applies
FFFFh (nop ) at required locations |
clocksw |
15 | Code corruption if switching to external oscillator clock source – applies switch to HFINTOSC high-power mode first |
branch |
16 | The PC might become invalid when restoring
from an interrupt during a bra or brw
instruction — avoids branch instructions |
brknop2 |
17 | Hardware breakpoints might be affected by
bra instruction — avoids branching to the following
location |
nvmreg |
18 | The program will access data flash rather than program flash memory after a reset — adjusts the NVMCON register |
bsr63 |
19 | Corrupted execution of movff instruction when
the BSR holds 63 |
At present, workarounds are mainly employed for PIC18 devices, but the
clocksw
and branch
errata are only applicable for some
enhanced Mid-range devices.
To disable all software workarounds, use the following.
-merrata=none
To maintain all the default workarounds but disable the jump across 4000 errata, for example, use the following:
-merrata=default,-4000
The value assigned to the preprocessor macro
_ERRATA_TYPES
(see 5.14.2 Predefined Macros) indicates
the errata applied. Each errata listed in Table 4-12 table represents one bit position in the macro’s value, with the topmost errata in the
table being the least significant. That bit position in the _ERRATA_TYPES
macro is set if the corresponding errata is applied. The header file
<errata.h>
contains definitions for each errata value, for
example ERRATA_4000
and ERRATA_FETCH
, which can be used
with the compiler-defined _ERRATA_TYPES
macro to determine which erratas
are in effect.