{"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\/de\/c-erweiterung-fur-micropyth-auf-raspberry-pi-pico\/","title":{"rendered":"C-Erweiterung f\u00fcr MicroPython auf Raspberry Pi Pico"},"content":{"rendered":"<p>Dies ist eine Anleitung, wie man eine einfache C-Erweiterung f\u00fcr MicroPython auf dem Raspberry Pi Pico schreibt und ausf\u00fchrt. Ich werde die Gr\u00fcnde f\u00fcr die Erweiterung von MicroPython behandeln, wie man das Erweiterungsmodul schreibt, wie man es kompiliert und wie man es auf dem Pico installiert. Wenn Sie mehr \u00fcber dieses Thema lesen m\u00f6chten, lesen Sie bitte <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>Einf\u00fchrung<\/h2>\n<h3>Warum MicroPython erweitern?<\/h3>\n<p>Es kann mehrere Gr\u00fcnde geben, warum Sie MicroPython erweitern m\u00f6chten. Da es sich um eine abgespeckte Version von Python handelt, ist MicroPython nicht sehr leistungsf\u00e4hig, wenn es um rechenintensive Aufgaben geht (\u00e4hnlich wie Python). C hingegen ist f\u00fcr solche Aufgaben sehr gut geeignet. Eine C-Erweiterung f\u00fcr Micropython erm\u00f6glicht es Ihnen, diese Berechnungen in C durchzuf\u00fchren und die Ergebnisse in MicroPython zu verwenden. Dies kann einige Prozesse um Gr\u00f6\u00dfenordnungen beschleunigen.<\/p>\n<p>Ein zweiter Grund k\u00f6nnte sein, dass Sie Hardware, die eine C-API verwendet, von MicroPython aus ansprechen wollen.&nbsp;<\/p>\n<h3>Arten von MicroPython C-Erweiterungen<\/h3>\n<p>Es gibt zwei verschiedene M\u00f6glichkeiten, MicroPython zu erweitern: externe C-Module und nativer Maschinencode in .mpy-Dateien.<\/p>\n<p>Um ein externes C-Modul auszuf\u00fchren, m\u00fcssen Sie es in die MicroPython-Firmware rekompilieren. Dies ist ein ziemlich komplizierter Prozess, weshalb sich dieser Leitfaden auf die zweite Alternative konzentriert. Wenn Sie jedoch an diesem Ansatz interessiert sind, k\u00f6nnen Sie auf diesen Webseiten mehr dar\u00fcber lesen:&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>Die .mpy ist eine Datei, die kompilierten nativen Maschinencode enth\u00e4lt und dynamisch gelinkt werden kann. Das macht es viel flexibler, da Sie nicht die gesamte MicroPython-Firmware neu kompilieren m\u00fcssen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Schreiben Sie das Erweiterungsmodul<\/h2>\n\n\n\n<p>Das Schreiben des Erweiterungsmoduls ist der einfachste Teil der Erweiterung von MicroPython. Ich werde Ihnen anhand eines einfachen Beispiels zeigen, wie es geht. Zu Beginn erstellen wir ein neues Verzeichnis namens <em>factfib<\/em>. \u00d6ffnen Sie ein neues Terminalfenster, wechseln Sie in das neue Verzeichnis und erstellen Sie eine neue Datei namens <em>factfib.c<\/em>. Wenn Sie das Verzeichnis auf einem Raspberry Pi unter Dekstop erstellt haben, sieht der Befehl wie folgt aus.<\/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=\"Kopieren\" 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>\u00d6ffnen Sie <span style=\"color: #008000;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\"><em>factfib.c<\/em><\/span><span style=\"color: #000000;\"> in Ihrem bevorzugten Texteditor und geben Sie den folgenden Code ein:<\/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=\"Kopieren\" 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>Lassen Sie mich den obigen Code erkl\u00e4ren: In MicroPython und Python ist jede Variable ein Objekt. Daher stellen wir sie in C als <em>mp_obj_t<\/em>. Aber ein C-Programm kann nur mit Variablen vom Typ C arbeiten, weshalb wir das Objekt in einen C-Typ umwandeln m\u00fcssen. Dies wird Marshalling genannt und MicroPython bietet Funktionen, um jeden C-Typ aus einem Objekt zu extrahieren.<\/p>\n\n\n\n<p>Diese Webseite von Oliver Robson ist sehr hilfreich f\u00fcr Marshalling <a rel=\"noreferrer noopener\" href=\"https:\/\/mpy-c-gen.oliverrobson.tech\/\" target=\"_blank\">https:\/\/mpy-c-gen.oliverrobson.tech\/<\/a>. Au\u00dferdem finden Sie Marshalling-Beispiele in der MicroPython-Dokumentation <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>. Ich empfehle Ihnen, diesen Artikel zu lesen, wenn Sie weitere Erkl\u00e4rungen ben\u00f6tigen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Bauen Sie die Erweiterung<\/h2>\n\n\n\n<p>Wir bauen die Erweiterung mit Hilfe eines Makefiles in eine .mpy-Datei ein. Aber wir m\u00fcssen zuerst ein paar Dinge einrichten. Stellen Sie sicher, dass Ihr Terminal noch im <em>factfib<\/em> Verzeichnis. Klonen Sie dann das MicroPython-GitHub-Repository.<\/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=\"Kopieren\" 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>Diese Installationen werden eine Weile dauern. Wenn Sie Zeit sparen wollen und wissen, was Sie tun, m\u00fcssen Sie nur die Verzeichnisse \/py und \/tools aus dem Micropython-Repository klonen und sie in ein <em>Mikropython<\/em> Ordner innerhalb des&nbsp;<em>factfib<\/em> Ordner (\u00fcberspringen Sie den zweiten Befehl).<\/p>\n\n\n\n<p>W\u00e4hrend die Installation l\u00e4uft, k\u00f6nnen wir die Zeit nutzen, um das Makefile zu schreiben. F\u00fchren Sie einfach<\/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=\"Kopieren\" 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>und \u00f6ffnen Sie die neu erstellte Datei in einem Texteditor.<\/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=\"Kopieren\" 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>Sie haben vielleicht bemerkt, dass wir die Option <em>ARCH <\/em>Variable zu <em>armv7m<\/em> obwohl der Pico <em>armv6m<\/em>. Wir m\u00fcssen dies tun, weil die <em>armv6m<\/em> Architektur wird (zum Zeitpunkt, an dem ich diesen Artikel schreibe) nicht von der <em>dynruntime.mk<\/em> Werkzeug.<\/p>\n\n\n\n<p>Aber zum Gl\u00fcck k\u00f6nnen wir immer noch eine funktionierende Erweiterung f\u00fcr den Pico kompilieren. Wir m\u00fcssen nur die <em>dynruntime.mk <\/em>Datei, die sich unter <em>micropython\/py\/dynruntime.mk.&nbsp;<\/em>\u00d6ffnen Sie es und suchen Sie unter Architecture configuration in armv7m die Variable CFLAGS (sollte Zeile 64 sein). \u00c4ndern Sie&nbsp;<em>-mcpu=cortex-m3<\/em> zu&nbsp;<em>-mcpu=cortex-m0<\/em> und speichern Sie die Datei.<\/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 zu -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>Nachdem alles installiert ist, f\u00fchren Sie<\/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=\"Kopieren\" 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>und die&nbsp;<em>factfib.mpy<\/em> Datei erstellt werden.<\/p>\n\n\n\n<h2>Installieren und testen Sie die Erweiterung<\/h2>\n\n\n\n<p>Der letzte Schritt ist das Installieren und Testen. Hierf\u00fcr nutzen wir das Dateisystem, das Micropython auf dem Raspberry Pi Pico erstellt. Zuerst m\u00fcssen wir den Pico mit der MicroPython-Firmware flashen. Der einfachste Weg, dies zu tun, ist die Verwendung der Thonny IDE (vorinstalliert auf Raspbian\/Raspberry Pi OS).<\/p>\n\n\n\n<p>Wenn Sie keinen Raspberry Pi zum Programmieren Ihres Pico verwenden oder wenn Sie MicroPython noch nie auf dem Pico verwendet haben, lesen Sie bitte die Anleitung \"Erste Schritte mit MicroPython\" von 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>Wenn Sie Windows verwenden, sollten Sie sich diesen Blog-Beitrag \u00fcber den Raspberry Pi Pico und MicroPython unter Windows ansehen <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>Schlie\u00dfen Sie Thonny, nachdem Sie Ihren Pico mit der MicroPython-Firmware geflasht haben, und installieren Sie rshell. Wir verwenden rshell f\u00fcr den Zugriff auf das Dateisystem von der Kommandozeile aus.<\/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=\"Kopieren\" 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>Dies gibt die rhsell-Version aus, wenn alles richtig eingestellt ist. Ziehen Sie dann den Pico ab und stecken Sie ihn wieder ein (ohne die BOOTSEL-Taste zu halten), um sicherzustellen, dass nichts versucht, auf das Dateisystem zuzugreifen. Jetzt m\u00fcssen wir Folgendes ausf\u00fchren<\/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=\"Kopieren\" 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>Um die Installation zu testen, k\u00f6nnen Sie entweder rshell oder die Thonny-IDE verwenden, um Ihre <em>.py<\/em> Dateien auf dem Pico, aber ich werde zeigen, wie man den MicroPython-Interpreter \u00fcber das Minicom benutzt.<\/p>\n\n\n\n<p>Dr\u00fccken Sie also zuerst&nbsp;<em>Strg+c<\/em> um rshell zu verlassen und dann minicom \u00fcber<\/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=\"Kopieren\" 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>jetzt k\u00f6nnen wir auf die Picos REPL zugreifen (Read-eval-print-Schleife)<\/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=\"Kopieren\" 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>Die drei schlie\u00dfenden spitzen Klammern &gt;&gt;&gt; zeigen an, dass der MicroPython-Interpreter l\u00e4uft. Jetzt k\u00f6nnen wir unsere Erweiterung importieren und wie gewohnt mit ihr arbeiten.<\/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=\"Kopieren\" 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>Herzlichen Gl\u00fcckwunsch! Sie haben Ihre erste MicroPython C-Erweiterung f\u00fcr den Pico erstellt! Der n\u00e4chste Schritt ist zu lernen, wie man komplexere Module schreibt und kompiliert. Ein guter Anfang ist es, zu testen, wie das Marshalling von Listen und Dicts funktioniert (siehe die Marshalling-Webseite von oben). <\/p>\n\n\n\n<p>Wenn Sie Fragen zu diesem Beitrag haben, k\u00f6nnen Sie gerne einen Kommentar schreiben.<\/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%2Fde%2Fc-erweiterung-fur-micropyth-auf-raspberry-pi-pico%2F&text=C%20extension%20for%20MicroPython%20on%20Raspberry%20Pi%20Pico\" title=\"Bei X teilen\" aria-label=\"Bei X teilen\" 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\">teilen<\/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%2Fde%2Fc-erweiterung-fur-micropyth-auf-raspberry-pi-pico%2F\" title=\"Bei Facebook teilen\" aria-label=\"Bei Facebook teilen\" 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\">teilen<\/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%2Fde%2Fc-erweiterung-fur-micropyth-auf-raspberry-pi-pico%2F&text=C%20extension%20for%20MicroPython%20on%20Raspberry%20Pi%20Pico\" title=\"Bei Telegram teilen\" aria-label=\"Bei Telegram teilen\" 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\">teilen<\/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%2Fde%2Fc-erweiterung-fur-micropyth-auf-raspberry-pi-pico%2F\" title=\"Bei Reddit teilen\" aria-label=\"Bei Reddit teilen\" 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\">teilen<\/span>&nbsp;<\/a><\/li><\/ul><\/div>","protected":false},"excerpt":{"rendered":"<p>Dies ist eine Anleitung, wie man eine einfache C-Erweiterung f\u00fcr MicroPython auf dem Raspberry Pi Pico schreibt und ausf\u00fchrt. Ich werde die Gr\u00fcnde f\u00fcr die Erweiterung von MicroPython behandeln, wie man das Erweiterungsmodul schreibt, wie man es kompiliert und wie man es auf dem Pico installiert. Wenn Sie mehr \u00fcber dieses Thema lesen wollen,...<\/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.4 - 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\/de\/c-erweiterung-fur-micropyth-auf-raspberry-pi-pico\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\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\/de\/c-erweiterung-fur-micropyth-auf-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=\"Geschrieben von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nathan Busler\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"5\u00a0Minuten\" \/>\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\":\"de\",\"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\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@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\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\",\"name\":\"PiCockpit.com\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@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\":\"de\",\"@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\\\/de\\\/author\\\/nathan\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C-Erweiterung f\u00fcr MicroPython auf Raspberry Pi Pico | PiCockpit","description":"Anleitung, wie man eine C-Erweiterung f\u00fcr MicroPython auf dem Raspberry Pi Pico schreibt und ausf\u00fchrt. Diese Anleitung ist f\u00fcr Anf\u00e4nger und Experten geeignet.","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\/de\/c-erweiterung-fur-micropyth-auf-raspberry-pi-pico\/","og_locale":"de_DE","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\/de\/c-erweiterung-fur-micropyth-auf-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":{"Geschrieben von":"Nathan Busler","Gesch\u00e4tzte Lesezeit":"5\u00a0Minuten"},"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":"de","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-Erweiterung f\u00fcr MicroPython auf 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":"Anleitung, wie man eine C-Erweiterung f\u00fcr MicroPython auf dem Raspberry Pi Pico schreibt und ausf\u00fchrt. Diese Anleitung ist f\u00fcr Anf\u00e4nger und Experten geeignet.","breadcrumb":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/"]}]},{"@type":"ImageObject","inLanguage":"de","@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":"de"},{"@type":"Organization","@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization","name":"PiCockpit.de","url":"https:\/\/picockpit.com\/raspberry-pi\/","logo":{"@type":"ImageObject","inLanguage":"de","@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":"de","@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\/de\/author\/nathan\/"}]}},"_links":{"self":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/posts\/774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/comments?post=774"}],"version-history":[{"count":18,"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/posts\/774\/revisions"}],"predecessor-version":[{"id":6144,"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/posts\/774\/revisions\/6144"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/media\/679"}],"wp:attachment":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/media?parent=774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/categories?post=774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/de\/wp-json\/wp\/v2\/tags?post=774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}