Subsections

4.3.2 Rabbit ports

SDCC has three Rabbit-supporting ports: r2k for the Rabbit 2000, r2ka for the Rabbit 2000A, 2000B, 2000C and 3000, r3ka for the Rabbit 3000A, 4000 and 6000. Some Rabbits support different memory types (Rabbit 4000 and later), different memory access modes (Rabbit 5000 and later), different instruction modes (Rabbit 4000 and later). All SDCC ports assume 8-bit memories, 8-bit memory access mode, 00/default instruction set mode (the code generated is also compatible with 10 and 01 instruction set mode, but not 11/enhanced instruction set mode).

4.3.2.1 Port choice

Ports vs. Device R2K R2kK R2KB R2KC R3K R3KA R4K R5K R6K
r2k Y y y y y y y N y
r2ka n Y Y Y y y y N y
r3ka N N N N N Y Y N Y

Legend:

Y - The code this port generates is the best for this CPU.

y - The code this port generates will work on this CPU.

N - The code this port generates will not work on this CPU.

n - The code this port generates will typically not work on this CPU.

There are multiple wait state bugs present in some of the the Rabbits. The difference between the r2k and r2ka port is additional wait state bug workarounds. If all memory used has zero wait states, code from the r2ka backend can be safely run on the original Rabbit 2000.

The r2k and r2ka port assume that the whole stack has the same number of wait states (code from the r2k and r2ka ports can fail is the stack spans memories with a different amount of wait states).

The Rabbit 2000 has some wait state bugs that SDCC does not work around. These bugs result in the number of wait states used being one less than configured for some instructions. The workaround has to be supplied by the user, by configuring all memories that do use wait states to use on additional wait state.

For all Rabbit ports, SDCC assumes that all data memory is at least as fast (i.e. does not need more wait states) as all code memory. Code where this is not the case (e.g. code in fast Flash writing into slow battery-backed SRAM) will have to be written in assembler by hand.

4.3.2.2 Rabbit hardware bugs

Bug R2K R2KA R2KB R2KC R3K R3KA R4K R5K R6K
ioi / ioe prefix bug x                
ddcb / fdcb wait state bug U                
conditional jump wait state bug U                
ldir / lddr wait state bug U                
mul wait state bug w                
ldir / lddr split bug   S              
new ldir / lddr wait state bug w w w w w        
16-bit mode alignment bug               X  
ioi / ioe bit bug               x  
ret cc bug               X  
rmw wait state bug W W W W W W W W  
16-bit vs. 8-bit wait state bug             W    
dma vs stack prot. bug             X    
16-bit dma vs. ldir / lddr / etc. bug             X    

Legend:

x s w u - bug present, worked around by SDCC.

X S W U - bug present, not worked around by SDCC.

w W u U - wait state bug, only relevant when the Rabbit is configured to have wait states for some memory.

s S - instruction / data split bug, only relevant when instruction / data split is enabled, which is currently not supported by SDCC.

u U - bug can be worked around by the user by configuring memory that needs wait states to use one additional wait state.

The 16-bit mode alignment bug only affects 16-bit mode, which is not currently supported by SDCC.

The rmw wait state bug is only relevant when executing fast code writing to slow memory, such as code in fast RAM writing to slow battery-backed SRAM.

The 16-bit vs. 8-bit wait state bug is only relevant when the target system uses both 16-bit and 8-bit memories for code, and the 8-bit memory requires wait states.

The 16-bit dma vs. ldir / lddr / etc. bug is only relevant when using DMA and the target system uses 16-bit memory for code. Since SDCC uses the block move instructions like ldir, lddr, etc. without applying a workaround, this means that code execution and DMA may then not happen at the same time. A possible user workaround is to not use DMA when using 16-bit memory for code. Among all Rabbit 4000-based RCM and BL modules, only the RCM4000 and the RCM4010 use 16-bit memories.

There are no documented Rabbit 6000 bugs, but Rabbit 6000 documentation in general is lacking compared to the other Rabbits.