{"id":146,"date":"2020-12-29T08:30:32","date_gmt":"2020-12-29T08:30:32","guid":{"rendered":"https:\/\/ibndias.wordpress.com\/?p=146"},"modified":"2021-01-14T10:27:23","modified_gmt":"2021-01-14T01:27:23","slug":"arty-a7-riscv-debugging-using-j-link","status":"publish","type":"post","link":"https:\/\/blog.derrylab.com\/index.php\/2020\/12\/29\/arty-a7-riscv-debugging-using-j-link\/","title":{"rendered":"Stuck at Debugging RISCV on Arty A7 using J-Link"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Running the RISCV Processor<\/h2>\n\n\n\n<p>I got an Arty A7 board coming to my desk, and I&#8217;m curious to try running a RISCV processor on it. Not long after following the <a rel=\"noreferrer noopener\" href=\"https:\/\/reference.digilentinc.com\/reference\/programmable-logic\/arty-a7\/arty_a7_100_risc_v\/start\" data-type=\"URL\" data-id=\"https:\/\/reference.digilentinc.com\/reference\/programmable-logic\/arty-a7\/arty_a7_100_risc_v\/start\" target=\"_blank\">tutorial from Digilent<\/a>, I was able to program the RISCV processor on this board just by using a MicroUSB cable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Running the Program on RISCV<\/h2>\n\n\n\n<p>Now I have a RISCV running on this Arty A7 Board. I need to run a program. After a couple of minutes of researching, I found <a rel=\"noreferrer noopener\" href=\"https:\/\/forums.sifive.com\/t\/uploading-to-my-arty-board-not-working\/323\/12\" data-type=\"URL\" data-id=\"https:\/\/forums.sifive.com\/t\/uploading-to-my-arty-board-not-working\/323\/12\" target=\"_blank\">this<\/a> post, I was able to put my program running by putting it on <code>*.mcs<\/code> that I build from the <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/sifive\/freedom\" data-type=\"URL\" data-id=\"https:\/\/github.com\/sifive\/freedom\" target=\"_blank\">SiFive Freedom GitHub<\/a> repository.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Or simply you could follow <a rel=\"noreferrer noopener\" href=\"https:\/\/www.youtube.com\/watch?v=1TEoY0vCdcE&amp;ab_channel=GeekTillItHertz\" data-type=\"URL\" data-id=\"https:\/\/www.youtube.com\/watch?v=1TEoY0vCdcE&amp;ab_channel=GeekTillItHertz\" target=\"_blank\">this explanation from YouTube<\/a> to try to run your program without a debugger.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Now How to Debug?<\/h2>\n\n\n\n<p>Since I don&#8217;t have an Olimex debugger, I tried to find a way to debug it using J-link which is the only debugger available here. Luckily, I found <a rel=\"noreferrer noopener\" href=\"https:\/\/wiki.segger.com\/SiFive_Arty_FPGA_Dev_Kit#Preparing_for_J-Link\" target=\"_blank\">this official guide<\/a> from Segger, I tried to connect all the pins and start my <a href=\"https:\/\/www.sifive.com\/software\" data-type=\"URL\" data-id=\"https:\/\/www.sifive.com\/software\" target=\"_blank\" rel=\"noreferrer noopener\">Freedom Studio<\/a>. I configured the debug configuration according to the wiki. Everything was going well until I found out that there is no output.<\/p>\n\n\n\n<p>I thought it was a serial baud rate problem. Since the clock is downclocked and the serial baud rate is not updated. So currently in the master branch of freedom, the serial baud rate should be <code>57600<\/code>. I tried to put my program inside the <code>*.mcs<\/code> file then flash it using Vivado via the micro USB port. It works.<\/p>\n\n\n\n<p>I wonder why my J-link does not succeed in programming the Arty. Is it because of the wrong pins? But J-link said it detects the RISCV. Then I realize at the log there is verify failure.<\/p>\n\n\n\n<p>However, I cannot continue to troubleshoot since I have other works to do. If you guys know this problem please share it with me. I will update this post as soon as I got it working. \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Running the RISCV Processor I got an Arty A7 board coming to my desk, and I&#8217;m curious to try running a RISCV processor on it. Not long after following the tutorial from Digilent, I was able to program the RISCV processor on this board just by using a MicroUSB cable. Running the Program on RISCV [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[79,87,84,85,80,77,82,83,86,81],"class_list":["post-146","post","type-post","status-publish","format-standard","hentry","category-programming","tag-arty-a7","tag-compile","tag-debugger","tag-debugging","tag-digilent","tag-fpga","tag-j-link","tag-olimex","tag-riscv","tag-segger"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":244,"url":"https:\/\/blog.derrylab.com\/index.php\/2021\/03\/12\/the-riscv-isa-documentation-is-better-than-riscv-green-card\/","url_meta":{"origin":146,"position":0},"title":"The RISCV ISA Documentation Is Better than RISCV Green Card","author":"derry","date":"March 12, 2021","format":false,"excerpt":"I hosted the RISCV ISA Documentation. This is really helpful if you want to learn about the assembly syntax or learning the RISCV itself. As a beginner, this documentation is more effective instead of constantly checking at the green card. :) RISCV ISA Documentation:https:\/\/blog.derrylab.com\/riscv-isa-documentation You can host it yourself, it\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":235,"url":"https:\/\/blog.derrylab.com\/index.php\/2021\/06\/24\/this-makes-my-risc-v-trap-handler-does-not-work\/","url_meta":{"origin":146,"position":1},"title":"This Makes My RISC-V Trap Handler Does Not Work","author":"derry","date":"June 24, 2021","format":false,"excerpt":"I was working on a RISCV assembly when suddenly I got a weird issue.The exception does not get caught in the trap handler. I thought this was a QEMU bug on the RISCV target because the trap handler works on my other code.Then after a day of digging, I figured\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/blog.derrylab.com\/index.php\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":552,"url":"https:\/\/blog.derrylab.com\/index.php\/2022\/03\/15\/how-to-run-linux-on-riscv-in-arty-a7-100t-fpga\/","url_meta":{"origin":146,"position":2},"title":"How to Run Linux on RISCV in Arty A7-100T FPGA","author":"derry","date":"March 15, 2022","format":false,"excerpt":"It's been tempting for me to try running open-source software on top of open-source hardware. SiFive provides a bitstream for Arty A7 called Freedom, but it seems that the repository is dead now. The other interesting alternative to try is VexRiscv, and everyone keeps posting about Arty A7 35T while\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/pexels-rone-ferreira-3690005-1-scaled.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/pexels-rone-ferreira-3690005-1-scaled.jpg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/pexels-rone-ferreira-3690005-1-scaled.jpg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/pexels-rone-ferreira-3690005-1-scaled.jpg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/pexels-rone-ferreira-3690005-1-scaled.jpg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":40,"url":"https:\/\/blog.derrylab.com\/index.php\/2020\/04\/01\/how-to-view-pointer-as-array-in-visual-studio-code\/","url_meta":{"origin":146,"position":3},"title":"How to View Pointer as Array in Visual Studio Code","author":"derry","date":"April 1, 2020","format":false,"excerpt":"It is irritating when you have to write and memorize this syntax in the middle of debugging, but let me just put it in here for future use: *mypointer@10 Replace mypointer with your pointer name, and replace 10 with how much array you want to view. The ,h at the\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/blog.derrylab.com\/index.php\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":544,"url":"https:\/\/blog.derrylab.com\/index.php\/2022\/03\/19\/how-to-enable-https-on-your-apache-ubuntu-web-server\/","url_meta":{"origin":146,"position":4},"title":"How to Enable HTTPS on Your Apache Ubuntu Web Server","author":"derry","date":"March 19, 2022","format":false,"excerpt":"I thought this is an easy task, but after searching for various ways on the internet, it is not as simple as I imagined. There are many ways to enable HTPPS on your web server depending on what server software is used, the operating system, and where the server is\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/franck-DoWZMPZ-M9s-unsplash.jpg?fit=1200%2C900&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/franck-DoWZMPZ-M9s-unsplash.jpg?fit=1200%2C900&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/franck-DoWZMPZ-M9s-unsplash.jpg?fit=1200%2C900&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/franck-DoWZMPZ-M9s-unsplash.jpg?fit=1200%2C900&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/franck-DoWZMPZ-M9s-unsplash.jpg?fit=1200%2C900&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2242,"url":"https:\/\/blog.derrylab.com\/index.php\/2022\/10\/18\/how-to-do-buffer-overflow-attack-on-64bit-machine\/","url_meta":{"origin":146,"position":5},"title":"How to Do Buffer Overflow Attack on 64bit Machine","author":"derry","date":"October 18, 2022","format":false,"excerpt":"Professor's course material was out of date. He made an example of a buffer overflow attack several years ago. Then here I am, asked to fix the code to work on a modern machine, 64bit Kali Linux. There should be no difference with other Linux; you can practice this on\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"giant tsunami wave","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/comments?post=146"}],"version-history":[{"count":4,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/146\/revisions"}],"predecessor-version":[{"id":194,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/146\/revisions\/194"}],"wp:attachment":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/media?parent=146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/categories?post=146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/tags?post=146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}