__flash as an alternative to PROGMEM

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
ulao
Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

__flash as an alternative to PROGMEM

Post by ulao » Sat Mar 15, 2014 7:02 pm

Lots of talk on this with the new avr-gcc 4.7

No need for any #include and no need for any pgm_read*() nonsense. __flash is a new qualifier added to the language, it turns GCC support from explicit to implicit.

see here for more details.
http://www.avrfreaks.net/index.php?name ... 24#1144424

Any impact on v-usb if I made the changes?

blargg
Rank 3
Rank 3
Posts: 102
Joined: Thu Nov 14, 2013 10:01 pm

Re: __flash as an alternative to PROGMEM

Post by blargg » Tue Mar 18, 2014 1:56 am

The main issue is that you make your code incompatible with older versions of GCC. Personally I've found the cost of using the older macro to be trivial in terms of clarity and finding bugs. It's not like this new approach magically makes functions work with pointers to flash, as a pointer to flash is a different and fundamentally incompatible type with a pointer to ram.

Post Reply