{"id":653,"date":"2017-11-18T18:05:09","date_gmt":"2017-11-18T17:05:09","guid":{"rendered":"http:\/\/www.fabienm.eu\/flf\/?p=653"},"modified":"2019-07-04T20:56:25","modified_gmt":"2019-07-04T19:56:25","slug":"prise-en-main-du-kit-de-dev-hifive1-freedom-e310","status":"publish","type":"post","link":"http:\/\/www.fabienm.eu\/flf\/prise-en-main-du-kit-de-dev-hifive1-freedom-e310\/","title":{"rendered":"Prise en main du kit de dev HiFive1 (Freedom E310)"},"content":{"rendered":"<p>Les chercheurs de Berkley qui ont fond\u00e9 le set d&rsquo;instruction (ISA) <a href=\"https:\/\/riscv.org\/\">Risc-V <\/a>(prononcez Risque failleve) ont \u00e9galement mont\u00e9 une soci\u00e9t\u00e9 nomm\u00e9e <a href=\"https:\/\/www.sifive.com\/\">SiFive<\/a>.<\/p>\n<p>Cette soci\u00e9t\u00e9 con\u00e7oit des c\u0153urs de processeurs nomm\u00e9s Freedom Everywhere et propose \u00e0 ses clients de l&rsquo;inclure dans des ASIC personnalis\u00e9. Les processeurs cr\u00e9\u00e9s restent \u00e9videmment open-source, et l&rsquo;int\u00e9gralit\u00e9 du code (Chisel) est disponible sur le site de SiFive.<\/p>\n<p>Pour promouvoir leur processeur, SiFive a fabriqu\u00e9 un microcontr\u00f4leur 32bits nomm\u00e9 Freedom E310. SiFive a \u00e9galement r\u00e9alis\u00e9 une carte \u00abcompatible arduino\u00bb qu&rsquo;il est possible de <a href=\"https:\/\/www.crowdsupply.com\/sifive\/hifive1-rev-b\">commander en crowdsourcing <\/a> pour prendre en main ce processeur.<\/p>\n<p>C&rsquo;est ce que nous allons tester ici. Le kit est livr\u00e9 \u00absec\u00bb, pour l&rsquo;alimenter il faut donc soit trouver un c\u00e2ble d&rsquo;alimentation, soit d\u00e9cider de l&rsquo;alimenter via l&rsquo;USB comme expliqu\u00e9 dans <a href=\"https:\/\/static.dev.sifive.com\/dev-kits\/hifive1\/hifive1-getting-started-v1.0.2.pdf\">le manuel de d\u00e9marrage<\/a>.<\/p>\n<figure id=\"attachment_655\" aria-describedby=\"caption-attachment-655\" style=\"width: 800px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.fabienm.eu\/flf\/wp-content\/uploads\/2017\/11\/P1010906_modified.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-655\" src=\"http:\/\/www.fabienm.eu\/flf\/wp-content\/uploads\/2017\/11\/P1010906_modified.jpg\" alt=\"\" width=\"800\" height=\"600\" srcset=\"http:\/\/www.fabienm.eu\/flf\/wp-content\/uploads\/2017\/11\/P1010906_modified.jpg 800w, http:\/\/www.fabienm.eu\/flf\/wp-content\/uploads\/2017\/11\/P1010906_modified-300x225.jpg 300w, http:\/\/www.fabienm.eu\/flf\/wp-content\/uploads\/2017\/11\/P1010906_modified-768x576.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption id=\"caption-attachment-655\" class=\"wp-caption-text\">Kit HiFive1 (compatible arduino)<\/figcaption><\/figure>\n<p>Le plus gros composant que l&rsquo;on voit sur la carte est le convertisseur USB-S\u00e9rie et non le microcontr\u00f4leur. Le microcontr\u00f4leur se trouve \u00e0 droite avec le \u00absymbole superman\u00bb.<\/p>\n<p>Branchement<\/p>\n<p>Le branchement du kit sur l&rsquo;USB fait appara\u00eetre deux convertisseurs FTDI :<\/p>\n<pre>[16353.800810] usb 3-1: new high-speed USB device number 2 using xhci_hcd\n[16353.941120] usb 3-1: New USB device found, idVendor=0403, idProduct=6010\n[16353.941124] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0\n[16353.941126] usb 3-1: Product: Dual RS232-HS\n[16353.941139] usb 3-1: Manufacturer: FTDI\n[16354.969029] usbcore: registered new interface driver usbserial\n[16354.969056] usbcore: registered new interface driver usbserial_generic\n[16354.969076] usbserial: USB Serial support registered for generic\n[16354.986140] usbcore: registered new interface driver ftdi_sio\n[16354.986162] usbserial: USB Serial support registered for FTDI USB Serial Device\n[16354.986298] ftdi_sio 3-1:1.0: FTDI USB Serial Device converter detected\n[16354.986354] usb 3-1: Detected FT2232H\n[16354.986609] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0\n[16354.986634] ftdi_sio 3-1:1.1: FTDI USB Serial Device converter detected\n[16354.986673] usb 3-1: Detected FT2232H\n[16354.986906] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB1\n<\/pre>\n<p>La carte est livr\u00e9e avec un bootloader faisant clignoter la led 4-couleurs D6. Il est possible de communiquer avec ce programme via le second port s\u00e9rie :<\/p>\n<pre>$ sudo screen \/dev\/ttyUSB1 115200\n<\/pre>\n<p>On obtient le message de superman apr\u00e8s avoir appuy\u00e9 sur reset:<\/p>\n<pre>                SIFIVE, INC.\n\n         5555555555555555555555555\n        5555                   5555\n       5555                     5555\n      5555                       5555\n     5555       5555555555555555555555\n    5555       555555555555555555555555\n   5555                             5555\n  5555                               5555\n 5555                                 5555\n5555555555555555555555555555          55555\n 55555           555555555           55555\n   55555           55555           55555\n     55555           5           55555\n       55555                   55555\n         55555               55555\n           55555           55555\n             55555       55555\n               55555   55555\n                 555555555\n                   55555\n                     5\n\n               'led_fade' Demo \n\n\n\n55555555555555555555555555555555555555555555555\n5555555 Are the LEDs Changing? [y\/n]  555555555\n55555555555555555555555555555555555555555555555\ny\nPASS\n<\/pre>\n<p><strong>Compilons un programme pour l&rsquo;E310<\/strong><\/p>\n<p>La mise en route du kit est relativement simple dans la mesure ou tout est d\u00e9crit dans le document \u00abgetting started\u00bb.<\/p>\n<p>\u00c9videmment, le c\u0153ur du proc est libre, du coup la cha\u00eene de compilation l&rsquo;est aussi pardi. Il suffit de la t\u00e9l\u00e9charger sur sa machine :<\/p>\n<pre>$ git clone --recursive https:\/\/github.com\/sifive\/freedom-e-sdk.git\n<\/pre>\n<p>Puis<\/p>\n<pre>cd freedom-e-sdk\nmake tools\n<\/pre>\n<p>Et attendre que \u00e7a compile en prenant son caf\u00e9.<\/p>\n<p>Dans mon cas (Debian jessie) il fallait \u00e9galement installer les packets suivant pour que \u00e7a compile:<\/p>\n<pre>sudo apt-get install libmpc-dev\n<\/pre>\n<p>Un fois install\u00e9, on peut compiler la d\u00e9mo de gpio comme \u00e7a:<\/p>\n<pre>$ make software PROGRAM=demo_gpio BOARD=freedom-e300-hifive1\n<\/pre>\n<p>Puis la t\u00e9l\u00e9charger ainsi :<\/p>\n<pre>$ make upload PROGRAM=demo_gpio BOARD=freedom-e300-hifive1\nwork\/build\/openocd\/prefix\/bin\/openocd -f bsp\/env\/freedom-e300-hifive1\/openocd.cfg &amp; \\\n\/opt\/freedom-e-sdk\/work\/build\/riscv-gnu-toolchain\/riscv64-unknown-elf\/prefix\/bin\/riscv64-unknown-elf-gdb software\/demo_gpio\/demo_gpio --batch -ex \"set remotetimeout 240\" -ex \"target extended-remote localhost:3333\" -ex \"monitor reset halt\" -ex \"monitor flash protect 0 64 last off\" -ex \"load\" -ex \"monitor resume\" -ex \"monitor shutdown\" -ex \"quit\" &amp;&amp; \\\necho \"Successfully uploaded 'demo_gpio' to freedom-e300-hifive1.\"\nOpen On-Chip Debugger 0.10.0+dev (2017-11-18-18:04)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp:\/\/openocd.org\/doc\/doxygen\/bugs.html\nadapter speed: 10000 kHz\nInfo : auto-selecting first available session transport \"jtag\". To override use 'transport select '.\nInfo : ftdi: if you experience problems at higher adapter clocks, try the command \"ftdi_tdo_sample_edge falling\"\nInfo : clock speed 10000 kHz\nInfo : JTAG tap: riscv.cpu tap\/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)\nInfo : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=0\nInfo : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=1\nInfo : Examined RISCV core; XLEN=32, misa=0x40001105\nInfo : Listening on port 3333 for gdb connections\nInfo : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=2\nInfo : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=3\nInfo : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=4\nInfo : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=5\nInfo : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=6\nInfo : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=7\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=7\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=8\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=9\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=10\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=12\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=14\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=16\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=18\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=20\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=23\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=26\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=29\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=32\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=36\nInfo : [0] Found 2 triggers\nhalted at 0x204000fe due to debug interrupt\nInfo : Listening on port 6666 for tcl connections\nInfo : Listening on port 4444 for telnet connections\nInfo : accepting 'gdb' connection on tcp\/3333\nInfo : Found flash device 'issi is25lp128' (ID 0x0018609d)\ntrap_entry () at \/opt\/freedom-e-sdk\/bsp\/env\/entry.S:41\n41\t  STORE x27, 27*REGBYTES(sp)\nInfo : JTAG tap: riscv.cpu tap\/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)\nJTAG tap: riscv.cpu tap\/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)\nhalted at 0x204000fe due to debug interrupt\nhalted at 0x204000fe due to debug interrupt\ncleared protection for sectors 64 through 255 on flash bank 0\ncleared protection for sectors 64 through 255 on flash bank 0\nInfo : JTAG tap: riscv.cpu tap\/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)\nhalted at 0x204000fe due to debug interrupt\nLoading section .init, size 0x6c lma 0x20400000\nLoading section .text, size 0xbbe6 lma 0x2040006c\nLoading section .rodata, size 0x1144 lma 0x2040bc58\nLoading section .eh_frame, size 0x68 lma 0x2040cd9c\nLoading section .data, size 0x9d0 lma 0x2040ce04\nInfo : Padding image section 0 with 6 bytes\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=40\nInfo : Retrying memory read starting from 0x80000000 with more delays\nInfo : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=45\nInfo : Retrying memory read starting from 0x80000000 with more delays\nhalted at 0x80000004 due to software breakpoint\nhalted at 0x80000004 due to software breakpoint\nhalted at 0x80000004 due to software breakpoint\nhalted at 0x80000004 due to software breakpoint\nhalted at 0x80000004 due to software breakpoint\nhalted at 0x80000004 due to software breakpoint\nhalted at 0x80000004 due to software breakpoint\nhalted at 0x80000004 due to software breakpoint\nhalted at 0x80000004 due to software breakpoint\nhalted at 0x80000004 due to software breakpoint\nInfo : JTAG tap: riscv.cpu tap\/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)\nhalted at 0x80000004 due to software breakpoint\nStart address 0x20400000, load size 55246\nTransfer rate: 52 KB\/sec, 6905 bytes\/write.\nhalted at 0x20400004 due to step\nhalted at 0x20400004 due to step\nshutdown command invoked\nshutdown command invoked\nA debugging session is active.\n\n\tInferior 1 [Remote target] will be detached.\n\nQuit anyway? (y or n) [answered Y; input not from terminal]\nRemote communication error.  Target disconnected.: Connection reset by peer.\nSuccessfully uploaded 'demo_gpio' to freedom-e300-hifive1.\n\n<\/pre>\n<p>Malgr\u00e9s l&rsquo;erreur, visiblement le programme a bien \u00e9t\u00e9 t\u00e9l\u00e9charg\u00e9 dans le micro puisque les leds s&rsquo;allument bien alternativement.<br \/>\nEt surtout, le message de d\u00e9marrage s&rsquo;affiche bien sur le \/dev\/ttyUSB1 :<\/p>\n<pre>core freq at 266646323 Hz\n \n                SIFIVE, INC.\n\n         5555555555555555555555555\n        5555                   5555\n       5555                     5555\n      5555                       5555\n     5555       5555555555555555555555\n    5555       555555555555555555555555\n   5555                             5555\n  5555                               5555\n 5555                                 5555\n5555555555555555555555555555          55555\n 55555           555555555           55555\n   55555           55555           55555\n     55555           5           55555\n       55555                   55555\n         55555               55555\n           55555           55555\n             55555       55555\n               55555   55555\n                 555555555\n                   55555\n                     5\n\nSiFive E-Series Software Development Kit 'demo_gpio' program.\nEvery 2 second, the Timer Interrupt will invert the LEDs.\n(Arty Dev Kit Only): Press Buttons 0, 1, 2 to Set the LEDs.\nPin 19 (HiFive1) or A5 (Arty Dev Kit) is being bit-banged\nfor GPIO speed demonstration.\n<\/pre>\n<p>.<br \/>\n<strong>Avec arduino<\/strong><\/p>\n<p>\u00c7a n&rsquo;est pas pour rien que le kit ressemble \u00e0 s&rsquo;y m\u00e9prendre \u00e0 un arduino : il est possible d&rsquo;utiliser l&rsquo;ide d&rsquo;arduino pour se connecter \u00e0 la carte.<\/p>\n<p>L&rsquo;ide arduino se trouvant dans ma debian est trop vieux pour pouvoir ajouter la toolchaine\u00a0 sifive. J&rsquo;ai donc du t\u00e9l\u00e9charger la 1.8 puis l&rsquo;installer. Heureusement \u00e7a n&rsquo;est pas tr\u00e8s compliqu\u00e9 :<\/p>\n<pre>$ tar -Jxvf arduino-1.8.5-linux64.tar.xz\n$ cd arduino-1.8.5\/\n$ .\/install.sh \n$ .\/arduino\n<\/pre>\n<p>Une fois lanc\u00e9, il faut ajouter la configuration du package sifive en allant dans les pr\u00e9f\u00e9rences pour ajouter l&rsquo;url suivante :<\/p>\n<pre>http:\/\/static.dev.sifive.com\/bsp\/arduino\/package_sifive_index.json\n<\/pre>\n<p>Puis installer la plate-forme \u00absifive\u00bb via le board manager. Il faut \u00e9galement s\u00e9lectionner \u00abSiFive open ocd\u00bb comme programmeur.<\/p>\n<p>Ne pas oublier de relancer l&rsquo;ide et roulez jeunesse ! On peut facilement compiler\/t\u00e9l\u00e9charger l&rsquo;exemple de clignotement de led.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Les chercheurs de Berkley qui ont fond\u00e9 le set d&rsquo;instruction (ISA) Risc-V (prononcez Risque failleve) ont \u00e9galement mont\u00e9 une soci\u00e9t\u00e9 nomm\u00e9e SiFive. Cette soci\u00e9t\u00e9 con\u00e7oit des c\u0153urs de processeurs nomm\u00e9s Freedom Everywhere et propose \u00e0 ses clients de l&rsquo;inclure dans des ASIC personnalis\u00e9. Les processeurs cr\u00e9\u00e9s restent \u00e9videmment open-source, et l&rsquo;int\u00e9gralit\u00e9 du code (Chisel) est &hellip; <a href=\"http:\/\/www.fabienm.eu\/flf\/prise-en-main-du-kit-de-dev-hifive1-freedom-e310\/\" class=\"more-link\">Continuer la lecture de <span class=\"screen-reader-text\">Prise en main du kit de dev HiFive1 (Freedom E310)<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[4,3,24],"tags":[57,94,95],"class_list":["post-653","post","type-post","status-publish","format-standard","hentry","category-chisel-langages","category-langages","category-materiel","tag-chisel","tag-risc-v","tag-sifive"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"Fabien Marteau","author_link":"http:\/\/www.fabienm.eu\/flf\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"Les chercheurs de Berkley qui ont fond\u00e9 le set d&rsquo;instruction (ISA) Risc-V (prononcez Risque failleve) ont \u00e9galement mont\u00e9 une soci\u00e9t\u00e9 nomm\u00e9e SiFive. Cette soci\u00e9t\u00e9 con\u00e7oit des c\u0153urs de processeurs nomm\u00e9s Freedom Everywhere et propose \u00e0 ses clients de l&rsquo;inclure dans des ASIC personnalis\u00e9. Les processeurs cr\u00e9\u00e9s restent \u00e9videmment open-source, et l&rsquo;int\u00e9gralit\u00e9 du code (Chisel) est\u2026","_links":{"self":[{"href":"http:\/\/www.fabienm.eu\/flf\/wp-json\/wp\/v2\/posts\/653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.fabienm.eu\/flf\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.fabienm.eu\/flf\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.fabienm.eu\/flf\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.fabienm.eu\/flf\/wp-json\/wp\/v2\/comments?post=653"}],"version-history":[{"count":14,"href":"http:\/\/www.fabienm.eu\/flf\/wp-json\/wp\/v2\/posts\/653\/revisions"}],"predecessor-version":[{"id":970,"href":"http:\/\/www.fabienm.eu\/flf\/wp-json\/wp\/v2\/posts\/653\/revisions\/970"}],"wp:attachment":[{"href":"http:\/\/www.fabienm.eu\/flf\/wp-json\/wp\/v2\/media?parent=653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.fabienm.eu\/flf\/wp-json\/wp\/v2\/categories?post=653"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.fabienm.eu\/flf\/wp-json\/wp\/v2\/tags?post=653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}