AVR C Runtime Library - Bugs: bug #31613, In pgm_read_byte the address is a...
You are not allowed to post comments on this tracker with your current authentication level.
bug #31613: In pgm_read_byte the address is a byte instead of an int
Submitter: | Reinier van der Welle <reinier> | ||
Submitted: | Wed 10 Nov 2010 02:23:52 PM UTC | ||
Category: | Library | Severity: | 3 - Normal |
Priority: | 5 - Normal | Item Group: | libc code |
Status: | Invalid | Assigned to: | None |
Percent Complete: | 0% | Open/Closed: | Closed |
Release: | 1.6.7 | Fixed Release: | None |
Wed 10 Nov 2010 04:30:00 PM UTC, comment #4: |
Reinier van der Welle <reinier> |
Wed 10 Nov 2010 04:07:22 PM UTC, comment #3:
|
Joerg Wunsch <joerg_wunsch> |
Wed 10 Nov 2010 03:45:10 PM UTC, comment #2: Thanks for your comment, but I cannot see an error in the attached example. When the code is run and j is watched, it gets the values 10, 8, 6, 4 end so on, instead of 10, 9, 8 ,7 ... See also the compiler warning "assignment from incompatible pointer type". When the char pointer is used, all is OK (of course). But the address of the table could be well beyond $FF (the maximum of the char pointer).
|
Reinier van der Welle <reinier> |
Wed 10 Nov 2010 02:37:17 PM UTC, comment #1: You are confusing the pointer with the object it points to:
|
Joerg Wunsch <joerg_wunsch> |
Wed 10 Nov 2010 02:23:52 PM UTC, original submission:
I am trying to use pgm_read_byte(address) for reading a byte from tables in program flash. The compiler requires a char (byte) address instead of an int (16 bits) (which should be the case according to the documentation). Using an int address skips every second byte in the table. How can I use int addresses?
|
Reinier van der Welle <reinier> |
Depends on the following items: None found
Items that depend on this one: None found
Follow 4 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2010-11-10 | reinier | Attached File | - | Added readbyte.zip, #21976 | |
2010-11-10 | joerg_wunsch | Open/Closed | Open | Closed | |
2010-11-10 | joerg_wunsch | Status | None | Invalid | |
2010-11-10 | reinier | Carbon-Copy | - | Added reinier |
Powered by Savane 3.13-caa5.
Corresponding source code
I apologize for having bothered you; I am too much a newbie, I fear. I was not aware of avr-gcc-list (did not see it in the docs up till now).
I was confused about the pointer, supposing that it was 8 bits wide.
Anyway, thanks a lot for your help. I will stick now to avr-gcc-list.