I think I found a bug in the SDCC compiler. More
information below (especially point 4).
1. sample code: see attachment
- if you installed d52 (hex file decompiler), ajust the
makefile so the CFLAGS macro points to the directory
where fx2regs is installed. Then, run: make
- if you didn't install d52, run: sdcc main.c
3. version: 2.5.3
4. I'm using a Cypress FX2 chip. This chip makes use of
an enhanced 8051 processor. In my c file I included the
OED = 0x3F;
OED is a special function register and it's location is
specified in fx2regs.h:
sfr OED = 0xB5;
I expected a line like:
mov B5h, #3Fh
in the main.d52 file (which means: set 3F to address
B5), but there is no such line.
However, there is a line stating:
mov 28h, #3Fh
which means move 3F to address 28, but this is the
wrong address!!!! I also discovered the following line:
mov 28h, #b5h
So, the right value for OED is stored at location 28h.
It seems to me location 28h should be 'dereferenced'.
Instead of 28h there should stay @28h. However,
according to me, this is not allowed (I thought it was
only allowed for register 0 and 1)
I think the symbol table should take care of the
address of OED. Isn't it possible to take the address
of OED from the symbol table?
I'm very sorry that I cannot locate the exact problem.
I'm not to deep into compiler stuff. I hope you are:P,
and you can help me. Thanks in advance!!!
5. firstname.lastname@example.org (if you have time to
send me more information I would appreciate that. My
professor will be impressed (and I too) :P)