renode / renode

Renode - Antmicro's open source simulation and virtual development framework for complex embedded systems
https://renode.io
Other
1.45k stars 257 forks source link

Failed to emulate mbed-os-socket-example for both wireless and wired board #596

Open xidoo123 opened 2 months ago

xidoo123 commented 2 months ago

Description

Renode failed to emulate mbed-os-socket-example for both wireless and wired board. Particularly, the only example script I found for mbed works on STM32F746 board, so the report will base on this board.

Expected behaviour

It should connect to the switch and the socket should work.

How to reproduce?

resc

emulation CreateSwitch "switch1"

using sysbus
$name?="STM32F746"
mach create $name

machine LoadPlatformDescription @platforms/boards/stm32f7_discovery-bb.repl

connector Connect sysbus.ethernet switch1

:sysbus LogPeripheralAccess sysbus.ethernet true
switch1 EnablePromiscuousMode sysbus.ethernet

showAnalyzer usart1
showAnalyzer ltdc

$bin ?= @/check/attachment

macro reset
"""
    sysbus LoadELF $bin
"""

runMacro $reset

Renode seems to freeze during connecting.

18:11:40.9149 [INFO] usart1: [host: 0.45s (+0.45s)|virt: 52?s (+52?s)]
18:11:40.9154 [INFO] usart1: [host: 0.45s (+0.43ms)|virt:   52?s (+0s)] Starting socket demo
18:11:40.9155 [INFO] usart1: [host: 0.45s (+0.25ms)|virt:   52?s (+0s)]
18:11:40.9198 [INFO] Pseudorandom Number Generator was created with seed: 1599700164
18:11:40.9300 [INFO] usart1: [host: 0.47s (+14.46ms)|virt: 84?s (+32?s)] Connecting to the network...
18:11:40.9322 [WARNING] sysbus: [cpu: 0x8004C38] ReadDoubleWord from non existing peripheral at 0x1FF0F420. (2)
18:11:40.9325 [WARNING] nvic: Unhandled write to offset 0xF74, value 0x0.
18:11:40.9337 [WARNING] syscfg: Unhandled read from offset 0x4.
18:11:40.9339 [WARNING] syscfg: Unhandled write to offset 0x4, value 0x0.
18:11:40.9341 [WARNING] syscfg: Unhandled read from offset 0x4.
18:11:40.9342 [WARNING] syscfg: Unhandled write to offset 0x4, value 0x800000.
18:11:40.9367 [WARNING] ethernet.phy: Unhandled write to offset 0x0, value 0x8000.
18:12:02.2489 [WARNING] ethernet.phy: Unhandled write to offset 0x0, value 0x1000.
18:12:02.4122 [WARNING] ethernet: Unhandled write to offset 0x8, value 0x0.
18:12:02.4123 [WARNING] ethernet: Unhandled write to offset 0xC, value 0x0.
18:12:02.4907 [WARNING] ethernet: Unhandled write to offset 0x1C, value 0x0.
18:12:02.4908 [WARNING] ethernet: Unhandled read from offset 0x1C.
18:12:02.5775 [WARNING] ethernet: Unhandled write to offset 0x1C, value 0x0.
18:12:02.7681 [INFO] ethernet: Setting RDLA to 0x2000059C.
18:12:02.9381 [WARNING] ethernet: Unhandled write to offset 0x8, value 0x0.
18:12:02.9381 [WARNING] ethernet: Unhandled write to offset 0xC, value 0x0.
18:12:03.0252 [WARNING] ethernet: Unhandled write to offset 0x1C, value 0x0.
18:12:03.0253 [WARNING] ethernet: Unhandled read from offset 0x1C.
18:12:03.1088 [WARNING] ethernet: Unhandled write to offset 0x1C, value 0x0.
18:12:03.3765 [WARNING] sysbus: Read from an unimplemented register LPTIM1:CNT (0x4000241C), returning a value from SVD: 0x0. (14)

Environment

Renode version

Renode v1.15.0.27975
  build: 9111b18e-202403181532
  build type: Release
  runtime: Mono 4.0.30319.42000

NOTE: I slightly modify the app.json here on mbed side like this to add components for DISCO_F746NG.

{
    "config": {
        "hostname": {
            "help": "The demo will try to connect to this web address on port 80 (or port 443 when using tls).",
            "value": "\"ifconfig.io\""
        },
        "use-tls-socket": {
            "value": false
        }
    },
    "target_overrides": {
        "*": {
             "nsapi.default-wifi-security": "WPA_WPA2",
            "nsapi.default-wifi-ssid": "\"YOUR_SSID\"",
            "nsapi.default-wifi-password": "\"YOUR_PASSWORD\"",
            "platform.stdio-baud-rate": 9600,
            "mbed-trace.enable": false,
            "mbed-trace.max-level": "TRACE_LEVEL_DEBUG",
            "rtos.main-thread-stack-size": 8192
        },
        "DISCO_F413ZH": {
            "target.components_add": ["ism43362"],
            "target.macros_add" : ["MBEDTLS_SHA1_C"]
        },
        "DISCO_F746NG": {
            "target.components_add": ["ism43362"],
            "target.macros_add" : ["MBEDTLS_SHA1_C"]
        },
        "DISCO_L475VG_IOT01A": {
            "target.components_add": ["ism43362"],
            "ism43362.provide-default": true,
            "target.network-default-interface-type": "WIFI",
            "target.macros_add" : ["MBEDTLS_SHA1_C"]
        },
        "K64F": {
            "target.macros_add" : ["MBEDTLS_SHA1_C"]
        }
    }
}

Check the attachment for the binary I used.

Additional information

I also tried it on NRF52840dk board with IEEE802_15_4Medium, still not working.

Do you plan to address this issue and file a PR?

Sadly I haven't figured out why and how to fix it :/ Would be great if someone could look into this and make it work.

mbed-os-example-sockets.DISCO_F746NG.zip