{"action":"created","issue":{"url":"https://api.github.com/repos/arduino/Arduino/issues/2474","labels_url":"https://api.github.com/repos/arduino/Arduino/issues/2474/labels{/name}","comments_url":"https://api.github.com/repos/arduino/Arduino/issues/2474/comments","events_url":"https://api.github.com/repos/arduino/Arduino/issues/2474/events","html_url":"https://github.com/arduino/Arduino/issues/2474","id":50420015,"number":2474,"title":"Critical Leonardo + Micro Bootkey conflicts","user":{"login":"NicoHood","id":6888294,"avatar_url":"https://avatars.githubusercontent.com/u/6888294?v=3","gravatar_id":"","url":"https://api.github.com/users/NicoHood","html_url":"https://github.com/NicoHood","followers_url":"https://api.github.com/users/NicoHood/followers","following_url":"https://api.github.com/users/NicoHood/following{/other_user}","gists_url":"https://api.github.com/users/NicoHood/gists{/gist_id}","starred_url":"https://api.github.com/users/NicoHood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicoHood/subscriptions","organizations_url":"https://api.github.com/users/NicoHood/orgs","repos_url":"https://api.github.com/users/NicoHood/repos","events_url":"https://api.github.com/users/NicoHood/events{/privacy}","received_events_url":"https://api.github.com/users/NicoHood/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"cmaglie","id":423515,"avatar_url":"https://avatars.githubusercontent.com/u/423515?v=3","gravatar_id":"","url":"https://api.github.com/users/cmaglie","html_url":"https://github.com/cmaglie","followers_url":"https://api.github.com/users/cmaglie/followers","following_url":"https://api.github.com/users/cmaglie/following{/other_user}","gists_url":"https://api.github.com/users/cmaglie/gists{/gist_id}","starred_url":"https://api.github.com/users/cmaglie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmaglie/subscriptions","organizations_url":"https://api.github.com/users/cmaglie/orgs","repos_url":"https://api.github.com/users/cmaglie/repos","events_url":"https://api.github.com/users/cmaglie/events{/privacy}","received_events_url":"https://api.github.com/users/cmaglie/received_events","type":"User","site_admin":false},"milestone":null,"comments":16,"created_at":"2014-11-29T09:00:00Z","updated_at":"2015-07-04T12:04:15Z","closed_at":null,"body":"The way we write the Bootloader key in the ram is not reliable. You can destroy important data since you can revert the bootloader reset. With a 32u4 it might be very unlikely (because of that much ram) but still possible and then people are wondering about weird bugs. And with a 16u2 (500b ram) it is even more likely that this will happen if the reset is reverted.\r\n\r\nReferring to this lines:\r\nhttps://github.com/arduino/Arduino/blob/master/hardware/arduino/cores/arduino/CDC.cpp#L94-L108\r\n\r\nSo what we need to do is to ensure this address is really NOT USED.\r\n\r\n3 Solutions i have in mind:\r\nReserve the Bootkey address so its not used in any case. See this for a possible solution:\r\nhttp://electronics.stackexchange.com/questions/140516/where-to-put-bootloader-key-in-ram-what-address-is-the-last-ram-address\r\n\r\nThe other solution would be to force a reset in any case or add some other debounce routines.\r\n\r\nThe last might be the best but 'biggest' change. Also save the value to a fixed address, add this to the bootloader and Arduino core. Shrink the size to 8bit since its reserved anyways and move it to the beginning of the ram to not fragment data. I know you wont be happy about this since you need to update all Bootloaders and the USB Core.\r\n\r\n\r\nI think the simplest option to fix this is the first. Someone should have thought about this first but well, it would be a mess to tell the customers now to update the bootloader and most just cant do it.\r\nBut what we should do for further boards is to use the first ram address 0x100 and a 8 bit value (option3). I will also use this for my 16u2/32u2 core that i will publish soon (also as pullup request maybe)."},"comment":{"url":"https://api.github.com/repos/arduino/Arduino/issues/comments/118504818","html_url":"https://github.com/arduino/Arduino/issues/2474#issuecomment-118504818","issue_url":"https://api.github.com/repos/arduino/Arduino/issues/2474","id":118504818,"user":{"login":"yyyc514","id":6473,"avatar_url":"https://avatars.githubusercontent.com/u/6473?v=3","gravatar_id":"","url":"https://api.github.com/users/yyyc514","html_url":"https://github.com/yyyc514","followers_url":"https://api.github.com/users/yyyc514/followers","following_url":"https://api.github.com/users/yyyc514/following{/other_user}","gists_url":"https://api.github.com/users/yyyc514/gists{/gist_id}","starred_url":"https://api.github.com/users/yyyc514/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yyyc514/subscriptions","organizations_url":"https://api.github.com/users/yyyc514/orgs","repos_url":"https://api.github.com/users/yyyc514/repos","events_url":"https://api.github.com/users/yyyc514/events{/privacy}","received_events_url":"https://api.github.com/users/yyyc514/received_events","type":"User","site_admin":false},"created_at":"2015-07-04T12:04:15Z","updated_at":"2015-07-04T12:04:15Z","body":"Sure, at the cost of losing a byte or two of RAM that can't be used for anything else.  I think that requires passing command line options.  I like using RAMEND since that memory is essentially \"free\" as it's already stuck on the stack and you aren't taking away memory that would otherwise be available to the sketch (without some manual SP hacking)."}}