

在 Windows 环境下使用 VSCode 和 Go 语言开发 STM32
source link: https://discretetom.github.io/posts/windows-vscode-tinygo-stm32/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

在 Windows 环境下使用 VSCode 和 Go 语言开发 STM32
STM32和Arduino相比,要配置的东西多一些
- 安装 Go 语言编译器、TinyGo 编译器、配置 VSCode:参考此文
- 买一个STLink v2
- 需要安装驱动,安装完毕后连接 STLink 和电脑,LED 应该常亮
- 安装 MSYS2,然后安装 OpenOCD
- 需要执行两次
pacman -Syu
- 需要执行两次
我的开发板是 STM32F103 ,对应 TinyGo 里面的 bluepill
根据开发板的文档,开发板上有一个 RGB LED RGB 对应的引脚分别是 PB5 PB0 PB1
package main
import (
"machine"
"time"
)
func main() {
red := machine.PB5
green := machine.PB0
blue := machine.PB1
red.Configure(machine.PinConfig{Mode: machine.PinOutput})
green.Configure(machine.PinConfig{Mode: machine.PinOutput})
blue.Configure(machine.PinConfig{Mode: machine.PinOutput})
red.High()
blue.High()
green.High()
for {
green.High()
red.Low()
time.Sleep(time.Millisecond * 500)
red.High()
blue.Low()
time.Sleep(time.Millisecond * 500)
blue.High()
green.Low()
time.Sleep(time.Millisecond * 500)
}
}
tinygo flash -target=bluepill
Recommend
-
31
因为不花钱的goland毕竟不是正途,所以耗点精力搭建基于vscode的开发环境是有必要的。 跟着本文,你可以得到 docker开发环境 vscode + ssh 远程golang语言服务器
-
35
vscode 内核开发环境配置In DEV By Rapiz 2021-02-03 Linux Linux,内核,开发环境,自动补全,vscode内核模块是用 Makefile 作为编译...
-
6
本文预计阅读时间 11 分钟 vscode安装非常简单,无论是Mac还是Windows,都可以直接在官网下载,然后直接安装。接下来是一些个人日常使用到的配置内容,在此记录,以备后用易找。 1,...
-
6
VSCode 前端开发环境安装及配置 兰玉磊 • 2020年7月9日 00:11 • Web • 阅读 6877开发工具介绍HBuilder
-
4
更新于 2021/12/29 | 创建于 2021/12/24 如何在Linux/MacOS使用vscode构建一个c/c++开发环境 无论您是否是《指环王...
-
9
以下代码使用 Windows Powershell 执行 安装 Scoop # PowerShell must be allowed to execute local scripts for your user account Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser #...
-
6
这两天一直在用PHPstudy+Vscode配置php开发环境,膜拜过许许多多网上师傅的博客,发现方式多样,但是版本不一致,导致了配置存在问题,利用我课间20分钟时间,就这今天我遇见的问题,以及搭建过程进行简要概括!希望对大家有帮助! 首先到官网上自...
-
4
Milton 日常笔记, 仅供个人学习使用 随笔 - 750, 文章 - 0, 评论 - 140,...
-
6
VScode开发STM32/GD32单片机-环境搭建 1、软件下载 1.1、安装
-
8
VsCode搭建C语言运行环境以及终端乱码问题解决 在VsCode中...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK