avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Possible bug in stdio.h *_P functions


From: Tavish Naruka
Subject: [avr-gcc-list] Possible bug in stdio.h *_P functions
Date: Tue, 16 Aug 2016 14:56:58 +0530

Hi

I'm linking a program as a bootloader with --section-start, everything is working fine, except that stdio functions with _P do not work as expected, once I link the same program with --section-start=0x00, it works just fine. I am not sure but it seems to me that only 16-bit addresses are working since only registers r24 and r25 are being used for the function calls. Here is the difference in the generated assembly:

Function call is puts_P(NOT_PRESSED_STR).

Linked at 0x00-:

000000e4 <NOT_PRESSED_STR>:
  e4:   4e 6f 74 20 50 72 65 73 73 65 64 0a 00              Not Pressed..


 1d6:   00 00           nop
 1d8:   84 ee           ldi     r24, 0xE4       ; 228
 1da:   90 e0           ldi     r25, 0x00       ; 0
 1dc:   0e 94 f2 00     call    0x1e4   ; 0x1e4 <puts_P>


 Linked at 0x1E000-:

 0001e0e4 <NOT_PRESSED_STR>:
   1e0e4:       4e 6f 74 20 50 72 65 73 73 65 64 0a 00              Not Pressed..

   1e1d6:       00 00           nop
   1e1d8:       84 ee           ldi     r24, 0xE4       ; 228
   1e1da:       90 ee           ldi     r25, 0xE0       ; 224
   1e1dc:       0e 94 f2 f0     call    0x1e1e4 ; 0x1e1e4 <puts_P>

I haven't been able to find a workaround yet, so I'll use strings in initialized data section for now.

--
Regards
Tavish Naruka

reply via email to

[Prev in Thread] Current Thread [Next in Thread]