{"action":"created","issue":{"url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/125","repository_url":"https://api.github.com/repos/SuperHouse/esp-open-rtos","labels_url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/125/comments","events_url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/125/events","html_url":"https://github.com/SuperHouse/esp-open-rtos/issues/125","id":147158333,"number":125,"title":"Ending a FreeRTOS task crash","user":{"login":"pellepl","id":5098839,"avatar_url":"https://avatars.githubusercontent.com/u/5098839?v=3","gravatar_id":"","url":"https://api.github.com/users/pellepl","html_url":"https://github.com/pellepl","followers_url":"https://api.github.com/users/pellepl/followers","following_url":"https://api.github.com/users/pellepl/following{/other_user}","gists_url":"https://api.github.com/users/pellepl/gists{/gist_id}","starred_url":"https://api.github.com/users/pellepl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pellepl/subscriptions","organizations_url":"https://api.github.com/users/pellepl/orgs","repos_url":"https://api.github.com/users/pellepl/repos","events_url":"https://api.github.com/users/pellepl/events{/privacy}","received_events_url":"https://api.github.com/users/pellepl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-09T19:56:11Z","updated_at":"2016-04-10T06:46:46Z","closed_at":"2016-04-10T03:17:35Z","body":"I might be out on deep waters here, but it seems that if I write a task that do not ```while forever``` but actually exits, I get a fatal exception 20, which might be stemming from ```esp-open-rtos/FreeRTOS/Source/tasks.c:2373```.\r\n\r\nI made an one-liner modification of the [examples/simple/simple.c:14](https://github.com/SuperHouse/esp-open-rtos/blob/master/examples/simple/simple.c#L14), from\r\n\r\n```\r\n    uint32_t count = 0;\r\n    while(1) {\r\n        vTaskDelay(100);\r\n```\r\n\r\nto \r\n\r\n```\r\n    uint32_t count = 0;\r\n    while(count < 10) {\r\n        vTaskDelay(100);\r\n```\r\n\r\nAfter 10 seconds, I get:\r\n\r\n```\r\nFatal exception (20): \r\nepc1=0x00000000\r\nepc2=0x00000000\r\nepc3=0x40225b9d\r\nexcvaddr=0x00000000\r\ndepc=0x00000000\r\nexcsave1=0x00000000\r\n```\r\n\r\naddrsourcing epc3 which seems to be the only interesting address but might just be from a previous context switch, I get:\r\n\r\n```\r\n0x40225b9d is in prvIdleTask (/home/petera/proj/wisleep/esp-open-rtos/FreeRTOS/Source/tasks.c:2133).\r\n2128\t\r\n2129\t\t\t\tA critical region is not required here as we are just reading from\r\n2130\t\t\t\tthe list, and an occasional incorrect value will not matter.  If\r\n2131\t\t\t\tthe ready list at the idle priority contains more than one task\r\n2132\t\t\t\tthen a task other than the idle task is ready to execute. */\r\n2133\t\t\t\tif( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( unsigned portBASE_TYPE ) 1 )\r\n2134\t\t\t\t{\r\n2135\t\t\t\t\ttaskYIELD();\r\n2136\t\t\t\t}\r\n2137\t\t\t}\r\nLine 2133 of \"/home/petera/proj/wisleep/esp-open-rtos/FreeRTOS/Source/tasks.c\" starts at address 0x40225b9d <prvIdleTask+125> and ends at 0x40225ba5 <prvIdleTask+133>.\r\nDump of assembler code for function prvIdleTask:\r\n   0x40225b20 <+0>:\taddi\ta1, a1, -32\r\n   0x40225b23 <+3>:\ts32i.n\ta12, a1, 24\r\n   0x40225b25 <+5>:\ts32i.n\ta13, a1, 20\r\n   0x40225b27 <+7>:\ts32i\ta14, a1, 16\r\n   0x40225b2a <+10>:\tl32r\ta13, 0x40225988\r\n   0x40225b2d <+13>:\tl32r\ta12, 0x40225ac0\r\n   0x40225b30 <+16>:\tl32r\ta14, 0x40225784\r\n   0x40225b33 <+19>:\ts32i.n\ta0, a1, 28\r\n   0x40225b35 <+21>:\ts32i\ta15, a1, 12\r\n   0x40225b38 <+24>:\tmemw\r\n   0x40225b3b <+27>:\tl32i.n\ta2, a13, 0\r\n   0x40225b3d <+29>:\tbeqz\ta2, 0x40225b9d <prvIdleTask+125>\r\n   0x40225b40 <+32>:\tmemw\r\n   0x40225b43 <+35>:\tl32i.n\ta2, a12, 0\r\n   0x40225b45 <+37>:\tl32i.n\ta15, a14, 0\r\n   0x40225b47 <+39>:\taddi.n\ta2, a2, 1\r\n   0x40225b49 <+41>:\tmemw\r\n   0x40225b4c <+44>:\ts32i.n\ta2, a12, 0\r\n   0x40225b4e <+46>:\tl32r\ta0, 0x40225584\r\n   0x40225b51 <+49>:\tcallx0\ta0\r\n   0x40225b54 <+52>:\tbeqz\ta15, 0x40225b38 <prvIdleTask+24>\r\n   0x40225b57 <+55>:\tl32r\ta0, 0x40225400\r\n   0x40225b5a <+58>:\tcallx0\ta0\r\n   0x40225b5d <+61>:\tl32i.n\ta2, a14, 12\r\n   0x40225b5f <+63>:\tl32i.n\ta15, a2, 12\r\n   0x40225b61 <+65>:\taddi.n\ta2, a15, 4\r\n   0x40225b63 <+67>:\tl32r\ta0, 0x4022598c\r\n   0x40225b66 <+70>:\tcallx0\ta0\r\n   0x40225b69 <+73>:\tl32r\ta3, 0x4022576c\r\n   0x40225b6c <+76>:\tmemw\r\n   0x40225b6f <+79>:\tl32i.n\ta2, a3, 0\r\n   0x40225b71 <+81>:\taddi.n\ta2, a2, -1\r\n   0x40225b73 <+83>:\tmemw\r\n   0x40225b76 <+86>:\ts32i.n\ta2, a3, 0\r\n   0x40225b78 <+88>:\tmemw\r\n   0x40225b7b <+91>:\tl32i.n\ta2, a13, 0\r\n   0x40225b7d <+93>:\taddi.n\ta2, a2, -1\r\n   0x40225b7f <+95>:\tmemw\r\n   0x40225b82 <+98>:\ts32i.n\ta2, a13, 0\r\n   0x40225b84 <+100>:\tl32r\ta0, 0x4022540c\r\n   0x40225b87 <+103>:\tcallx0\ta0\r\n   0x40225b8a <+106>:\tl32i.n\ta2, a15, 48\r\n   0x40225b8c <+108>:\tl32r\ta0, 0x40225494\r\n   0x40225b8f <+111>:\tcallx0\ta0\r\n   0x40225b92 <+114>:\tmov.n\ta2, a15\r\n   0x40225b94 <+116>:\tl32r\ta0, 0x40225494\r\n   0x40225b97 <+119>:\tcallx0\ta0\r\n   0x40225b9a <+122>:\tj\t0x40225b38 <prvIdleTask+24>\r\n   0x40225b9d <+125>:\tl32r\ta3, 0x40225774\r\n   0x40225ba0 <+128>:\tl32i.n\ta2, a3, 0\r\n   0x40225ba2 <+130>:\tbltui\ta2, 2, 0x40225b38 <prvIdleTask+24>\r\n   0x40225ba5 <+133>:\tmovi.n\ta2, 1\r\n   0x40225ba7 <+135>:\tl32r\ta0, 0x40225408\r\n   0x40225baa <+138>:\tcallx0\ta0\r\n   0x40225bad <+141>:\tj\t0x40225b38 <prvIdleTask+24>\r\nEnd of assembler dump.\r\n```\r\n\r\nNow, I am a mere grasshopper when it comes to FreeRTOS, but shouldn't it suppose to handle exiting tasks? Or am I just exiting it the wrong way?"},"comment":{"url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/comments/207933586","html_url":"https://github.com/SuperHouse/esp-open-rtos/issues/125#issuecomment-207933586","issue_url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/125","id":207933586,"user":{"login":"pellepl","id":5098839,"avatar_url":"https://avatars.githubusercontent.com/u/5098839?v=3","gravatar_id":"","url":"https://api.github.com/users/pellepl","html_url":"https://github.com/pellepl","followers_url":"https://api.github.com/users/pellepl/followers","following_url":"https://api.github.com/users/pellepl/following{/other_user}","gists_url":"https://api.github.com/users/pellepl/gists{/gist_id}","starred_url":"https://api.github.com/users/pellepl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pellepl/subscriptions","organizations_url":"https://api.github.com/users/pellepl/orgs","repos_url":"https://api.github.com/users/pellepl/repos","events_url":"https://api.github.com/users/pellepl/events{/privacy}","received_events_url":"https://api.github.com/users/pellepl/received_events","type":"User","site_admin":false},"created_at":"2016-04-10T06:46:46Z","updated_at":"2016-04-10T06:46:46Z","body":"Thanks! I suspected so. Totally missed that in the freertos docs, sorry."}}