what is __flash parameter

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

I have the following function declaration

 

void EthernetBuffer_add(const char c);

 

which gives this warning

 

!W C:\Workspace\Common\EthernetBuffer.h(5):[warning] Illegal storage class __flash for parameter 'c'. Storage class removed.

 

I am new to this stuff and really know what it measns

 

Can anybody clarify this for me ?

 

Last Edited: Mon. Feb 10, 2020 - 10:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I think you'd better start by saying which C compiler you are using and where the code you are feeding to it originated.

 

"__flash" actually originated in the IAR compiler for AVR

Codevision has something similar but it is just "flash" (no underscores)

GCC used to have a thing called "PROGMEM"/pgm_read_XXX() but a "better" system was invented. To be compatible with IAR syntax the implementor chose to use "__flash" too.

I don't know if other compilers like Imagecraft ICC, Rowley, MikroC have some equivalent and whether it is "__flash" or something else.

 

In GCC __flash is only available in the C compiler, it is not supported in the C++ compiler. For the latter you can either use the older PROGMEM way of doing things or you can make a shared C/C++ project and put anything "__flash" into C not C++ files.

 

So it's kind of important to say which C compiler you use and where the code came from (as it may have been written for a different AVR C compiler).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

So it's kind of important to say which C compiler you use and where the code came from (as it may have been written for a different AVR C compiler).

Exactly.  I don't immediately recognize the format of that warning, either.

 

clawson wrote:

Codevision has something similar but it is just "flash" (no underscores)

Perhaps true back when I was your age, but nowadays

The flash or __flash keywords can be used to specify that a constant must be placed in FLASH memory, no matter what is the state of the Store Global Constants in FLASH Memory option:

 

flash <type definition> <identifier> = constant expression;

__flash <type definition> <identifier> = constant expression;

...

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps true back when I was your age, but nowadays

At least pi will always be 3.1415926535... 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!