{"id":2349,"date":"2023-01-11T01:49:53","date_gmt":"2023-01-10T17:49:53","guid":{"rendered":"http:\/\/www.hellofpga.com\/?p=2349"},"modified":"2023-08-29T16:24:47","modified_gmt":"2023-08-29T08:24:47","slug":"petalinux_gpio_app","status":"publish","type":"post","link":"http:\/\/www.hellofpga.com\/index.php\/2023\/01\/11\/petalinux_gpio_app\/","title":{"rendered":"ZYNQ linux\u5f00\u53d1 \u7ae0\u8282\u4e03 Petalinux \u4e0bGPIO\uff08EMIO\u65b9\u5f0f\uff09\u7684\u8f93\u5165\u8f93\u51fa\u5b9e\u9a8c\u4e8c\u2014\u2014\u901a\u8fc7\u7f16\u5199\u5e94\u7528\u7a0b\u5e8f\u6765\u8c03\u7528\uff08Tiny FPGA\u7248\uff09"},"content":{"rendered":"\n<p>\u63a5\u524d\u4e00\u8282\u5185\u5bb9\uff0c \u524d\u4e00\u8282\u5185\u5bb9 \u901a\u8fc7SYSFS\u7684\u4e00\u4e9b\u6307\u4ee4\u6765\u5b9e\u73b0 GPIO\u7684\u7b80\u5355\u64cd\u4f5c\uff0c\u8fd9\u4e00\u8282\u5c06\u901a\u8fc7\u7f16\u7a0b\u7684\u65b9\u5f0f\uff0c\u6765\u8c03\u7528GPIO  \u8ba9LED\u706f\u81ea\u52a8\u7684\u95ea\u70c1\u8d77\u6765<\/p>\n\n\n\n<p>\u672c\u6587\u63a5\u524d\u4e00\u8282\u7684\u5185\u5bb9\u7ee7\u7eed\u5199\uff0c vivado \u8bbe\u7f6e\uff0c\u548cPetalinux \u955c\u50cf\u7f16\u8bd1\u7684\u8fc7\u7a0b\u8bf7\u53c2\u770b\u4e0a\u4e00\u8282\u5185\u5bb9<a rel=\"noreferrer noopener\" href=\"http:\/\/www.hellofpga.com\/wp-admin\/post.php?post=2273&amp;action=edit\" data-type=\"URL\" data-id=\"http:\/\/www.hellofpga.com\/wp-admin\/post.php?post=2273&amp;action=edit\" target=\"_blank\">ZYNQ linux\u5f00\u53d1 \u7ae0\u8282\u516d Petalinux \u4e0bGPIO\uff08EMIO\u65b9\u5f0f\uff09\u7684\u8f93\u5165\u8f93\u51fa\u5b9e\u9a8c\u4e00 \u2014\u2014sysfs\u65b9\u5f0f\uff08Tiny FPGA\u7248<\/a>\uff09<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4e4b\u524dsysfs\u7684\u6d41\u7a0b\u5982\u4e0b\uff0c\u5b9e\u9645\u7f16\u7a0b\u53bb\u8c03\u7528\u7684\u65f6\u5019 \u4e5f\u662f\u6309\u7167\u4e0b\u5217\u6d41\u7a0b\u6765\u8fdb\u884c\u7684<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u2460\u5bfc\u5165IO\u5230\u7528\u6237\u7a7a\u95f4\uff1a\/sys\/class\/gpio\/export\n\necho &nbsp; &nbsp;960 &nbsp;&gt; &nbsp;export\n\n\u2461\u914d\u7f6eIO\uff1a\/sys\/class\/gpio\/direction\n\necho &nbsp; &nbsp; out &nbsp; &nbsp;&gt; &nbsp; direction &nbsp; &nbsp; # \u8f93\u51fa\n\necho &nbsp; &nbsp; in &nbsp; &nbsp;&gt; &nbsp; direction &nbsp; &nbsp; &nbsp; # \u8f93\u5165\n\n\u2462\u63a7\u5236IO\uff1a\/sys\/class\/gpio\/value\n\necho &nbsp; &nbsp; 1 &nbsp; &gt; value &nbsp; &nbsp; &nbsp; &nbsp;#\u8f93\u51fa\u9ad8\u7535\u5e73\n\necho &nbsp; &nbsp; 0 &nbsp; &gt; value &nbsp; &nbsp; &nbsp; &nbsp;#\u8f93\u51fa\u4f4e\u7535\u5e73<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5b8c\u6574\u7a0b\u5e8f\u5982\u4e0b\uff0c\u5f88\u597d\u7406\u89e3 \uff0c\u5176\u5b9e\u64cd\u4f5c\u6d41\u7a0b\u548c\u4e0a\u4e00\u8282\u7684\u76f8\u540c\uff0c \u4e5f\u540c\u6837\u662f\u5bf9direction\u548cvalue\u8fdb\u884c\u64cd\u4f5c\uff0c\u6765\u5b9e\u73b0IO\u53e3\u8f93\u5165\u8f93\u51fa\u548c\u9ad8\u4f4e\u7535\u5e73\u7684\u5b9a\u4e49 \uff08led_init\u8d1f\u8d23led\u7684\u521d\u59cb\u5316\uff0c\u8bbe\u7f6e\u8f93\u5165\u8f93\u51fa\u6a21\u5f0f\uff0c led_ctr\u8d1f\u8d23\u63a7\u5236led\u706f\u7684\u5f00\u548c\u5173\uff0c main\u51fd\u6570\u7684\u4e3b\u5faa\u73af\u5219\u53cd\u590d\u5faa\u73af\u8fd9\u4e2a\u5f00\u5173\u7684\u8fc7\u7a0b\uff0c\u4ece\u800c\u8fbe\u5230LED\u706f\u95ea\u70c1\u7684\u6548\u679c\uff0c sleep(1) \u8d77\u52301\u79d2\u949f\u4f11\u7720\u7684\u4f5c\u7528\uff09<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n#include &lt;fcntl.h&gt;\n#include &lt;stdbool.h&gt;\n\n \nvoid led_init(void)\n{\n    int fd;\n \n    fd = open(\"\/sys\/class\/gpio\/export\",O_WRONLY);\n    if(fd &lt; 0)\n    {\n        printf(\"open export fail\\r\\n\");\n        return ;\n    }\n    write(fd,\"960\",4);\n    close(fd);\n \n    fd = open(\"\/sys\/class\/gpio\/gpio960\/direction\",O_RDWR);\n    if(fd &lt; 0)\n    {\n        printf(\"open direction fail\\r\\n\");\n        return ;\n    }\n    write(fd,\"out\",4);\n    close(fd);\n}\n \nvoid led_ctl(bool on_off)\n{\n    int fd;\n \n    fd = open(\"\/sys\/class\/gpio\/gpio960\/value\",O_RDWR);\n    if(fd &lt; 0)\n    {\n        printf(\"open value fail\\r\\n\");\n        return ;\n    }\n    if(on_off==true)\n    {\n        write(fd,\"1\",2);\n    }\n    else\n    {\n        write(fd,\"0\",2);\n    }\n    close(fd);\n}\n \nint main(void)\n{\n    led_init();\n \n    while(1)\n    {\n        led_ctl(true);\n        sleep(1);\n \n        led_ctl(false);\n        sleep(1);\n    }\n    return 0;\n}<\/pre>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-19274efc-2e8d-42d2-8548-4bf17abb6909\" href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/led.zip\">led<\/a><a href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/led.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-19274efc-2e8d-42d2-8548-4bf17abb6909\">\u4e0b\u8f7d<\/a><\/div>\n\n\n\n<p>\u5b8c\u6210\u7684led.c\u6587\u4ef6 \u4e5f\u53ef\u4ee5\u76f4\u63a5\u4e0b\u8f7d<\/p>\n\n\n\n<p>a) \u6253\u5f00\u865a\u62df\u673a\u4e0a <\/p>\n\n\n\n<p>\u521b\u5efa\u4e00\u4e2a \u6587\u4ef6\u5939\u7528\u4e8e\u5b58\u653e\u6211\u4eec\u521a\u624d\u7684led.c\u6587\u4ef6\uff0c \u8fd9\u91cc\u76f4\u63a5\u7528\u56fe\u5f62\u754c\u9762\u53f3\u952e\u521b\u5efa<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"897\" height=\"253\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-32.png\" alt=\"\" class=\"wp-image-2355\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-32.png 897w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-32-300x85.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-32-768x217.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>b)  \u590d\u5236\u6211\u4eec\u4e0a\u9762\u7684 led.c \u5230\u8fd9\u4e2a\u76ee\u5f55\u4e0b  (\u4e5f\u53ef\u4ee5\u5728ubuntu\u4e0b\u4f7f\u7528vim\u7f16\u8f91\u5668\u65b0\u5efa\u4e00\u4e2aled.c\u6587\u4ef6\uff0c\u5728\u91cc\u9762\u8f93\u5165\u4e0a\u8ff0\u7684\u4ee3\u7801\u5185\u5bb9)<\/p>\n\n\n\n<p>c)  \u5728led.c \u6240\u5728\u6587\u4ef6\u5939\u7684\u7a7a\u767d\u5904\uff0c\u53f3\u952e open in Terminal \u6765\u6253\u5f00\u7ec8\u7aef<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"388\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-33.png\" alt=\"\" class=\"wp-image-2356\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-33.png 622w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-33-300x187.png 300w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/figure>\n\n\n\n<p>d )  \u52a0\u8f7dpetalinux\u5f00\u53d1\u73af\u5883<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">source \/opt\/pkg\/petalinux\/2018.3\/settings.sh\n<\/pre>\n\n\n\n<p>e ) \u4f7f\u7528arm-linux-gnueabihf-gcc\u5c06led.c\u7f16\u8bd1\u4e3aled\u53ef\u6267\u884c\u6587\u4ef6,  \u7531\u4e0b\u56fe\u53ef\u4ee5\u770b\u5230\uff0c\u6587\u4ef6\u5939\u4e0b\u591a\u51fa\u4e86\u4e00\u4e2aled\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> arm-linux-gnueabihf-gcc led.c -o led<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"903\" height=\"543\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-34.png\" alt=\"\" class=\"wp-image-2357\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-34.png 903w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-34-300x180.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-34-768x462.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>f ) \u7f16\u8bd1\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7file led\u547d\u4ee4\u6765\u67e5\u770b\u6587\u4ef6\u7c7b\u578b\uff0c  \u5165\u4e0b\u56fe\u6240\u793a\uff0c\u6211\u4eec\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u662f32\u4f4d\uff0carm\u67b6\u6784\uff0c\u8bf4\u660e\u53ef\u5728arm\u4e0b\u8fd0\u884c<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"807\" height=\"179\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-35.png\" alt=\"\" class=\"wp-image-2361\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-35.png 807w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-35-300x67.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-35-768x170.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>g \uff09 \u62f7\u8d1d\u5230fat32\u683c\u5f0f\u7684TF\u5361\u4e2d\uff08 \u4e5f\u9700\u8981\u62f7\u8d1d\u4e0a\u4e00\u8282\u5e26gpio\u529f\u80fd\u7684 petalinux \u955c\u50cf\uff0c\u5165\u4e0b\u56fe\u6240\u793a\uff09<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"479\" height=\"221\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-37.png\" alt=\"\" class=\"wp-image-2363\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-37.png 479w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-37-300x138.png 300w\" sizes=\"auto, (max-width: 479px) 100vw, 479px\" \/><\/figure>\n\n\n\n<p>\u4e4b\u540e\u6b63\u5e38\u9000\u51faTF\u5361\uff0c \u5e76\u5c06\u5361\u63d2\u5165\u5230 \u6211\u4eec\u7684\u4e3b\u677f\u4e0a<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e0a\u7535\u6d4b\u8bd5<\/h2>\n\n\n\n<p><strong>\u5c06\u8df3\u7ebf\u4f4d\u7f6e\u6362\u56de\u5230SD\u4e0a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"378\" height=\"531\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/12\/image-97.png\" alt=\"\" class=\"wp-image-2239\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/12\/image-97.png 378w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/12\/image-97-214x300.png 214w\" sizes=\"auto, (max-width: 378px) 100vw, 378px\" \/><\/figure>\n\n\n\n<p><strong>\u5907\u6ce8 \u5b9e\u9645\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d\u4f1a\u53d1\u73b0 \u865a\u62df\u673a \u548cwindows \u4e89\u62a2\u4e32\u53e3\u7684\u8d44\u6e90\u7684\u60c5\u51b5\uff0c\u5bfc\u81f4windows \u4e0b \u65e0\u6cd5\u8bbf\u95ee\u4e32\u53e3\uff0c\u6240\u4ee5\u8fd9\u91cc\u6d4b\u8bd5\u7684\u65f6\u5019\uff08\u628a\u4e32\u53e3\u9ed8\u8ba4\u8bbe\u7f6e\u8fde\u63a5\u5230windows \uff09 \u6216\u8005\u4e34\u65f6\u6302\u8d77\u865a\u62df\u673a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"529\" height=\"462\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/12\/image-98.png\" alt=\"\" class=\"wp-image-2240\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/12\/image-98.png 529w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/12\/image-98-300x262.png 300w\" sizes=\"auto, (max-width: 529px) 100vw, 529px\" \/><\/figure>\n\n\n\n<p><strong>\u5907\u6ce8 \u5b9e\u9645\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d\u4f1a\u53d1\u73b0 \u865a\u62df\u673a \u548cwindows \u4e89\u62a2\u4e32\u53e3\u7684\u8d44\u6e90\u7684\u60c5\u51b5\uff0c\u5bfc\u81f4windows \u4e0b \u65e0\u6cd5\u8bbf\u95ee\u4e32\u53e3\uff0c\u6240\u4ee5\u8fd9\u91cc\u6d4b\u8bd5\u7684\u65f6\u5019\uff08\u628a\u4e32\u53e3\u9ed8\u8ba4\u8bbe\u7f6e\u8fde\u63a5\u5230windows \uff09 \u6216\u8005\u4e34\u65f6\u6302\u8d77\u865a\u62df\u673a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"529\" height=\"462\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/12\/image-98.png\" alt=\"\" class=\"wp-image-2240\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/12\/image-98.png 529w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/12\/image-98-300x262.png 300w\" sizes=\"auto, (max-width: 529px) 100vw, 529px\" \/><\/figure>\n\n\n\n<p><strong>\u56e0\u4e3a\u672c\u5de5\u7a0b\u9700\u8981\u7528\u5230ctrl+c\u6765\u4e2d\u65ad\u5e94\u7528\uff0c\u6240\u4ee5\u8fd9\u91cc\u7528putty\u8fd9\u6837\u7684\u4e13\u4e1a\u5de5\u5177\u66ff\u4ee3\u4e32\u53e3\u52a9\u624b\uff08\u8fd9\u6837\u8bf8\u5982CTRL+C\u8fd9\u6837\u7684\u6307\u4ee4\u5c31\u53ef\u4ee5\u7528\u952e\u76d8\u7684\u5f62\u5f0f\u76f4\u63a5\u53d1\u9001\u4e86\uff0cputty\u5b98\u7f51\u53ef\u4ee5\u514d\u8d39\u4e0b\u8f7d\u5230\uff09<\/strong><\/p>\n\n\n\n<p>\u6253\u5f00\u540e\u914d\u7f6e\u754c\u9762\u5982\u4e0b \u6a21\u5f0f\u9009\u62e9serial \uff0c\u5e76\u8bbe\u7f6e\u597d\u4e32\u53e3\u53f7(<strong>\u67e5\u770b\u8bbe\u5907\u7ba1\u7406\u5668\u5f97\u5230)<\/strong> \u548c\u6ce2\u7279\u7387115200\u5c31\u884c<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"964\" height=\"508\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/1UN88AEMMOLWOXKZM0.png\" alt=\"\" class=\"wp-image-2900\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/1UN88AEMMOLWOXKZM0.png 964w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/1UN88AEMMOLWOXKZM0-300x158.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/1UN88AEMMOLWOXKZM0-768x405.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u8bbe\u7f6e\u6210SD\u542f\u52a8\u540e<strong>\u91cd\u65b0\u4e0a\u7535<\/strong>\uff0c\u6211\u4eec\u5c31\u80fd\u5728putty\u4e0a\u770b\u5230linux \u53d1\u51fa\u6765\u7684\u547d\u4ee4\u884c\u4e86<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"656\" height=\"418\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-40.png\" alt=\"\" class=\"wp-image-2974\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-40.png 656w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-40-300x191.png 300w\" sizes=\"auto, (max-width: 656px) 100vw, 656px\" \/><\/figure>\n\n\n\n<p>\u7cfb\u7edf\u6b64\u65f6\u505c\u7559\u5728\u7b49\u5f85\u8f93\u5165\u8d26\u53f7\u5bc6\u7801\u7684\u72b6\u6001, \u6b64\u65f6\u8f93\u5165\u7528\u6237\u540d root \u8f93\u5165\u5bc6\u7801 root \uff08\u4e0d\u540c\u7684\u4e32\u53e3\u52a9\u624b\u6709\u4e9b\u9700\u8981\u5e26\u56de\u8f66\uff09<\/p>\n\n\n\n<p>\u4e4b\u540e\u5c31\u6b63\u5f0f\u767b\u5f55 petalinux \u4e86<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"477\" height=\"119\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-41.png\" alt=\"\" class=\"wp-image-2975\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-41.png 477w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-41-300x75.png 300w\" sizes=\"auto, (max-width: 477px) 100vw, 477px\" \/><\/figure>\n\n\n\n<p>\u4e4b\u540e\u5c31\u53ef\u4ee5\u8fdb\u884clinux \u7684\u64cd\u4f5c\u4e86<\/p>\n\n\n\n<p>a) \u6211\u4eec\u5148\u7528 df -h\u6765\u67e5\u770b TF\u5361\u7684\u6302\u8f7d\u4f4d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df -h<\/pre>\n\n\n\n<p>\u7531\u4e0b\u56fe\u77e5\u9053\uff0c\u6211\u4eec\u7684TF\u5361\u8def\u5f84\u662f \/run\/media\/mmcblk0p1<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"641\" height=\"201\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-42.png\" alt=\"\" class=\"wp-image-2976\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-42.png 641w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-42-300x94.png 300w\" sizes=\"auto, (max-width: 641px) 100vw, 641px\" \/><\/figure>\n\n\n\n<p>b ) cd \u8fdb\u5165\u6211\u4eec\u7684tf\u5361 \/run\/media\/mmcblk0p1  \uff08putty\u4e0b   cd \u7684\u65f6\u5019 \u8def\u5f84\u4e0b\u6309TAP\u952e \u4e5f\u4f1a\u548cUbuntu \u4e0b\u4e00\u6837\u6709\u63d0\u9192\u7684\uff09<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd  \/run\/media\/mmcblk0p1<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"642\" height=\"231\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-43.png\" alt=\"\" class=\"wp-image-2977\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-43.png 642w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-43-300x108.png 300w\" sizes=\"auto, (max-width: 642px) 100vw, 642px\" \/><\/figure>\n\n\n\n<p>e) \u7528ls \u6307\u4ee4\u67e5\u770b mmcblk0p1\u4e0b\u7684\u6587\u4ef6\uff0c \u53ef\u4ee5\u770b\u5230 \u7cfb\u7edf\u68c0\u7d22\u5230\u6211\u4eec\u4e4b\u524d\u653e\u8fdb\u53bb\u7684led \u53ef\u6267\u884c\u6587\u4ef6\u4e86,\u7528.\/led \u6765\u8fd0\u884c\u6211\u4eec\u7684led\u7a0b\u5e8f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">.\/led<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"453\" height=\"74\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-42.png\" alt=\"\" class=\"wp-image-2369\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-42.png 453w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-42-300x49.png 300w\" sizes=\"auto, (max-width: 453px) 100vw, 453px\" \/><\/figure>\n\n\n\n<p>\u6211\u4eec\u677f\u5b50\u4e0a\u7684LED\u706f\u5f00\u59cb\u95ea\u70c1\uff0c\u95ea\u70c1\u95f4\u9694\u662f1\u79d2\u949f\uff0c \u8bc1\u660e\u6211\u4eec\u7684LED\u53ef\u6267\u884c\u7a0b\u5e8f\u5de5\u4f5c\u6b63\u5e38<\/p>\n\n\n\n<p>\u5982\u679c\u60f3\u8981\u7a0b\u5e8f\u505c\u6b62\u8fd0\u884c\uff0c\u5219\u5728putty\u547d\u4ee4\u884c\u7a97\u53e3\u4e0b \u540c\u65f6\u6309\u4e0b&#8221;ctrl&#8221;  \u548c \u201cc&#8221; \u952e  <strong>\uff08\u666e\u901a\u7684\u4e32\u53e3\u52a9\u624b\u4e0d\u80fd\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\uff09<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"629\" height=\"198\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-44.png\" alt=\"\" class=\"wp-image-2978\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-44.png 629w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/02\/image-44-300x94.png 300w\" sizes=\"auto, (max-width: 629px) 100vw, 629px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u6837\u7a0b\u5e8f\u5c31\u88ab\u4e2d\u65ad\u4e86\uff0c\u63a7\u5236\u6743\u53c8\u56de\u5230\u4e86\u547d\u4ee4\u884c\u4e0a\u3002<\/p>\n\n\n\n<p><strong>\u4ee5\u4e0b\u662f\u7f16\u8bd1\u597d\u7684LED\u53ef\u6267\u884c\u6587\u4ef6(\u5305\u542b\u4e0a\u4e00\u7ae0\u8282\u4e2d\u7684petalinux \u7cfb\u7edf)\uff0c \u76f4\u63a5\u590d\u5236\u5230FAT32\u683c\u5f0f\u7684TF\u5361\u6839\u76ee\u5f55\u4e0b\u5c31\u53ef\u542f\u52a8\u6f14\u793a<\/strong><\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-1d8a8994-fff9-4cd9-92ce-e73fede2f890\" href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image.zip\">image<\/a><a href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-1d8a8994-fff9-4cd9-92ce-e73fede2f890\">\u4e0b\u8f7d<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u63a5\u524d\u4e00\u8282\u5185\u5bb9\uff0c \u524d\u4e00\u8282\u5185\u5bb9 \u901a\u8fc7SYSFS\u7684\u4e00\u4e9b\u5217\u6307\u4ee4\u6765\u5b9e\u73b0 GPIO\u7684\u7b80\u5355\u64cd\u4f5c\uff0c\u8fd9\u4e00\u8282\u5c06\u901a\u8fc7\u7f16\u7a0b\u7684\u65b9\u5f0f\uff0c\u6765\u8c03\u7528GPIO  \u8ba9LED\u706f\u81ea\u52a8\u7684\u95ea\u70c1\u8d77\u6765<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,13],"tags":[],"class_list":["post-2349","post","type-post","status-publish","format-standard","hentry","category-tiny-zynq","category-tiny-zynq-2"],"views":737,"_links":{"self":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/2349","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/comments?post=2349"}],"version-history":[{"count":18,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/2349\/revisions"}],"predecessor-version":[{"id":2983,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/2349\/revisions\/2983"}],"wp:attachment":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/media?parent=2349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/categories?post=2349"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/tags?post=2349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}