From: SourceForge.net <no...@so...> - 2008-12-17 04:36:48
|
Bugs item #2430878, was opened at 2008-12-15 15:17 Message generated for change (Comment added) made by ivanturinsf You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=520074&aid=2430878&group_id=68108 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: AVR-LibC Group: v1.0 (example) Status: Open Resolution: None Priority: 7 Private: No Submitted By: SBizon (ivanturinsf) Assigned to: Eric Weddington (arcanum) Summary: WinAVR-20081205: generating LPM r30, Z+ Initial Comment: WinAVR-20081205 Part of lss file: rc_key = pgm_read_byte(&recode_tbl[keycode]); 25c: f0 e0 ldi r31, 0x00 ; 0 25e: ec 5c subi r30, 0xCC ; 204 260: ff 4f sbci r31, 0xFF ; 255 262: e4 91 lpm r30, Z+ 264: e0 93 01 01 sts 0x0101, r30 In Document doc0856E.pdf (AVR Instruction Set) page 91: The result of these combinations is undefined: LPM r30, Z+ LPM r31, Z+ best regards, SB ---------------------------------------------------------------------- >Comment By: SBizon (ivanturinsf) Date: 2008-12-17 07:36 Message: There is no problem, because 262: _e4_91_ lpm r30, Z+ actually lpm r30, Z and work as well. Z+ is bug of wrong dissasembling. No need modify pgmspace.h for solve this problem. See doc0856E.pdf page 91: (i) LPM None, R0 implied PC ← PC + 1 (ii) LPM Rd, Z 0 ≤ d ≤ 31 PC ← PC + 1 (iii) LPM Rd, Z+ 0 ≤ d ≤ 31 PC ← PC + 1 16-bit Opcode: (i) 1001 0101 1100 1000 (ii) 1001 000d (91) dddd 0100 (E4) -> E4 91 -> lpm r30, Z -> work as well (iii) 1001 000d (91) dddd 0101 (E5) -> E4 95 -> lpm r30, Z+ -> wrong code ---------------------------------------------------------------------- Comment By: Eric Weddington (arcanum) Date: 2008-12-17 02:46 Message: Try using this new version of the pgmspace.h header file. I added a modifier to the operand constraints on the inline assembly macros that generate the LPM instructions (and ELPM). So far this seems to fix the problem. Let me know how this works. If it solves the problem we'll get this committed to avr-libc for the next version. File Added: pgmspace.h ---------------------------------------------------------------------- Comment By: SBizon (ivanturinsf) Date: 2008-12-16 10:35 Message: 262: e4 91 lpm r30, Z+ e4 91 is lpm r30, Z This "bug" is echo of "objdump disassembles "lpm reg, Z" wrongly" bug :( http://sourceforge.net/tracker/index.php?func=detail&aid=1996284&group_id=68108&atid=520074 ---------------------------------------------------------------------- Comment By: SBizon (ivanturinsf) Date: 2008-12-16 10:18 Message: make all Building file: ../lpm30z.c Invoking: AVR Compiler avr-gcc -I"C:\WinAVR\mylib" -I"C:\WinAVR\avrlib" -Wall -g2 -gdwarf-2 -Os -fpack-struct -fshort-enums -fwhole-program --combine -std=gnu99 -funsigned-char -funsigned-bitfields -fvar-tracking -mmcu=atmega48 -DF_CPU=8000000UL -MMD -MP -MF"lpm30z.d" -MT"lpm30z.d" -c -o"lpm30z.o" "../lpm30z.c" Finished building: ../lpm30z.c Building target: LPM30Z.elf Invoking: AVR C Linker avr-gcc -Wl,-Map,LPM30Z.map -mmcu=atmega48 -o"LPM30Z.elf" ./lpm30z.o Finished building target: LPM30Z.elf Invoking: AVR Create Extended Listing avr-objdump -h -S LPM30Z.elf >"LPM30Z.lss" Finished building: LPM30Z.lss ---------------------------------------------------------------------- Comment By: SBizon (ivanturinsf) Date: 2008-12-16 10:11 Message: File Added: lpm30z.c ---------------------------------------------------------------------- Comment By: Eric Weddington (arcanum) Date: 2008-12-15 16:05 Message: Please attach a small test case that can be used to reproduce the problem, not just a snippet. Thanks. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=520074&aid=2430878&group_id=68108 |