本文最后更新于 216 天前,其中的信息可能已经有所发展或是发生改变。
使用IoTDK测试串行输出:
1.单击putty窗口的Open以打开控制台。
2.按下IoTDK开发板上的Reset按钮运行uboot程序,控制台将显示如下内容:
U-Boot 2018.11-rc1-iotdk-1.0 (Oct 15 2018 - 09:57:14 +0200)
CPU: ARC EM9D at 144 MHz
Board: Synopsys IoT Development Kit
DRAM: 128 KiB
MMC: Synopsys Mobile storage: 0
Loading Environment from FAT... MMC: no card present
In: serial0@80014000
Out: serial0@80014000
Err: serial0@80014000
IoTDK#
运行示例程序:
以程序blinky为例。
1.在embARC OSP 软件包安装目录下打开命令提示符。打开方式:在资源管理器地址栏输入cmd并按下回车。
2.在cmd中执行构建并运行命令。
cd example\baremetal\blinky
make TOOLCHAIN=gnu BOARD=iotdk run
执行运行命令后,cmd中会显示如下内容:
embarc_osp > cd example\baremetal\blinky
embarc_osp\example\baremetal\blinky > make TOOLCHAIN=gnu BOARD=iotdk run
"Compiling : " main.c
"Linking : " obj_iotdk_10/gnu_arcem9d/blinky_gnu_arcem9d.elf
c:/arc_gnu/bin/../lib/gcc/arc-snps-elf/12.2.1/../../../../arc-snps-elf/bin/ld.exe: warning: obj_iotdk_10/gnu_arcem9d/blinky_gnu_arcem9d.elf has a LOAD segment with RWX permissions
"Download & Run obj_iotdk_10/gnu_arcem9d/blinky_gnu_arcem9d.elf"
arc-elf32-gdb -ex "target remote | openocd --pipe -s c:/arc_gnu/bin/../lib/gcc/arc-snps-elf/12.2.1/../../../../arc-snps-elf/bin/../../share/openocd/scripts -f ../../../board/iotdk/configs/openocd/snps_iotdk.cfg" -ex "load" -ex "c" obj_iotdk_10/gnu_arcem9d/blinky_gnu_arcem9d.elf
GNU gdb (ARCompact/ARCv2 ISA elf32 toolchain - build 1360) 14.0.50.20230314-git
Copyright (C) 2023 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=i686-host_w64-mingw32 --target=arc-snps-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 obj_iotdk_10/gnu_arcem9d/blinky_gnu_arcem9d.elf...
Remote debugging using | openocd --pipe -s c:/arc_gnu/bin/../lib/gcc/arc-snps-elf/12.2.1/../../../../arc-snps-elf/bin/../../share/openocd/scripts -f ../../../board/iotdk/configs/openocd/snps_iotdk.cfg
Open On-Chip Debugger 0.9.0-dev (2023-06-09-04:44)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
0x00000400 in ?? ()
Loading section .init, size 0x214 lma 0x20000000
Loading section .vector, size 0x400 lma 0x20000400
Loading section .text, size 0x2854 lma 0x20000800
Loading section .rodata, size 0xde0 lma 0x20003054
Loading section .data, size 0x3e8 lma 0x20003e34
Start address 0x20000004, load size 16432
Transfer rate: 401 KB/sec, 3286 bytes/write.
Continuing.
putty控制台会显示如下内容:
除运行外,还有其它两种命令:
#构建
cd example\baremetal\blinky
make TOOLCHAIN=gnu BOARD=iotdk
#构建和调试
cd example\baremetal\blinky
make TOOLCHAIN=gnu BOARD=iotdk gui
3.停止程序
在cmd中按下Ctrl+C,显示如下内容:
Program received signal SIGINT, Interrupt.
0x20000aa4 in board_get_cur_us () at ../../../board/iotdk/common/iotdk_timer.c:146
146 total_us = ((uint64_t)OSP_GET_CUR_MS()) * 1000 + (uint64_t)sub_us;
(gdb)
输入q并回车,显示如下内容
(gdb) q
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n)
输入y并回车,显示如下内容
Quit anyway? (y or n) y
Detaching from program: embarc_osp\example\baremetal\blinky\obj_iotdk_10\gnu_arcem9d\blinky_gnu_arcem9d.elf, Remote target
Ending remote debugging.
[Inferior 1 (Remote target) detached]
终止批处理操作吗(Y/N)?
输入y并回车,显示如下内容
终止批处理操作吗(Y/N)? y
../../../options/rules.mk:250: recipe for target 'run' failed
make: *** [run] Error 255
embarc_osp\example\baremetal\blinky >
IoTDK支持eFlash和spi Flash,但不能通过调试器将应用程序直接写入开发板,需要通过u-boot或embarc bootloader等外部程序完成此操作。具体可参阅示例程序example_bootloader。