{"id":1651,"date":"2021-06-10T20:50:20","date_gmt":"2021-06-10T18:50:20","guid":{"rendered":"http:\/\/www.fabienm.eu\/wordpress\/?p=1651"},"modified":"2021-06-11T11:52:26","modified_gmt":"2021-06-11T09:52:26","slug":"zephyr-sur-hifive1-en-5-minutes","status":"publish","type":"post","link":"http:\/\/www.fabienm.eu\/wordpress\/2021\/06\/10\/zephyr-sur-hifive1-en-5-minutes\/","title":{"rendered":"Zephyr sur Hifive1 en 5 minutes"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"242\" src=\"http:\/\/www.fabienm.eu\/wordpress\/wp-content\/uploads\/2021\/06\/zephyr.png\" alt=\"\" class=\"wp-image-1661\" srcset=\"http:\/\/www.fabienm.eu\/wordpress\/wp-content\/uploads\/2021\/06\/zephyr.png 708w, http:\/\/www.fabienm.eu\/wordpress\/wp-content\/uploads\/2021\/06\/zephyr-300x103.png 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/www.zephyrproject.org\/\">Zephyr<\/a> est un syst\u00e8me d&rsquo;exploitation temps r\u00e9el con\u00e7u pour les microcontr\u00f4leurs.  L&rsquo;OS a d\u00e9j\u00e0 \u00e9t\u00e9 introduit dans une<a href=\"http:\/\/www.fabienm.eu\/wordpress\/?p=1573\" data-type=\"post\" data-id=\"1573\"> pr\u00e9c\u00e9dente note<\/a> de ce blog.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"http:\/\/www.fabienm.eu\/wordpress\/wp-content\/uploads\/2021\/06\/hifive1-1024x683.jpeg\" alt=\"\" class=\"wp-image-1659\" srcset=\"http:\/\/www.fabienm.eu\/wordpress\/wp-content\/uploads\/2021\/06\/hifive1-1024x683.jpeg 1024w, http:\/\/www.fabienm.eu\/wordpress\/wp-content\/uploads\/2021\/06\/hifive1-300x200.jpeg 300w, http:\/\/www.fabienm.eu\/wordpress\/wp-content\/uploads\/2021\/06\/hifive1-768x512.jpeg 768w, http:\/\/www.fabienm.eu\/wordpress\/wp-content\/uploads\/2021\/06\/hifive1.jpeg 1500w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>La carte HiFive1 au format compatible arduino<\/figcaption><\/figure>\n\n\n\n<p>La carte de d\u00e9veloppement <a href=\"http:\/\/www.fabienm.eu\/wordpress\/?p=1189\" data-type=\"post\" data-id=\"1189\">Hifive1<\/a> contient le premier microcontr\u00f4leur \u00e0 base de <a href=\"http:\/\/www.fabienm.eu\/wordpress\/?page_id=1303\" data-type=\"page\" data-id=\"1303\">RISC-V<\/a> sortie en \u00absilicium\u00bb : le <a href=\"https:\/\/old-www.sifive.com\/products\/freedom-e310\/\">E310<\/a>. La Hifive1 officiellement support\u00e9e par Zephyr depuis un petit bout de temps, son utilisation devrait donc passer comme une lettre \u00e0 la poste contrairement au GD32VF103 de la Longan Nano.<\/p>\n\n\n\n<p>Tout d&rsquo;abord initialisons un projet zephyr :<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs \">$ west init ~\/zephyrhifive\n$ cd ~\/zephyrhifive\n$ west update<\/code><\/span><\/pre>\n\n\n<p>Compilation du projet hello world:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript \">$ cd ~<span class=\"hljs-regexp\">\/zephyrhifive\/<\/span>zephyr\n$ west build -b hifive1 samples\/hello_world\n\n\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Langage du code\u00a0:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Pour flasher il suffit ensuite de lancer la commande west flash:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php \">$ west flash\n -- west flash: rebuilding\n ninja: no work to <span class=\"hljs-keyword\">do<\/span>.\n -- west flash: using runner hifive1\n Open On-Chip Debugger <span class=\"hljs-number\">0.10<\/span><span class=\"hljs-number\">.0<\/span>+dev<span class=\"hljs-number\">-01508<\/span>-gf79c90268-dirty (<span class=\"hljs-number\">2021<\/span><span class=\"hljs-number\">-03<\/span><span class=\"hljs-number\">-26<\/span><span class=\"hljs-number\">-16<\/span>:<span class=\"hljs-number\">13<\/span>)\n Licensed under GNU GPL v2\n <span class=\"hljs-keyword\">For<\/span> bug reports, read\n     http:<span class=\"hljs-comment\">\/\/openocd.org\/doc\/doxygen\/bugs.html<\/span>\n Info : auto-selecting first available session transport <span class=\"hljs-string\">\"jtag\"<\/span>. To override <span class=\"hljs-keyword\">use<\/span> '<span class=\"hljs-title\">transport<\/span> <span class=\"hljs-title\">select<\/span> '.\n <span class=\"hljs-title\">Info<\/span> : <span class=\"hljs-title\">ftdi<\/span>: <span class=\"hljs-title\">if<\/span> <span class=\"hljs-title\">you<\/span> <span class=\"hljs-title\">experience<\/span> <span class=\"hljs-title\">problems<\/span> <span class=\"hljs-title\">at<\/span> <span class=\"hljs-title\">higher<\/span> <span class=\"hljs-title\">adapter<\/span> <span class=\"hljs-title\">clocks<\/span>, <span class=\"hljs-title\">try<\/span> <span class=\"hljs-title\">the<\/span> <span class=\"hljs-title\">command<\/span> \"<span class=\"hljs-title\">ftdi_tdo_sample_edge<\/span> <span class=\"hljs-title\">falling<\/span>\"\n <span class=\"hljs-title\">Info<\/span> : <span class=\"hljs-title\">clock<\/span> <span class=\"hljs-title\">speed<\/span> 10000 <span class=\"hljs-title\">kHz<\/span>\n <span class=\"hljs-title\">Info<\/span> : <span class=\"hljs-title\">JTAG<\/span> <span class=\"hljs-title\">tap<\/span>: <span class=\"hljs-title\">riscv<\/span>.<span class=\"hljs-title\">cpu<\/span> <span class=\"hljs-title\">tap<\/span>\/<span class=\"hljs-title\">device<\/span> <span class=\"hljs-title\">found<\/span>: 0<span class=\"hljs-title\">x10e31913<\/span> (<span class=\"hljs-title\">mfg<\/span>: 0<span class=\"hljs-title\">x489<\/span> (<span class=\"hljs-title\">SiFive<\/span>, <span class=\"hljs-title\">Inc<\/span>.), <span class=\"hljs-title\">part<\/span>: 0<span class=\"hljs-title\">x0e31<\/span>, <span class=\"hljs-title\">ver<\/span>: 0<span class=\"hljs-title\">x1<\/span>)\n <span class=\"hljs-title\">Info<\/span> : <span class=\"hljs-title\">Examined<\/span> <span class=\"hljs-title\">RISCV<\/span> <span class=\"hljs-title\">core<\/span>; XLEN=<span class=\"hljs-number\">32<\/span>, misa=<span class=\"hljs-number\">0x40001105<\/span>\n Info : starting gdb server <span class=\"hljs-keyword\">for<\/span> riscv.cpu on <span class=\"hljs-number\">3333<\/span>\n Info : Listening on port <span class=\"hljs-number\">3333<\/span> <span class=\"hljs-keyword\">for<\/span> gdb connections\n Info : &#91;<span class=\"hljs-number\">0<\/span>] Found <span class=\"hljs-number\">2<\/span> triggers\n halted at <span class=\"hljs-number\">0x2040019c<\/span> due to debug interrupt\n Info : Found flash device <span class=\"hljs-string\">'issi is25lp128d'<\/span> (ID <span class=\"hljs-number\">0x0018609d<\/span>)\n Info : Listening on port <span class=\"hljs-number\">6666<\/span> <span class=\"hljs-keyword\">for<\/span> tcl connections\n Info : Listening on port <span class=\"hljs-number\">4444<\/span> <span class=\"hljs-keyword\">for<\/span> telnet connections\n Info : accepting <span class=\"hljs-string\">'gdb'<\/span> connection on tcp\/<span class=\"hljs-number\">3333<\/span>\n Info : JTAG tap: riscv.cpu tap\/device found: <span class=\"hljs-number\">0x10e31913<\/span> (mfg: <span class=\"hljs-number\">0x489<\/span> (SiFive, Inc.), part: <span class=\"hljs-number\">0x0e31<\/span>, ver: <span class=\"hljs-number\">0x1<\/span>)\n halted at <span class=\"hljs-number\">0x2040019c<\/span> due to debug interrupt\n force hard breakpoints\n <span class=\"hljs-number\">0x2040019c<\/span> in skip_callee_saved_reg () at \/home\/fabien\/zephyrhifive\/zephyr\/arch\/riscv\/core\/isr.S:<span class=\"hljs-number\">886<\/span>\n <span class=\"hljs-number\">886<\/span>        LOAD_CALLER_SAVED(t1)\n Info : JTAG tap: riscv.cpu tap\/device found: <span class=\"hljs-number\">0x10e31913<\/span> (mfg: <span class=\"hljs-number\">0x489<\/span> (SiFive, Inc.), part: <span class=\"hljs-number\">0x0e31<\/span>, ver: <span class=\"hljs-number\">0x1<\/span>)\n halted at <span class=\"hljs-number\">0x2040019c<\/span> due to debug interrupt\n Loading section vector, size <span class=\"hljs-number\">0x10<\/span> lma <span class=\"hljs-number\">0x20400000<\/span>\n Loading section exceptions, size <span class=\"hljs-number\">0x2b8<\/span> lma <span class=\"hljs-number\">0x20400010<\/span>\n Loading section text, size <span class=\"hljs-number\">0x3fdc<\/span> lma <span class=\"hljs-number\">0x204002c8<\/span>\n Loading section initlevel, size <span class=\"hljs-number\">0x50<\/span> lma <span class=\"hljs-number\">0x204042a4<\/span>\n Loading section sw_isr_table, size <span class=\"hljs-number\">0x200<\/span> lma <span class=\"hljs-number\">0x204042f4<\/span>\n Loading section device_handles, size <span class=\"hljs-number\">0x36<\/span> lma <span class=\"hljs-number\">0x204044f4<\/span>\n Loading section rodata, size <span class=\"hljs-number\">0x338<\/span> lma <span class=\"hljs-number\">0x2040452c<\/span>\n Loading section datas, size <span class=\"hljs-number\">0xc0<\/span> lma <span class=\"hljs-number\">0x20404864<\/span>\n Loading section devices, size <span class=\"hljs-number\">0x90<\/span> lma <span class=\"hljs-number\">0x20404924<\/span>\n Info : Padding image section <span class=\"hljs-number\">0<\/span> at <span class=\"hljs-number\">0x2040452a<\/span> with <span class=\"hljs-number\">2<\/span> bytes\n Info : Retrying memory read starting from <span class=\"hljs-number\">0x80000000<\/span> with more delays\n Info : Retrying memory read starting from <span class=\"hljs-number\">0x800010d8<\/span> with more delays\n halted at <span class=\"hljs-number\">0x80000004<\/span> due to software breakpoint\n halted at <span class=\"hljs-number\">0x80000004<\/span> due to software breakpoint\n halted at <span class=\"hljs-number\">0x80000004<\/span> due to software breakpoint\n Info : JTAG tap: riscv.cpu tap\/device found: <span class=\"hljs-number\">0x10e31913<\/span> (mfg: <span class=\"hljs-number\">0x489<\/span> (SiFive, Inc.), part: <span class=\"hljs-number\">0x0e31<\/span>, ver: <span class=\"hljs-number\">0x1<\/span>)\n halted at <span class=\"hljs-number\">0x80000004<\/span> due to software breakpoint\n Start address <span class=\"hljs-number\">0x20400000<\/span>, load size <span class=\"hljs-number\">18866<\/span>\n Transfer rate: <span class=\"hljs-number\">42<\/span> KB\/sec, <span class=\"hljs-number\">1886<\/span> bytes\/write.\n A debugging session is active.\n &lt;code&gt;Inferior <span class=\"hljs-number\">1<\/span> &#91;Remote target] will be detached.&lt;\/code&gt;\n Quit anyway? (y <span class=\"hljs-keyword\">or<\/span> n) &#91;answered Y; input not from terminal]\n &#91;Inferior <span class=\"hljs-number\">1<\/span> (Remote target) detached]\n shutdown command invoked\n Info : dropped <span class=\"hljs-string\">'gdb'<\/span> connection<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Langage du code\u00a0:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>On peut v\u00e9rifier le bon fonctionnement en se connectant \u00e0 l&rsquo;uart ttyUSB1:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs \">$ screen \/dev\/ttyUSB1 115200\nHello World! hifive1<\/code><\/span><\/pre>\n\n\n<p><strong>Attention<\/strong><\/p>\n\n\n\n<p>Une fois flash\u00e9, c&rsquo;est une application Zephyr qui tourne sur la carte. Or zephyr part en veille s&rsquo;il n&rsquo;a plus rien \u00e0 faire. Ce qui est le cas ici.<\/p>\n\n\n\n<p>Et quand la hifive1 est en veille on ne peut plus la flasher, l&rsquo;erreur du type suivant survient :<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml \"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">code<\/span>&gt;<\/span>Error: Timed out waiting for debug int to clear.Increase timeout with riscv set_command_timeout_sec. Error: Debug interrupt didn't clear.<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">code<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Langage du code\u00a0:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Pour r\u00e9soudre ce probl\u00e8me on peut appuyer sur le bouton reset puis le bouton wake et enfin lancer la commande de flashage.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Zephyr est un syst\u00e8me d&rsquo;exploitation temps r\u00e9el con\u00e7u pour les microcontr\u00f4leurs. L&rsquo;OS a d\u00e9j\u00e0 \u00e9t\u00e9 introduit dans une pr\u00e9c\u00e9dente note de ce blog. La carte de d\u00e9veloppement Hifive1 contient le premier microcontr\u00f4leur \u00e0 base de RISC-V sortie en \u00absilicium\u00bb : &hellip; <a href=\"http:\/\/www.fabienm.eu\/wordpress\/2021\/06\/10\/zephyr-sur-hifive1-en-5-minutes\/\">Continuer la lecture <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[194,237,218,242],"class_list":["post-1651","post","type-post","status-publish","format-standard","hentry","category-non-classe","tag-hifive1","tag-openocd","tag-riscv","tag-zephyr"],"_links":{"self":[{"href":"http:\/\/www.fabienm.eu\/wordpress\/wp-json\/wp\/v2\/posts\/1651","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.fabienm.eu\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.fabienm.eu\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.fabienm.eu\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.fabienm.eu\/wordpress\/wp-json\/wp\/v2\/comments?post=1651"}],"version-history":[{"count":10,"href":"http:\/\/www.fabienm.eu\/wordpress\/wp-json\/wp\/v2\/posts\/1651\/revisions"}],"predecessor-version":[{"id":1665,"href":"http:\/\/www.fabienm.eu\/wordpress\/wp-json\/wp\/v2\/posts\/1651\/revisions\/1665"}],"wp:attachment":[{"href":"http:\/\/www.fabienm.eu\/wordpress\/wp-json\/wp\/v2\/media?parent=1651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.fabienm.eu\/wordpress\/wp-json\/wp\/v2\/categories?post=1651"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.fabienm.eu\/wordpress\/wp-json\/wp\/v2\/tags?post=1651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}