bugSimulavr: an AVR simulator - Bugs: bug #35737, new awr-gcc is picky about...

 
 

bug #35737: new awr-gcc is picky about depreciated constants

Submitter:  None
Submitted:  Tue 06 Mar 2012 10:38:47 PM UTC
   
 
Category:  Configure Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Closed
Component Version:  simulavr

Discussion locked!

Jump to the original submission

Mon 20 May 2013 08:59:50 AM UTC, comment #7: 

actual HEAD compiles with gcc 4.7.2 and avr-libc 1.8

Klaus Rudolph <zfrdh>
Group administrator
Sun 24 Mar 2013 09:44:24 AM UTC, comment #6: 

Hi,

ticket is now duplicate of #38536 and will be tracked there. Ticket closed.

cu, Thomas

Thomas K. <tomk>
Group administrator
Mon 12 Mar 2012 02:43:41 PM UTC, comment #5: 

Just two small additional notes:

PROGMEM is defined in "avr/include/avr/pgmspace.h":
#define _ATTR_PROGMEM_ __attribute__((_progmem_))
#define PROGMEM _ATTR_PROGMEM_

and "prog_char" you can still find in "avr/include/avr/pgmspace.h":
typedef char PROGMEM prog_char;
typedef char prog_char _attribute_((_progmem_,deprecated("prog_char type is deprecated.")));

Hope it helps.

Anonymous
Mon 12 Mar 2012 02:35:23 PM UTC, comment #4: 

Note that I also fix "prog_char" in my changes.

There is only one place in the "./examples/atmel_key/scancodes.h" file which needs to be fixed. I change:
prog_char shifted[][2]
into:
char shifted[][2] PROGMEM
where "PROGMEM" actually means "__attribute__((_progmem_))"

Anonymous
Mon 12 Mar 2012 01:24:10 PM UTC, comment #3: 

prog_char is something else to get rid of.
It's not supposed to work.
That it does is a compiler bug.
In avr-g++, it doesn't work.
That libc has it was a poor choice that causes occasional discussion on avrfreaks, especially when someone tries to use it with avr-g++.

Michael Hennebry <skeeve>
Group Member
Mon 12 Mar 2012 12:53:45 PM UTC, comment #2: 

Hi,
I decided to add some small comments to my previous post.

Most of the changes, that I do, are "self-explanatory". You will get an "error: attempt to use poisoned SOME_MAGIC_NAME" if you do not apply them.

However, there are some changes in the "atmel_key" example which may need some additional explanation.

In the "./examples/atmel_key/main.c" file I replace the call to "msleep" with "_delay_ms", and in the "./examples/atmel_key/StdDefs.c" file I comment out the call to "_delay_ms" (in the "msleep" implementation - this makes this function unusable - it's "dummy" then - but it was ONLY used in one place in the "./examples/atmel_key/main.c" file, which I also patched).
The reason is that the "_delay_ms" accepts ONLY constant parameters, no variable parameters are allowed in the call. If you do not apply these changes, you will get "/.../avr/.../4.5.1/.../include/util/delay.h:164:28: error: __builtin_avr_delay_cycles expects an integer constant."

Hope it helps.

Anonymous
Sun 11 Mar 2012 11:47:31 PM UTC, comment #1: 

Here's what I had to do in order to get simulavr-1.0.0 compiled with avr-gcc-4.5.1 and avr-libc-1.8.0:

cd simulavr-1.0.0
find ./ -name "*" -type f -exec sed -i -e 's/SIG_INTERRUPT0/INT0_vect/' \{\} \;
find ./ -name "*" -type f -exec sed -i -e 's/SIG_INTERRUPT1/INT1_vect/' \{\} \;
find ./ -name "*" -type f -exec sed -i -e 's/SIG_INTERRUPT2/INT2_vect/' \{\} \;
find ./ -name "*" -type f -exec sed -i -e 's/SIG_OUTPUT_COMPARE2/TIMER2_COMP_vect/' \{\} \;
find ./ -name "*" -type f -exec sed -i -e 's/SIG_OUTPUT_COMPARE2A/TIMER2_COMPA_vect/' \{\} \;
find ./ -name "*" -type f -exec sed -i -e 's/SIG_OUTPUT_COMPARE3B/TIMER3_COMPB_vect/' \{\} \;
find ./ -name "*" -type f -exec sed -i -e 's/SIG_UART0_RECV/USART0_RX_vect/' \{\} \;
find ./ -name "*" -type f -exec sed -i -e 's/SIG_UART0_DATA/USART0_UDRE_vect/' \{\} \;
find ./ -name "*" -type f -exec sed -i -e 's/__attribute__((progmem))/PROGMEM/' \{\} \;
find ./ -name "*" -type f -exec sed -i -e 's/__attribute__ ((progmem))/PROGMEM/' \{\} \;
sed -i -e 's+prog_char shifted\[\]\[2\]+char shifted\[\]\[2\] PROGMEM+' ./examples/atmel_key/scancodes.h
sed -i -e 's+#include <avr/io.h>+#include <avr/io.h>\n#include <util/delay.h>+' ./examples/atmel_key/main.c
sed -i -e 's+msleep+_delay_ms+' ./examples/atmel_key/main.c
sed -i -e 's+_delay_ms+// _delay_ms+' ./examples/atmel_key/StdDefs.c

Hope it helps.

Anonymous
Tue 06 Mar 2012 10:38:47 PM UTC, original submission:  

gcc-4.6.3, avr-libc-1.8.0, simulavr-1.0.0: compilation of examples fails because the new gcc has old style interrupt vector names poisoned (example: SIG_INTERRUPT0 is bad, INT0_vect is good). Also prog_char is depreciated.

I have replaced the old style interrupt names with the new ones, and proc_char in examples/atmel_key/scancodes.h by a const char with attribute, now i can at least compile.

I don't know what downward compatibility issues result from these changes.
If you want i can create a patch.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by zfrdh (Posted a comment)
  • -email is unavailable- added by tomk (Posted a comment)
  • -email is unavailable- added by skeeve (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-05-20 zfrdh StatusDuplicate Fixed
    2013-03-24 tomk StatusNone Duplicate
        Open/ClosedOpen Closed
        Discussion LockNone Locked

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code