{"action":"created","issue":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1101","repository_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1101/labels{/name}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1101/comments","events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1101/events","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/1101","id":137491619,"number":1101,"title":"Dead code pwm in firmware","user":{"login":"TerryE","id":690173,"avatar_url":"https://avatars.githubusercontent.com/u/690173?v=3","gravatar_id":"","url":"https://api.github.com/users/TerryE","html_url":"https://github.com/TerryE","followers_url":"https://api.github.com/users/TerryE/followers","following_url":"https://api.github.com/users/TerryE/following{/other_user}","gists_url":"https://api.github.com/users/TerryE/gists{/gist_id}","starred_url":"https://api.github.com/users/TerryE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TerryE/subscriptions","organizations_url":"https://api.github.com/users/TerryE/orgs","repos_url":"https://api.github.com/users/TerryE/repos","events_url":"https://api.github.com/users/TerryE/events{/privacy}","received_events_url":"https://api.github.com/users/TerryE/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-01T07:01:30Z","updated_at":"2016-03-01T13:42:38Z","closed_at":null,"body":"This one was thrown up by  #1100.  At the moment the platform.h tier declares the platform abstraction for GPIO, SPI, UART, PMW, Sigma_delta, I2C and Flash which are all implemented in `platform.c`.  It also declares Eth and ADC which aren't implemented at all!   \r\n\r\nThe current implementation results in most of these functions being optimised out by the loader as unused if not referenced, however the pwm_init is done as part of platform_init() and hence the some of the  PWM driver and platform_pwm code gets mapped in -- roughly 0.5Kb iram0 and 2Kb irom -- whether or not pwm is used.  Likewise the gpio system also calls pwm close functions, so IMO its worth considering moving these lazily into the first routines that need them or suppress this logic if the PWM module is not enabled. Thoughts?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/comments/190728327","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/1101#issuecomment-190728327","issue_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1101","id":190728327,"user":{"login":"pjsg","id":1508813,"avatar_url":"https://avatars.githubusercontent.com/u/1508813?v=3","gravatar_id":"","url":"https://api.github.com/users/pjsg","html_url":"https://github.com/pjsg","followers_url":"https://api.github.com/users/pjsg/followers","following_url":"https://api.github.com/users/pjsg/following{/other_user}","gists_url":"https://api.github.com/users/pjsg/gists{/gist_id}","starred_url":"https://api.github.com/users/pjsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjsg/subscriptions","organizations_url":"https://api.github.com/users/pjsg/orgs","repos_url":"https://api.github.com/users/pjsg/repos","events_url":"https://api.github.com/users/pjsg/events{/privacy}","received_events_url":"https://api.github.com/users/pjsg/received_events","type":"User","site_admin":false},"created_at":"2016-03-01T13:42:38Z","updated_at":"2016-03-01T13:42:38Z","body":"Yeah -- I realized that the pwm stuff cannot be excluded -- and hence adding the init into pwms_init was the safe approach. pwms_init is called from somewhere pretty fundamental.\r\n\r\nget_pin_map() should be called early (and then it should not re-run if it is called again). \r\n\r\nI was trying to make the minimal fix to get the system working again....."}}