美文网首页
2020-11-27 qemu仿真STM32F407,用nc看u

2020-11-27 qemu仿真STM32F407,用nc看u

作者: linuxScripter | 来源:发表于2020-11-27 16:35 被阅读0次

    ~/xpack-qemu-arm-2.8.0-9/bin/qemu-system-gnuarmeclipse  \

      --board STM32F429I-Discovery -d  unimp,guest_errors --image led.elf  \

      --mcu STM32F407VG \  板子和MCU可以不是一个型号,有趣。

      --verbose --verbose \

      -gdb tcp::3333  -S \  开gdb端口和4444控制端口

      -monitor  tcp:127.0.0.1:4444,server,nowait   

    首先确认一下monitor好用,看到的chardev为:

    echo info chardev | nc localhost 4444

    QEMU 2.8.0-9 monitor - type 'help' for more information

    (qemu)

    gdb: filename=tcp:127.0.0.1:3333,server <-> 127.0.0.1:55304

    serial5: filename=null

    serial2: filename=null

    serial1: filename=null

    parallel0: filename=vc

    serial0: filename=vc   串口号与MCU手册上的号差1,所以就是MCU的usart1 2 3 6串口。

    compat_monitor0: filename=tcp:127.0.0.1:4444,server <-> 127.0.0.1:50052

    再就是gdb的调试,也好用:

    ~/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gdb led.elf

    GNU gdb (GNU Arm Embedded Toolchain 9-2020-q2-update) 8.3.1.20191211-git

    Copyright (C) 2019 Free Software Foundation, Inc.

    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

    This is free software: you are free to change and redistribute it.

    There is NO WARRANTY, to the extent permitted by law.

    Type "show copying" and "show warranty" for details.

    This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".

    Type "show configuration" for configuration details.

    For bug reporting instructions, please see:

    <http://www.gnu.org/software/gdb/bugs/>.

    Find the GDB manual and other documentation resources online at:

        <http://www.gnu.org/software/gdb/documentation/>.

    For help, type "help".

    Type "apropos word" to search for commands related to "word"...

    Reading symbols from led.elf...

    (gdb) target remote :3333

    Remote debugging using :3333

    Reset_Handler () at startup_stm32f40xx.s:76

    76

    (gdb) c

    Continuing.

    最后是nc显示usart1的内部寄存器:

    seq 10000 | xargs -i bash -c "echo x  /7wx 0x40011000   | nc localhost 4444; sleep 1; clear"

    (qemu) 

    40011000: 0x000003c0 0x00000023 0x000002d9 0x0000200c  这里的23在变,它就是串口发送reg。而程序是freeRTOS的多任务设计,一秒发一次usart,与nc的显示结果完全对上。

    40011010: 0x00000000 0x00000000 0x00000000

    相关文章

      网友评论

          本文标题:2020-11-27 qemu仿真STM32F407,用nc看u

          本文链接:https://www.haomeiwen.com/subject/thwxwktx.html