PelionIoT / pelion-ready-example

Pelion Device Ready example - deprecated
https://github.com/ARMmbed/pelion-ready-example
Apache License 2.0
2 stars 18 forks source link

disable nanostack_event_thread #20

Closed maciejbocianski closed 5 years ago

maciejbocianski commented 6 years ago

turning off nanostack_event_thread by setting following flags to true:

nanostack-hal.event-loop-dispatch-from-application nanostack-hal.event-loop-use-mbed-events

In result: Application is responsible of message dispatch loop Use Mbed OS global event queue for Nanostack event loop

Related PR: https://github.com/ARMmbed/simple-mbed-cloud-client-template-restricted/pull/16

GCC Results

Gain

Total Static RAM memory (data + bss): 78716 - 72572 = 6144 bytes (of heap) Total Flash memory (text + data): 395582 - 395382 = 200 bytes

Before

Total Static RAM memory (data + bss): 78716 bytes Total Flash memory (text + data): 395582 bytes

active threads count: 8 [ 0] id: 536949236 state: 2 priority: 24 stack_size: 4608 stack_space: 1600 name: main_thread [ 1] id: 536889940 state: 1 priority: 1 stack_size: 512 stack_space: 432 name: idle_thread [ 2] id: 536880012 state: 3 priority: 24 stack_size: 1200 stack_space: 608 name: tcpip_thread [ 3] id: 536877892 state: 3 priority: 24 stack_size: 1024 stack_space: 840 name: application_unnamed_thread [ 4] id: 536889868 state: 3 priority: 40 stack_size: 768 stack_space: 664 name: timer_thread [ 5] id: 536888216 state: 3 priority: 24 stack_size: 512 stack_space: 312 name: Kinetis_EMAC_thread [ 6] id: 536887584 state: 3 priority: 24 stack_size: 6144 stack_space: 2368 name: nanostack_event_thread [ 7] id: 536876312 state: 3 priority: 40 stack_size: 1024 stack_space: 728 name: application_unnamed_thread

After

Total Static RAM memory (data + bss): 72572 bytes Total Flash memory (text + data): 395382 bytes

active threads count: 7 [ 0] id: 536943092 state: 2 priority: 24 stack_size: 4608 stack_space: 1600 name: main_thread [ 1] id: 536883732 state: 1 priority: 1 stack_size: 512 stack_space: 416 name: idle_thread [ 2] id: 536877892 state: 3 priority: 24 stack_size: 1024 stack_space: 840 name: application_unnamed_thread [ 3] id: 536880012 state: 3 priority: 24 stack_size: 1200 stack_space: 608 name: tcpip_thread [ 4] id: 536883660 state: 3 priority: 40 stack_size: 768 stack_space: 664 name: timer_thread [ 5] id: 536882004 state: 3 priority: 24 stack_size: 512 stack_space: 312 name: Kinetis_EMAC_thread [ 6] id: 536876312 state: 3 priority: 40 stack_size: 1024 stack_space: 728 name: application_unnamed_thread

MarceloSalazar commented 6 years ago

Duplicate of https://github.com/ARMmbed/simple-mbed-cloud-client-template-restricted/pull/16 ?

janjongboom commented 6 years ago

Yes, duplicate.

janjongboom commented 6 years ago

I've tried to test this, but this does not compile against hackathon-1.4. Do I need some special version of Cloud Client? event-loop-use-mbed-events is not defined.

maciejbocianski commented 6 years ago

You should use at least mbed-os-5.9.3 or master

event-loop-use-mbed-events was added in https://github.com/ARMmbed/mbed-os/commit/8ad3e47a7e1cab942b14993bf89adb6cd20a8fb6#diff-51ec9b60406d877f05f5c3996cfb3c90

janjongboom commented 6 years ago

I planned on taking this in the 2.0.0 release, but I keep running into runtime issues when using this (I guess out of memory issues). Postponing until we can properly verify this.