{"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":24,"created_at":"2014-11-29T09:00:00Z","updated_at":"2015-12-02T16:37:04Z","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/161357935","html_url":"https://github.com/arduino/Arduino/issues/2474#issuecomment-161357935","issue_url":"https://api.github.com/repos/arduino/Arduino/issues/2474","id":161357935,"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},"created_at":"2015-12-02T16:37:04Z","updated_at":"2015-12-02T16:37:04Z","body":"You can try HoodLoader2 for a 32u4. This has fixed this bug. You need to select HoodLoader2 32u4 as board then.\r\nhttps://github.com/NicoHood/HoodLoader2\r\n\r\nI asked so many times to fix this bug, but they dont want to, they just ignore it. BTW: HoodLoader2 also accepts the old option with 0x8000 as position in ram. To use the RAMEND position select the HoodLoader2 board entry as written above. You can ignore the additional USB-Serial function. For a production it should be removed to not trigger those physical pins maybe. But as a test it should work fine."}}