ARMmbed / wifi-x-nucleo-idw01m1

X-NUCLEO-IDW0xx1 Wi-Fi Driver
3 stars 8 forks source link

Eliminate static data when unreferenced #14

Closed kjbracey closed 6 years ago

kjbracey commented 6 years ago

Avoid static ROM + RAM use when driver is not referenced.

Saves about 150 bytes of ROM and 50 bytes of RAM in mbed OS easy-connect when using a different driver.

Switches mutex locking from built-in BlockExecuter to the ScopedMutexLock from mbed OS.

kjbracey commented 6 years ago

Sure - I just put that comment in to try to justify the BlockExecuter/ScopedLock mismatch.

Not sure what's misleading though. BlockExecuter is more flexible, but has the complexity of actually creating the Callback objects, which I think are complex enough that the compilers will fail to optimise them out. Or am I underestimating the optimisers?

A ScopedLock template instantiation can definitely be simple enough that at least at -O2 level it just compiles straight to the relevant function calls with no overhead.

kjbracey commented 6 years ago

Edited, and squashed your cosmetic change in.