{"action":"created","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/857","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/857/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/857/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/857/events","html_url":"https://github.com/esp8266/Arduino/pull/857","id":109906003,"number":857,"title":"Fix placement of code into RAM, enable gc-sections","user":{"login":"igrr","id":4349050,"avatar_url":"https://avatars.githubusercontent.com/u/4349050?v=3","gravatar_id":"","url":"https://api.github.com/users/igrr","html_url":"https://github.com/igrr","followers_url":"https://api.github.com/users/igrr/followers","following_url":"https://api.github.com/users/igrr/following{/other_user}","gists_url":"https://api.github.com/users/igrr/gists{/gist_id}","starred_url":"https://api.github.com/users/igrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igrr/subscriptions","organizations_url":"https://api.github.com/users/igrr/orgs","repos_url":"https://api.github.com/users/igrr/repos","events_url":"https://api.github.com/users/igrr/events{/privacy}","received_events_url":"https://api.github.com/users/igrr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-05T23:23:27Z","updated_at":"2015-10-06T15:49:54Z","closed_at":"2015-10-06T09:19:20Z","pull_request":{"url":"https://api.github.com/repos/esp8266/Arduino/pulls/857","html_url":"https://github.com/esp8266/Arduino/pull/857","diff_url":"https://github.com/esp8266/Arduino/pull/857.diff","patch_url":"https://github.com/esp8266/Arduino/pull/857.patch"},"body":"Related to #856, #826, #803, #734.\r\n\r\n- enable -gc-sections linker option (#734)\r\n- enable -ffunction-sections -fdata-sections (in conjunction with the above, helps with #826)\r\n- fix #856 by making ICACHE_RAM_ATTR place functions into `.iram.text` instead of `.text`. Place `.iram.text` into `.text` segment via linker script. This allows to (selectively) place code into RAM from .cpp files *and* moves code from .c files into `.irom.text` by default (#803).\r\n\r\nReduces size of the sketches somewhat.\r\nWithout this change (HelloServer sample sketch):\r\n\r\n    Sketch uses 349,510 bytes (33%) of program storage space. Maximum is 1,044,464 bytes.\r\n    Global variables use 45,674 bytes (55%) of dynamic memory, leaving 36,246 bytes for local variables. Maximum is 81,920 bytes.\r\n\r\nWith this change:\r\n\r\n    Sketch uses 225,310 bytes (21%) of program storage space. Maximum is 1,044,464 bytes.\r\n    Global variables use 36,506 bytes (44%) of dynamic memory, leaving 45,414 bytes for local variables. Maximum is 81,920 bytes.\r\n\r\nCompile tests pass, but might break some sketches at run time. Needs testing."},"comment":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/comments/145907058","html_url":"https://github.com/esp8266/Arduino/pull/857#issuecomment-145907058","issue_url":"https://api.github.com/repos/esp8266/Arduino/issues/857","id":145907058,"user":{"login":"Juppit","id":10826660,"avatar_url":"https://avatars.githubusercontent.com/u/10826660?v=3","gravatar_id":"","url":"https://api.github.com/users/Juppit","html_url":"https://github.com/Juppit","followers_url":"https://api.github.com/users/Juppit/followers","following_url":"https://api.github.com/users/Juppit/following{/other_user}","gists_url":"https://api.github.com/users/Juppit/gists{/gist_id}","starred_url":"https://api.github.com/users/Juppit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Juppit/subscriptions","organizations_url":"https://api.github.com/users/Juppit/orgs","repos_url":"https://api.github.com/users/Juppit/repos","events_url":"https://api.github.com/users/Juppit/events{/privacy}","received_events_url":"https://api.github.com/users/Juppit/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T15:49:54Z","updated_at":"2015-10-06T15:49:54Z","body":"\n\nOn 06.10.2015 at 01:23 wrote Ivan Grokhotkov:\n> |Sketch uses 349,510 bytes (33%) of program storage space. Maximum is\n> 1,044,464 bytes. Global variables use 45,674 bytes (55%) of dynamic\n> memory, leaving 36,246 bytes for local variables. Maximum is 81,920 bytes. |\n>\n> With this change:\n>\n> |Sketch uses 225,310 bytes (21%) of program storage space. Maximum is\n> 1,044,464 bytes. Global variables use 36,506 bytes (44%) of dynamic\n> memory, leaving 45,414 bytes for local variables. Maximum is 81,920 bytes. |\n>\n> Compile tests pass, but might break some sketches at run time. Needs\n> testing.\n\nReduced my sketch size from 32% to 20% and RAM usage from 52% to 41%.\nNo problems occurred.\nGreat, once again.\n"}}