{"action":"created","issue":{"url":"https://api.github.com/repos/contiki-os/contiki/issues/1075","labels_url":"https://api.github.com/repos/contiki-os/contiki/issues/1075/labels{/name}","comments_url":"https://api.github.com/repos/contiki-os/contiki/issues/1075/comments","events_url":"https://api.github.com/repos/contiki-os/contiki/issues/1075/events","html_url":"https://github.com/contiki-os/contiki/pull/1075","id":77415730,"number":1075,"title":"cc2538: Fix and improve .data/.bss initialization","user":{"login":"bthebaudeau","id":5755442,"avatar_url":"https://avatars.githubusercontent.com/u/5755442?v=3","gravatar_id":"","url":"https://api.github.com/users/bthebaudeau","html_url":"https://github.com/bthebaudeau","followers_url":"https://api.github.com/users/bthebaudeau/followers","following_url":"https://api.github.com/users/bthebaudeau/following{/other_user}","gists_url":"https://api.github.com/users/bthebaudeau/gists{/gist_id}","starred_url":"https://api.github.com/users/bthebaudeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bthebaudeau/subscriptions","organizations_url":"https://api.github.com/users/bthebaudeau/orgs","repos_url":"https://api.github.com/users/bthebaudeau/repos","events_url":"https://api.github.com/users/bthebaudeau/events{/privacy}","received_events_url":"https://api.github.com/users/bthebaudeau/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-05-17T22:32:41Z","updated_at":"2015-05-23T16:05:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/contiki-os/contiki/pulls/1075","html_url":"https://github.com/contiki-os/contiki/pull/1075","diff_url":"https://github.com/contiki-os/contiki/pull/1075.diff","patch_url":"https://github.com/contiki-os/contiki/pull/1075.patch"},"body":"Make the initialization of the .data and .bss output sections safer, faster, smaller, simpler and more maintainable. See the commit messages for details.\r\n\r\nThis is a follow-up of #581.\r\n\r\nFor `memcpy()` vs. `rom_util_memcpy()` speed/size comparison, see https://github.com/contiki-os/contiki/pull/426#issuecomment-28699372."},"comment":{"url":"https://api.github.com/repos/contiki-os/contiki/issues/comments/104917507","html_url":"https://github.com/contiki-os/contiki/pull/1075#issuecomment-104917507","issue_url":"https://api.github.com/repos/contiki-os/contiki/issues/1075","id":104917507,"user":{"login":"bthebaudeau","id":5755442,"avatar_url":"https://avatars.githubusercontent.com/u/5755442?v=3","gravatar_id":"","url":"https://api.github.com/users/bthebaudeau","html_url":"https://github.com/bthebaudeau","followers_url":"https://api.github.com/users/bthebaudeau/followers","following_url":"https://api.github.com/users/bthebaudeau/following{/other_user}","gists_url":"https://api.github.com/users/bthebaudeau/gists{/gist_id}","starred_url":"https://api.github.com/users/bthebaudeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bthebaudeau/subscriptions","organizations_url":"https://api.github.com/users/bthebaudeau/orgs","repos_url":"https://api.github.com/users/bthebaudeau/repos","events_url":"https://api.github.com/users/bthebaudeau/events{/privacy}","received_events_url":"https://api.github.com/users/bthebaudeau/received_events","type":"User","site_admin":false},"created_at":"2015-05-23T16:05:09Z","updated_at":"2015-05-23T16:05:09Z","body":"I've found! The bug is in Contiki, not in the ROM. I've used QEMU to run the ROM and cc2538-demo, and the bug is that `startup-gcc.c` puts the stack in .bss, which is total nonsense. Because of that, the initialization of .bss destroys the stack contents, so any code initializing .bss and using the stack (just like `rom_util_memset()` does) is doomed to crash. This also explains the size threshold that you found while testing, because it corresponds to the first useful stack entries being destroyed.\r\n\r\nI'll send a fix for that."}}