{"id":95,"date":"2026-05-10T16:15:57","date_gmt":"2026-05-10T08:15:57","guid":{"rendered":"https:\/\/blog.shufue.top\/?p=95"},"modified":"2026-05-10T16:15:57","modified_gmt":"2026-05-10T08:15:57","slug":"rust_emb%e5%9f%ba%e7%a1%80%e8%ae%a4%e8%af%86","status":"publish","type":"post","link":"https:\/\/blog.shufue.top\/?p=95","title":{"rendered":"[Rust_emb]\u57fa\u7840\u8ba4\u8bc6"},"content":{"rendered":"\n<h2 class=\"wp-block-heading is-style-default\">\u4f7f\u7528STM32F3DISCOVERY<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"477\" src=\"https:\/\/blog.shufue.top\/wp-content\/uploads\/2026\/04\/f3.jpg\" alt=\"\" class=\"wp-image-107\" srcset=\"https:\/\/blog.shufue.top\/wp-content\/uploads\/2026\/04\/f3.jpg 720w, https:\/\/blog.shufue.top\/wp-content\/uploads\/2026\/04\/f3-300x199.jpg 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a STM32F303VCT6 \u5fae\u63a7\u5236\u5668\u3002\u8fd9\u4e2a\u5fae\u63a7\u5236\u5668\u5177\u6709<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e00\u4e2a\u5355\u6838 ARM Cortex-M4F \u5904\u7406\u5668\uff0c\u652f\u6301\u5355\u7cbe\u5ea6\u6d6e\u70b9\u8fd0\u7b97\uff0c\u6700\u9ad8\u65f6\u949f\u9891\u7387\u4e3a 72 MHz\u3002<\/li>\n\n\n\n<li>256 KiB \u7684\u201cFlash\u201d\u5185\u5b58\u3002\uff081 KiB = 1024 \u5b57\u8282\uff09<\/li>\n\n\n\n<li>48 KiB \u7684 RAM\u3002<\/li>\n\n\n\n<li>\u5404\u79cd\u96c6\u6210\u5916\u8bbe\uff0c\u5982\u5b9a\u65f6\u5668\u3001I2C\u3001SPI \u548c USART\u3002<\/li>\n\n\n\n<li>\u901a\u7528\u8f93\u5165\u8f93\u51fa (GPIO) \u4ee5\u53ca\u5176\u4ed6\u7c7b\u578b\u7684\u5f15\u811a\uff0c\u53ef\u901a\u8fc7\u677f\u5b50\u4e24\u4fa7\u7684\u4e24\u6392\u63a5\u53e3\u8bbf\u95ee\u3002<\/li>\n\n\n\n<li>\u53ef\u901a\u8fc7\u6807\u6709\u201cUSB USER\u201d\u7684 USB \u7aef\u53e3\u8bbf\u95ee\u7684 Mini-USB \u63a5\u53e3\u3002<\/li>\n\n\n\n<li>&nbsp;LSM303DLHC \u82af\u7247\u6709\u52a0\u901f\u5ea6\u8ba1\uff0c\u78c1\u529b\u8ba1\uff0c\u9640\u87ba\u4eea\u3002<\/li>\n\n\n\n<li>8 \u4e2a\u7528\u6237 LED\uff0c\u6392\u5217\u6210\u6307\u5357\u9488\u5f62\u72b6\u3002<\/li>\n\n\n\n<li>\u7b2c\u4e8c\u4e2a\u5fae\u63a7\u5236\u5668\uff1aSTM32F103\u3002\u8fd9\u4e2a\u5fae\u63a7\u5236\u5668\u5b9e\u9645\u4e0a\u662f\u677f\u8f7d\u7f16\u7a0b\u5668\/\u8c03\u8bd5\u5668\u7684\u4e00\u90e8\u5206\uff0c\u5e76\u8fde\u63a5\u5230\u540d\u4e3a\u201cUSB ST-LINK\u201d\u7684 Mini-USB \u7aef\u53e3\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u83b7\u53d6\u66f4\u8be6\u7ec6\u7684\u529f\u80fd\u5217\u8868\u548c\u677f\u5361\u7684\u8fdb\u4e00\u6b65\u89c4\u683c\uff0c\u8bf7\u8bbf\u95ee <a href=\"https:\/\/www.st.com\/en\/evaluation-tools\/stm32f3discovery.html\">STMicroelectronics <\/a>\u7f51\u7ad9\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">#![no_std]<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5d4c\u5165\u5f0f\u7f16\u7a0b\u8fd9\u4e00\u672f\u8bed\u6db5\u76d6\u4e86\u5e7f\u6cdb\u7684\u4e0d\u540c\u7c7b\u522b\u7684\u7f16\u7a0b\u3002\u4ece\u4ec5\u4f7f\u7528\u51e0 KB RAM \u548c ROM \u7f16\u7a0b\u7684 8 \u4f4d\u5fae\u63a7\u5236\u5668\uff08\u5982 <a href=\"https:\/\/www.st.com\/resource\/en\/datasheet\/st72325j6.pdf\">ST72325xx<\/a>\uff09\uff0c\u5230\u62e5\u6709 32\/64 \u4f4d 4 \u6838 Cortex-A53 @ 1.4 GHz \u548c 1GB RAM \u7684\u7cfb\u7edf\u5982 Raspberry Pi \uff08<a href=\"https:\/\/en.wikipedia.org\/wiki\/Raspberry_Pi#Specifications\">Model B 3+<\/a>\uff09\u3002\u6839\u636e\u4f60\u7684\u76ee\u6807\u548c\u4f7f\u7528\u573a\u666f\u4e0d\u540c\uff0c\u7f16\u5199\u4ee3\u7801\u65f6\u5c06\u9762\u4e34\u4e0d\u540c\u7684\u9650\u5236\/\u5c40\u9650\u6027\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span id=\"hosted-environments\" style=\"letter-spacing: normal; white-space: normal; margin-block-start: 2.5em; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: &quot;Open Sans&quot;, sans-serif;\"><a style=\"text-decoration: none;\" href=\"https:\/\/docs.rust-embedded.org\/book\/intro\/no-std.html#hosted-environments\" class=\"header\">Hosted Environments<\/a><\/span>\u5bbf\u4e3b\u73af\u5883<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u73af\u5883\u63a5\u8fd1\u4e8e\u666e\u901a PC \u73af\u5883\u3002\u8fd9\u610f\u5473\u7740\u5c06\u83b7\u5f97\u4e00\u4e2a\u7cfb\u7edf\u63a5\u53e3\u5e2e\uff0c\u4f8b\u5982 <code>POSIX<\/code>\uff0c\u5b83\u4e3a\u4f60\u63d0\u4f9b\u4e86\u4e0e\u5404\u79cd\u7cfb\u7edf\u4ea4\u4e92\u7684\u57fa\u7840\u8bbe\u65bd\uff0c\u5982\u6587\u4ef6\u7cfb\u7edf\u3001\u7f51\u7edc\u3001\u5185\u5b58\u7ba1\u7406\u3001\u7ebf\u7a0b\u7b49\u3002\u6807\u51c6\u5e93\u901a\u5e38\u4f1a\u4f9d\u8d56\u8fd9\u4e9b\u57fa\u7840\u8bbe\u65bd\u6765\u5b9e\u73b0\u5176\u529f\u80fd\u3002\u4f60\u53ef\u80fd\u6709\u67d0\u79cd\u5f62\u5f0f\u7684 sysroot\uff0c\u4ee5\u53ca RAM\/ROM \u4f7f\u7528\u7684\u9650\u5236\uff0c\u6216\u8bb8\u8fd8\u6709\u4e00\u4e9b\u7279\u6b8a\u7684\u786c\u4ef6\u6216 I\/O\u3002\u603b\u7684\u6765\u8bf4\uff0c\u611f\u89c9\u5c31\u50cf\u5728\u7279\u6b8a\u7528\u9014\u7684 PC \u73af\u5883\u4e2d\u7f16\u7a0b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u6709\u4e9b\u6700\u57fa\u7840\u7684\u4e8b\u60c5\u4e0d\u7528\u81ea\u5df1\u8003\u8651\u7531\u5bbf\u4e3b\u7cfb\u7edf\u4ee3\u4e3a\u7ba1\u7406\uff0c\u5982\u5185\u5b58\u5206\u914d\/\u8c03\u5ea6\uff0c\u6838\u5fc3\u7ebf\u7a0b\u4efb\u52a1\u8c03\u5ea6\u7b49\u3002\u53ea\u9700\u4f7f\u7528\u5bbf\u4e3b\u7cfb\u7edf\u7ed9\u7684\u63a5\u53e3\u5c31\u80fd\u57fa\u4e8e\u7cfb\u7edf\u6765\u907f\u514d\u505a\u201c\u91cd\u590d\u9020\u8f6e\u5b50\u201d\u7684\u4efb\u52a1\u6765\u51cf\u5c11\u5f00\u53d1\u8d1f\u8377\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading is-style-default\">Bare Metal Environments&nbsp;&nbsp;\u88f8\u673a\u73af\u5883<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u4e00\u4e2a\u88f8\u673a\u73af\u5883\u4e2d\uff0c\u5728\u60a8\u7684\u7a0b\u5e8f\u4e4b\u524d\u6ca1\u6709\u52a0\u8f7d\u4efb\u4f55\u4ee3\u7801\u3002\u6ca1\u6709\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u8f6f\u4ef6\uff0c\u65e0\u6cd5\u52a0\u8f7d\u6807\u51c6\u5e93\u3002\u76f8\u53cd\uff0c\u7a0b\u5e8f\u53ca\u5176\u4f7f\u7528\u7684 crates \u53ea\u80fd\u4f7f\u7528\u786c\u4ef6\uff08\u88f8\u673a\uff09\u6765\u8fd0\u884c\u3002\u4e3a\u4e86\u9632\u6b62 rust \u52a0\u8f7d\u6807\u51c6\u5e93\uff0c\u4f7f\u7528&nbsp;<code>no_std<\/code>&nbsp;\u3002\u6807\u51c6\u5e93\u7684\u5e73\u53f0\u65e0\u5173\u90e8\u5206\u901a\u8fc7 <code>libcore<\/code> \u63d0\u4f9b\u3002<code>libcore<\/code>\u8fd8\u6392\u9664\u4e86\u5728\u5d4c\u5165\u5f0f\u73af\u5883\u4e2d\u5e76\u975e\u6307\u7684\u4f7f\u7528\u7684\u5185\u5bb9\u3002\u5176\u4e2d\u4e4b\u4e00\u662f\u7528\u4e8e\u52a8\u6001\u5185\u5b58\u5206\u914d\u7684\u5185\u5b58\u5206\u914d\u5668\u3002\u5982\u679c\u60a8\u9700\u8981\u8fd9\u4e2a\u6216\u5176\u4ed6\u4efb\u4f55\u529f\u80fd\uff0c\u901a\u5e38\u6709 <code>crates<\/code>\u63d0\u4f9b\u8fd9\u4e9b\u529f\u80fd\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">The <code>libstd<\/code><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5<code>libstd<\/code>\u662fRust\u7684\u6807\u51c6\u5e93\uff0c\u63d0\u4f9b\u5728\u6709\u64cd\u4f5c\u7cfb\u7edf\u652f\u6301\u4e0b\u5f00\u53d1\u5e94\u7528\u6240\u9700\u7684\u7684\u57fa\u7840\u529f\u80fd\u7684\u96c6\u5408\u3002\u9ed8\u8ba4\u94fe\u63a5\u6807\u51c6\u5e93\uff0c\u5c01\u88c5\u64cd\u4f5c\u7cfb\u7edf\u80fd\u529b\u5e76\u63d0\u4f9b\u901a\u7528\u6570\u636e\u7ed3\u6784\u4e0e\u5de5\u5177(\u5982 \u7f51\u7edc <code>std::net<\/code>)\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5\u5728\u6211\u4eec\u4f7f\u7528\u88f8\u673a\u73af\u5883(<code>#![no_std]<\/code>)\u65f6\u662f\u65e0\u6cd5\u8c03\u7528<code>listd<\/code>\u7684<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u603b\u7ed3<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>#![no_std]<\/code>&nbsp;\u662f\u4e00\u4e2a crate \u7ea7\u522b\u7684\u5c5e\u6027\uff0c\u8868\u793a\u8be5 crate \u5c06\u94fe\u63a5\u5230 core-crate \u800c\u4e0d\u662f std-crate\u3002libcore crate \u672c\u8eab\u662f std crate \u7684\u5e73\u53f0\u65e0\u5173\u5b50\u96c6\uff0c\u5b83\u4e0d\u5bf9\u7a0b\u5e8f\u8fd0\u884c\u7684\u7cfb\u7edf\u505a\u4efb\u4f55\u5047\u8bbe\u3002\u5b83\u63d0\u4f9b\u4e86\u7528\u4e8e\u8bed\u8a00\u57fa\u672c\u7c7b\u578b\uff08\u5982\u6d6e\u70b9\u6570\u3001\u5b57\u7b26\u4e32\u548c\u5207\u7247\uff09\u7684 API\uff0c\u4ee5\u53ca\u7528\u4e8e\u66b4\u9732\u5904\u7406\u5668\u7279\u6027\u7684 API\uff08\u5982\u539f\u5b50\u64cd\u4f5c\u548c SIMD \u6307\u4ee4\uff09\u3002\u4f46\u5b83\u7f3a\u4e4f\u6d89\u53ca\u5e73\u53f0\u96c6\u6210\u7684 API\u3002\u56e0\u4e3a\u8fd9\u4e9b\u7279\u6027\uff0cno_std \u548c libcore \u4ee3\u7801\u53ef\u7528\u4e8e\u4efb\u4f55\u7c7b\u578b\u7684\u5f15\u5bfc\uff08\u9636\u6bb5 0\uff09\u4ee3\u7801\uff0c\u5982\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\u3001\u56fa\u4ef6\u6216\u5185\u6838\u3002<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-fixed-layout\"><thead><tr><th>feature<\/th><th>no_std<\/th><th>std<\/th><\/tr><\/thead><tbody><tr><td>heap (dynamic memory)<\/td><td>*<\/td><td>\u2713<\/td><\/tr><tr><td>collections (Vec, BTreeMap, etc)<\/td><td>**<\/td><td>\u2713<\/td><\/tr><tr><td>stack overflow protection<\/td><td>\u2718<\/td><td>\u2713<\/td><\/tr><tr><td>runs init code before main<\/td><td>\u2718<\/td><td>\u2713<\/td><\/tr><tr><td>libstd available<\/td><td>\u2718<\/td><td>\u2713<\/td><\/tr><tr><td>libcore available<\/td><td>\u2713<\/td><td>\u2713<\/td><\/tr><tr><td>writing firmware, kernel, or bootloader code<\/td><td>\u2713<\/td><td>\u2718<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">* \u4ec5\u5f53\u4f60\u4f7f\u7528&nbsp;<code>alloc<\/code>&nbsp;crate \u5e76\u4f7f\u7528\u5408\u9002\u7684\u5206\u914d\u5668(\u5982 alloc-cortex-m)\u65f6\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">** \u53ea\u6709\u5728\u4f7f\u7528&nbsp;<code>collections<\/code>&nbsp;crate \u5e76\u914d\u7f6e\u5168\u5c40\u9ed8\u8ba4\u5206\u914d\u5668\u65f6\u624d\u53ef\u7528\u3002<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">** \u7531\u4e8e\u7f3a\u5c11\u5b89\u5168\u7684\u968f\u673a\u6570\u751f\u6210\u5668\uff0cHashMap \u548c HashSet \u65e0\u6cd5\u4f7f\u7528\u3002<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528STM32F3DISCOVERY \u4e00\u4e2a STM32F303VCT6 \u5fae\u63a7\u5236\u5668\u3002\u8fd9\u4e2a\u5fae\u63a7\u5236\u5668\u5177\u6709 \u4e3a\u4e86\u83b7\u53d6\u66f4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-95","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.shufue.top\/index.php?rest_route=\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.shufue.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.shufue.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.shufue.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.shufue.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=95"}],"version-history":[{"count":4,"href":"https:\/\/blog.shufue.top\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":108,"href":"https:\/\/blog.shufue.top\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions\/108"}],"wp:attachment":[{"href":"https:\/\/blog.shufue.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.shufue.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.shufue.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}