RTL8710 and OpenOCD

Post your RTL8710 based projects and build logs here
rebane
Posts: 18
Joined: Thu Aug 18, 2016 10:11 pm

RTL8710 and OpenOCD

Postby rebane » Thu Aug 18, 2016 10:15 pm

I made a quick test with RTL-00 and openocd (using stlink-v2). The code just blinks LED connected to GC4 on RTL-00 module. Code is uploaded to RAM, but it might be possible to write flash, some helper code is needed (as I understand the integrated flash is some kind of "spi flash").

https://bitbucket.org/rebane/rtl8710/src

dpape
Site Admin
Posts: 26
Joined: Fri Jul 29, 2016 6:11 pm

Re: RTL8710 and OpenOCD

Postby dpape » Fri Aug 19, 2016 9:59 am

Hi Rebane,

Thank you for sharing your project, this is very interesting. I'll look into it.

Kind regards,
Daan

BasilFX
Posts: 15
Joined: Thu Aug 18, 2016 5:28 pm

Re: RTL8710 and OpenOCD

Postby BasilFX » Fri Aug 19, 2016 1:28 pm

I don't own a STLink-v2, but I used BusPirate (V3) to connect as follows, using OpenOCD v0.10-dev:

  • BusPirate pinout: here
  • JTAG pinout (see top left): here

I only connected 3V3, GND, TDI, TCK, TDO and TMS, using the following startup script:

Code: Select all

interface buspirate

buspirate_vreg 1
buspirate_mode open-drain
buspirate_pullup 1
buspirate_port /dev/YOUR_PORT_HERE


I re-used the RTL8710 script from @rebane.

It connects and detects, now I will test further. Note that the chip is using JTAG instead of SWD.

bogdanm
Posts: 14
Joined: Mon Aug 08, 2016 12:15 pm

Re: RTL8710 and OpenOCD

Postby bogdanm » Fri Aug 19, 2016 2:14 pm

The chip can very likely use both JTAG and SWD; in fact, rebane's project uses it in SWD mode. Awesome work! I'll try this later with a JLink interface.

bogdanm
Posts: 14
Joined: Mon Aug 08, 2016 12:15 pm

Re: RTL8710 and OpenOCD

Postby bogdanm » Fri Aug 19, 2016 7:31 pm

Thanks rabane, that worked flawlessly! I ended up using a STLink too, in SWD mode. The only difference from your setup was that I connected the NRST pin on STLink to the CHIP_EN pin on the RTL8710, which seems to make this command:

Code: Select all

make install

work a bit more consistently.

rebane
Posts: 18
Joined: Thu Aug 18, 2016 10:11 pm

Re: RTL8710 and OpenOCD

Postby rebane » Fri Aug 19, 2016 8:54 pm

Hey. I started to dig into SDK mess. Managed to get LOG_UART peripheral working. Now it is possible to use printf (to read register values etc. With OpenOCD it's too complicated to read memory) and send commands to module. I included my own created/collected minimalistic libc library.

https://bitbucket.org/rebane/rtl8710_bare_metal/src

rebane
Posts: 18
Joined: Thu Aug 18, 2016 10:11 pm

Re: RTL8710 and OpenOCD

Postby rebane » Sat Aug 20, 2016 10:51 pm

Good evening. Just pushed new version to git. Now it's possible to log internal spi flash content via UART. Tomorrow I'll make OpenOCD support as well, then it will be possible to save content of spi flash to a file. There is demo code in git right now. Just hit "f" key to log first 1KB of flash, but it's easy to modify the code.

rebane
Posts: 18
Joined: Thu Aug 18, 2016 10:11 pm

Re: RTL8710 and OpenOCD

Postby rebane » Sun Aug 21, 2016 1:00 pm

As I promised. It's now possible to dump the whole flash memory.

Code: Select all

make flash_dump

It generates file named "flash_dump.bin". Someone maybe needs to change openocd interface as I'm using stlink-v2-1. It's also good idea to run first:

Code: Select all

make reset

I'm not familiar with all registers and there are probably some stuff uninitialized.
After reading JEDEC ID from flash, it turns out that the integrated flash chip is MX25L8073E (as you can also see in hal_spi_flash.h file). I included the datasheet for spi flash memory as well in doc/ directory.

rebane
Posts: 18
Joined: Thu Aug 18, 2016 10:11 pm

Re: RTL8710 and OpenOCD

Postby rebane » Mon Aug 22, 2016 4:48 pm

Ok. There's now writing support as well. Software is there:

https://bitbucket.org/rebane/rtl8710_openocd/src

You can use script/rtl8710.ocd file without building. Just include it in your OpenOCD command line.

BasilFX
Posts: 15
Joined: Thu Aug 18, 2016 5:28 pm

Re: RTL8710 and OpenOCD

Postby BasilFX » Tue Aug 23, 2016 10:05 am

rebane wrote:Hey. I started to dig into SDK mess. Managed to get LOG_UART peripheral working. Now it is possible to use printf (to read register values etc. With OpenOCD it's too complicated to read memory) and send commands to module. I included my own created/collected minimalistic libc library.

https://bitbucket.org/rebane/rtl8710_bare_metal/src


Small 'bug report': in lib/cpu/cortex/cortex.c there are too many interrupts defined. If I recall correctly, there are at most 256 vector table entries, so you should remove entries 240-255 (the default ones make up another 16) ;)


Return to “Projects and builds”

Who is online

Users browsing this forum: No registered users and 1 guest