Share

Small Device C Compiler

Tracker: Bugs

5 initialization issue - ID: 2870890
Last Update: Settings changed ( maartenbrock )

1. For sample code, please see the 'sample.c' attachment.
2. sdcc -mmcs51 --model-small -c src\sample.c
3. SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.9.2 #5492 (Aug 17 2009) (MINGW32)
4. I think I may have found an issue regarding the initialization code used
for the 8051 target. The issue did not appear when using the Keil uVision
dev environment, which is why I thought the issue may be SDCC specific.
Please see the attached snippet.


bughunter2 ( bughunter2 ) - 2009-09-30 17:34

5

Closed

Invalid

Nobody/Anonymous

None

non bugs

Public


Comments ( 6 )

Date: 2009-10-01 01:16
Sender: bughunter2

Maarten,

I apologize deeply for this bug report. The hexadecimal to binary
converter I was using had a bug. The binary file didn't include the null
terminator, but with another converter program it is now included and the
sample code works fine.

Again, sorry!
Jelle


Date: 2009-09-30 22:17
Sender: bughunter2

In sample.rst I see '.ascii "hello, world"' and at the next line '.db
0x00', as expected. The hex file also contains the null terminator.


Date: 2009-09-30 22:09
Sender: maartenbrockProject Admin

Please compile with --debug and look at the generated sample.rst. It should
contain the __str_1 initializer in the CONST area including the 0x00. Also
check the hex file at that address for the 0x00.


Date: 2009-09-30 20:55
Sender: bughunter2

Oh, perhaps I should add that the first 12 bytes ("hello, world") of the
string can correctly be read inside the function test(). Just the zero byte
doesn't seem to be there (which is why I thought something could be wrong
with the initialization).


Date: 2009-09-30 20:44
Sender: bughunter2

It does stop indeed, that is the point of this bug report.


Date: 2009-09-30 20:41
Sender: maartenbrockProject Admin

Jelle,

I don't get it. What is wrong with the code? Since TESTSTR_LEN equals 12
it should never stop in function test, because the character at index 12 is
\0.

If it does stop in function test it could mean that __gptrget() does not
work correctly for code memory on your device.

Maarten


Attached File ( 1 )

Filename Description Download
sample.c Download

Changes ( 5 )

Field Old Value Date By
resolution_id None 2009-10-01 07:16 maartenbrock
artifact_group_id None 2009-10-01 07:16 maartenbrock
status_id Open 2009-10-01 01:16 bughunter2
close_date - 2009-10-01 01:16 bughunter2
File Added 344885: sample.c 2009-09-30 17:34 bughunter2