{"action":"created","issue":{"url":"https://api.github.com/repos/contiki-os/contiki/issues/1623","repository_url":"https://api.github.com/repos/contiki-os/contiki","labels_url":"https://api.github.com/repos/contiki-os/contiki/issues/1623/labels{/name}","comments_url":"https://api.github.com/repos/contiki-os/contiki/issues/1623/comments","events_url":"https://api.github.com/repos/contiki-os/contiki/issues/1623/events","html_url":"https://github.com/contiki-os/contiki/issues/1623","id":150637475,"number":1623,"title":"Can not use malloc on CC26XX/CC13XX platform","user":{"login":"xukai871105","id":3615443,"avatar_url":"https://avatars.githubusercontent.com/u/3615443?v=3","gravatar_id":"","url":"https://api.github.com/users/xukai871105","html_url":"https://github.com/xukai871105","followers_url":"https://api.github.com/users/xukai871105/followers","following_url":"https://api.github.com/users/xukai871105/following{/other_user}","gists_url":"https://api.github.com/users/xukai871105/gists{/gist_id}","starred_url":"https://api.github.com/users/xukai871105/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xukai871105/subscriptions","organizations_url":"https://api.github.com/users/xukai871105/orgs","repos_url":"https://api.github.com/users/xukai871105/repos","events_url":"https://api.github.com/users/xukai871105/events{/privacy}","received_events_url":"https://api.github.com/users/xukai871105/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-24T07:46:29Z","updated_at":"2016-04-24T10:15:01Z","closed_at":null,"body":"I just write a very simple program to test malloc function on CC1310 platform.\r\n`\r\n#include \"contiki.h\"\r\n#include <stdio.h> \r\n#include <stdlib.h>\r\n/*---------------------------------------------------------------------------*/\r\nPROCESS(hello_world_process, \"Hello world process\");\r\nAUTOSTART_PROCESSES(&hello_world_process);\r\n/*---------------------------------------------------------------------------*/\r\nPROCESS_THREAD(hello_world_process, ev, data)\r\n{\r\n  PROCESS_BEGIN();\r\n\r\n  char *mem = (char *)malloc(20);\r\n  sprintf(mem, \"Hello %s\", \"World\");\r\n  printf(\"%s\\n\", mem);\r\n  free(mem);\r\n  \r\n  PROCESS_END();\r\n}`\r\n\r\nA error happen and I could not solve it.\r\n\"/usr/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':\r\nsbrkr.c:(.text._sbrk_r+0xc): undefined reference to `**_sbrk**'\r\ncollect2: error: ld returned 1 exit status\"\r\n\r\nI just modify the makefile.cc26xx-cc13xx file .\r\nAdd \"MODULES += lib/newlib\" \r\nBut it has no effect.\r\n\r\nI also test the same program on the cc2538 platform. It can work well.\r\n\r\nFinally, please forgive my poor english."},"comment":{"url":"https://api.github.com/repos/contiki-os/contiki/issues/comments/213926026","html_url":"https://github.com/contiki-os/contiki/issues/1623#issuecomment-213926026","issue_url":"https://api.github.com/repos/contiki-os/contiki/issues/1623","id":213926026,"user":{"login":"tonnenpinguin","id":9628825,"avatar_url":"https://avatars.githubusercontent.com/u/9628825?v=3","gravatar_id":"","url":"https://api.github.com/users/tonnenpinguin","html_url":"https://github.com/tonnenpinguin","followers_url":"https://api.github.com/users/tonnenpinguin/followers","following_url":"https://api.github.com/users/tonnenpinguin/following{/other_user}","gists_url":"https://api.github.com/users/tonnenpinguin/gists{/gist_id}","starred_url":"https://api.github.com/users/tonnenpinguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonnenpinguin/subscriptions","organizations_url":"https://api.github.com/users/tonnenpinguin/orgs","repos_url":"https://api.github.com/users/tonnenpinguin/repos","events_url":"https://api.github.com/users/tonnenpinguin/events{/privacy}","received_events_url":"https://api.github.com/users/tonnenpinguin/received_events","type":"User","site_admin":false},"created_at":"2016-04-24T10:15:01Z","updated_at":"2016-04-24T10:15:01Z","body":"Have a look at [this](https://github.com/contiki-os/contiki/wiki/Memory-allocation) wiki page that describes contikis approach to dynamic memory allocation!"}}