{"id":774,"date":"2021-04-08T14:26:05","date_gmt":"2021-04-08T14:26:05","guid":{"rendered":"https:\/\/picockpit.com\/raspberry-pi\/?p=774"},"modified":"2023-11-23T02:13:08","modified_gmt":"2023-11-23T02:13:08","slug":"c-extension-for-micropython-on-raspberry-pi-pico","status":"publish","type":"post","link":"https:\/\/picockpit.com\/raspberry-pi\/fr\/c-extension-for-micropython-on-raspberry-pi-pico\/","title":{"rendered":"Extension C pour MicroPython sur Raspberry Pi Pico"},"content":{"rendered":"<p>Ceci est un guide sur la fa\u00e7on d'\u00e9crire et d'ex\u00e9cuter une extension C de base pour MicroPython sur le Raspberry Pi Pico. Je couvrirai les raisons d'\u00e9tendre MicroPython, comment \u00e9crire le module d'extension, comment le compiler et comment l'installer sur le Pico. Si vous voulez en savoir plus sur ce sujet, veuillez vous r\u00e9f\u00e9rer \u00e0 <a href=\"https:\/\/docs.micropython.org\/en\/latest\/develop\/extendingmicropython.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/docs.micropython.org\/en\/latest\/develop\/extendingmicropython.html<\/a><\/p>\n\n\n\n<h2>Introduction<\/h2>\n<h3>Pourquoi \u00e9tendre MicroPython ?<\/h3>\n<p>Il peut y avoir plusieurs raisons pour lesquelles vous souhaitez \u00e9tendre MicroPython. \u00c9tant donn\u00e9 qu'il s'agit d'une version all\u00e9g\u00e9e de Python, MicroPython n'est pas tr\u00e8s performant lorsqu'il s'agit de t\u00e2ches de calcul lourd (comme Python). En revanche, le langage C est parfaitement adapt\u00e9 \u00e0 ce type de t\u00e2ches. Une extension C pour Micropython vous permet d'effectuer ces calculs en langage C et d'utiliser les r\u00e9sultats dans MicroPython. Cela peut acc\u00e9l\u00e9rer certains processus d'un ordre de grandeur.<\/p>\n<p>Une deuxi\u00e8me raison pourrait \u00eatre que vous souhaitez interfacer un mat\u00e9riel qui utilise une API C \u00e0 partir de MicroPython.&nbsp;<\/p>\n<h3>Types d'extensions C de MicroPython<\/h3>\n<p>Il existe deux fa\u00e7ons diff\u00e9rentes d'\u00e9tendre MicroPython : les modules C externes et le code machine natif dans les fichiers .mpy.<\/p>\n<p>Pour ex\u00e9cuter un module C externe, vous devez le recompiler dans le firmware MicroPython. Il s'agit d'un processus assez compliqu\u00e9, c'est pourquoi ce guide se concentrera sur la seconde alternative. Si vous \u00eates toutefois int\u00e9ress\u00e9 par cette approche, vous pouvez en lire plus sur ces pages web :&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"https:\/\/docs.micropython.org\/en\/latest\/develop\/cmodules.html\" target=\"_blank\" rel=\"noopener\">https:\/\/docs.micropython.org\/en\/latest\/develop\/cmodules.html<\/a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?t=300352\" target=\"_blank\" rel=\"noopener\">https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?t=300352<\/a><\/p>\n<p>Le fichier .mpy est un fichier qui contient le code machine natif compil\u00e9 et qui peut \u00eatre li\u00e9 dynamiquement. Cela le rend beaucoup plus flexible puisque vous n'avez pas besoin de recompiler l'ensemble du firmware MicroPython.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u00c9crire le module d'extension<\/h2>\n\n\n\n<p>L'\u00e9criture du module d'extension est la partie la plus facile de l'extension de MicroPython. Je vais vous montrer comment le faire \u00e0 l'aide d'un exemple simple. Pour commencer, nous allons cr\u00e9er un nouveau r\u00e9pertoire appel\u00e9 <em>factfib<\/em>. Ouvrez une nouvelle fen\u00eatre de terminal, allez dans le nouveau r\u00e9pertoire et cr\u00e9ez un nouveau fichier appel\u00e9 <em>factfib.c<\/em>. Si vous avez cr\u00e9\u00e9 le r\u00e9pertoire sur un Raspberry Pi sous Dekstop, la commande ressemble \u00e0 ceci.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"cd ~\/Desktop\/factfibtouch factfib.c\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">cd<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">~\/<\/span><span style=\"color: #D8DEE9\">Desktop<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">factfib<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">touch<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factfib<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">c<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Ouvrir <span style=\"color: #008000;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\"><em>factfib.c<\/em><\/span><span style=\"color: #000000;\"> dans votre \u00e9diteur de texte favori et saisissez le code suivant :<\/span><\/span><\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"#include &quot;py\/dynruntime.hSTATIC mp_int_t factorial_helper(mp_int_t x) {   if (x < 1) {      return 1;   }   return x*factorial_helper(x-1);}STATIC mp_obj_t factorial(mp_obj_t x_obj) {   mp_int_t x = mp_obj_get_int(x_obj);   mp_int_t rslt = factorial_helper(x);   return rslt;}STATIC MP_DEFINE_CONST_FUN_OBJ_1(factorial_obj, factorial);STATIC mp_int_t fibonacci_helper(mp_int_t x) {   if (x <= 0) {      return 0;   }   else if (x == 1) {      return 1;   }   else {      return (fibonacci_helper(x-1) + fibonacci_helper(x-2));   }}STATIC mp_obj_t fibonacci(mp_obj_t x_obj) {   mp_int_t x = mp_obj_get_int(x_obj);   mp_int_t rslt = fibonacci_helper(x);   return mp_obj_new_int(rslt);}STATIC MP_DEFINE_CONST_FUN_OBJ_1(fibonacci_obj, fibonacci);mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {   MP_DYNRUNTIME_INIT_ENTRY   mp_store_global(MP_QSTR_factorial, MP_OBJ_FROM_PTR(&amp;factorial_obj));   mp_store_global(MP_QSTR_fibonacci, MP_OBJ_FROM_PTR(&amp;fibonacci_obj));   MP_DYNRUNTIME_INIT_EXIT}\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9FF\">#<\/span><span style=\"color: #D8DEE9\">include<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">py\/dynruntime.<\/span><span style=\"color: #D8DEE9\">h<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">factorial_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">&lt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #81A1C1\">*<\/span><span style=\"color: #88C0D0\">factorial_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">factorial<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x_obj<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">mp_obj_get_int<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x_obj<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">rslt<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">factorial_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">rslt<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">MP_DEFINE_CONST_FUN_OBJ_1<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">factorial_obj<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factorial<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">fibonacci_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">&lt;=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">else<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">else<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #88C0D0\">fibonacci_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">fibonacci_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #B48EAD\">2<\/span><span style=\"color: #D8DEE9FF\">))<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">fibonacci<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x_obj<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">mp_obj_get_int<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x_obj<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">rslt<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">fibonacci_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">mp_obj_new_int<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">rslt<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">MP_DEFINE_CONST_FUN_OBJ_1<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">fibonacci_obj<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">fibonacci<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">mpy_init<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">mp_obj_fun_bc_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">*<\/span><span style=\"color: #D8DEE9\">self<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">size_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">n_args<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">size_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">n_kw<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">*<\/span><span style=\"color: #D8DEE9\">args<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">MP_DYNRUNTIME_INIT_ENTRY<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #88C0D0\">mp_store_global<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">MP_QSTR_factorial<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">MP_OBJ_FROM_PTR<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #81A1C1\">&amp;<\/span><span style=\"color: #D8DEE9\">factorial_obj<\/span><span style=\"color: #D8DEE9FF\">))<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #88C0D0\">mp_store_global<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">MP_QSTR_fibonacci<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">MP_OBJ_FROM_PTR<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #81A1C1\">&amp;<\/span><span style=\"color: #D8DEE9\">fibonacci_obj<\/span><span style=\"color: #D8DEE9FF\">))<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">MP_DYNRUNTIME_INIT_EXIT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Laissez-moi vous expliquer le code ci-dessus : Dans MicroPython et Python, chaque variable est un objet. Par cons\u00e9quent, en C, nous les repr\u00e9sentons comme <em>mp_obj_t<\/em>. Mais un programme C ne peut travailler qu'avec des variables de type C, c'est pourquoi nous devons transformer l'objet en un type C. Cela s'appelle le Marshalling. Ceci est appel\u00e9 Marshalling et MicroPython fournit des fonctions pour extraire n'importe quel type C d'un objet.<\/p>\n\n\n\n<p>Cette page web d'Oliver Robson est tr\u00e8s utile pour le mar\u00e9chalage. <a rel=\"noreferrer noopener\" href=\"https:\/\/mpy-c-gen.oliverrobson.tech\/\" target=\"_blank\">https:\/\/mpy-c-gen.oliverrobson.tech\/<\/a>. En outre, vous pouvez trouver des exemples de Marshalling dans la documentation de MicroPython. <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.micropython.org\/en\/latest\/develop\/natmod.html\" target=\"_blank\">https:\/\/docs.micropython.org\/en\/latest\/develop\/natmod.html<\/a>. Je vous conseille de lire cet article si vous avez besoin de plus d'explications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Construire l'extension<\/h2>\n\n\n\n<p>Nous construisons l'extension dans un fichier .mpy en utilisant un Makefile. Mais nous devons d'abord mettre en place certaines choses. Assurez-vous que votre terminal est toujours ouvert en mode <em>factfib<\/em> r\u00e9pertoire. Puis clonez le d\u00e9p\u00f4t GitHub de MicroPython.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo apt-get install build-essential libreadline-dev libffi-dev git pkg-config gcc-arm-none-eabi libnewlib-arm-none-eabigit clone --recurse-submodules\u00a0https:\/\/github.com\/micropython\/micropython.gitpip3\u00a0install\u00a0'pyelftools&gt;=0.25'\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">apt<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">get<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">install<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">build<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">essential<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">libreadline<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">dev<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">libffi<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">dev<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">git<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">pkg<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">config<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">gcc<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">arm<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">none<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">eabi<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">libnewlib<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">arm<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">none<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">eabi<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">git<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">clone<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">--<\/span><span style=\"color: #D8DEE9\">recurse<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">submodules<\/span><span style=\"color: #D8DEE9FF\">\u00a0https<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #616E88\">\/\/github.com\/micropython\/micropython.git<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">pip3<\/span><span style=\"color: #D8DEE9FF\">\u00a0<\/span><span style=\"color: #D8DEE9\">install<\/span><span style=\"color: #D8DEE9FF\">\u00a0<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">pyelftools&gt;=0.25<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Ces installations prendront un certain temps, si vous voulez gagner du temps et que vous savez ce que vous faites, il vous suffit de cloner les r\u00e9pertoires \/py et \/tools \u00e0 partir du d\u00e9p\u00f4t micropython et de les placer dans un r\u00e9pertoire de type <em>micropython<\/em> dans le dossier&nbsp;<em>factfib<\/em> (ignorez la deuxi\u00e8me commande).<\/p>\n\n\n\n<p>Pendant que l'installation est en cours, nous pouvons utiliser ce temps pour \u00e9crire le Makefile. Ex\u00e9cutez simplement<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"touch Makefile\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">touch<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">Makefile<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>et ouvrez le fichier nouvellement cr\u00e9\u00e9 dans un \u00e9diteur de texte.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"MPY_DIR = micropythonMOD = factfibSRC = factfib.cARCH = armv7minclude $(MPY_DIR)\/py\/dynruntime.mk\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">MPY_DIR<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">micropython<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">MOD<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factfib<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">SRC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factfib<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">c<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">ARCH<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">armv7m<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">include<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">$<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">MPY_DIR<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">py<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">dynruntime<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">mk<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Vous avez peut-\u00eatre remarqu\u00e9 que nous avons d\u00e9fini le <em>ARCH <\/em>\u00e0 la variable <em>armv7m<\/em> bien que le pico soit <em>armv6m<\/em>. Nous devons le faire parce que le <em>armv6m<\/em> n'est (au moment o\u00f9 j'\u00e9cris cet article) pas support\u00e9e par l'architecture <em>dynruntime.mk<\/em> outil.<\/p>\n\n\n\n<p>Mais heureusement, nous pouvons toujours compiler une extension fonctionnelle pour le Pico. Nous devons juste modifier le fichier <em>dynruntime.mk <\/em>qui doit \u00eatre situ\u00e9 sous <em>micropython\/py\/dynruntime.mk.&nbsp;<\/em>Ouvrez-le et sous la rubrique Configuration de l'architecture dans armv7m, trouvez la variable CFLAGS (qui devrait \u00eatre la ligne 64). Changez&nbsp;<em>-mcpu=cortex-m3<\/em> \u00e0&nbsp;<em>-mcpu=cortex-m0<\/em> et enregistrez le fichier.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"86\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/04\/dynruntimeChange-300x86.png\" alt=\"chnge -mcpu=cortex-m3 to -mcpu=cortex-m0\" class=\"wp-image-780\" style=\"width:648px;height:186px\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/04\/dynruntimeChange-300x86.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/04\/dynruntimeChange-768x219.png 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/04\/dynruntimeChange.png 946w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/figure>\n<\/div>\n\n\n<p>Puis, une fois que tout est install\u00e9, ex\u00e9cutez<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"make\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">make<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>et le&nbsp;<em>factfib.mpy<\/em> sera cr\u00e9\u00e9.<\/p>\n\n\n\n<h2>Installer et tester l'extension<\/h2>\n\n\n\n<p>La derni\u00e8re \u00e9tape est l'installation et le test. Pour cela, nous utilisons le syst\u00e8me de fichiers que Micropython cr\u00e9e sur le Raspberry Pi Pico. Tout d'abord, nous devons flasher le Pico avec le firmware MicroPython. La fa\u00e7on la plus simple de le faire est d'utiliser l'IDE Thonny (pr\u00e9install\u00e9 sur Raspbian\/Raspberry Pi OS).<\/p>\n\n\n\n<p>Si vous n'utilisez pas un Raspberry Pi pour programmer votre Pico ou si vous n'avez jamais utilis\u00e9 MicroPython sur le Pico auparavant, veuillez vous reporter au guide de d\u00e9marrage avec MicroPython de Raspberry Pi. <a href=\"https:\/\/www.raspberrypi.org\/documentation\/rp2040\/getting-started\/#getting-started-with-micropython\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.raspberrypi.org\/documentation\/rp2040\/getting-started\/#getting-started-with-micropython<\/a><\/p>\n\n\n\n<p>Si vous utilisez Windows, vous devriez consulter cet article de blog sur le Raspberry Pi Pico et MicroPython sous Windows. <a href=\"https:\/\/picockpit.com\/raspberry-pi\/raspberry-pi-pico-and-micropython-on-windows\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/picockpit.com\/raspberry-pi\/raspberry-pi-pico-and-micropython-on-windows\/<\/a><\/p>\n\n\n\n<p>Fermez Thonny apr\u00e8s avoir flash\u00e9 votre Pico avec le firmware MicroPython et installez rshell. Nous utilisons rshell pour acc\u00e9der au syst\u00e8me de fichiers \u00e0 partir de la ligne de commande.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo pip3 install rshellrshell --version\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">pip3<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">install<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">rshell<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">rshell<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">--<\/span><span style=\"color: #D8DEE9\">version<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Cela imprime la version rhsell si tout est configur\u00e9 correctement. Ensuite, d\u00e9branchez le pico et rebranchez-le (sans maintenir le bouton BOOTSEL) pour vous assurer que rien n'essaie d'acc\u00e9der au syst\u00e8me de fichiers. Maintenant, nous devons ex\u00e9cuter<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"rshell -p \/dev\/ttyACM0 --buffer-size 512cp factfib.mpy \/pyboard\/factfib.mpy\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">rshell<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">p<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">dev<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">ttyACM0<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">--<\/span><span style=\"color: #D8DEE9\">buffer<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">512<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">cp<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factfib<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">mpy<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">pyboard<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">factfib<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">mpy<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Pour tester l'installation, vous pouvez utiliser soit rshell, soit l'IDE Thonny pour enregistrer votre <em>.py<\/em> sur le Pico mais je vais d\u00e9montrer comment utiliser l'interpr\u00e9teur MicroPython sur le minicom.<\/p>\n\n\n\n<p>Alors, appuyez d'abord sur&nbsp;<em>Ctrl+c<\/em> pour quitter rshell et ensuite installer minicom via<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo apt install minicom\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">apt<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">install<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">minicom<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>maintenant nous pouvons acc\u00e9der au REPL de Picos (boucle Read-eval-print)<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"minicom -o -D \/dev\/ttyACM0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">minicom<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">o<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">D<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">dev<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">ttyACM0<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Les trois crochets de fermeture &gt;&gt;&gt; indiquent que l'interpr\u00e9teur MicroPython est en cours d'ex\u00e9cution. Nous pouvons maintenant importer notre extension et travailler avec elle comme d'habitude.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&gt;&gt;&gt; import factfib as ff&gt;&gt;&gt; ff.factorial(5)&gt;&gt;&gt; 120&gt;&gt;&gt; ff.fibonacci(7)&gt;&gt;&gt; 13\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copie\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #81A1C1\">&gt;&gt;&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factfib<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">as<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">ff<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">&gt;&gt;&gt; <\/span><span style=\"color: #8FBCBB\">ff<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">factorial<\/span><span style=\"color: #D8DEE9FF\">(5)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">&gt;&gt;&gt; 120<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">&gt;&gt;&gt; <\/span><span style=\"color: #8FBCBB\">ff<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">fibonacci<\/span><span style=\"color: #D8DEE9FF\">(7)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">&gt;&gt;&gt; 13<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>F\u00e9licitations ! Vous avez cr\u00e9\u00e9 votre premi\u00e8re extension MicroPython C pour le Pico ! L'\u00e9tape suivante consiste \u00e0 apprendre \u00e0 \u00e9crire et \u00e0 compiler des modules plus complexes. Une bonne fa\u00e7on de commencer est de tester le fonctionnement du Marshalling de listes et de dicts (voir la page web Marshalling ci-dessus). <\/p>\n\n\n\n<p>Si vous avez des questions concernant cet article, n'h\u00e9sitez pas \u00e0 \u00e9crire un commentaire.<\/p>\n<div class=\"shariff shariff-align-center shariff-widget-align-left shariff-buttonstretch\"><ul class=\"shariff-buttons theme-white orientation-horizontal buttonsize-medium\"><li class=\"shariff-button twitter shariff-nocustomcolor\" style=\"background-color:#595959\"><a href=\"https:\/\/twitter.com\/share?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Ffr%2Fc-extension-for-micropython-on-raspberry-pi-pico%2F&text=C%20extension%20for%20MicroPython%20on%20Raspberry%20Pi%20Pico\" title=\"Envoyer par X\" aria-label=\"Envoyer par X\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#000; color:#000\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#000\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 24 24\"><path fill=\"#000\" d=\"M14.258 10.152L23.176 0h-2.113l-7.747 8.813L7.133 0H0l9.352 13.328L0 23.973h2.113l8.176-9.309 6.531 9.309h7.133zm-2.895 3.293l-.949-1.328L2.875 1.56h3.246l6.086 8.523.945 1.328 7.91 11.078h-3.246zm0 0\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#000\">partager<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button facebook shariff-nocustomcolor\" style=\"background-color:#4273c8\"><a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Ffr%2Fc-extension-for-micropython-on-raspberry-pi-pico%2F\" title=\"Envoyer par Facebook\" aria-label=\"Envoyer par Facebook\" role=\"button\" rel=\"nofollow\" class=\"shariff-link\" style=\"; background-color:#3b5998; color:#3b5998\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#3b5998\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 18 32\"><path fill=\"#3b5998\" d=\"M17.1 0.2v4.7h-2.8q-1.5 0-2.1 0.6t-0.5 1.9v3.4h5.2l-0.7 5.3h-4.5v13.6h-5.5v-13.6h-4.5v-5.3h4.5v-3.9q0-3.3 1.9-5.2t5-1.8q2.6 0 4.1 0.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#3b5998\">partager<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button telegram shariff-nocustomcolor\" style=\"background-color:#4084A6\"><a href=\"https:\/\/telegram.me\/share\/url?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Ffr%2Fc-extension-for-micropython-on-raspberry-pi-pico%2F&text=C%20extension%20for%20MicroPython%20on%20Raspberry%20Pi%20Pico\" title=\"Envoyer par Telegram\" aria-label=\"Envoyer par Telegram\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#0088cc; color:#0088cc\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#0088cc\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\"><path fill=\"#0088cc\" d=\"M30.8 6.5l-4.5 21.4c-.3 1.5-1.2 1.9-2.5 1.2L16.9 24l-3.3 3.2c-.4.4-.7.7-1.4.7l.5-7L25.5 9.2c.6-.5-.1-.8-.9-.3l-15.8 10L2 16.7c-1.5-.5-1.5-1.5.3-2.2L28.9 4.3c1.3-.5 2.3.3 1.9 2.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#0088cc\">partager<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button reddit shariff-nocustomcolor\" style=\"background-color:#ff5700\"><a href=\"https:\/\/www.reddit.com\/submit?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Ffr%2Fc-extension-for-micropython-on-raspberry-pi-pico%2F\" title=\"Envoyer par Reddit\" aria-label=\"Envoyer par Reddit\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#ff4500; color:#ff4500\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#ff4500\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 512 512\"><path fill=\"#ff4500\" d=\"M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#ff4500\">partager<\/span>&nbsp;<\/a><\/li><\/ul><\/div>","protected":false},"excerpt":{"rendered":"<p>Ceci est un guide sur la fa\u00e7on d'\u00e9crire et d'ex\u00e9cuter une extension C de base pour MicroPython sur le Raspberry Pi Pico. Je couvrirai les raisons d'\u00e9tendre MicroPython, comment \u00e9crire le module d'extension, comment le compiler et comment l'installer sur le Pico. Si vous voulez en savoir plus sur ce sujet,...<\/p>","protected":false},"author":3,"featured_media":679,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1193,10],"tags":[964,19,756,477,18,963,606,14,11,486,447,476,187,17],"class_list":["post-774","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-raspberry-pi-pico","tag-bash","tag-c","tag-c-c","tag-circuitpython","tag-extension","tag-fibonacci","tag-linux","tag-micropython","tag-pico","tag-project","tag-projects","tag-python","tag-raspberry-pi","tag-raspberrypi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C extension for MicroPython on Raspberry Pi Pico | PiCockpit<\/title>\n<meta name=\"description\" content=\"Guide on how to write and run a C extension for MicroPython on the Raspberry Pi Pico. This guide is suited for beginners and experts.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/picockpit.com\/raspberry-pi\/fr\/c-extension-for-micropython-on-raspberry-pi-pico\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C extension for MicroPython on Raspberry Pi Pico | PiCockpit\" \/>\n<meta property=\"og:description\" content=\"Guide on how to write and run a C extension for MicroPython on the Raspberry Pi Pico. This guide is suited for beginners and experts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/picockpit.com\/raspberry-pi\/fr\/c-extension-for-micropython-on-raspberry-pi-pico\/\" \/>\n<meta property=\"og:site_name\" content=\"PiCockpit\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pi3gshop\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-08T14:26:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-23T02:13:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"1143\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Nathan Busler\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pi3g\" \/>\n<meta name=\"twitter:site\" content=\"@pi3g\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nathan Busler\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\"},\"author\":{\"name\":\"Nathan Busler\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/person\\\/e38fef75134e5e54175b2615a8c3eb47\"},\"headline\":\"C extension for MicroPython on Raspberry Pi Pico\",\"datePublished\":\"2021-04-08T14:26:05+00:00\",\"dateModified\":\"2023-11-23T02:13:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\"},\"wordCount\":1089,\"commentCount\":8,\"publisher\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/PICO-BOARD-TOP-WHITE.jpg\",\"keywords\":[\"bash\",\"C\",\"c\\\/c++\",\"circuitpython\",\"extension\",\"fibonacci\",\"linux\",\"microPython\",\"Pico\",\"project\",\"Projects\",\"python\",\"Raspberry Pi\",\"RaspberryPi\"],\"articleSection\":[\"Python\",\"Raspberry Pi Pico\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\",\"name\":\"C extension for MicroPython on Raspberry Pi Pico | PiCockpit\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/PICO-BOARD-TOP-WHITE.jpg\",\"datePublished\":\"2021-04-08T14:26:05+00:00\",\"dateModified\":\"2023-11-23T02:13:08+00:00\",\"description\":\"Guide on how to write and run a C extension for MicroPython on the Raspberry Pi Pico. This guide is suited for beginners and experts.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#primaryimage\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/PICO-BOARD-TOP-WHITE.jpg\",\"contentUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/PICO-BOARD-TOP-WHITE.jpg\",\"width\":1600,\"height\":1143,\"caption\":\"raspberry pi pico\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/category\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"C extension for MicroPython on Raspberry Pi Pico\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#website\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\",\"name\":\"PiCockpit\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\",\"name\":\"PiCockpit.com\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/Screenshot-from-2023-07-24-15-01-24.png\",\"contentUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/Screenshot-from-2023-07-24-15-01-24.png\",\"width\":1165,\"height\":283,\"caption\":\"PiCockpit.com\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/pi3gshop\",\"https:\\\/\\\/x.com\\\/pi3g\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/person\\\/e38fef75134e5e54175b2615a8c3eb47\",\"name\":\"Nathan Busler\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g\",\"caption\":\"Nathan Busler\"},\"sameAs\":[\"https:\\\/\\\/buyzero.de\"],\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/fr\\\/author\\\/nathan\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Extension C pour MicroPython sur Raspberry Pi Pico | PiCockpit","description":"Guide sur comment \u00e9crire et ex\u00e9cuter une extension C pour MicroPython sur le Raspberry Pi Pico. Ce guide est adapt\u00e9 aux d\u00e9butants et aux experts.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/picockpit.com\/raspberry-pi\/fr\/c-extension-for-micropython-on-raspberry-pi-pico\/","og_locale":"fr_FR","og_type":"article","og_title":"C extension for MicroPython on Raspberry Pi Pico | PiCockpit","og_description":"Guide on how to write and run a C extension for MicroPython on the Raspberry Pi Pico. This guide is suited for beginners and experts.","og_url":"https:\/\/picockpit.com\/raspberry-pi\/fr\/c-extension-for-micropython-on-raspberry-pi-pico\/","og_site_name":"PiCockpit","article_publisher":"https:\/\/www.facebook.com\/pi3gshop","article_published_time":"2021-04-08T14:26:05+00:00","article_modified_time":"2023-11-23T02:13:08+00:00","og_image":[{"width":1600,"height":1143,"url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg","type":"image\/jpeg"}],"author":"Nathan Busler","twitter_card":"summary_large_image","twitter_creator":"@pi3g","twitter_site":"@pi3g","twitter_misc":{"\u00c9crit par":"Nathan Busler","Dur\u00e9e de lecture estim\u00e9e":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#article","isPartOf":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/"},"author":{"name":"Nathan Busler","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/person\/e38fef75134e5e54175b2615a8c3eb47"},"headline":"C extension for MicroPython on Raspberry Pi Pico","datePublished":"2021-04-08T14:26:05+00:00","dateModified":"2023-11-23T02:13:08+00:00","mainEntityOfPage":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/"},"wordCount":1089,"commentCount":8,"publisher":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#primaryimage"},"thumbnailUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg","keywords":["bash","C","c\/c++","circuitpython","extension","fibonacci","linux","microPython","Pico","project","Projects","python","Raspberry Pi","RaspberryPi"],"articleSection":["Python","Raspberry Pi Pico"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/","url":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/","name":"Extension C pour MicroPython sur Raspberry Pi Pico | PiCockpit","isPartOf":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#website"},"primaryImageOfPage":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#primaryimage"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#primaryimage"},"thumbnailUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg","datePublished":"2021-04-08T14:26:05+00:00","dateModified":"2023-11-23T02:13:08+00:00","description":"Guide sur comment \u00e9crire et ex\u00e9cuter une extension C pour MicroPython sur le Raspberry Pi Pico. Ce guide est adapt\u00e9 aux d\u00e9butants et aux experts.","breadcrumb":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#primaryimage","url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg","contentUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg","width":1600,"height":1143,"caption":"raspberry pi pico"},{"@type":"BreadcrumbList","@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/picockpit.com\/raspberry-pi\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/picockpit.com\/raspberry-pi\/category\/python\/"},{"@type":"ListItem","position":3,"name":"C extension for MicroPython on Raspberry Pi Pico"}]},{"@type":"WebSite","@id":"https:\/\/picockpit.com\/raspberry-pi\/#website","url":"https:\/\/picockpit.com\/raspberry-pi\/","name":"PiCockpit","description":"","publisher":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/picockpit.com\/raspberry-pi\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization","name":"PiCockpit.com","url":"https:\/\/picockpit.com\/raspberry-pi\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/logo\/image\/","url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2023\/07\/Screenshot-from-2023-07-24-15-01-24.png","contentUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2023\/07\/Screenshot-from-2023-07-24-15-01-24.png","width":1165,"height":283,"caption":"PiCockpit.com"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pi3gshop","https:\/\/x.com\/pi3g"]},{"@type":"Person","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/person\/e38fef75134e5e54175b2615a8c3eb47","name":"Nathan Busler","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/secure.gravatar.com\/avatar\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g","caption":"Nathan Busler"},"sameAs":["https:\/\/buyzero.de"],"url":"https:\/\/picockpit.com\/raspberry-pi\/fr\/author\/nathan\/"}]}},"_links":{"self":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/posts\/774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/comments?post=774"}],"version-history":[{"count":18,"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/posts\/774\/revisions"}],"predecessor-version":[{"id":6144,"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/posts\/774\/revisions\/6144"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/media\/679"}],"wp:attachment":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/media?parent=774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/categories?post=774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/fr\/wp-json\/wp\/v2\/tags?post=774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}