[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] GCC 6.1.0, strings and PROGMEM
From: |
Senthil Kumar Selvaraj |
Subject: |
Re: [avr-gcc-list] GCC 6.1.0, strings and PROGMEM |
Date: |
Sun, 15 May 2016 14:32:58 +0530 |
User-agent: |
mu4e 0.9.17; emacs 24.5.1 |
Alan Burlison writes:
> I've just updated my toolchain to use GCC 6.1.0 and I notice that
> constant C strings seem to be being placed automatically in PROGMEM,
> rather than requiring the use of the PSTR macro as in the past. This
> caused me some confusion because call such as printf("foo") started
> printing garbage. Here's the proof:
>
> printf(" ");
> 91e: 84 e7 ldi r24, 0x74 ; 116
> 920: 90 e0 ldi r25, 0x00 ; 0
> 922: 9f 93 push r25
> 924: 8f 93 push r24
> 926: 0e 94 04 17 call 0x2e08 ; 0x2e08 <printf>
>
> 74: 20 20 and r2, r0
> 76: 20 20 and r2, r0
> 78: 20 20 and r2, r0
> 7a: 20 20 and r2, r0
> 7c: 20 20 and r2, r0
> 7e: 00 21 and r16, r0
>
> I haven't been able to find any mention of this change anywhere. Is
> this a deliberate change in gcc behaviour, or a bug?
It looks correct to me. From the dissassembly output, I guess you're
looking at contents at 0x0074 in the flash address space. You should
be looking at contents in the data address space instead. Can you try
dumping contents of the .data section, like so (assuming a.out is the ELF
output)
$ avr-objdump -s -j .data a.out
You should see the blank space string at 0x0074 in the output.
Don't know why you're getting garbage output though. Can you post a
testcase that shows the incorrect behavior?
Regards
Senthil
>
> Thanks,
>
> --
> Alan Burlison