This is a MPLAB specific issue
The compiler generates a .register section with the
udata_ovr directive, the section is always located to
0x0000
Unfortunately such sections can only be located to a
"DATABANK" - the given example in the SDCC doc which
specifies 0x00-0x7f as "ACCESSBANK" does not work, the
linker returns following error message (example):
Error - section '.registers' can not fit the absolute
section. Section '.registers' start=0x00000000,
length=0x00000008
There are two possible workarounds, but both produce
other problems which are not solvable with the current
MPLAB release 7.11
1) replace "udata_ovr" by "udata_acs" in the generated
.asm file before it is passed to the assembler.
Problem: access sections cannot be overlayed, this
means: it works so long only one C file is compiled and
linked, but it leads to conflicts once multiple C files
are used
2) replace ACCESSBANK by DATABANK in the linker file.
The linker passes now, but it produces instructions in
BANKED mode if the access type is not specified
This can be checked with a disassembler - a "movf
r0x01, W" results to "movf r0x01, W, BANKED"
A proper solution would be a change in SDCC: if ",
ACCESS" is added to all instructions (except for movff,
etc...) which are using overlayed registers, it is
guaranteed that the linker will generate the right
opcodes (I've checked this with a converter script)
SDCC version:
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.5.0 #1020 (May 8 2005) (MINGW32)
Thorsten.Klose@gmx.de
Logged In: YES
user_id=1115835
I have just fixed (?) this in SDCC #1029 by suffixing all
neccessary instructions with either ", ACCESS" or ", BANKED"
(if ---mplab-comp is given).
Does this close the bug or is there additional work needed
regarding banks/naming/udata_ovr vs. udata_acs?
Logged In: YES
user_id=911832
I guess that additional changes are not required
(renaming udata_ovr to udata_acs wouldn't help, since
udata_acs sections cannot be overlayed)
thank you!