Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No restore possible with mesh shell app from /tests using qemu_x86 on RaspberryPi3 #30416

Closed
CSparn opened this issue Dec 3, 2020 · 11 comments
Closed

Comments

@CSparn
Copy link

CSparn commented Dec 3, 2020

Hi,
I'm trying to run the mesh shell from tests on a RaspberryPi with Qemu_x86.
This is working fine as long as I'm not expecting to use store and restore of the mesh network.
After some research I released that this is not working, because qemu has no flash where it can save the data.
So I created an image with 8MB to pass it to the qemu command as pflash:

qemu-img create -f raw flash/flash.img 8M

The final qemu command looks like this:
qemu-system-x86_64 -m 9 -cpu qemu32,+nx,+pae -device isa-debug-exit,iobase=0xf4,iosize=0x04 -no-reboot -nographic -net none -pidfile qemu.pid -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev==con,mode=readline -drive file=flash/flash.img,format=raw,if=pflash -serial unix:/tmp/bt-server-bredr -s -kernel zephyr/build/zephyr/zephyr.elf

When I'm running it like that, nothing happens. Qemu is started but no shell is shown. When I'm deleting the if=pflash from the command qemu and the mesh shell is starting. But when I run the 'mesh init' command qemu crahes with the error:

ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:374 k_sem_take failed with err -11

I'm not even sure if this is a bug in the zephyr code or if I did something wrong configuring qemu. But does any have an idea how to get this working?

To Reproduce
Steps to reproduce the behavior:

  1. Build mesh shell app for qemu_x86
  2. Copy the folder to RaspberryPi
  3. Start the btproxy from bluez with sudo ./btproxy -u -i 0
  4. Create the flash image like described
  5. Start qemu with the aboth command

Expected behavior
Error Message or nothing.

Thanks in Advance
CSparn

@CSparn CSparn added the bug The issue is a bug, or the PR is fixing a bug label Dec 3, 2020
@Laczen
Copy link
Collaborator

Laczen commented Dec 7, 2020

@CSparn, I don't know if qemu provides flash support. Native_posix does provide flash support where a file is used as a flash emulator. Maybe it is possible to achieve your goal using native_posix.

@CSparn
Copy link
Author

CSparn commented Dec 7, 2020

Hi,
as far as I know, it is possible to use a flash in qemu. For that you need to create an image and add -pflash image_name to the command you start qemu with. But when I do this starting the mesh app, I just see a black line but qemu is not starting properly.
More information you can find here:
https://wiki.qemu.org/Features/PC_System_Flash
and here
https://qemu.readthedocs.io/en/latest/system/images.html

Greetings
CSparn

@Laczen
Copy link
Collaborator

Laczen commented Dec 7, 2020

@CSparn, I don't know if that is the correct way to use flash on qemu. Qemu_x86 does provide simulated flash storage support but I think this is all done in memory and not on a "flash" device (even if you provide -pflash image_name). Is there a zephyr flash driver to support the -pflash area added to the command line ? For storage you need to be able to write this "flash", so a flash driver is needed.

@CSparn
Copy link
Author

CSparn commented Dec 7, 2020

Hi,
I'm also not sure if the command line is the only option to add a flash to qemu.
And I couldn't find a driver for pflash or qemu. But it looks like there is a flash simulator.
Maybe this is the right way to get the flash running with qemu. But when I enable the config
CONFIG_FLASH_SIMULATOR it does not change anything. Maybe another option is missing?
But the flash simulator seems to run on qemu:
https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_FLASH_SIMULATOR.html#cmdoption-arg-CONFIG_FLASH_SIMULATOR
Greetings CSparn

@Laczen
Copy link
Collaborator

Laczen commented Dec 7, 2020

Hi @CSparn, please give native_posix a try, this has full support for flash storage.

@CSparn
Copy link
Author

CSparn commented Dec 7, 2020

Hi,
I tried with native_posix but I could not get it running properly. I always get errors running the app. I will go on trying with native_posix, but for me it seems that the app is running more stable in Qemu. So I also try to find a solution for the flash problem in qemu.

--------------Update---------------
It really seems like the flash is not working with qemu!!

And I could find a solution for native_posix in ubuntu and it works well there.
But now another problem occurs:

I can not directly copy the app from Ubuntu(x86_64) to the RaspberryPi(armv71).
So as I understand, I need to compile the app for arm on ubuntu or compile it directly on the RaspberryPi.
I tried to install the Zephyr project on the RaspberryPi but it is not possible to compile any app because
the dependencies gcc-multilib and g++-multilib are not in the apt list for Raspbian Buster. Then I installed
different gcc toolchains for Raspbian but it's still not working.
Does anyone know how to cross-compile a native_posix app in x86_64 for armv71 with Zephyr, or is that even possible?
Or does anyone know hot to get the Zephyr sdk fully working on RaspberryPi?

Greetings
CSparn

@nashif nashif added the priority: low Low impact/importance bug label Dec 15, 2020
@carlescufi carlescufi added question area: Bluetooth area: Flash and removed bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug labels Feb 9, 2021
@carlescufi
Copy link
Member

ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:374 k_sem_take failed with err -11

This assertion will happen if you have not correctly configured your Bluetooth/BLE controller so that qemu (or native_posix) finds it.
Please follow the documentation on this page and see if you can get it working.

@Laczen
Copy link
Collaborator

Laczen commented Feb 9, 2021

@carlescufi, IIRC the question was to have persistent storage support for qemu, so that on a restart the previous stored settings could be used. I think a flash driver is missing for the case a file is passed to qemu as a flash representation.

@carlescufi
Copy link
Member

@carlescufi, IIRC the question was to have persistent storage support for qemu, so that on a restart the previous stored settings could be used. I think a flash driver is missing for the case a file is passed to qemu as a flash representation.

Sure, but I was addressing the error log from the PR description.

@github-actions
Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Apr 12, 2021
@CSparn
Copy link
Author

CSparn commented Apr 12, 2021

Hi,
thanks for all your help. I could finally solve it by using the native_posix app.
Greetings CSparn

@CSparn CSparn closed this as completed Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants