ilg-archived / qemu

The GNU MCU Eclipse QEMU
http://gnuarmeclipse.github.io/qemu/
Other
205 stars 78 forks source link

socket programming throught semihosting #60

Closed duslabo closed 5 years ago

duslabo commented 5 years ago

Hello,

Device: cortex M4 based qemu-system-gnuarmeclipse version: 2.8.0-3

  1. Is there socket programming available through semihosting? or is it planned?

  2. If socket is not availabe through semihosting, how I can achieve communication in qemu. I use lwip stack in my device.

Thanks

ilg-ul commented 5 years ago

Is there socket programming available through semihosting?

I did not check the latest qemu, but in the old fork I used here it is not.

or is it planned?

it is the first time something like this was suggested. can you elaborate how do you expect this to work?

how I can achieve communication in qemu. I use lwip stack in my device.

qemu has support for net stacks, but I did not evaluate how this can be used for Cortex-M devices.

if you have any concrete suggestions, please let me know.

duslabo commented 5 years ago

My understanding was, there are some system calls (host) supported in qemu. like file read, write, printing to stdout etc. reference: https://github.com/gnu-mcu-eclipse/eclipse-qemu-test-projects/blob/master/cm3-fs-shd/system/include/arm/semihosting.h

Similar way, we can also support linux socket calls? like connect, send and recv ? which is POSIC compliant.

Currently I am not very sure how to implement this, but if anybody throws an idea I can start the implementation here.

ilg-ul commented 5 years ago

The semihosting implementation is conform to an ARM document (https://static.docs.arm.com/100863/0200/semihosting.pdf) which does not cover network calls.

duslabo commented 5 years ago

Thanks for this info, I didn't know that header created based on ARM document, so networking in semihosting as of now.

I should look for network stack thing.. Thanks @ilg-ul for the information...

ilg-ul commented 5 years ago

In QEMU you'll find support for generic Ethernet peripherals and some specific peripherals implemented on top of it.

I did not check the recent Cortex-M support if any small devices use this, but for sure larger devices have such emulated peripherals.