Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging MaixGo on PlatformIO using Kendryte standalone SDK #10

Closed
carlosedp opened this issue Jun 19, 2019 · 10 comments

Comments

@carlosedp
Copy link

commented Jun 19, 2019

I have a problem on my Sipeed MaixGo board, while trying to use it with the Kendryte standalone SDK, I can't debug using it's internal link to see registers and instructions.

My platformio.ini is this:

[env:sipeed-maix-go]
platform = kendryte210
framework = kendryte-standalone-sdk
board = sipeed-maix-go
monitor_speed = 115200
debug_tool = jlink

Here is the error I get first:

Reading symbols from /Users/cdepaula/repos/maix-go/kendryte-blink/.pioenvs/sipeed-maix-go/firmware.elf...
done.
PlatformIO Unified Debugger > http://bit.ly/pio-debug
PlatformIO: Initializing remote target...
 _  __              _            _
| |/ /___ _ __   __| |_ __ _   _| |_ ___
| ' // _ \ '_ \ / _` | '__| | | | __/ _ \
| . \  __/ | | | (_| | |  | |_| | ||  __/
|_|\_\___|_| |_|\__,_|_|   \__, |\__\___|
                           |___/
Kendryte Open On-Chip Debugger For RISC-V v0.2.2 (2019-01-17)
Licensed under GNU GPL v2
embedded:startup.tcl:60: Error: Can't find kendryte_jlink.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 60
.pioinit:10: Error in sourced command file:
Remote connection closed

Then, I changed sipeed-maix-go.json to have the absolute path for the cfg and get this error:

Reading symbols from /Users/cdepaula/repos/maix-go/kendryte-blink/.pioenvs/sipeed-maix-go/firmware.elf...
done.
PlatformIO Unified Debugger > http://bit.ly/pio-debug
PlatformIO: Initializing remote target...
 _  __              _            _
| |/ /___ _ __   __| |_ __ _   _| |_ ___
| ' // _ \ '_ \ / _` | '__| | | | __/ _ \
| . \  __/ | | | (_| | |  | |_| | ||  __/
|_|\_\___|_| |_|\__,_|_|   \__, |\__\___|
                           |___/
Kendryte Open On-Chip Debugger For RISC-V v0.2.2 (2019-01-17)
Licensed under GNU GPL v2
adapter speed: 3000 kHz
Error: No J-Link device found.

.pioinit:10: Error in sourced command file:
Remote connection closed

If I try to debug over FTDI using the kendryte_ftdi.cfg I got on the OpenOCD:

interface ftdi

ftdi_vid_pid 0x0403 0x6010

#func   io  dir val
#TCK    0   1   0
#TDI    1   1   0
#TDO    2   1   0
#TMS    3   0   1
#RST    4   1   1

#       val dir
#ftdi_layout_init 0x0028 0x002b
#只有jtagio分配
ftdi_layout_init 0x0008 0x000b

#ftdi_layout_init 0x0808 0x0a1b
#ftdi_layout_signal nSRST -oe 0x0200
#ftdi_layout_signal nTRST -data 0x0100 -oe 0x0100
#ftdi_layout_signal LED -data 0x0800

adapter_khz 500

gdb_port 3333
telnet_port 4444

set _CHIPNAME riscv

jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x04e4796b

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME riscv -chain-position $_TARGETNAME

if {[ info exists pulse_srst]} {
  ftdi_set_signal nSRST 0
  ftdi_set_signal nSRST z
}

init
halt

I get this error:

Reading symbols from /Users/cdepaula/repos/maix-go/kendryte-blink/.pioenvs/sipeed-maix-go/firmware.elf...
done.
PlatformIO Unified Debugger > http://bit.ly/pio-debug
PlatformIO: Initializing remote target...
 _  __              _            _
| |/ /___ _ __   __| |_ __ _   _| |_ ___
| ' // _ \ '_ \ / _` | '__| | | | __/ _ \
| . \  __/ | | | (_| | |  | |_| | ||  __/
|_|\_\___|_| |_|\__,_|_|   \__, |\__\___|
                           |___/
Kendryte Open On-Chip Debugger For RISC-V v0.2.2 (2019-01-17)
Licensed under GNU GPL v2
adapter speed: 500 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : clock speed 500 kHz
Info : TAP riscv.cpu does not have valid IDCODE (idcode=0xfa82fa)
Info : JTAG tap: auto0.tap tap/device found: 0x007d417d (mfg: 0x0be (Seiko Epson), part: 0x07d4, ver: 0x0)
Info : JTAG tap: auto1.tap tap/device found: 0x007d007d (mfg: 0x03e (Oracle Corporation), part: 0x07d0, ver: 0x0)
Info : JTAG tap: auto2.tap tap/device found: 0x3cb5807d (mfg: 0x03e (Oracle Corporation), part: 0xcb58, ver: 0x3)
Info : TAP auto3.tap does not have valid IDCODE (idcode=0xffff8272)
Info : JTAG tap: auto4.tap tap/device found: 0xffffc139 (mfg: 0x09c (Eon Silicon Devices), part: 0xfffc, ver: 0xf)
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 2 -expected-id 0x007d417d"
Error: auto0.tap: IR capture error; saw 0x0003 not 0x0001
Warn : Bypassing JTAG setup events due to errors
Error: dtmcontrol is 0. Check JTAG connectivity/board power.
Info : Listening on port 3333 for gdb connections
Error: Target not examined yet

.pioinit:10: Error in sourced command file:
Remote connection closed
@ivankravets

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

  1. Please switch to the latest upstream version http://docs.platformio.org/en/latest/platforms/kendryte210.html#upstream
  2. You need to configure debug_tool. See currently supported https://github.com/sipeed/platform-kendryte210/blob/master/platform.py#L42

For example,

[env:sipeed-maix-go]
platform = kendryte210
framework = kendryte-standalone-sdk
board = sipeed-maix-go
monitor_speed = 115200
debug_tool = jlink
build_type = debug

See a demo from my sipeed-maix-bit
Screen Shot 2019-07-11 at 14 45 48

@ivankravets

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

@btx000, @GitJer , please re-test.

There are some issues with Kendryte toolchain where it returns a fake list of CSR* registers. We reported this to RISC-V official team and they fixed this bug a lot of months ago. It seems that @kendryte uses very old fork of RISC-V GCC. Ping @vowstar, @sunnycase. Can we use official RISC-V GCC toolchain?

@ivankravets

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

Please note that uploading through "upload_protocol" currently does not work. See issue kendryte/openocd-kendryte#11

@carlosedp

This comment has been minimized.

Copy link
Author

commented Jul 11, 2019

But you are using an external debugger right? (I see Olimex on the config).

Can't I use the internal debugger from the MaixGo board?

@ivankravets

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

Does MaixGo have an internal debugger? I didn't see it.

@carlosedp

This comment has been minimized.

Copy link
Author

commented Jul 11, 2019

According to the docs, yes: http://docs.platformio.org/en/latest/boards/kendryte210/sipeed-maix-go.html#debugging

But according to the comment it's still not implemented or working: #9 (comment)

@ivankravets

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

This is old and invalid docs. It was a mistake by @btx000. We will release a new version soon and re-generate docs.

@btx000 am I correct? MaixGo does not have on-board debugger?

@btx000

This comment has been minimized.

Copy link
Collaborator

commented Jul 12, 2019

@ivankravets Maix go board has an open-ec firmware based onboard debugger (using stm32 emulation ftdi2232), but the current version is not perfect, we are working for it.

@ivankravets

This comment has been minimized.

Copy link
Collaborator

commented Jul 12, 2019

@btx000 please ping me when it will be supported.

@adigandhi

This comment has been minimized.

Copy link

commented Jul 16, 2019

@Posting here to track this bug, I am unable to debug as well. Please keep us posted whenever we can debug this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.