├── .bookignore ├── .gitignore ├── .markdownlint.json ├── .travis.yml ├── CNAME ├── LANGS.md ├── LICENSE ├── README.md ├── assets ├── arduino.png ├── css │ └── custom_theme.css ├── dfu_zadig.png ├── examples │ ├── XnViewMP.png │ ├── how_to_install_dfu.png │ ├── how_to_use_dfu.png │ └── potplayer.png ├── favicon.ico ├── icon_sipeed.png ├── icon_sipeed2.png ├── icon_sipeed_arduino.png ├── longan_nano.jpg ├── longan_nano_pinout_v1.1.0_w5676_h4000_large.png ├── longan_pio_debug.jpg ├── pio_complie.png ├── pio_debug_longan.png ├── pio_ini_cfg.png ├── pio_install_add_gd32v_step1.png ├── pio_install_add_gd32v_step2.png ├── pio_install_add_gd32v_step3.png ├── pio_install_gd32v.png ├── pio_open_rvlink.png ├── pio_upload.png └── sipeed_longan_logo.jpg ├── book.json ├── deploy.sh ├── en ├── README.md ├── SUMMARY.md ├── _layouts │ └── website │ │ ├── header.html │ │ └── page.html ├── book.json ├── get_started │ ├── blink.md │ ├── debug.md │ ├── pio.md │ ├── rv-link.md │ └── sipeed-debugger.md └── styles │ ├── website.css │ └── website.less ├── gulpfile.js ├── index.html ├── index_zh.html ├── package.json ├── serve.sh ├── serve_daemon.sh └── zh ├── README.md ├── SUMMARY.md ├── _layouts └── website │ ├── header.html │ └── page.html ├── book.json ├── examples ├── badapple.md └── printf.md ├── get_started ├── blink.md ├── debug.md ├── pio.md ├── rv-link.md └── sipeed-debugger.md └── styles ├── website.css └── website.less /.bookignore: -------------------------------------------------------------------------------- 1 | /config/ 2 | gulpfile.js 3 | .markdownlint.json 4 | package.json 5 | .gitignore 6 | .bookignore 7 | /README.md 8 | /zh/CONTRIBUTING.md 9 | *.xlsx 10 | *.orig 11 | *.less 12 | *.ai 13 | .travis.yml 14 | deploy.sh 15 | serve.sh 16 | serve_daemon.sh 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | .DS_Store 3 | node_modules/ 4 | output/ 5 | .vscode/ 6 | _book/ 7 | *.epub 8 | *.mobi 9 | serve.tmp 10 | *-lock.json 11 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "fenced-code-language": false, 3 | "ol-prefix": false, 4 | "line-length": false 5 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - "8" 5 | 6 | # 缓存依赖 7 | cache: 8 | directories: 9 | - $HOME/.npm 10 | 11 | before_install: 12 | - export TZ='Asia/Shanghai' # 更改时区 13 | 14 | # 依赖安装 15 | install: 16 | - npm install gitbook-cli -g 17 | # 安装 gitbook 插件 18 | - gitbook install 19 | 20 | # 构建脚本 21 | script: 22 | # 自定义输出目录 gitbook build src dest 23 | - gitbook build . ./build 24 | 25 | # 分支白名单 26 | branches: 27 | only: 28 | - master # 只对 master 分支进行构建 29 | - dev 30 | - /v*.*/ 31 | 32 | # # GitHub Pages 部署 33 | # deploy: 34 | # provider: pages 35 | # skip_cleanup: true 36 | # # 在项目仪表盘的 Settings -> Environment Variables 中配置 37 | # github_token: $GITHUB_TOKEN 38 | # # 将 build 目录下的内容推送到默认的 gh-pages 分支上,并不会连带 build/zh 目录一起 39 | # local_dir: build/zh 40 | # #fqdn: $CUSTOM_DOMAIN 41 | # name: $GIT_NAME 42 | # email: $GIT_EMAIL 43 | # on: 44 | # branch: master 45 | 46 | # 不使用travis的github pages构建功能,自定义脚本 47 | after_success: 48 | - bash ./deploy.sh 49 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | longan.sipeed.com -------------------------------------------------------------------------------- /LANGS.md: -------------------------------------------------------------------------------- 1 | - [English](/en) 2 | - [中文](/zh) 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Longan board 2 | ========== 3 | 4 | Wiki for Sipeed Longan series boards. 5 | 6 | 7 | 8 | |[Read me online](https://longan.sipeed.com/en/) | [在线阅读](https://longan.sipeed.com/zh/) | 9 | | ------------------------ | ----------- | 10 | 11 | [![Build Status](https://travis-ci.org/sipeed/Longan-DOC.svg?branch=master)](https://travis-ci.org/sipeed/Longan-DOC) 12 | 13 | 14 | 15 | 16 | 17 | ## Build Doc 18 | 19 | 20 | This documentation site is powered by GitBook. You can check out the online version here. 21 | 22 | You need Node.js and npm to be able to build the site. 23 | 24 | To install gitbook: 25 | 26 | ``` 27 | npm install gitbook-cli -g 28 | ``` 29 | 30 | Get Doc source code: 31 | ``` 32 | sudo apt install git 33 | git clone https://github.com/sipeed/Longan-DOC.git 34 | ``` 35 | 36 | Install gitbook plugins: 37 | 38 | ``` 39 | cd Longan-DOC 40 | gitbook install 41 | ``` 42 | 43 | Serve as a website: 44 | 45 | ``` 46 | chmod +x serve.sh 47 | ./serve.sh 48 | ``` 49 | 50 | Then visit http://localhost:4000 51 | 52 | 53 | -------------------------------------------------------------------------------- /assets/arduino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/arduino.png -------------------------------------------------------------------------------- /assets/css/custom_theme.css: -------------------------------------------------------------------------------- 1 | 2 | .languages{ 3 | margin-top: 50px; 4 | } 5 | 6 | .languages a{ 7 | color: green; 8 | font-size: 18px; 9 | } 10 | -------------------------------------------------------------------------------- /assets/dfu_zadig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/dfu_zadig.png -------------------------------------------------------------------------------- /assets/examples/XnViewMP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/examples/XnViewMP.png -------------------------------------------------------------------------------- /assets/examples/how_to_install_dfu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/examples/how_to_install_dfu.png -------------------------------------------------------------------------------- /assets/examples/how_to_use_dfu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/examples/how_to_use_dfu.png -------------------------------------------------------------------------------- /assets/examples/potplayer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/examples/potplayer.png -------------------------------------------------------------------------------- /assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/favicon.ico -------------------------------------------------------------------------------- /assets/icon_sipeed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/icon_sipeed.png -------------------------------------------------------------------------------- /assets/icon_sipeed2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/icon_sipeed2.png -------------------------------------------------------------------------------- /assets/icon_sipeed_arduino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/icon_sipeed_arduino.png -------------------------------------------------------------------------------- /assets/longan_nano.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/longan_nano.jpg -------------------------------------------------------------------------------- /assets/longan_nano_pinout_v1.1.0_w5676_h4000_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/longan_nano_pinout_v1.1.0_w5676_h4000_large.png -------------------------------------------------------------------------------- /assets/longan_pio_debug.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/longan_pio_debug.jpg -------------------------------------------------------------------------------- /assets/pio_complie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/pio_complie.png -------------------------------------------------------------------------------- /assets/pio_debug_longan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/pio_debug_longan.png -------------------------------------------------------------------------------- /assets/pio_ini_cfg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/pio_ini_cfg.png -------------------------------------------------------------------------------- /assets/pio_install_add_gd32v_step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/pio_install_add_gd32v_step1.png -------------------------------------------------------------------------------- /assets/pio_install_add_gd32v_step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/pio_install_add_gd32v_step2.png -------------------------------------------------------------------------------- /assets/pio_install_add_gd32v_step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/pio_install_add_gd32v_step3.png -------------------------------------------------------------------------------- /assets/pio_install_gd32v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/pio_install_gd32v.png -------------------------------------------------------------------------------- /assets/pio_open_rvlink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/pio_open_rvlink.png -------------------------------------------------------------------------------- /assets/pio_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/pio_upload.png -------------------------------------------------------------------------------- /assets/sipeed_longan_logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/Longan-DOC/7cefd548badfca65c82ffd26442f825d0d512416/assets/sipeed_longan_logo.jpg -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Longan DOC", 3 | "description": "Longan documentation", 4 | "author":"sipeed", 5 | "plugins": [ 6 | "my-toolbar", 7 | "-lunr", 8 | "-search", 9 | "search-title", 10 | "anchor-navigation-ex", 11 | "anchorjs", 12 | "sharing", 13 | "splitter", 14 | "edit-link", 15 | "ga", 16 | "expandable-chapters-small@git+https://github.com/sipeed/gitbook-plugin-expandable-chapters-small.git" 17 | ], 18 | "styles": { 19 | "website": "./styles/website.css" 20 | }, 21 | "pluginsConfig": { 22 | "github": { 23 | "url": "https://github.com/sipeed/" 24 | }, 25 | "my-toolbar": { 26 | "buttons": [ 27 | { 28 | "label": "Github", 29 | "text":" ", 30 | "icon": "fa fa-github", 31 | "position": "left", 32 | "target": "_blank", 33 | "url": "https://github.com/sipeed/" 34 | } 35 | ] 36 | }, 37 | "search": { 38 | "maxIndexSize": 1000000000 39 | }, 40 | 41 | "lunr": { 42 | "maxIndexSize": 1000000000 43 | }, 44 | "edit-link": { 45 | "base": "https://github.com/sipeed/Longan-DOC/blob/master", 46 | "label": "" 47 | }, 48 | "sharing": { 49 | "douban": false, 50 | "facebook": true, 51 | "google": true, 52 | "hatenaBookmark": false, 53 | "instapaper": false, 54 | "line": false, 55 | "linkedin": false, 56 | "messenger": false, 57 | "pocket": false, 58 | "qq": false, 59 | "qzone": false, 60 | "stumbleupon": false, 61 | "twitter": true, 62 | "viber": false, 63 | "vk": false, 64 | "weibo": true, 65 | "whatsapp": false, 66 | "all": [ 67 | "weibo", 68 | "facebook", 69 | "google", 70 | "twitter", 71 | "vk" 72 | ] 73 | }, 74 | "anchor-navigation-ex": { 75 | "associatedWithSummary": false, 76 | "showLevel": true, 77 | "multipleH1": false, 78 | "mode": "float", 79 | "pageTop": { 80 | "showLevelIcon": true, 81 | "level1Icon": "fa fa-angle-double-right", 82 | "level2Icon": "fa fa-angle-double-right", 83 | "level3Icon": "fa fa-angle-double-right" 84 | } 85 | }, 86 | "ga": { 87 | "token": "UA-119047820-3" 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit -o nounset 4 | 5 | rev=$(git rev-parse --short HEAD) 6 | BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) 7 | echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, BRANCH=$BRANCH" 8 | curr_branch=$TRAVIS_BRANCH 9 | 10 | cp -f index.html build/index.html 11 | cp -f assets/favicon.ico build/gitbook/images/favicon.ico 12 | cp -f assets/icon_sipeed.png build/gitbook/images/apple-touch-icon-precomposed-152.png 13 | 14 | git clone -b gh-pages https://github.com/sipeed/Longan-DOC.git ./old 15 | rm -rf ./old/.git/ 16 | echo "current build branch: --$curr_branch--" 17 | if [[ "$curr_branch" == "master" ]]; then 18 | echo "master" 19 | if [[ -d './old/dev' ]]; then 20 | echo "copy dev" 21 | cp -r ./old/dev ./build/ 22 | fi 23 | cd ./old 24 | v_folder=`find ./ -maxdepth 1 -name 'v*.*'` 25 | echo "version folder:$v_folder" 26 | if [[ "x$v_folder" != "x" ]]; then 27 | echo "copy version folder" 28 | cp -r $v_folder ../build/ 29 | fi 30 | cd .. 31 | elif [[ "$curr_branch" == "dev" ]]; then 32 | echo "dev" 33 | rm -rf ./old/dev 34 | mkdir ./old/dev 35 | cp -r ./build/* ./old/dev 36 | rm -rf ./build 37 | mv ./old ./build 38 | else 39 | echo "not master or dev" 40 | rm -rf ./old/$curr_branch 41 | mkdir ./old/$curr_branch 42 | cp -r ./build/* ./old/$curr_branch 43 | rm -rf ./build 44 | mv ./old ./build 45 | fi 46 | 47 | cd build 48 | 49 | git init 50 | 51 | git config user.name $GIT_NAME 52 | 53 | git config user.email $GIT_EMAIL 54 | 55 | git remote add upstream "https://$GITHUB_TOKEN@github.com/sipeed/Longan-DOC.git" 56 | 57 | # comment below because we don't need history of gh-pages, and use git push --force to cover history 58 | # git fetch upstream 59 | 60 | # git reset upstream/gh-pages 61 | 62 | # echo "gprs.ai-thinker.com" > CNAME 63 | 64 | git add -A 65 | 66 | git commit -m "rebuild pages at ${rev}" 67 | 68 | git push upstream HEAD:gh-pages --force 69 | 70 | -------------------------------------------------------------------------------- /en/README.md: -------------------------------------------------------------------------------- 1 | Longan Documentation 2 | ====== 3 | 4 |
5 | 6 |
7 | 8 | 9 | 10 | ## What is Longan 11 | 12 | Longan Nano is a GD32VF103CBT6 based minimal development board based on GigaDevice's latest RISC-V 32-bit core microcontroller. Convenient for students, engineers, geeks and enthusiasts to access the latest generation of RISC-V processors. 13 | 14 | In the heart of Longan Nano is a GigaDevice's GD32VF103CBT6, based on [Nucleisys](http://www.nucleisys.com/) Bumblebee kernel (support RV32IMAC instruction sets and ECLIC rapid interrupt). You can download instruction set documents here: [http://dl.sipeed.com/LONGAN/Nano/DOC/](http://dl.sipeed.com/LONGAN/Nano/DOC/). 15 | 16 | The chip has built-in 128KB Flash, 32KB SRAM, and peripherals listes below: 17 | * 4 x universal 16-bit timer 18 | * 2 x basic 16-bit timer 19 | * 1 x advanced 16-bit timer 20 | * Watchdog timer 21 | * RTC 22 | * Systick 23 | * 3 x USART 24 | * 2 x I2C 25 | * 3 x SPI 26 | * 2 x I2S 27 | * 2 x CAN 28 | * 1 x USBFS(OTG) 29 | * 2 x ADC(10 channel) 30 | * 2 x DAC 31 | 32 | Longan Nano development board is breadboard friendly. It has onboard 8M passive crystal, 32.768KHz RTC low-speed crystal, mini TF card slot, and use the latest Type-C USB interface. 33 | 34 | ## How to develop 35 | 36 | Longan Nano supports development using the VS CODE-based under PlatformIO IDE environment, supporting one-click project configuration, compilation, download and debugging. See the installation and tutorial here: [PIO configuration](./get_started/pio.md). 37 | 38 | ![pio_debug](../assets/longan_pio_debug.jpg) 39 | 40 | ## PIN Map 41 | 42 | ![](../assets/longan_nano_pinout_v1.1.0_w5676_h4000_large.png) 43 | -------------------------------------------------------------------------------- /en/SUMMARY.md: -------------------------------------------------------------------------------- 1 | Summary 2 | ===== 3 | 4 | ## Introduction 5 | 6 | - [Introduction](README.md) 7 | 8 | ## Getting started 9 | 10 | - [PIO configuration](get_started/pio.md) 11 | - [Getting to Blinky](get_started/blink.md) 12 | - [Debugging](get_started/debug.md) 13 | - [Using Sipeed debugger](get_started/sipeed-debugger.md) 14 | - [Using RV-LINK](get_started/rv-link.md) 15 | 16 | ## Examples 17 | 18 | - [UART](examples/printf.md) 19 | - [Playing Badapple](examples/badapple.md) 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /en/_layouts/website/header.html: -------------------------------------------------------------------------------- 1 | {% extends template.self %} 2 | {% block book_header %} 3 | 37 | 47 | {% endblock %} -------------------------------------------------------------------------------- /en/_layouts/website/page.html: -------------------------------------------------------------------------------- 1 | {% extends template.self %} 2 | {% block book_sidebar %} 3 | 37 | {{ super() }} 38 | {% endblock %} 39 | {% block javascript %} 40 | {{ super() }} 41 | 54 | {% endblock %} -------------------------------------------------------------------------------- /en/book.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Longan DOC", 3 | "description": "Longan documentation", 4 | "structure": { 5 | "summary": "SUMMARY.md", 6 | "readme": "README.md" 7 | }, 8 | "variables": { 9 | "items": [ 10 | { 11 | "name": "Blog", 12 | "link": "http://blog.sipeed.com" 13 | }, 14 | { 15 | "name": "BBS", 16 | "link": "https://bbs.sipeed.com/" 17 | }, 18 | { 19 | "name": "Feedback", 20 | "links": [ 21 | { 22 | "name": "doc", 23 | "link": "https://github.com/sipeed/Longan-DOC/issues" 24 | }, 25 | { 26 | "name": "Source code", 27 | "link": "https://github.com/sipeed/platform-gd32v/issues" 28 | } 29 | ] 30 | } 31 | ], 32 | "version": [ 33 | { 34 | "name": "", 35 | "links": [ 36 | { 37 | "name": "master", 38 | "link": "/en/" 39 | }, 40 | { 41 | "name": "dev", 42 | "link": "/dev/en/" 43 | } 44 | ] 45 | } 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /en/get_started/blink.md: -------------------------------------------------------------------------------- 1 | Getting to Blinky 2 | ===== 3 | 4 | ## Create a LED Blink project 5 | 6 | * Open the PIO home page selection `Project Examples` 7 | 8 | ![](http://blog.sipeed.com/wp-content/uploads/2019/04/d977e844490e6ccc4625f701883a29f5.png) 9 | 10 | * Select `arduino blink` Click `Import` Import sample program (first need to download the schema file and import tool, It may take long time to download) 11 | ![](http://blog.sipeed.com/wp-content/uploads/2019/04/82943a6b74077e6210e2d9421cb5438f.png) 12 | 13 | 14 | * You can see the sample project after the import is successful. 15 | ![](http://blog.sipeed.com/wp-content/uploads/2019/04/1262373ca7b0b483e30dac1124adaabf.png) 16 | 17 | ## Project configuration file 18 | 19 | 20 | * We first need to edit the configuration file works `platformio.ini` according to their own development board model, delete the other development board environments. 21 | 22 | ![](assets/../../../assets/pio_ini_cfg.png) 23 | 24 | Configuration example 25 | ```ini 26 | [env:sipeed-longan-nano] 27 | platform = gd32v ;Platform, choose gd32v 28 | framework = arduino ;Optional gd32vf103-sdk or arduino 29 | board = sipeed-longan-nano ; Development board 30 | monitor_speed = 115200 ; Serial monitor baudrate 31 | upload_protocol = serial ; Download tool Default serial port, optional jlink, gd-link, dfu, etc. 32 | debug_tool = jlink ; Debugging tool default jlink, optional sipeed-rv-debugger, etc. 33 | ``` 34 | PIO can implement setting macro definitions in the configuration file, control custom functions such as compilation process, etc. For advanced usage, please refer to [PIO official documentation](https://docs.platformio.org/en/latest/projectconf.html). 35 | 36 | ## One-click compilation 37 | 38 | Click on the lower left corner `Build` to build the project 39 | ![](../../assets/pio_complie.png) 40 | 41 | ## Connect to the development board 42 | ### Serial ISP download 43 | * Prepare the USB to serial downloader 44 | * Connect development board and downloader 45 | * Modify the `platformio.ini` file and add the following line: 46 | ```ini 47 | upload_protocol = serial 48 | ``` 49 | * Development board hold down the `BOOT` key, then press the `RESET` button to restart development board and then release the `BOOT` button to enter download mode development board. 50 | 51 | ### JTAG download 52 | * Prepare J-link or Sipeed RV Debugger 53 | * Connection development board 54 | * Modify the `platformio.ini` file, add the following line: 55 | ```ini 56 | upload_protocol = jlink 57 | ``` 58 | or 59 | ```ini 60 | upload_protocol = sipeed-rv-debugger 61 | ``` 62 | 63 | ### USB DFU download 64 | * If using it for the first time then you need to install libusb driver, please refer to this guide [using Zaidig install the driver](#install-drivers-using-zadig). 65 | * Prepare the USB Type-C cable 66 | * Use a data cable to connect development board to your computer. 67 | * Modify the `platformio.ini` file, add the following line: 68 | ```ini 69 | upload_protocol = dfu 70 | ``` 71 | * Development board hold down the `BOOT` key, then press the `RESET` button to restart development board and then release the `BOOT` button to enter DFU mode. 72 | 73 | 74 | ## One click download 75 | 76 | After selecting the download method according to the above steps, you can use the PIO built-in tool to download it with one click. 77 | 78 | Click on the lower left corner `Upload` to upload the program to the development board. 79 | 80 | ![](../../assets/pio_upload.png) 81 | 82 | ## Install drivers using Zadig 83 | PIO has a built-in dfu-util download tool. To use this tool, you need to install the libusb driver for the development board. (Note: different from GD official driver) 84 | 85 | It is recommended to install the winusb driver via Zadig. [download link](https://github.com/pbatard/libwdi/releases/download/b721/zadig-2.4.exe) 86 | 87 | Open Zadig after successful download 88 | 89 | Select GD32V in the drop-down bar, replace the driver with WinUSB, click the Replace button, and the replacement will succeed. 90 | 91 | ![](../../assets/dfu_zadig.png) 92 | 93 | ### USB DFU download 94 | Download the DFU tool:http://dl.sipeed.com/LONGAN/Nano/Tools/GD32_MCU_Dfu_Tool_V3.8.1.5784_1.rar 95 | 96 | Unzip two folders: 97 | 98 | GD32 MCU Dfu Drivers_v1.0.1.2316 and GD32 MCU Dfu Tool_v3.8.1.5784 99 | 100 | First enter the driver folder, install the corresponding driver file, pay attention to run with administrator privileges 101 | 102 | ![](../../assets/examples/how_to_install_dfu.png) 103 | 104 | Run GD32 MCU Dfu Tool.exe Insert Longan Nano into the computer, press and hold the Boot0 key, short press the Reset key, then release the Boot0 key, you can see that the GD32VF chip is recognized in the DFU tool. 105 | 106 | Select the corresponding firmware file, and check the checksum after burning. Click OK to burn. 107 | 108 | After the burning is completed, it will not be reset automatically. You need to manually press the reset button to check the running effect. 109 | 110 | ![](../../assets/examples/how_to_use_dfu.png) 111 | -------------------------------------------------------------------------------- /en/get_started/debug.md: -------------------------------------------------------------------------------- 1 | Debugging Longan Nano 2 | ====== 3 | 4 | ## Connect the debugger 5 | | Development board | Debugger | 6 | | :----: | :----: | 7 | | JTDO | TDO | 8 | | JTDI | TDI | 9 | | JTCK | TCK | 10 | | JTMS | TMS | 11 | | 3V3 | 3V3 | 12 | | GND | GND | 13 | 14 | ## Modify the configuration file 15 | Modify the project configuration file `platformio.ini`, add below 16 | 17 | ```ini 18 | debug_tool = jlink 19 | ``` 20 | 21 | Select according to the actual debugger model. List of currently supported debuggers 22 | 23 | * `jlink` 24 | * `gd-link` 25 | * `ft2232` 26 | * `sipeed-rv-debugger` 27 | * `altera-usb-blaster` 28 | * `um232h` 29 | * `RV-Link` 30 | 31 | ## One-click debugging 32 | 33 | VSCode switch to the left side of the `DEBUG` screen, click the green arrow to debug. 34 | 35 | ![](../../../assets/pio_debug_longan.png). -------------------------------------------------------------------------------- /en/get_started/pio.md: -------------------------------------------------------------------------------- 1 | PIO configuration 2 | ===== 3 | 4 | ## Install VSCode 5 | VS CODE is a more common development tool. Go to the VSCode official website and download and install the installation package for the corresponding operating system version. 6 | 7 | ## Install the PIO plugin 8 | Open VSCode -> click on the left extension -> search for PlatformIO -> click install plugin -> wait for the installation to complete -> restart VSCODE 9 | 10 | ![](http://blog.sipeed.com/wp-content/uploads/2019/04/0d501a8515a735fba54e2f5de908cd1e.png) 11 | 12 | ## Install the GD32V platform definition 13 | 14 | PIO currently offers both **command line** and **graphical interface** installation. The following will introduce: 15 | (PS: Recommended command line, because you can see the download progress bar.) 16 | 17 | ### Command line 18 | 19 | Click the PlatformIO logo on the left -> click New Terminal at the bottom left -> execute the following installation command in the terminal window 20 | 21 | * Release version (stable version) 22 | ``` 23 | platformio platform install gd32v 24 | ``` 25 | 26 | * Development version (synchronized with Github) 27 | ``` 28 | platformio platform install https://github.com/sipeed/platform-gd32v 29 | ``` 30 | ![](../../assets/pio_install_gd32v.png) 31 | 32 | Note: Due to the domestic network environment, the installation process takes a long time, please be patient. 33 | 34 | 35 | ### Graphical interface 36 | 37 | Open VS CODE -> click on the PIO icon on the left -> click on the Open option at the bottom left -> click on the Platforms page -> click on Advanced Installation to open the add window 38 | ![](../../assets/pio_install_add_gd32v_step1.png) 39 | 40 | Enter the following URL in the window that opens 41 | ``` 42 | https://github.com/sipeed/platform-gd32v.git 43 | ``` 44 | 45 | Click Install to add it. 46 | 47 | ![](../../assets/pio_install_add_gd32v_step2.png) 48 | 49 | Wait patiently to install successfully. (The installation failure is mostly for network reasons, please try again after replacing the network environment) 50 | 51 | ![](../../assets/pio_install_add_gd32v_step3.png) 52 | -------------------------------------------------------------------------------- /en/get_started/rv-link.md: -------------------------------------------------------------------------------- 1 | Using RV-LINK 2 | ========= 3 | 4 | ## What is RV-LINK 5 | 6 | **RV-LINK** is a simulation-based firmware development board RISC-V, by programming **RV-LINK** firmware can be **Sipeed Longan Nano** development board into a jtagdebugger for debugging another piece Longan or other development support jtag debugging board. RV-LINK project address: [https://gitee.com/zoomdy/RV-LINK](https://gitee.com/zoomdy/RV-LINK) 7 | 8 | ## Burn RV-LINK firmware 9 | 10 | ### Using the PlatformIO project to burn a key 11 | * Download RV-LINK source code 12 | 13 | Project source code download address: [http://dl.sipeed.com/LONGAN/Nano/Tools/RV-LINK-pio-src-v0.1.zip](http://dl.sipeed.com/LONGAN/Nano/Tools/RV-LINK-pio-src-v0.1.zip) 14 | 15 | It can also be downloaded from the official RV-LINK project: [https://gitee.com/zoomdy/RV-LINK](https://gitee.com/zoomdy/RV-LINK) 16 | 17 | * Open the project directory with VSCODE 18 | 19 | Extract the source code downloaded above into a separate folder and open the source folder using VSCODE 20 | 21 | As shown below: 22 | ![](../../assets/pio_open_rvlink.png) 23 | 24 | The firmware is usually burned using the DFU method, and the configuration file **does not need to be** modified. 25 | 26 | If you need to change the programming mode, you can modify `platformio.ini` to modify the file, please refer to the specific configuration:[modify the project configuration file](blink.md/#project-configuration-file) 27 | 28 | * Burn firmware with PIO 29 | 30 | After connecting the development board, after the development board enters the burning mode, click the arrow symbol in the lower left corner to burn. 31 | 32 | After the programming is successful, you can see the green light flashing on the development board. After connecting the development board to the USB port of the computer, you can see that there is one more serial device in the device manager. At this point the Longan board successfully became the RV-LINK debugger. 33 | 34 | ### Other burning methods 35 | 36 | Reference Document: [Turning the Longan Nano Development Board into a RISC-V Emulator](https://gitee.com/zoomdy/RV-LINK/wikis/%E5%B0%86%20Longan%20Nano%20%E5%BC%80%E5%8F%91%E6%9D%BF%E5%8F%98%E6%88%90%20RISC-V%20%E4%BB%BF%E7%9C%9F%E5%99%A8) 37 | 38 | ## Debugging with RV-LINK 39 | 40 | ### Connecting the development board 41 | 42 | Connect the development board that brushes the RV-LINK firmware to the jtag of the development board to be debugged. 43 | 44 | | RV-LINK | To be debugged development board | 45 | | :----: | :----: | 46 | | JTDO | JTDO | 47 | | JTDI | JTDI | 48 | | JTCK | JTCK | 49 | | JTMS | JTMS | 50 | | 3V3 | 3V3 | 51 | | GND | GND | 52 | 53 | ### Using RV-LINK in the PlatformIO IDE 54 | 55 | RV-LINK in the PlatformIO IDE can support one-button boot debugging just like any other debugger. 56 | 57 | Only in the project `platformio.ini` configuration file, specify the debug options and debug port option. 58 | 59 | Sample code 60 | 61 | ```ini 62 | [env:sipeed-longan-nano] 63 | platform = gd32v 64 | framework = gd32vf103-sdk 65 | board = sipeed-longan-nano 66 | monitor_speed = 115200 67 | upload_protocol = rv-link ; rv-link download option 68 | debug_tool = rv-link ; rv-link debug option 69 | debug_port = COM2 ; Required with rv-link Required debugger serial port 70 | ``` 71 | 72 | ### Using RV-LINK on other platforms 73 | 74 | Reference [RV-LINK WIKI](https://gitee.com/zoomdy/RV-LINK/wikis/) -------------------------------------------------------------------------------- /en/get_started/sipeed-debugger.md: -------------------------------------------------------------------------------- 1 | Using the Sipeed debugger 2 | ===== 3 | 4 | ## Sipeed rv debugger 5 | 6 | 7 | ## Sipeed rv debugger lite 8 | 9 | -------------------------------------------------------------------------------- /en/styles/website.css: -------------------------------------------------------------------------------- 1 | .navigation { 2 | top: 90px; 3 | } 4 | .book-summary nav.autoshow a, 5 | .book-summary nav.autoshow a:hover { 6 | color: inherit; 7 | text-decoration: none; 8 | } 9 | @media (min-width: 800px) { 10 | .book-summary nav.autoshow { 11 | display: none; 12 | } 13 | } 14 | .sipeed-navbar { 15 | overflow: visible; 16 | width: 100%; 17 | min-width: 600px; 18 | z-index: 2; 19 | font-size: 0.85em; 20 | color: #7e888b; 21 | background: #f5f5f5; 22 | display: flex; 23 | position: absolute; 24 | top: 0; 25 | } 26 | .sipeed-navbar::after { 27 | clear: both; 28 | content: '.'; 29 | display: block; 30 | visibility: hidden; 31 | height: 0; 32 | } 33 | .sipeed-navbar a, 34 | .sipeed-navbar a:hover { 35 | color: inherit; 36 | text-decoration: none; 37 | } 38 | .sipeed-navbar ul { 39 | list-style-type: none; 40 | margin: 0; 41 | padding: 0; 42 | width: 100%; 43 | } 44 | .sipeed-navbar ul li { 45 | margin-right: 1px; 46 | position: relative; 47 | float: left; 48 | } 49 | .sipeed-navbar ul li a:hover + .hovershow, 50 | .sipeed-navbar ul li .hovershow:hover, 51 | .sipeed-navbar ul li .hovershow li:hover { 52 | display: block; 53 | } 54 | .sipeed-navbar ul li img { 55 | margin-top: 3px; 56 | } 57 | .sipeed-navbar ul li ul { 58 | margin: -3px 0 0 0; 59 | background: #f5f5f5; 60 | display: none; 61 | width: 100%; 62 | z-index: 999; 63 | position: absolute; 64 | } 65 | .sipeed-navbar ul li ul li { 66 | display: block; 67 | float: none; 68 | } 69 | .sipeed-navbar ul li ul li a { 70 | width: auto; 71 | min-width: 100px; 72 | padding: 0 20px; 73 | } 74 | @media screen and (max-width: 800px) { 75 | .sipeed-navbar ul li { 76 | /*Make dropdown links appear inline*/ 77 | /*Create vertical spacing*/ 78 | /*Make all menu links full width*/ 79 | } 80 | .sipeed-navbar ul li ul { 81 | position: static; 82 | display: none; 83 | } 84 | .sipeed-navbar ul li li { 85 | margin-bottom: 1px; 86 | } 87 | .sipeed-navbar ul li ul li, 88 | .sipeed-navbar ul li li a { 89 | width: 100%; 90 | } 91 | } 92 | .sipeed-navbar .btn { 93 | display: inline-block; 94 | height: 40px; 95 | padding: 0px 15px; 96 | border-bottom: none; 97 | color: #aaa; 98 | text-transform: none; 99 | line-height: 40px; 100 | position: relative; 101 | font-size: 14px; 102 | } 103 | .sipeed-navbar .btn:hover { 104 | position: relative; 105 | text-decoration: none; 106 | color: #444; 107 | background: none; 108 | } 109 | .sipeed-navbar .btn:focus { 110 | outline: none; 111 | } 112 | .sipeed-navbar:hover h1 { 113 | opacity: 1; 114 | } 115 | @media (max-width: 800px) { 116 | .sipeed-navbar { 117 | display: none; 118 | } 119 | } 120 | @media (min-width: 800px) { 121 | .page-wrapper { 122 | padding-top: 40px; 123 | } 124 | } 125 | @media (max-width: 800px) { 126 | .page-wrapper { 127 | /* min-width: 800px; */ 128 | padding-top: 0; 129 | } 130 | } 131 | @media (min-width: 800px) and (max-width: 1000px) { 132 | .sipeed-navbar ul .version-link ul { 133 | margin-left: 20px; 134 | } 135 | .sipeed-navbar .nav { 136 | list-style-type: none; 137 | margin: 0; 138 | padding: 0; 139 | width: 100%; 140 | } 141 | } 142 | @media (max-width: 1240px) { 143 | .book-body .body-inner { 144 | overflow: visible; 145 | } 146 | } 147 | .sipeed-navbar ul .version-link { 148 | float: left; 149 | z-index: 10; 150 | padding-right: 15px; 151 | /* text-align: right; */ 152 | min-width: 180px; 153 | } 154 | .version-link ul li .btn { 155 | padding-right: 35px; 156 | padding-left: 0; 157 | } 158 | .version-link a span { 159 | padding: 0; 160 | } 161 | .book-header { 162 | margin-top: 40px; 163 | } 164 | 165 | .title_pic { 166 | padding-top: 30px; 167 | padding-bottom: 30px; 168 | } 169 | 170 | .markdown-section li code{ 171 | color: #ec5d11; 172 | } 173 | 174 | #anchor-navigation-ex-navbar { 175 | top:100px; 176 | } 177 | 178 | 179 | -------------------------------------------------------------------------------- /en/styles/website.less: -------------------------------------------------------------------------------- 1 | // Header 2 | @header-height: 40px; 3 | @header-color: hsl(194, 5%, 52%); 4 | @header-background: #f5f5f5; 5 | @header-border: rgba(0, 0, 0, 0.07); 6 | @header-button-color: #aaa; 7 | @header-button-hover-color: #444; 8 | @header-button-hover-background: none; 9 | // Font sizes 10 | @font-size-base: 14px; 11 | @font-size-large: ceil(@font-size-base * 1.25); // ~18px 12 | @font-size-small: ceil(@font-size-base * 0.85); // ~12px 13 | @line-height-base: 1.428571429; // 20/14 14 | @line-height-computed: floor(@font-size-base * @line-height-base); 15 | 16 | .navigation { 17 | top: 90px; 18 | } 19 | 20 | .book-summary nav.autoshow { 21 | a, a:hover { 22 | color: inherit; 23 | text-decoration: none; 24 | } 25 | @media (min-width: 800px) { 26 | display: none; 27 | } 28 | } 29 | 30 | .sipeed-navbar { 31 | overflow: visible; 32 | height: @header-height; 33 | padding: 0px 8px; 34 | z-index: 2; 35 | 36 | font-size: 0.85em; 37 | color: @header-color; 38 | background: @header-background; 39 | 40 | display: flex; 41 | 42 | a, a:hover { 43 | color: inherit; 44 | text-decoration: none; 45 | } 46 | 47 | ul { 48 | list-style-type: none; 49 | margin: 0; 50 | padding: 0; 51 | position: absolute; 52 | li { 53 | margin-right: 1px; 54 | position: relative; 55 | float: left; 56 | a:hover + .hovershow, .hovershow:hover, .hovershow li:hover { 57 | display:block; 58 | } 59 | img { 60 | margin-top: 3px; 61 | } 62 | ul { 63 | margin: -3px 0 0 0; 64 | background: #f5f5f5; 65 | display:none; 66 | width: 100%; 67 | z-index:999; 68 | li { 69 | display: block; 70 | float: none; 71 | a { 72 | width: auto; 73 | min-width: 100px; 74 | padding: 0 20px; 75 | 76 | } 77 | } 78 | } 79 | @media screen and (max-width : 800px){ 80 | /*Make dropdown links appear inline*/ 81 | ul { 82 | position: static; 83 | display: none; 84 | } 85 | /*Create vertical spacing*/ 86 | li { 87 | margin-bottom: 1px; 88 | } 89 | /*Make all menu links full width*/ 90 | ul li, li a { 91 | width: 100%; 92 | } 93 | } 94 | } 95 | } 96 | 97 | .btn { 98 | display: inline-block; 99 | height: @header-height; 100 | padding: 0px 15px; 101 | border-bottom: none; 102 | color: @header-button-color; 103 | text-transform: none; 104 | line-height: @header-height; 105 | position:relative; 106 | font-size: @font-size-base; 107 | 108 | &:hover { 109 | position: relative; 110 | text-decoration: none; 111 | color: @header-button-hover-color; 112 | background: @header-button-hover-background; 113 | } 114 | 115 | &:focus { 116 | outline: none; 117 | } 118 | } 119 | 120 | .autohide{ 121 | @media (max-width: 800px) { 122 | display: none; 123 | } 124 | } 125 | 126 | &:hover { 127 | h1 { 128 | opacity: 1; 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Fs = require('fs'); 4 | const Path = require('path'); 5 | const Del = require('del'); 6 | const Globby = require('globby'); 7 | // const spawn = require('child_process').spawn; 8 | // const gulpSequence = require('gulp-sequence'); 9 | const Difference = require('lodash/difference'); 10 | const { exec } = require('child_process'); 11 | 12 | const gulp = require('gulp'); 13 | const program = require('commander'); 14 | program 15 | .option('-o, --only ', 'Only build these files, specrated by ","', x => x.split(',')) 16 | .option('--dest ', 'Copy generated document to specified path.') 17 | .parse(process.argv); 18 | 19 | gulp.task('publish', function (done) { 20 | 21 | var dest = program.dest; 22 | if (!dest) { 23 | return done('dest not supplied'); 24 | } 25 | 26 | var del = Path.join(dest, '*'); 27 | console.log('deleting ' + del); 28 | Del.sync(del, { force: true }); 29 | 30 | console.log('copying _book/**/* to ' + dest); 31 | gulp.src('_book/**/*', { 32 | base: '_book' 33 | }) 34 | .pipe(gulp.dest(dest)) 35 | .on('end', done); 36 | }); 37 | 38 | const FORBID_IGNORE_ARRAY = ['README.md', 'SUMMARY.md']; 39 | const allPagesPattern = ['zh/**/*.md', 'en/**/*.md', '!zh/*.md', '!en/*.md']; 40 | const START_TAG = '\n\n## CC_HIDE_IN_SUMMARY_START'; 41 | const END_TAG = '## CC_HIDE_IN_SUMMARY_END\n'; 42 | const START_TAG_IGNORE = '\n\nCC_IGNORE_START'; 43 | const END_TAG_IGNORE = '\nCC_IGNORE_END'; 44 | const PRUNE_LEFT_BAR_RE = /<[^<>]*>\s*CC_HIDE_IN_SUMMARY_START\s*<\/[^<>]*>(?:\n|\r|.)*<[^<>]*>\s*CC_HIDE_IN_SUMMARY_END\s*<\/[^<>]*>/g; 45 | const PAGE_TITLE_RE = /^\s*(?:\s*)*#*\s*(.*?)\s*\n/; 46 | 47 | function parseListedPages (summaryPath) { 48 | var content = Fs.readFileSync(summaryPath, 'utf8'); 49 | var re = /\[[^\]]*\]\(([^\)]+)\)/g; // should recreate a new RegExp every time this function called 50 | var res = []; 51 | var exec = null; 52 | while ((exec = re.exec(content)) !== null) { 53 | res.push(Path.resolve(Path.dirname(summaryPath), exec[1])); 54 | } 55 | return res; 56 | } 57 | 58 | function getPageTitle (path) { 59 | var content = Fs.readFileSync(path, 'utf8'); 60 | var match = PAGE_TITLE_RE.exec(content); 61 | if (match) { 62 | return match[1]; 63 | } 64 | else { 65 | return Path.parse(path).name; 66 | } 67 | } 68 | 69 | function fillSummary (path) { 70 | var cwd = Path.dirname(path); 71 | // get missing pages 72 | var listedPages = parseListedPages(path); 73 | var allPagesPattern = Path.join(cwd, '*/**/*.md'); 74 | var allPages = Globby.sync(allPagesPattern, { absolute: true }); 75 | var missingPages = Difference(allPages, listedPages); 76 | // fill summary 77 | var content = Fs.readFileSync(path, 'utf8'); 78 | var append = missingPages.map(x => `- [${getPageTitle(x)}](${Path.relative(cwd, x)})`).join('\n'); 79 | content = `${content}${START_TAG}\n\n${append}\n\n${END_TAG}`; 80 | Fs.writeFileSync(path, content, 'utf8'); 81 | } 82 | 83 | // add unlisted pages into SUMMARY.md to allow gitbook to build them 84 | gulp.task('prebuild', ['restore-summary'], function () { 85 | fillSummary('zh/SUMMARY.md'); 86 | fillSummary('en/SUMMARY.md'); 87 | }); 88 | 89 | gulp.task('preview', ['restore-summary', 'restore-ignore'], function (done) { 90 | var includeFiles = program.only; 91 | if (includeFiles) { 92 | quickPreview(includeFiles, (error) => { 93 | if (error) { 94 | return done(error); 95 | } 96 | else { 97 | openServer(done); 98 | } 99 | }); 100 | } 101 | else { 102 | fillSummary('zh/SUMMARY.md'); 103 | fillSummary('en/SUMMARY.md'); 104 | openServer(done); 105 | } 106 | }); 107 | 108 | function restoreSummary (path) { 109 | var re = new RegExp(START_TAG + '(?:\\n|.)*' + END_TAG); 110 | var content = Fs.readFileSync(path, 'utf8'); 111 | content = content.replace(re, ''); 112 | Fs.writeFileSync(path, content, 'utf8'); 113 | } 114 | 115 | function restoreIgnore (path) { 116 | var re = new RegExp(START_TAG_IGNORE + '(?:\\n|.)*' + END_TAG_IGNORE); 117 | var content = Fs.readFileSync(path, 'utf8'); 118 | content = content.replace(re, ''); 119 | Fs.writeFileSync(path, content, 'utf8'); 120 | } 121 | 122 | function openServer (done) { 123 | var server = exec('gitbook serve --no-watch --open'); 124 | server.stderr.on('error', error => { 125 | if(error) { 126 | return done(error); 127 | process.exit(1); 128 | } 129 | }); 130 | server.stdout.on('data', data => { 131 | console.log(data.toString()); 132 | }); 133 | } 134 | 135 | //only build the target file 136 | function quickPreview (includeFiles, done) { 137 | includeFiles = includeFiles.concat(FORBID_IGNORE_ARRAY); 138 | var excludePattern = includeFiles.map(x => '!**/' + Path.basename(x, '.md') + '.md'); 139 | var allIgnorePages = Globby.sync(allPagesPattern.concat(excludePattern), { absolute: true }); 140 | allIgnorePages = allIgnorePages.map(x => '/' + Path.relative(__dirname,x).replace(/\\/g, '/')); 141 | Fs.readFile('.bookignore', 'utf8', function (error, content) { 142 | if (error) { 143 | return done(error); 144 | } 145 | const fileContent = `${content}\n${START_TAG_IGNORE}\n${allIgnorePages.join('\n')}${END_TAG_IGNORE}`; 146 | Fs.writeFile('.bookignore', fileContent, 'utf8', done); 147 | }); 148 | } 149 | 150 | // restore SUMMARY.md to keep repo clean 151 | gulp.task('restore-summary', function () { 152 | restoreSummary('zh/SUMMARY.md'); 153 | restoreSummary('en/SUMMARY.md'); 154 | }); 155 | 156 | gulp.task('restore-ignore', function () { 157 | restoreIgnore('.bookignore'); 158 | }); 159 | 160 | function pruneLeftBar (dir) { 161 | var allPagesPattern = Path.join(dir, '**/*.html'); 162 | var allPages = Globby.sync(allPagesPattern); 163 | for (var i = 0; i < allPages.length; ++i) { 164 | var path = allPages[i]; 165 | var content = Fs.readFileSync(path, 'utf8'); 166 | var result = content.replace(PRUNE_LEFT_BAR_RE, ''); 167 | if (content !== result) { 168 | Fs.writeFileSync(path, result, 'utf8'); 169 | } 170 | else { 171 | throw 'Prune Summary Failed!'; 172 | } 173 | } 174 | } 175 | 176 | // remove added pages from generated index.html 177 | gulp.task('prune-left-bar', function () { 178 | pruneLeftBar('_book/zh'); 179 | pruneLeftBar('_book/en'); 180 | }); 181 | 182 | gulp.task('postbuild', ['restore-summary', 'prune-left-bar']); -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Longan 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /index_zh.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Longan 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Longan-DOC", 3 | "version": "1.0.0", 4 | "description": "This repo is for hosting Longan documents.", 5 | "main": "index.js", 6 | "dependencies": { 7 | "commander": "^2.12.2", 8 | "del": "^3.0.0", 9 | "globby": "^7.1.1", 10 | "gulp": "^3.9.1", 11 | "gulp-sequence": "^0.4.6", 12 | "lodash": "^4.17.4" 13 | }, 14 | "devDependencies": {}, 15 | "scripts": { 16 | "build": "gulp restore-ignore && gulp prebuild && gitbook build && gulp postbuild", 17 | "preview": "gulp preview", 18 | "upload": "gulp publish --dest /Volumes/Longan/manual", 19 | "publish": "npm run build && npm run upload" 20 | }, 21 | "repository": { 22 | "type": "git", 23 | "url": "git+https://github.com/sipeed/Longan-DOC.git" 24 | }, 25 | "author": "", 26 | "license": "ISC", 27 | "bugs": { 28 | "url": "https://github.com/sipeed/Longan-DOC/issues" 29 | }, 30 | "homepage": "https://github.com/sipeed/Longan-DOC" 31 | } 32 | -------------------------------------------------------------------------------- /serve.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | function cancel() 5 | { 6 | sub=`ps -ef|grep "serve_daemon.sh"|grep -v grep|awk '{print $2}'` 7 | if [[ "x$sub" != "x" ]]; then 8 | `ps -ef|grep "serve_daemon.sh"|grep -v grep|awk '{print $2}'|xargs kill -9` 9 | fi 10 | rm -rf serve.tmp 11 | exit 0 12 | } 13 | 14 | trap cancel SIGINT SIGTERM SIGQUIT 15 | 16 | 17 | echo "" > serve.tmp 18 | ./serve_daemon.sh & 19 | gitbook serve | tee serve.tmp 20 | 21 | -------------------------------------------------------------------------------- /serve_daemon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function cp_files(){ 4 | cp -f index.html _book/index.html 5 | cp -f assets/favicon.ico _book/gitbook/images/favicon.ico 6 | cp -f assets/icon_sipeed.png _book/gitbook/images/apple-touch-icon-precomposed-152.png 7 | } 8 | 9 | success_str='Serving book on' 10 | while [ 0 ]; 11 | do 12 | a=`cat serve.tmp |grep "$success_str"` 13 | b=`cat serve.tmp|grep "Error"` 14 | 15 | if [[ "x$a" != "x" ]]; then 16 | cp_files 17 | `echo "">serve.tmp` 18 | elif [[ "x$b" != "x" ]]; then 19 | exit 0 20 | fi 21 | sleep 1s 22 | done 23 | -------------------------------------------------------------------------------- /zh/README.md: -------------------------------------------------------------------------------- 1 | Longan 文档 2 | ====== 3 | 4 |
5 | 6 |
7 | 8 | 9 | 10 | 11 | ## 什么是 Longan 12 | 13 | Longan Nano 是基于兆易创新(GigaDevice)最新基于 RISC-V 32 位内核的`GD32VF103CBT6` 单片机的极简开发板。方便广大学生、工程师、极客爱好者们接触最新一代的RISC-V处理器。了解其特性。 14 | 15 | 主芯片为 GD32VF103CBT6 ,基于[芯来科技](http://www.nucleisys.com/).的Bumblebee内核(指令集文档在此下载:[http://dl.sipeed.com/LONGAN/Nano/DOC/](http://dl.sipeed.com/LONGAN/Nano/DOC/).。支持 `RV32IMAC` 指令集及`ECLIC` 快速中断功能。内核功耗仅传统 `Cortex-M3` 的1/3. 16 | 17 | 芯片内置 `128KB` Flash, `32KB` SRAM,外设情况为: 18 | * 4 x 通用16位定时器 19 | * 2 x 基本16位定时器 20 | * 1 x 高级16位定时器 21 | * 看门狗定时器 22 | * RTC 23 | * Systick 24 | * 3 x USART 25 | * 2 x I2C 26 | * 3 x SPI 27 | * 2 x I2S 28 | * 2 x CAN 29 | * 1 x USBFS(OTG) 30 | * 2 x ADC(10 channel) 31 | * 2 x DAC 32 | 33 | Longan Nano 开发板,双列插针版型设计,排针间距 700mil,可直插面包板;板载 8M 无源晶振,32.768KHz RTC 低速晶振,迷你 TF 卡槽,并使用最新的 Type-C USB 接口。 34 | 35 | ## 如何开发 36 | 37 | Longan Nano 支持基于 VS CODE 的 PlatformIO IDE 环境下的开发, 支持一键工程配置、编译、下载、调试。安装使用教程见:[PIO 配置](./get_started/pio.md). 38 | 39 | ![pio_debug](../assets/longan_pio_debug.jpg) 40 | 41 | ## 引脚定义 42 | 43 | ![](../assets/longan_nano_pinout_v1.1.0_w5676_h4000_large.png) 44 | -------------------------------------------------------------------------------- /zh/SUMMARY.md: -------------------------------------------------------------------------------- 1 | Summary 2 | ===== 3 | 4 | ## 简介 5 | 6 | - [关于Longan](README.md) 7 | 8 | ## 准备 9 | 10 | - [PIO 配置](get_started/pio.md) 11 | - [Blink闪灯](get_started/blink.md) 12 | - [DEBUG 调试](get_started/debug.md) 13 | - [使用 Sipeed 调试器](get_started/sipeed-debugger.md) 14 | - [使用 RV-LINK](get_started/rv-link.md) 15 | 16 | ## 示例 17 | 18 | - [串口输出](examples/printf.md) 19 | - [播放Badapple](examples/badapple.md) 20 | -------------------------------------------------------------------------------- /zh/_layouts/website/header.html: -------------------------------------------------------------------------------- 1 | {% extends template.self %} 2 | {% block book_header %} 3 | 37 | 47 | {% endblock %} -------------------------------------------------------------------------------- /zh/_layouts/website/page.html: -------------------------------------------------------------------------------- 1 | {% extends template.self %} 2 | {% block book_sidebar %} 3 | 37 | {{ super() }} 38 | {% endblock %} 39 | {% block javascript %} 40 | {{ super() }} 41 | 54 | {% endblock %} -------------------------------------------------------------------------------- /zh/book.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Longan 文档", 3 | "description": "Longan 文档", 4 | "language" : "zh-hans", 5 | "structure": { 6 | "summary": "SUMMARY.md", 7 | "readme": "README.md" 8 | }, 9 | "variables": { 10 | "items": [ 11 | { 12 | "name": "博客", 13 | "link": "http://blog.sipeed.com" 14 | }, 15 | { 16 | "name": "论坛", 17 | "link": "https://bbs.sipeed.com/" 18 | }, 19 | { 20 | "name": "反馈", 21 | "links": [ 22 | { 23 | "name": "文档", 24 | "link": "https://github.com/sipeed/Longan-DOC/issues" 25 | }, 26 | { 27 | "name": "源码", 28 | "link": "https://github.com/sipeed/platform-gd32v/issues" 29 | } 30 | ] 31 | } 32 | ], 33 | "version": [ 34 | { 35 | "name": "", 36 | "links": [ 37 | { 38 | "name": "master", 39 | "link": "/zh/" 40 | }, 41 | { 42 | "name": "dev", 43 | "link": "/dev/zh/" 44 | } 45 | ] 46 | } 47 | ] 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zh/examples/badapple.md: -------------------------------------------------------------------------------- 1 | Bad Apple 演示视频 2 | ================== 3 | 4 | 本文目的是使用板载的 160*80 分辨率的 OLED 屏幕播放 bad apple 视频 5 | 6 | ## 主要工作介绍 7 | 8 | + 移植 OLED 屏幕的驱动 9 | + 移植 tf 卡驱动和 fatfs 文件系统 10 | + 将视频按自己需要的帧率转换为一帧帧的图片然后打包到 tf 卡 11 | + 在 gd32v 上读取 tf 卡中的图片并进行显示 12 | 13 | ### 屏幕驱动 14 | 15 | 使用硬件 SPI 驱动屏幕,首先需要初始化 SPI 16 | 17 | ```c 18 | void spi_config(void) 19 | { 20 | spi_parameter_struct spi_init_struct; 21 | /* deinitilize SPI and the parameters */ 22 | OLED_CS_Set(); 23 | spi_struct_para_init(&spi_init_struct); 24 | 25 | /* SPI0 parameter config */ 26 | spi_init_struct.trans_mode = SPI_TRANSMODE_FULLDUPLEX; 27 | spi_init_struct.device_mode = SPI_MASTER; 28 | spi_init_struct.frame_size = SPI_FRAMESIZE_8BIT; 29 | spi_init_struct.clock_polarity_phase = SPI_CK_PL_HIGH_PH_2EDGE; 30 | spi_init_struct.nss = SPI_NSS_SOFT; 31 | spi_init_struct.prescale = SPI_PSC_8; 32 | spi_init_struct.endian = SPI_ENDIAN_MSB; 33 | spi_init(SPI0, &spi_init_struct); 34 | 35 | spi_crc_polynomial_set(SPI0,7); 36 | spi_enable(SPI0); 37 | } 38 | ``` 39 | 40 | 初始化完成后就可以实现数据指令的发送 41 | 42 | ```c 43 | void LCD_Writ_Bus(u8 dat) 44 | { 45 | OLED_CS_Clr(); 46 | 47 | while(RESET == spi_i2s_flag_get(SPI0, SPI_FLAG_TBE)); 48 | spi_i2s_data_transmit(SPI0, dat); 49 | while(RESET == spi_i2s_flag_get(SPI0, SPI_FLAG_RBNE)); 50 | spi_i2s_data_receive(SPI0); 51 | 52 | OLED_CS_Set(); 53 | } 54 | 55 | void LCD_WR_DATA8(u8 dat) 56 | { 57 | OLED_DC_Set();//写数据 58 | LCD_Writ_Bus(dat); 59 | } 60 | 61 | void LCD_WR_DATA(u16 dat) 62 | { 63 | OLED_DC_Set();//写数据 64 | LCD_Writ_Bus(dat>>8); 65 | LCD_Writ_Bus(dat); 66 | } 67 | 68 | void LCD_WR_REG(u8 dat) 69 | { 70 | OLED_DC_Clr();//写命令 71 | LCD_Writ_Bus(dat); 72 | } 73 | ``` 74 | 75 | `LCD_Writ_Bus` 完成了 SPI 的收发,通过控制命令数据线,完成命令和数据的发送 76 | 77 | OLED 屏幕在使用前还需要设置它的一些参数,比如屏幕开启、数据帧的格式等等,这些在参数在屏幕初始化的时候,通过写命令再写数据的方式写入。想修改这些参数需要依靠屏幕配套的数据手册,不过一般可以参数屏幕生产商提供的例程中的参数。 78 | 79 | ### tf 卡驱动和 fatfs 文件系统 80 | 81 | tf 卡在 longan 上也是使用 SPI 驱动的。为了更快的访问速率,也是使用硬件 SPI 驱动。使用前也需要初始化,方式和屏幕的 SPI 初始化类似,就不再累述。 82 | 83 | fatfs 是一个专为小型嵌入式设备设计的文件系统。fatfs 符合 ANSI C(C89)规范,并且和磁盘 I/O 层完全分离。 84 | 85 | 具体的移植也很简单,直接参照 fatfs 提供的 stm32 的工程移植进行 86 | 87 | 这里提供该工程的[下载地址](http://dl.sipeed.com/LONGAN/Nano/Firmware/badapple_demo_tools/ffsample.7z),完整版可以去 fatfs 的[官网下载](http://elm-chan.org/fsw/ff/ffsample.zip) 88 | 89 | 主要的工作在于实现 fatfs 的几个基本函数 `disk_initialize` `disk_status` `disk_read` `disk_ioctl` 90 | 91 | 这些函数又是基于 SPI 通信的,还需要修改 SPI 接收发送的实现 92 | 93 | ```c 94 | static 95 | BYTE xchg_spi ( 96 | BYTE dat /* Data to send */ 97 | ) 98 | { 99 | while(RESET == spi_i2s_flag_get(SPI1, SPI_FLAG_TBE)); 100 | spi_i2s_data_transmit(SPI1, dat); 101 | while(RESET == spi_i2s_flag_get(SPI1, SPI_FLAG_RBNE)); 102 | return(spi_i2s_data_receive(SPI1)); /* Return received byte */ 103 | } 104 | 105 | static 106 | void rcvr_spi_multi ( 107 | BYTE *buff, /* Pointer to data buffer */ 108 | UINT btr /* Number of bytes to receive (even number) */ 109 | ) 110 | { 111 | do 112 | { 113 | *buff = xchg_spi(0xff); 114 | buff++; 115 | } while (btr--); 116 | 117 | } 118 | ``` 119 | 120 | ### 视频预解码 121 | 122 | mp4 格式的视频,单片机因为没有硬件的加速,无法胜任解码播放的工作,所以只能靠手工预解码,相当于按照一定的帧率对原视频进行截图 123 | 124 | 这里需要使用到 PotPlayer XnViewMP 125 | 126 | 首先使用 PotPlayer 打开视频,快捷键 ctrl+G 打开连续截图 127 | 128 | 打开后如图 129 | 130 | ![](../../assets/examples/potplayer.png) 131 | 132 | 其中格式一定要 BMP,尺寸按照屏幕的尺寸设置,时间我这里设置的是 100ms 也就是 1s 十帧的样子,采集数量就自己计算一下视频总时间再乘每秒帧数,我这里就是 219s * 10 = 2190 133 | 134 | 最后得到的图片是 32位 的 BMP,转换起来不方便,就用 XnViewMP 转换为 24位 的 BMP 135 | 136 | 打开 XnViewMP ,选择要转换的图片,快捷键 ctrl+U 打开批量转换,在动作中选择 24位 进行转换,如图 137 | 138 | ![](../../assets/examples/XnViewMP.png) 139 | 140 | 然后就是将这些图片打包到 tf 卡,这里为了方便,修改了网上的一个开源项目 [bmp2hex](https://github.com/robertgallup/bmp2hex),重新整理了一个工具,可以[点击下载](http://dl.sipeed.com/LONGAN/Nano/Firmware/badapple_demo_tools/tools_bmp2hex.zip) 141 | 142 | 使用方法很简单,把下载的这个压缩包放到之前生成的图片集中,进行解压 143 | 144 | 使用工具前需要确保所有图片的名字是 数字.bmp ,不是的话可以先运行一遍 rename.py 这个脚本,直接在命令行输入 `python rename.py` 即可 145 | 146 | 根据自己图片总数修改 genhex.py 这个脚本的第4行中的数字,比如我有 2190张 图片,这里的数字就写 2190 147 | 148 | 然后就运行这个脚本,在命令行输入 `python genhex.py`,时间可能比较久,需要耐心等待 149 | 150 | 最后运行完毕后会生成一个 bmp.bin 文件,将这个文件放入到 tf 卡中即可 151 | 152 | ### 读取图片 153 | 154 | 最后的读取图片并显示其实很简单了,主要涉及到的就是文件操作,关于 fatfs 的 API [可以点击这里阅读](http://elm-chan.org/fsw/ff/doc/open.html) 155 | 156 | 首先需要将 tf 卡挂载到文件系统,这里需要使用到 f_mount 这个函数 157 | 158 | ```c 159 | fr = f_mount(&fs, "", 1); 160 | ``` 161 | 162 | 挂载上后,就找到对应的文件然后打开,这里涉及到 f_open 163 | 164 | ```c 165 | fr = f_open(&fil, "bmp.bin", FA_READ); 166 | ``` 167 | 168 | 文件打开后,就可以读取图片信息并显示了,这里 160*80 尺寸的 16位真彩图片,一张有 25600 字节,longan 上的处理器无法直接创建一个这么大的数组,所以只能分两次进行读取,每次读取完进行一次偏移,最后通过循环读取总共的 2189 张图片,这里涉及到 f_read f_lseek 169 | 170 | ```c 171 | for (int i=0; i<2189;i++) 172 | { 173 | fr = f_read(&fil, image, sizeof(image), &br); 174 | LCD_ShowPicture(0,0,159,39); 175 | offset += 12800; 176 | f_lseek(&fil, offset); 177 | LEDB_TOG; 178 | fr = f_read(&fil, image, sizeof(image), &br); 179 | LCD_ShowPicture(0,40,159,79); 180 | offset += 12800; 181 | f_lseek(&fil, offset); 182 | LEDB_TOG; 183 | } 184 | ``` 185 | 186 | 最后,本工程可以到 github 下载体验,[点击进行传送](https://github.com/sipeed/Longan_GD32VF_examples) 187 | -------------------------------------------------------------------------------- /zh/examples/printf.md: -------------------------------------------------------------------------------- 1 | 串口打印 2 | ========== 3 | 4 | 很多时候,串口打印都是一个非常方便的调试手段,通过串口打印的信息,可以方便的定位程序错误位置 5 | 6 | 本文基于 longan nano 演示如何实现 printf 通过串口打印 7 | 8 | 本文选择串口0作为串口打印信息的端口,外设使用前,自然需要进行初始化 9 | 10 | ```c 11 | void init_uart0(void) 12 | { 13 | /* enable GPIO clock */ 14 | rcu_periph_clock_enable(RCU_GPIOA); 15 | /* enable USART clock */ 16 | rcu_periph_clock_enable(RCU_USART0); 17 | 18 | /* connect port to USARTx_Tx */ 19 | gpio_init(GPIOA, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_9); 20 | /* connect port to USARTx_Rx */ 21 | gpio_init(GPIOA, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, GPIO_PIN_10); 22 | 23 | /* USART configure */ 24 | usart_deinit(USART0); 25 | usart_baudrate_set(USART0, 115200U); 26 | usart_word_length_set(USART0, USART_WL_8BIT); 27 | usart_stop_bit_set(USART0, USART_STB_1BIT); 28 | usart_parity_config(USART0, USART_PM_NONE); 29 | usart_hardware_flow_rts_config(USART0, USART_RTS_DISABLE); 30 | usart_hardware_flow_cts_config(USART0, USART_CTS_DISABLE); 31 | usart_receive_config(USART0, USART_RECEIVE_ENABLE); 32 | usart_transmit_config(USART0, USART_TRANSMIT_ENABLE); 33 | usart_enable(USART0); 34 | 35 | usart_interrupt_enable(USART0, USART_INT_RBNE); 36 | } 37 | ``` 38 | 39 | 这里首先的开启了端口时钟和串口时钟,在初始化完管脚后,就进行了串口的功能配置 40 | 41 | 我们一般比较关心的就是串口的波特率,这里设置成了 115200 42 | 43 | 然后我们还需要重新实现 _put_char ,将 printf 重映射 44 | 45 | ```c 46 | int _put_char(int ch) 47 | { 48 | usart_data_transmit(USART0, (uint8_t) ch ); 49 | while ( usart_flag_get(USART0, USART_FLAG_TBE)== RESET){ 50 | } 51 | 52 | return ch; 53 | } 54 | ``` 55 | 56 | 这样就可以快乐的使用 printf 了 57 | -------------------------------------------------------------------------------- /zh/get_started/blink.md: -------------------------------------------------------------------------------- 1 | Blink 闪灯程序 2 | ===== 3 | 4 | ## 创建 Blink 工程 5 | 6 | * 打开 PIO 主页 选择 `Project Examples` 7 | 8 | ![](http://blog.sipeed.com/wp-content/uploads/2019/04/d977e844490e6ccc4625f701883a29f5.png) 9 | 10 | * 选择 `arduino blink` 点击 `Import` 导入示例程序 (初次导入需要下载架构文件及工具,需要等待较长时间) 11 | ![](http://blog.sipeed.com/wp-content/uploads/2019/04/82943a6b74077e6210e2d9421cb5438f.png) 12 | 13 | * 导入成功后即可见到示例工程 14 | ![](http://blog.sipeed.com/wp-content/uploads/2019/04/1262373ca7b0b483e30dac1124adaabf.png) 15 | 16 | ## 工程配置文件 17 | 18 | 19 | * 我们首先需要编辑工程配置文件 `platformio.ini` 根据自己的开发板型号,删掉其他开发板环境。 20 | 21 | ![](assets/../../../assets/pio_ini_cfg.png) 22 | 23 | 配置示例 24 | ```ini 25 | [env:sipeed-longan-nano] 26 | platform = gd32v ;平台,选择gd32v 27 | framework = arduino ;可选 gd32vf103-sdk 或 arduino 28 | board = sipeed-longan-nano ; 开发板 29 | monitor_speed = 115200 ; 串口监视器波特率 30 | upload_protocol = serial ; 下载工具 默认串口, 可选 dfu、jlink、gd-link 等 31 | debug_tool = jlink ; 调试工具 默认jlink ,可选 sipeed-rv-debugger 等 32 | ``` 33 | PIO 可以在配置文件中实现设置宏定义, 控制编译流程等自定义功能,高级用法请参阅 [PIO 官方文档](https://docs.platformio.org/en/latest/projectconf.html). 34 | 35 | ## 一键编译 36 | 37 | 点击左下角的 `Build` 即可构建项目 38 | ![](../../assets/pio_complie.png) 39 | 40 | ## 连接开发板 41 | ### 串口 ISP 下载 42 | * 准备 USB 转 串口下载器 43 | * 连接开发板与下载器 44 | * 修改 `platformio.ini` 文件, 添加下面一行内容: 45 | ```ini 46 | upload_protocol = serial 47 | ``` 48 | * 开发板按住 `BOOT` 键,再按 `RESET` 键重启开发板后再松开 `BOOT` 键,进入下载模式。 49 | 50 | ### JTAG 下载 51 | * 准备J-link 或 Sipeed RV 调试器 52 | * 连接开发板 53 | * 修改 `platformio.ini` 文件, 添加下面一行内容: 54 | ```ini 55 | upload_protocol = jlink 56 | ``` 57 | 或者 58 | ```ini 59 | upload_protocol = sipeed-rv-debugger 60 | ``` 61 | 62 | ### USB DFU 下载 63 | * **首次** 使用需要安装 libusb 驱动程序, 请参考此步骤 [使用 Zaidig 安装驱动](#使用zadig安装驱动). 64 | * 准备 USB Type-c 数据线 65 | * 使用数据线连接电脑与开发板 66 | * 修改 `platformio.ini` 文件, 添加下面一行内容: 67 | ```ini 68 | upload_protocol = dfu 69 | ``` 70 | * 开发板按住 `BOOT` 键,再按 `RESET` 键重启开发板后再松开 `BOOT` 键,进入 DFU 模式。 71 | 72 | 73 | ## 一键下载 74 | 75 | 按照上面步骤选择好下载方式后,即可使用 PIO 内置工具一键下载。 76 | 77 | 点击左下角的 `Upload` 即可向开发板上传程序。 78 | 79 | ![](../../assets/pio_upload.png) 80 | 81 | ## 使用Zadig安装驱动 82 | PIO 内置 dfu-util 下载工具,使用此工具需要为开发板安装 libusb 驱动。(注意: 与 GD 官方驱动不同) 83 | 84 | 建议通过 Zadig 安装 winusb 驱动。[下载地址](https://github.com/pbatard/libwdi/releases/download/b721/zadig-2.4.exe) 85 | 86 | 下载成功后打开 Zadig 87 | 88 | 在下拉栏中选择 GD32V, 替换驱动选择 WinUSB, 点击替换按钮,即可替换成功。 89 | ![](../../assets/dfu_zadig.png) 90 | ## DFU 图形界面下载 91 | 92 | 下载DFU工具:http://dl.sipeed.com/LONGAN/Nano/Tools/GD32_MCU_Dfu_Tool_V3.8.1.5784_1.rar 93 | 94 | 解压出两个文件夹: 95 | 96 | GD32 MCU Dfu Drivers_v1.0.1.2316 和 GD32 MCU Dfu Tool_v3.8.1.5784 97 | 98 | 先进入driver文件夹,安装对应的驱动文件,注意使用管理员权限运行 99 | 100 | ![](../../assets/examples/how_to_install_dfu.png) 101 | 102 | 运行 GD32 MCU Dfu Tool.exe 103 | 将 Longan Nano 插到电脑,按住 Boot0 键,短按 Reset 键,再松开 Boot0 键, 104 | 可以看到 DFU 工具中识别到了 GD32VF 芯片 105 | 106 | 选择对应的固件文件,并勾选烧录后校验,点击OK,即可进行烧录 107 | 108 | 烧录完成之后不会自动复位,需要自己手工按下复位按键,查看运行效果 109 | 110 | ![](../../assets/examples/how_to_use_dfu.png) -------------------------------------------------------------------------------- /zh/get_started/debug.md: -------------------------------------------------------------------------------- 1 | Debug 调试 2 | ====== 3 | 4 | ## 连接调试器 5 | | 开发板 | 调试器 | 6 | | :----: | :----: | 7 | | JTDO | TDO | 8 | | JTDI | TDI | 9 | | JTCK | TCK | 10 | | JTMS | TMS | 11 | | 3V3 | 3V3 | 12 | | GND | GND | 13 | 14 | ## 修改配置文件 15 | 修改工程配置文件 `platformio.ini`, 在下面添加 16 | 17 | ```ini 18 | debug_tool = jlink 19 | ``` 20 | 21 | 根据实际调试器型号选择。目前支持的调试器列表 22 | 23 | * `jlink` 24 | * `gd-link` 25 | * `ft2232` 26 | * `sipeed-rv-debugger` 27 | * `altera-usb-blaster` 28 | * `um232h` 29 | * `rv-link` 30 | 31 | ## 一键调试 32 | 33 | 切换到 VS CODE 左侧的 `DEBUG` 界面, 点击绿色箭头即可进行调试。 34 | 35 | ![](../../assets/pio_debug_longan.png). -------------------------------------------------------------------------------- /zh/get_started/pio.md: -------------------------------------------------------------------------------- 1 | PIO 配置 2 | ===== 3 | 4 | ## 安装 VS-CODE 5 | VS CODE 是一款比较常用的开发工具。前往[VScode官网](https://code.visualstudio.com/ "VScode官网"),下载安装对应操作系统版本的安装包即可。 6 | 7 | ## 安装 PIO 插件 8 | 打开 VSCode -> 点击左侧扩展 -> 搜索 PlatformIO -> 点击安装插件 -> 等待安装完成 -> 重启 VSCODE 9 | 10 | ![](http://blog.sipeed.com/wp-content/uploads/2019/04/0d501a8515a735fba54e2f5de908cd1e.png) 11 | 12 | ## 安装 GD32V 平台定义 13 | 14 | PIO 目前提供**命令行**与**图形界面**两种方式来安装。下面将分别介绍: 15 | (PS : 推荐命令行,因为能看到下载进度条。) 16 | 17 | ### 命令行 18 | 19 | 点击左侧PIO标志 -> 点击左下方的新建终端 -> 在终端窗口中执行下面的安装指令 20 | 21 | * 发布版 (稳定版本) 22 | ``` 23 | platformio platform install gd32v 24 | ``` 25 | 26 | * 开发版(与Github同步) 27 | ``` 28 | platformio platform install https://github.com/sipeed/platform-gd32v 29 | ``` 30 | ![](../../assets/pio_install_gd32v.png) 31 | 32 | 注:受国内网络环境影响,安装过程需要较长时间,请耐心等待。 33 | 34 | 35 | ### 图形界面 36 | 37 | 打开VS CODE -> 点击左侧 PIO 图标 -> 点击左下方的 Open 选项 -> 点击 Platforms 页面 -> 点击 Advanced Installation 打开添加窗口 38 | ![](../../assets/pio_install_add_gd32v_step1.png) 39 | 40 | 在打开的窗口中输入下面的网址 41 | ``` 42 | https://github.com/sipeed/platform-gd32v.git 43 | ``` 44 | 45 | 点击 Install 即可添加完成。 46 | 47 | ![](../../assets/pio_install_add_gd32v_step2.png) 48 | 49 | 耐心等待即可安装成功。 (安装失败多为网络原因, 请更换网络环境后再次尝试) 50 | ![](../../assets/pio_install_add_gd32v_step3.png) 51 | -------------------------------------------------------------------------------- /zh/get_started/rv-link.md: -------------------------------------------------------------------------------- 1 | 使用 RV-LINK 2 | ========= 3 | 4 | ## 什么是 RV-LINK 5 | 6 | **RV-LINK** 是一个基于 RISC-V 开发板的仿真器固件,通过烧写 **RV-LINK** 固件, 可以将 **Sipeed Longan Nano** 开发板变成一个 `jtag` 调试器,用来调试另一块 Longan 或者其他支持 jtag 调试的开发板。 RV-LINK 项目地址: [https://gitee.com/zoomdy/RV-LINK](https://gitee.com/zoomdy/RV-LINK) 7 | 8 | ## 烧写 RV-LINK 固件 9 | 10 | ### 使用 PlatformIO 工程一键烧录 11 | * 下载 RV-LINK 源码 12 | 13 | 项目源码下载地址:[http://dl.sipeed.com/LONGAN/Nano/Tools/RV-LINK-pio-src-v0.1.zip](http://dl.sipeed.com/LONGAN/Nano/Tools/RV-LINK-pio-src-v0.1.zip) 14 | 15 | 也可以从RV-LINK官方项目下载: [https://gitee.com/zoomdy/RV-LINK](https://gitee.com/zoomdy/RV-LINK) 16 | * 使用 VSCODE 打开工程目录 17 | 18 | 将上面下载的源码解压到单独的文件夹 19 | 然后使用 VSCODE 打开源码文件夹 20 | 21 | 如下图所示: 22 | ![](../../assets/pio_open_rvlink.png) 23 | 24 | 通常使用 DFU 方式烧录固件,**不需要**修改配置文件。(使用 DFU 方式下载请安装 libusb 驱动, 参考[使用Zadig安装驱动](blink.md/#使用zadig安装驱动)) 25 | 26 | 如果需要更改烧录方式,可以通过修改 `platformio.ini` 文件来修改, 具体配置方式请参考:[修改工程配置文件](blink.md/#工程配置文件) 27 | 28 | * 使用 PIO 烧录固件 29 | 30 | 连接开发板,使开发板进入烧录模式后,点击左下角的箭头符号即可进行烧录。 31 | 32 | 烧录成功后,可以看到开发板上的绿灯闪烁,将开发板连接到电脑USB口之后,可以在设备管理器中看到多出了一个串口设备。此时 Longan 板子就成功变成了 RV-LINK 调试器。 33 | 34 | ### 其他烧录方式 35 | 36 | 参考文档: [将 Longan Nano 开发板变成 RISC-V 仿真器](https://gitee.com/zoomdy/RV-LINK/wikis/%E5%B0%86%20Longan%20Nano%20%E5%BC%80%E5%8F%91%E6%9D%BF%E5%8F%98%E6%88%90%20RISC-V%20%E4%BB%BF%E7%9C%9F%E5%99%A8) 37 | 38 | ## 使用 RV-LINK 调试 39 | 40 | ### 连接开发板 41 | 42 | 将刷好 RV-LINK 固件的开发板与待调试开发板 jtag 连线按下表连接 43 | 44 | | RV-LINK | 待调试开发板 | 45 | | :----: | :----: | 46 | | JTDO | JTDO | 47 | | JTDI | JTDI | 48 | | JTCK | JTCK | 49 | | JTMS | JTMS | 50 | | 3V3 | 3V3 | 51 | | GND | GND | 52 | 53 | #### WIN7 用户安装 GD 串口驱动 54 | 55 | 见此链接[安装 USB 串口驱动](https://gitee.com/zoomdy/RV-LINK/wikis/GDB%20%E4%BD%BF%E7%94%A8%20RV-LINK%20%E4%BB%BF%E7%9C%9F%E5%99%A8%E8%B0%83%E8%AF%95%20RISC-V%20%E7%A8%8B%E5%BA%8F?sort_id=1667650#%E5%AE%89%E8%A3%85-usb-%E4%B8%B2%E5%8F%A3%E9%A9%B1%E5%8A%A8) 56 | 57 | ### 在 PlatformIO IDE 中使用 RV-LINK 58 | 59 | RV-LINK 在 PlatformIO IDE 可以和其他调试器一样,支持一键启动调试。 60 | 61 | 只需要在工程的 `platformio.ini` 配置文件中,指定调试器选项和调试器端口选项。 62 | 63 | 示例代码 64 | 65 | ```ini 66 | [env:sipeed-longan-nano] 67 | platform = gd32v 68 | framework = gd32vf103-sdk 69 | board = sipeed-longan-nano 70 | monitor_speed = 115200 71 | upload_protocol = rv-link ; rv-link下载选项 72 | debug_tool = rv-link ; rv-link调试选项 73 | debug_port = COM2 ; 使用rv-link 必填此项 调试器串口 74 | ``` 75 | 76 | ### 在其他平台使用 RV-LINK 77 | 78 | 参考 [RV-LINK WIKI](https://gitee.com/zoomdy/RV-LINK/wikis/) -------------------------------------------------------------------------------- /zh/get_started/sipeed-debugger.md: -------------------------------------------------------------------------------- 1 | 使用 Sipeed 调试器 2 | ===== 3 | 4 | ## Sipeed rv debugger 5 | 6 | 7 | ## Sipeed rv debugger lite 8 | 9 | -------------------------------------------------------------------------------- /zh/styles/website.css: -------------------------------------------------------------------------------- 1 | .navigation { 2 | top: 90px; 3 | } 4 | .book-summary nav.autoshow a, 5 | .book-summary nav.autoshow a:hover { 6 | color: inherit; 7 | text-decoration: none; 8 | } 9 | @media (min-width: 800px) { 10 | .book-summary nav.autoshow { 11 | display: none; 12 | } 13 | } 14 | .sipeed-navbar { 15 | overflow: visible; 16 | width: 100%; 17 | min-width: 600px; 18 | z-index: 2; 19 | font-size: 0.85em; 20 | color: #7e888b; 21 | background: #f5f5f5; 22 | display: flex; 23 | position: absolute; 24 | top: 0; 25 | } 26 | .sipeed-navbar::after { 27 | clear: both; 28 | content: '.'; 29 | display: block; 30 | visibility: hidden; 31 | height: 0; 32 | } 33 | .sipeed-navbar a, 34 | .sipeed-navbar a:hover { 35 | color: inherit; 36 | text-decoration: none; 37 | } 38 | .sipeed-navbar ul { 39 | list-style-type: none; 40 | margin: 0; 41 | padding: 0; 42 | width: 100%; 43 | } 44 | .sipeed-navbar ul li { 45 | margin-right: 1px; 46 | position: relative; 47 | float: left; 48 | } 49 | .sipeed-navbar ul li a:hover + .hovershow, 50 | .sipeed-navbar ul li .hovershow:hover, 51 | .sipeed-navbar ul li .hovershow li:hover { 52 | display: block; 53 | } 54 | .sipeed-navbar ul li img { 55 | margin-top: 3px; 56 | } 57 | .sipeed-navbar ul li ul { 58 | margin: -3px 0 0 0; 59 | background: #f5f5f5; 60 | display: none; 61 | width: 100%; 62 | z-index: 999; 63 | position: absolute; 64 | } 65 | .sipeed-navbar ul li ul li { 66 | display: block; 67 | float: none; 68 | } 69 | .sipeed-navbar ul li ul li a { 70 | width: auto; 71 | min-width: 100px; 72 | padding: 0 20px; 73 | } 74 | @media screen and (max-width: 800px) { 75 | .sipeed-navbar ul li { 76 | /*Make dropdown links appear inline*/ 77 | /*Create vertical spacing*/ 78 | /*Make all menu links full width*/ 79 | } 80 | .sipeed-navbar ul li ul { 81 | position: static; 82 | display: none; 83 | } 84 | .sipeed-navbar ul li li { 85 | margin-bottom: 1px; 86 | } 87 | .sipeed-navbar ul li ul li, 88 | .sipeed-navbar ul li li a { 89 | width: 100%; 90 | } 91 | } 92 | .sipeed-navbar .btn { 93 | display: inline-block; 94 | height: 40px; 95 | padding: 0px 15px; 96 | border-bottom: none; 97 | color: #aaa; 98 | text-transform: none; 99 | line-height: 40px; 100 | position: relative; 101 | font-size: 14px; 102 | } 103 | .sipeed-navbar .btn:hover { 104 | position: relative; 105 | text-decoration: none; 106 | color: #444; 107 | background: none; 108 | } 109 | .sipeed-navbar .btn:focus { 110 | outline: none; 111 | } 112 | .sipeed-navbar:hover h1 { 113 | opacity: 1; 114 | } 115 | @media (max-width: 800px) { 116 | .sipeed-navbar { 117 | display: none; 118 | } 119 | } 120 | @media (min-width: 800px) { 121 | .page-wrapper { 122 | padding-top: 40px; 123 | } 124 | } 125 | @media (max-width: 800px) { 126 | .page-wrapper { 127 | /* min-width: 800px; */ 128 | padding-top: 0; 129 | } 130 | } 131 | @media (min-width: 800px) and (max-width: 1000px) { 132 | .sipeed-navbar ul .version-link ul { 133 | margin-left: 20px; 134 | } 135 | .sipeed-navbar .nav { 136 | list-style-type: none; 137 | margin: 0; 138 | padding: 0; 139 | width: 100%; 140 | } 141 | } 142 | @media (max-width: 1240px) { 143 | .book-body .body-inner { 144 | overflow: visible; 145 | } 146 | } 147 | .sipeed-navbar ul .version-link { 148 | float: left; 149 | z-index: 10; 150 | padding-right: 15px; 151 | /* text-align: right; */ 152 | min-width: 180px; 153 | } 154 | .version-link ul li .btn { 155 | padding-right: 35px; 156 | padding-left: 0; 157 | } 158 | .version-link a span { 159 | padding: 0; 160 | } 161 | .book-header { 162 | margin-top: 40px; 163 | } 164 | 165 | .title_pic { 166 | padding-top: 30px; 167 | padding-bottom: 30px; 168 | } 169 | 170 | .markdown-section li code{ 171 | color: #ec5d11; 172 | } 173 | 174 | #anchor-navigation-ex-navbar { 175 | top:100px; 176 | } 177 | 178 | 179 | -------------------------------------------------------------------------------- /zh/styles/website.less: -------------------------------------------------------------------------------- 1 | // Header 2 | @header-height: 40px; 3 | @header-color: hsl(194, 5%, 52%); 4 | @header-background: #f5f5f5; 5 | @header-border: rgba(0, 0, 0, 0.07); 6 | @header-button-color: #aaa; 7 | @header-button-hover-color: #444; 8 | @header-button-hover-background: none; 9 | // Font sizes 10 | @font-size-base: 14px; 11 | @font-size-large: ceil(@font-size-base * 1.25); // ~18px 12 | @font-size-small: ceil(@font-size-base * 0.85); // ~12px 13 | @line-height-base: 1.428571429; // 20/14 14 | @line-height-computed: floor(@font-size-base * @line-height-base); 15 | 16 | .navigation { 17 | top: 90px; 18 | } 19 | 20 | .book-summary nav.autoshow { 21 | a, a:hover { 22 | color: inherit; 23 | text-decoration: none; 24 | } 25 | @media (min-width: 800px) { 26 | display: none; 27 | } 28 | } 29 | 30 | .sipeed-navbar { 31 | overflow: visible; 32 | height: @header-height; 33 | padding: 0px 8px; 34 | z-index: 2; 35 | 36 | font-size: 0.85em; 37 | color: @header-color; 38 | background: @header-background; 39 | 40 | display: flex; 41 | 42 | a, a:hover { 43 | color: inherit; 44 | text-decoration: none; 45 | } 46 | 47 | ul { 48 | list-style-type: none; 49 | margin: 0; 50 | padding: 0; 51 | position: absolute; 52 | li { 53 | margin-right: 1px; 54 | position: relative; 55 | float: left; 56 | a:hover + .hovershow, .hovershow:hover, .hovershow li:hover { 57 | display:block; 58 | } 59 | img { 60 | margin-top: 3px; 61 | } 62 | ul { 63 | margin: -3px 0 0 0; 64 | background: #f5f5f5; 65 | display:none; 66 | width: 100%; 67 | z-index:999; 68 | li { 69 | display: block; 70 | float: none; 71 | a { 72 | width: auto; 73 | min-width: 100px; 74 | padding: 0 20px; 75 | 76 | } 77 | } 78 | } 79 | @media screen and (max-width : 800px){ 80 | /*Make dropdown links appear inline*/ 81 | ul { 82 | position: static; 83 | display: none; 84 | } 85 | /*Create vertical spacing*/ 86 | li { 87 | margin-bottom: 1px; 88 | } 89 | /*Make all menu links full width*/ 90 | ul li, li a { 91 | width: 100%; 92 | } 93 | } 94 | } 95 | } 96 | 97 | .btn { 98 | display: inline-block; 99 | height: @header-height; 100 | padding: 0px 15px; 101 | border-bottom: none; 102 | color: @header-button-color; 103 | text-transform: none; 104 | line-height: @header-height; 105 | position:relative; 106 | font-size: @font-size-base; 107 | 108 | &:hover { 109 | position: relative; 110 | text-decoration: none; 111 | color: @header-button-hover-color; 112 | background: @header-button-hover-background; 113 | } 114 | 115 | &:focus { 116 | outline: none; 117 | } 118 | } 119 | 120 | .autohide{ 121 | @media (max-width: 800px) { 122 | display: none; 123 | } 124 | } 125 | 126 | &:hover { 127 | h1 { 128 | opacity: 1; 129 | } 130 | } 131 | } --------------------------------------------------------------------------------