Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,46 @@ or PLAN B: open `~/.bashrc` file, and attach the command `source ~/.env/env.sh`
### Use Env

Please see: https://github.com/RT-Thread/rt-thread/blob/master/documentation/env/env.md#bsp-configuration-menuconfig

## Usage under Windows

Tested on the following version of PowerShell:

- PSVersion 5.1.22621.963
- PSVersion 5.1.19041.2673

### Install Env

您需要以管理员身份运行 PowerShell 来设置执行。(You need to run PowerShell as an administrator to set up execution.)

在 PowerShell 中执行(Execute the command in PowerShell):

```powershell
wget https://raw.githubusercontent.com/RT-Thread/env/master/install_windows.ps1 -O install_windows.ps1
set-executionpolicy remotesigned
.\install_windows.ps1
```

对于中国大陆用户,请使用以下命令:

```powershell
wget https://gitee.com/RT-Thread-Mirror/env/raw/master/install_windows.ps1 -O install_windows.ps1
set-executionpolicy remotesigned
.\install_windows.ps1 --gitee
```

注意:将其设置为 remotesigned 后,您可以作为普通用户运行 PowerShell。( After setting it to remotesigned, you can run PowerShell as a normal user.)

### Prepare Env

方案 A:每次重启 PowerShell 时,都需要输入命令 `~/.env/env.ps1`,以激活环境变量。(PLAN A: Each time you restart PowerShell, you need to enter the command `~/.env/env.ps1` to activate the environment variable.)

方案 B:打开 `C:\Users\user\Documents\WindowsPowerShell `,新建文件 Microsoft.PowerShell_profile.ps1,然后写入 `~/.env/env.ps1` 内容即可,它将在你重启 PowerShell 时自动执行,无需再执行方案 A 中的命令。(or PLAN B: Open `C:\Users\user\Documents\WindowsPowerShell` and create a new file `Microsoft.PowerShell_profile.ps1`. Then write `~/.env/env.ps1` to the file. It will be executed automatically when you restart PowerShell, without having to execute the command in scenario A.)

如果还需要使 scons 命令有效以及能使用 QEMU,则需要再添加工具链路径和 QEMU 路径。(If you also need the scons command to work and to use QEMU, you need to add the following two commands to add your toolchain path and the QEMU path.)

```
~/.env/env.ps1
$env:RTT_EXEC_PATH="your toolchain path"
$env:path="your QEMU path;$env:path"
```
8 changes: 8 additions & 0 deletions touch_env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ if ($args[0] -eq "--gitee") {
}

$env_dir = "$HOME\.env"

if (Test-Path -Path $env_dir) {
$option = Read-Host ".env directory already exists. Would you like to remove and recreate .env directory? (Y/N) " option
} if (( $option -eq 'Y' ) -or ($option -eq 'y')) {
Get-ChildItem $env_dir -Recurse | Remove-Item -Force -Recurse
rm -r $env_dir
}

if (!(Test-Path -Path $env_dir)) {
echo "creating .env folder!"
$package_url=$DEFAULT_RTT_PACKAGE_URL
Expand Down