atigyi / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
0 stars 0 forks source link

google_iot_device: Make it run with BOARD=qemu_x86 #2

Open pfalcon opened 5 years ago

pfalcon commented 5 years ago

From https://github.com/atigyi/zephyr/blob/google_iot_device_sdk_integration/samples/net/google_iot_device/README.rst:

Only tested on native_posix board. This is where Google IoT looks for value from Zephyr community: the board support.

Indeed, "native_posix" is quite a peculiar "board". It's not "native Zephyr", it's a simulation of some of Zephyr functionality. Quite leaky simulation also, so if you're not careful, you can easily pick up some functions from the underlying POSIX (e.g., Linux) system, which aren't actually available in Zephyr.

This is actually what happened in the previous branch I worked with (https://github.com/galak/iot-device-sdk-embedded-c/tree/zephyr), and I fixed it to run on a "real" Zephyr (still a qemu one). My work on that is in https://github.com/pfalcon/iot-device-sdk-embedded-c

Proposed plan: I'll review this repo's branch regarding that situation, and if needed, will prepare a PR with changes required for qemu_x86.

pfalcon commented 5 years ago

Some updates:

I found that bsp/iotc_bsp_io_net_zephyr.c may call poll() with uninitialized memory. This seems to pass "harmless" with a host system (Linux with native_posix), but leads to error with Zephyr. Maybe we'll need to fix that ;-), later, but so far I have a draft fix for bsp/iotc_bsp_io_net_zephyr.c, needs cleanup. Beyond that, integration of mbedTLS entropy subsystem with Zephyr entropy subsystem. So far, I just recollected the essence of the issue and forward-ported a workaround from my previous port. It will need to be fixed properly. With that, I finally proceed to actual connection, which fails. Certainly, it's a matter of lack of real time source in Zephyr. I had a kind of solution in my old port, hopefully will have time to work to improve it to a fully automagic state.

pfalcon commented 4 years ago

Ok, so with https://github.com/atigyi/zephyr/pull/8 and https://github.com/atigyi/zephyr/pull/9 paving the road to run on native Zephyr targets (thanks for merging), I squashed some issues and forward-ported my older changes, and got the sample app working on BOARD=qemu_x86 !

But I should say right away that there're a lot (well, relatively) clean up to do before we could say "ship it". I mean, if following the schedule "any changes will looks like belonging on Zephyr side, should be done on Zephyr side (instead of adhocly worked around on the SDK port side)". And that's the schedule I'm trying to follow.

Note that I'll be less available next few weeks. Before that, I hope to push current WIP changes in my branch, https://github.com/pfalcon/zephyr/commits/google_iot_device_sdk_integration-pfalcon , file more TODO tickets here, and send an interim progress report via email, so we could plan for next steps.

pfalcon commented 4 years ago

Ok, so changes on samples/net/google_iot_device side, required to get it running on qemu_x86, is in my branch: https://github.com/pfalcon/zephyr/commits/google_iot_device_sdk_integration-pfalcon .

Those are not complete however, because they should be accompanied with changes on Zephyr side. I'm currently working in upstream to get them there.