Comments (18)
@teetak01 @JanneKiiskila @kjbracey-arm
Is this just configuration issue, or should mbed-os have a mechanism in place for cloud client to use the nanostack event loop in co-operation with the mbed-mesh-api?
from mbed-cloud-client-example.
IIRC, the assumption originally when that was written was that mbed-mesh-api's init would get in first, and allocate a big heap to run Nanostack. Cloud client would be the second caller, and that was okay because it used a tiny dynamically-allocated heap - was only used for the event loop, as it used system malloc for all its main structures.
from mbed-cloud-client-example.
Obviously this is all a bit fragile, and I guess something has changed. Looking to see where mesh_system_init
is called, I see it
- in the constructor of
Nanostack
, which would kick in the moment you create anEthernetInterface
with it as the default stack. - in
MeshInterfaceNanostack::initialize
Seems like it should probably be in MeshInterfaceNanostack
's constructor too.
Can you reorder the test app to ensure the network interface is located for the first time before the client code activates?
from mbed-cloud-client-example.
If you do want to share init code with mbed-mesh-api, we could arrange that, but then you would be sharing the config setting, and those would be defaulting to "big enough for Nanostack", so you'd have to have app config to pull that back down when you knew Nanostack wasn't in use.
from mbed-cloud-client-example.
Can you reorder the test app to ensure the network interface is located for the first time before the client code activates?
Those are quite coupled together and I am not cloud client expert. @teetak01 could you take a look?
from mbed-cloud-client-example.
It's possible that you have already located the network interface first (via NetworkInterface::get_default_instance()
, and the issue is due to the lack of init in MeshInterfaceNanostack
's constructor.
By code inspection this sequence would initialise the HAL:
LoWPANNDInterface lowpan();
lowpan.initialize(&NanostackRfPhy::get_default_instance())
But MeshInterface::get_target_default_instance()
does this:
LoWPANNDInterface lowpan(&NanostackRfPhy::get_default_instance());
and that apparently does not. I think that's a bug.
from mbed-cloud-client-example.
mcc_common_setup.cpp calls the NetworkInterface::get_default_instance, that is called from simplem2mclient.h
SimpleM2MClient has a member MbedCloudClient which has a member ServiceClient which has a member ConnectorClient, which calls ns_hal_init in it's constructor. The member MbedCloudClient is constructed before calling the mcc_common_setup.
from mbed-cloud-client-example.
Yes, the initialising of HAL seems to be a bug and probably fixes issues with EUI64, but doesn't solve this issue straight away.
from mbed-cloud-client-example.
from mbed-cloud-client-example.
Could a get_default_instance
call could be done first in the initializer list? Bit subtle, I know...
from mbed-cloud-client-example.
Let's see, at least seems to be possible to do it in the initializer list.
Still the later calls to ns_hal_init are not doing anything, is this intentional that without Nanostack those would still be called? Couldn't just some preprocessor flag solve this race?
from mbed-cloud-client-example.
mbed client uses the ns_hal, so needs it initialised, even if Nanostack isn't in use. Those other calls will start doing something when Nanostack is out of use.
from mbed-cloud-client-example.
ARM Internal Ref: IOTCLT-3172
from mbed-cloud-client-example.
Changing the constructor https://github.com/ARMmbed/mbed-cloud-client-example/blob/master/source/simplem2mclient.h#L49
so that the mcc_platform_init_connection
is first in the initializer-list and calling _cloud_client()
last on the initializer-list still causes the ConnectorClient
to be initialised first thus causing it to call the ns_hal_init
first. Are the member objects constructed already before going through the initializer-list?
from mbed-cloud-client-example.
Not sure what happened after changing the initialising order. I have 2 different radio versions, seems that the SPI with the other one doesn't work properly anymore, other is working without problems.
from mbed-cloud-client-example.
Hmm, seems that using tr_info in the mesh_system_init caused the issues with the other version of the radio shield.
Reordering the app so that network interface gets initialised first and thus mesh_system.c calls the ns_hal_init
first doesn't seem to bring any ill effects. Now the statically allocated memory is used for the Nanostack heap and calls from cloud client to ns_hal_init
are returning immediately.
from mbed-cloud-client-example.
Will be fixed to Client 2.2.0 release.
from mbed-cloud-client-example.
This has been fixed in 2.2.0 release.
from mbed-cloud-client-example.
Related Issues (20)
- Problem with importing project to IDE HOT 3
- How to build the LITE configuration ? HOT 4
- License header missing in some files HOT 3
- Contributing: the license HOT 5
- Replace the Server HOT 3
- mbed-cloud-client example run in ARM9 system problem HOT 16
- Request: Add support for for CY8CPROTO-062-4343W HOT 22
- Build error for LPC55S69_NS target HOT 3
- DeviceKey was not declared for RZ_A1H target HOT 5
- Request to update the MbedTLS to 2.19 HOT 3
- EAPOL Key Message 4 of 4 twice HOT 5
- What combinations of wisun domain, class, and mode are supported? HOT 5
- Wi-SUN TLS cert check fail - Pelion HOT 5
- Wi-SUN Node connection with cloud error. HOT 18
- STM32 EMAC default configuration issue HOT 4
- pal-platform.py fails to run HOT 3
- Are there plans to update with mbed os 5.15.3 or wait for 6.0.0? HOT 4
- Can't connect Pelion Device Management with a ATECC608A Secure element HOT 8
- Failed to update firmware on Renesas EK-RA6M3 target HOT 2
- Build problem: inadequate handling of cyclic dependencies HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mbed-cloud-client-example.