oqibidipo:
The IDE calculates the program size by adding the sizes of the .data and .text sections from the output of
avr-size -A [i]sketch.ino.elf[/i]
The .ramfunc section is not included in the calculation, but will end up in Flash after the .text section.
without .ramfunc
ramfunc.ino.elf :
section size addr
.data 16 8388864
.text 1640 0
.bss 166 8388880
.comment 17 0
.note.gnu.avr.deviceinfo 64 0
.debug_aranges 48 0
.debug_info 5235 0
.debug_abbrev 2621 0
.debug_line 1017 0
.debug_frame 592 0
.debug_str 1765 0
.debug_loc 2114 0
.debug_ranges 80 0
Total 15375
with .ramfunc
ramfunc.ino.elf :
section size addr
.data 16 8388864
.text 1598 0
.ramfunc 42 1598
.bss 166 8388880
.comment 17 0
.note.gnu.avr.deviceinfo 64 0
.debug_aranges 56 0
.debug_info 5235 0
.debug_abbrev 2621 0
.debug_line 971 0
.debug_frame 592 0
.debug_str 1765 0
.debug_loc 2114 0
.debug_ranges 88 0
Total 15345
Note carefully that the .text + .ramfunc size in the second output is exactly equal to the .text size in the first. This supports RayLivingston's statement that you are not actually saving a single byte, it's just that the IDE is not including this section when it calculates the size of the sketch, so it's undercounting the size.
Also:
warning: 'long_call' attribute directive ignored [-Wattributes]
long_call is indeed ignored.
Interestingly, I can't see what you saw with version 1.8.2. Here's my test sketch.
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino model, check
the Technical Specs of your board at https://www.arduino.cc/en/Main/Products
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
*/
#define RAM_FUNC
#ifdef RAM_FUNC
#define RAM_ATT __attribute__ ((section (".ramfunc")))
#else
#define RAM_ATT
#endif
// the setup function runs once when you press reset or power the board
void RAM_ATT setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void RAM_ATT loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Size is 928 bytes whether I have the attribute defined or not.