I would like to assume that constants and inline literals always wind up in FLASH with the program.
Alas daddy taught me to “never assume”. So I wrote a simple “Hello World” sketch to look at the disassembly. (Please to see attached text file)
The avr-objdump tool doesn't show the data sections of the flash, only the code.
If you look at the hex file, somewhere you will see the ascii equivalent of "Hello World", normally near the start for PROGMEM variables and at the end for data initialisers.
But actually the sketch will store that string both in the Flash, and then in the RAM as well.
I would like to assume that constants and inline literals always wind up in FLASH with the program
Well obviously they do - where else could they be?
Unfortunately, unless you're careful, they also wind up in RAM, which is why you should always Serial.println(F("Hello World!")); if at all possible.
The F() macro tells the compiler to put the string in the Flash ONLY.
Serial.print("Hello World!");
uses 15 bytes of flash AND 15 bytes of RAM. When the program starts, the string is loaded from the flash into the ram as an array of 15 characters. A pointer to this new array is then sent to the print function. What it means is that you can use it with functions like strcpy() and sprintf(), e.g. sprintf(dest,"%d",2) stores a 3 character string of '%' then 'd', then '\0'.
Serial.print(F("Hello World!"));
uses 15 bytes of flash AND 0 bytes of RAM. When the program starts, the string is NOT loaded from the flash. This array is then sent to the print function. Instead a special print function is used which, starting with the address of the string in the flash, reads bytes one by one and writes them to the Serial port. Consequently, you can't use functions like strcpy, and instead have to use the strcpy_P set of functions which can read bytes in from the flash.