diff --git a/board/GD32VF103C_START/eclipse/hello_world/.settings/ilg.gnumcueclipse.debug.gdbjtag.openocd.prefs b/board/GD32VF103C_START/eclipse/hello_world/.settings/ilg.gnumcueclipse.debug.gdbjtag.openocd.prefs index 5ce8285b..a469e11b 100644 --- a/board/GD32VF103C_START/eclipse/hello_world/.settings/ilg.gnumcueclipse.debug.gdbjtag.openocd.prefs +++ b/board/GD32VF103C_START/eclipse/hello_world/.settings/ilg.gnumcueclipse.debug.gdbjtag.openocd.prefs @@ -1,3 +1,3 @@ -eclipse.preferences.version=1 -executable.name=openocd -install.folder=/Users/ace/sys/gnu-mcu-eclipse/openocd/self/bin +eclipse.preferences.version=1 +executable.name=openocd +install.folder=/Users/ace/sys/gnu-mcu-eclipse/openocd/self/bin diff --git a/board/GD32VF103C_START/eclipse/hello_world/.settings/ilg.gnumcueclipse.managedbuild.cross.riscv.prefs b/board/GD32VF103C_START/eclipse/hello_world/.settings/ilg.gnumcueclipse.managedbuild.cross.riscv.prefs index d5692f5e..8cebf325 100644 --- a/board/GD32VF103C_START/eclipse/hello_world/.settings/ilg.gnumcueclipse.managedbuild.cross.riscv.prefs +++ b/board/GD32VF103C_START/eclipse/hello_world/.settings/ilg.gnumcueclipse.managedbuild.cross.riscv.prefs @@ -1,2 +1,2 @@ -eclipse.preferences.version=1 -toolchain.path.512258282=/Users/ace/sys/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.2-20190521-0004/bin +eclipse.preferences.version=1 +toolchain.path.512258282=/Users/ace/sys/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.2-20190521-0004/bin diff --git a/board/GD32VF103C_START/eclipse/hello_world/.settings/language.settings.xml b/board/GD32VF103C_START/eclipse/hello_world/.settings/language.settings.xml index 1c9fb7ba..cf17e40e 100644 --- a/board/GD32VF103C_START/eclipse/hello_world/.settings/language.settings.xml +++ b/board/GD32VF103C_START/eclipse/hello_world/.settings/language.settings.xml @@ -1,48 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/board/GD32VF103C_START/eclipse/hello_world/.settings/org.eclipse.ltk.core.refactoring.prefs b/board/GD32VF103C_START/eclipse/hello_world/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index b196c64a..00000000 --- a/board/GD32VF103C_START/eclipse/hello_world/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/board/SipeedLonganNano/eclipse/hello_world/.settings/ilg.gnumcueclipse.debug.gdbjtag.openocd.prefs b/board/SipeedLonganNano/eclipse/hello_world/.settings/ilg.gnumcueclipse.debug.gdbjtag.openocd.prefs deleted file mode 100644 index 5ce8285b..00000000 --- a/board/SipeedLonganNano/eclipse/hello_world/.settings/ilg.gnumcueclipse.debug.gdbjtag.openocd.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -executable.name=openocd -install.folder=/Users/ace/sys/gnu-mcu-eclipse/openocd/self/bin diff --git a/board/SipeedLonganNano/eclipse/hello_world/.settings/ilg.gnumcueclipse.managedbuild.cross.riscv.prefs b/board/SipeedLonganNano/eclipse/hello_world/.settings/ilg.gnumcueclipse.managedbuild.cross.riscv.prefs deleted file mode 100644 index d5692f5e..00000000 --- a/board/SipeedLonganNano/eclipse/hello_world/.settings/ilg.gnumcueclipse.managedbuild.cross.riscv.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -toolchain.path.512258282=/Users/ace/sys/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.2-20190521-0004/bin diff --git a/board/SipeedLonganNano/eclipse/hello_world/.settings/language.settings.xml b/board/SipeedLonganNano/eclipse/hello_world/.settings/language.settings.xml deleted file mode 100644 index cf5bdf78..00000000 --- a/board/SipeedLonganNano/eclipse/hello_world/.settings/language.settings.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/board/SipeedLonganNano/eclipse/hello_world/.settings/org.eclipse.ltk.core.refactoring.prefs b/board/SipeedLonganNano/eclipse/hello_world/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index b196c64a..00000000 --- a/board/SipeedLonganNano/eclipse/hello_world/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/doc/RISC-V eclipse 开发环境搭建.md b/doc/RISC-V eclipse 开发环境搭建.md new file mode 100644 index 00000000..87a959a1 --- /dev/null +++ b/doc/RISC-V eclipse 开发环境搭建.md @@ -0,0 +1,141 @@ +#RISC-V eclipse 开发环境搭建 + +## 软件列表 + +* eclipse +* riscv toolchain +* riscv openocd + + +## eclipse + +下载安装过程略 + +## riscv toolchain + +在下载页`https://github.com/gnu-mcu-eclipse/riscv-none-gcc/releases`选择相应平台下载。并解压,放到合适的目录。 + +## riscv openocd + +签出代码```git clone https://github.com/riscv-mcu/riscv-openocd``` + +编译 +``` +./configure --enable-cmsis-dap --enable-ftdi --prefix=安装目录路径 + +make + +make install +``` + + +## 配置eclipse + +![](./img/riscv/properties.png) + + +配置toolchain路径 + +![](./img/riscv/toolchain.png) + + +配置openocd路径 + +![](./img/riscv/openocd.png) + + +##调试设置 + +添加如下两行 + +``` +set arch riscv:rv32 +set remotetimeout 250 +``` + +![](./img/riscv/debug.png) + + +## 如果用gd-link调试 + +配置文件 + +``` +adapter_khz 1000 +reset_config srst_only +adapter_nsrst_assert_width 100 + + + +interface cmsis-dap + +transport select jtag + +#autoexit true + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1000563d + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME riscv -chain-position $_TARGETNAME +$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 20480 -work-area-backup 0 + + +# Work-area is a space in RAM used for flash programming +if { [info exists WORKAREASIZE] } { + set _WORKAREASIZE $WORKAREASIZE +} else { + set _WORKAREASIZE 0x5000 +} + +# Allow overriding the Flash bank size +if { [info exists FLASH_SIZE] } { + set _FLASH_SIZE $FLASH_SIZE +} else { + # autodetect size + set _FLASH_SIZE 0 +} + +# flash size will be probed +set _FLASHNAME $_CHIPNAME.flash + +flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME +riscv set_reset_timeout_sec 1 +init + +halt +``` + +## 如果用sipeed riscv debugger调试 + +配置文件 + +``` +adapter_khz 1000 + +interface ftdi +ftdi_device_desc "Dual RS232" +ftdi_vid_pid 0x0403 0x6010 + +transport select jtag +ftdi_layout_init 0x0008 0x001b +ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020 + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME riscv -chain-position $_TARGETNAME +$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1 + +set _FLASHNAME $_CHIPNAME.flash +flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME + +riscv expose_csrs 3040-3071 + +init + +halt +# We must turn on this because otherwise the IDE version debug cannot download the program into flash +#flash protect 0 0 last off +``` \ No newline at end of file diff --git a/doc/img/riscv/debug.png b/doc/img/riscv/debug.png new file mode 100644 index 00000000..17fa5d10 Binary files /dev/null and b/doc/img/riscv/debug.png differ diff --git a/doc/img/riscv/openocd.png b/doc/img/riscv/openocd.png new file mode 100644 index 00000000..49f5fde7 Binary files /dev/null and b/doc/img/riscv/openocd.png differ diff --git a/doc/img/riscv/properties.png b/doc/img/riscv/properties.png new file mode 100644 index 00000000..94962e4e Binary files /dev/null and b/doc/img/riscv/properties.png differ diff --git a/doc/img/riscv/toolchain.png b/doc/img/riscv/toolchain.png new file mode 100644 index 00000000..2c143a10 Binary files /dev/null and b/doc/img/riscv/toolchain.png differ