--- Log opened Sun Jun 17 00:00:16 2018 | ||
shivm28[m] | shorne: Hi, I went through the implementation of gdbserver in openOCD. In openOCD, we can use GDB to program the board as well but that feature will be missing from the osd-gdb server, right? | 02:56 |
---|---|---|
shivm28[m] | http://openocd.org/doc-release/html/GDB-and-OpenOCD.html#programmingusinggdb | 02:56 |
shivm28[m] | We need GDB just to set breakpoints/watchpoints and monitor registers. | 03:02 |
shivm28[m] | I have also worked on a blog with some important aspects of OSD-GDB server: | 06:26 |
shivm28[m] | https://wp.me/p9SnJX-13 | 06:27 |
shorne | shivm28[m]: great | 09:39 |
shorne | as mentioned offline, as far as programming the board uploading bitsream would be out of scope, but uploading a binary should be possible | 09:40 |
shorne | its just, halt cpu, write to memory, update PC spr, start cpu | 09:40 |
shorne | those are all gdb interface commands | 09:40 |
shivm28[m] | shorne:ping? | 10:11 |
shivm28[m] | https://openrisc.io/newlib/ | 10:11 |
shorne | shivm28[m]: hello, did I have you this link | 10:28 |
shorne | https://github.com/stffrdhrn/gcc/releases/tag/or1k-9.0.0-20180613 | 10:28 |
shorne | download: or1k-elf-9.0.0-20180612.tar.xz | 10:28 |
shorne | I mean... I thought I sent you the link to download | 10:29 |
shivm28[m] | Yup | 10:29 |
shorne | so download it, let me know when you are done | 10:29 |
shivm28[m] | Done and extracted | 10:30 |
shorne | ok, can you add the or1k-elf/bin directory to your PATH? | 10:30 |
shorne | you should now be able to see or1k-elf-gcc -version | 10:31 |
shorne | you should see | 10:31 |
shorne | $ or1k-elf-gcc --version | 10:31 |
shorne | or1k-elf-gcc (GCC) 9.0.0 20180426 (experimental) | 10:31 |
shivm28[m] | I got: or1k-elf-gcc (GCC) 5.3.0 | 10:32 |
shivm28[m] | Copyright (C) 2015 Free Software Foundation, Inc. | 10:32 |
shivm28[m] | This is probably an older already installed version. | 10:32 |
shorne | you said you didnt have one | 10:32 |
shorne | $ or1k-elf-gdb --version | 10:33 |
shorne | GNU gdb (GDB) 8.1.50.20180521-git | 10:33 |
shorne | can you fix your path to point to the one I asked? | 10:33 |
shivm28[m] | I never worked with it. Maybe it came with HDMI2USB/LiteX firmware. I will try to fix the path | 10:34 |
shivm28[m] | Done | 10:35 |
shivm28[m] | I got: or1k-elf-gcc (GCC) 9.0.0 20180426 (experimental) | 10:35 |
shorne | and gdb? | 10:36 |
shivm28[m] | GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1 | 10:36 |
shivm28[m] | I will fix that as well | 10:37 |
shorne | wait | 10:38 |
shorne | did you run what I ased? | 10:38 |
shorne | $ or1k-elf-gdb --version | 10:38 |
shorne | the above looks like you ran 'gdb --version' | 10:38 |
shivm28[m] | Oh yes, you are right. | 10:39 |
shivm28[m] | It worked. Now, I get: GNU gdb (GDB) 8.1.50.20180521-git | 10:39 |
shorne | ok, now write a simple pogram like hellow world and compile it | 10:40 |
shorne | i.e. #include <stdio.h> | 10:40 |
shorne | int main() { | 10:40 |
shorne | printf ("hello gcc from or1k\n"); | 10:40 |
shorne | return 0; | 10:40 |
shorne | } | 10:40 |
shorne | $ or1k-elf-gcc -g hello.c | 10:41 |
shorne | sorry, its getting late | 10:42 |
shorne | once you rare done you can do.. | 10:42 |
shivm28[m] | Done | 10:42 |
shorne | 1. $ or1k-elf-run ./a.out | 10:42 |
shorne | 2. ... try in gdb | 10:42 |
shorne | $ or1k-elf-gdb a.out | 10:43 |
shivm28[m] | NO worries. I will complete the instructions and get back to you tomorrow. Thanks a lot!! | 10:44 |
shorne | Step 2. | 10:45 |
shorne | try to debug in gdb with the build in sim (later we will do with actual remote) | 10:45 |
shorne | $ or1k-elf-gdb | 10:45 |
shivm28[m] | The code is compiled and I am getting "Hello World" output | 10:45 |
shorne | (gdb) target sim | 10:46 |
shorne | (gdb) load a.out | 10:46 |
shorne | (gdb) run | 10:46 |
shorne | ... it should run to completion | 10:46 |
shorne | (gdb) b main | 10:46 |
shorne | (gdb) run | 10:47 |
shorne | it should break at the main function | 10:47 |
shorne | ^^ Notice above in gdb we did 'target sim' | 10:47 |
shorne | when you want to connect remote we do 'target remote localhost:1234' | 10:48 |
shorne | and notice 'load', that will load the program into the target's memory | 10:48 |
shorne | for 'target remote' we will want to use qemu/openocd ... then in the future 'open soc debug' | 10:49 |
shorne | I am off | 10:49 |
shivm28[m] | Okay | 10:50 |
shivm28[m] | Thanks | 10:50 |
shivm28[m] | GDB is working fine in simulation. I will try running it with qemu/openocd | 10:55 |
shivm28[m] | I installed qemu using "sudo apt-get install qemu qemu-system" but couldn't find any good resource to move further. | 16:55 |
shivm28[m] | Some resources I referred to: https://www.ece.cmu.edu/~ee349/f-2012/lab2/qemu.pdf | 16:56 |
shivm28[m] | https://helpmanual.io/man1/qemu-or1k/ | 16:56 |
shivm28[m] | https://wiki.qemu.org/index.php/Documentation/Platforms/OpenRISC | 16:57 |
shorne | trye https://wiki.qemu.org/index.php/Documentation/Platforms/OpenRISC | 17:41 |
--- Log closed Mon Jun 18 00:00:18 2018 |
Generated by irclog2html.py 2.15.2 by Marius Gedminas - find it at mg.pov.lt!