在Windows10上安装Linux子系统后,我们需要对Linux子系统进行一系列的配置,让其能够胜任STM32的开发。
首先,Linux子系统默认安装在Winodws系统分区中,为了方便管理,我们需要将其迁移到其他分区中。迁移Linux子系统需要用到LxRunOffline。
a. 安装LxRunOffline
在Github上有LxRunOffline源代码和编译的文件,下载地址:github.com/DDoSolitary… 下载编译好的安装包,进行解压,在软件要目录下运行CMD或者powershell,就可以使用LxRunOffline命令进行操作了。
b. 使用LxRunOffline
查看当前系统中存在的WSL,可以使用.\LxRunOffline.exe list命令。

修改WSL安装路径可以使用.\LxRunOffline.exe move -n Ubuntu-18.04 -d F:\Ubuntu命令,其含义是将名称为Ubuntu-18.04的WSL移动到F分区下的Ubuntu目录下。注意,执行该命令需要Linux子系统处于关闭状态下进行。


a.打开文件/etc/apt/source.list进行编辑,将文件中原有的源地址注释掉,并加入国内阿里云的镜像源地址。
deb mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

安装gcc工具链:sudo pat-get install gcc




在这里我选用Visual Studio Code。
关于如何将固件烧写到STM32芯片上,在这里我直接使用JLink-Windows中提供的FLASH工具完成固件的烧录工作。