From: Michael W. <mv...@oz...> - 2001-04-20 11:26:16
|
Hi all, I've been working on a new 8051 project using SDCC after not looking at it since its early days. I'm very impressed with the progress, and I've only found one compiler bug so far - great job! I'm using the Borland builds of asx8051 v1.70 and sdcc v2.2.1. To get the bug report out of the way: I have a const table of 256 words (unsigned ints) in the code segment. Looking up an entry in this table using a byte (unsigned char) index variable generates incorrect code which truncates the table offset to a single byte, causing wraparound. My current workaround is to cast the index var to a word. My problem is the initialisation of static variables. IIRC the C standard requires that all statics without explicit initialisers must be cleared, but SDCC doesn't do this, so I suppose this is a bug. Easily fixed, I think, pulling up _startup.c to add the little snippet of code needed to clear all internal RAM. My C version produced awful code (it didn't use @Rn indexing) so I tried writing it in inline assembly. However, despite its docs asx8051 doesn't seem to support that addressing mode either - it chokes on "mov @R0,a". So I'm currently unable to init RAM correctly. Could this assembler bug be fixed ASAP (or a workaround suggested), and consideration given to having the standard C startup code do this? Thanks! |