Skip to content

Commit 1425aaf

Browse files
Merge branch 'main' into fix-dependabot
2 parents 6e5a5f2 + 0d2f7b4 commit 1425aaf

File tree

81 files changed

+3257
-1292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+3257
-1292
lines changed

NuGet.Config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
<configuration>
33
<packageSources>
44
<add key="NuGet" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
5-
<add key="Azure Artifacts nanoFramework dev" value="https://pkgs.dev.azure.com/nanoframework/feed/_packaging/sandbox/nuget/v3/index.json" protocolVersion="3" />
65
</packageSources>
76
</configuration>

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ To show the details of the ESP32 device connected to COM31.
158158
nanoff --platform esp32 --serialport COM31 --devicedetails
159159
```
160160

161+
Optionally an extra parameter `--checkpsram` can be passed, which forces the detection of PSRAM availability.
162+
161163
### Deploy a managed application to an ESP32 target
162164

163165
To deploy a managed application to an ESP32_PSRAM_REV0 target connected to COM31.
@@ -447,6 +449,50 @@ nanoff --listtargets --platform stm32
447449

448450
If you use the `--listtargets` switch in conjunction with `--preview`, you'll get the list of available firmware packages that are available with experimental or major feature changes.
449451

452+
## Deploy file to device storage
453+
454+
Some devices like ESP32, Orgpal and few others have storage available. Files can be deployed in this storage. You have to use the `filedeployment` parameter pointing on a JSON file to deploy files while flashing the device:
455+
456+
```console
457+
nanoff --target XIAO_ESP32C3 --update --masserase --serialport COM21 --filedeployment C:\path\deploy.json
458+
```
459+
460+
The JSON an optional `SerialPort` in case the port to upload the files must be different than the one to flash the device or not specified in the main command line and a **mandatory** list of `Files` entries. Each entry must contains `DestinationFilePath`, the destination full path file name and `SourceFilePath` to deploy content, otherwise to delete the file, the full path with file name of the source file to be deployed:
461+
462+
```json
463+
{
464+
"serialport":"COM42",
465+
"files": [
466+
{
467+
"DestinationFilePath": "I:\\TestFile.txt",
468+
"SourceFilePath": "C:\\tmp\\NFApp3\\NFApp3\\TestFile.txt"
469+
},
470+
{
471+
"DestinationFilePath": "I:\\NoneFile.txt"
472+
},
473+
{
474+
"DestinationFilePath": "I:\\wilnotexist.txt",
475+
"SourceFilePath": "C:\\WRONGPATH\\TestFile.txt"
476+
}
477+
]
478+
}
479+
```
480+
481+
In the case you just want to deploy the files without any other operation, you can just specify:
482+
483+
```console
484+
nanoff --filedeployment C:\path\deploy.json
485+
```
486+
487+
In that case, the `SerialPort` must be present in the JSON file.
488+
489+
> [!Note]
490+
> If a file already exists in the storage, it will be replaced by the new one.
491+
>
492+
> If a file does not exist and is requested to be deleted, nothing will happen, a warning will be displayed.
493+
>
494+
> If a file can't be uploaded because of a problem, the deployment of the other files will continue and an error will be displayed.
495+
450496
## Clear cache location
451497

452498
If needed one can clear the local cache from the firmware packages that are stored there.
@@ -462,6 +508,12 @@ nanoff --clearcache
462508

463509
The exit codes can be checked in [this source file](https://github.com/nanoframework/nanoFirmwareFlasher/blob/main/nanoFirmwareFlasher.Library/ExitCodes.cs).
464510

511+
## Telemetry
512+
513+
This tool is using anonymous telemetry to help us improve the usage. You can opt out by setting up an environment variable `NANOFRAMEWORK_TELEMETRY_OPTOUT` to 1.
514+
515+
The telemetry information is mainly related to the command line arguments, the firmware versions installed and any issue that can occurs during the code execution.
516+
465517
## Feedback and documentation
466518

467519
To provide feedback, report issues and finding out how to contribute please refer to the [Home repo](https://github.com/nanoframework/Home).

README.zh-cn.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ nanoff --update --target KALUGA_1 --serialport COM31 --clrfile "C:\nf-interprete
138138
nanoff --platform esp32 --serialport COM31 --devicedetails
139139
```
140140

141+
可选地,可以传递额外的参数 `--checkpsram`,它会强制检测PSRAM的可用性。
142+
141143
### 将托管应用程序部署到ESP32设备
142144

143145
将托管应用程序部署到连接到COM31的ESP32_PSRAM_REV0设备上。

azure-pipelines.yml

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,17 @@ jobs:
178178
vmImage: 'windows-latest'
179179

180180
variables:
181-
DOTNET_NOLOGO: true
182-
buildPlatform: 'x64'
183-
buildConfiguration: 'Release'
184-
solution: 'nanoFirmwareFlasher.sln'
185-
run_update_dependents: $[dependencies.Check_Build_Options.outputs['BuildOptions.RUN_UPDATE_DEPENDENTS']]
181+
- group: sign-client-credentials
182+
- name: DOTNET_NOLOGO
183+
value: true
184+
- name: buildPlatform
185+
value: 'x64'
186+
- name: buildConfiguration
187+
value: 'Release'
188+
- name: solution
189+
value: 'nanoFirmwareFlasher.sln'
190+
- name: run_update_dependents
191+
value: $[dependencies.Check_Build_Options.outputs['BuildOptions.RUN_UPDATE_DEPENDENTS']]
186192

187193
steps:
188194

@@ -203,6 +209,11 @@ jobs:
203209

204210
- task: Cache@2
205211
displayName: Cache NuGet packages
212+
condition: >-
213+
and(
214+
succeeded(),
215+
eq(variables['UPDATE_DEPENDENTS'], 'false')
216+
)
206217
inputs:
207218
key: 'nuget | "$(Agent.OS)" | **/packages.lock.json, !bin/**'
208219
restoreKeys: |
@@ -321,6 +332,21 @@ jobs:
321332
eq(variables['UPDATE_DEPENDENTS'], 'false')
322333
)
323334
335+
# Replace the intrument key
336+
- powershell: |
337+
. ./common.ps1
338+
$fileToReplace = "$(System.DefaultWorkingDirectory)/nanoFirmwareFlasher.Tool\appsettings.json"
339+
$sourceString = "INSTRUMENT_KEY"
340+
$instrumentKey = "$(InstrumentKey)"
341+
342+
Find-ReplaceInFile -filePath $fileToReplace -sourceString $sourceString -targetString $instrumentKey
343+
displayName: Replace intrument key
344+
condition: >-
345+
and(
346+
succeeded(),
347+
eq(variables['UPDATE_DEPENDENTS'], 'false')
348+
)
349+
324350
- task: CopyFiles@1
325351
condition: >-
326352
and(
@@ -336,7 +362,7 @@ jobs:
336362
flattenFolders: true
337363

338364
- task: DotNetCoreCLI@2
339-
displayName: Install SignTool tool
365+
displayName: Install Sign Client CLI
340366
condition: >-
341367
and(
342368
succeeded(),
@@ -346,19 +372,21 @@ jobs:
346372
inputs:
347373
command: custom
348374
custom: tool
349-
arguments: install --tool-path . SignClient
375+
arguments: install --tool-path . sign --version 0.9.1-beta.23530.1
350376

351377
- pwsh: |
352-
.\SignClient "Sign" `
353-
--baseDirectory "$(Build.ArtifactStagingDirectory)" `
354-
--input "**/*.nupkg" `
355-
--config "$(Build.Repository.LocalPath)\config\SignClient.json" `
356-
--filelist "$(Build.Repository.LocalPath)\config\filelist.txt" `
357-
--user "$(SignClientUser)" `
358-
--secret '$(SignClientSecret)' `
359-
--name ".NET nanoFramework firmware flasher" `
378+
.\sign code azure-key-vault `
379+
"**/*.nupkg" `
380+
--base-directory "$(Build.ArtifactStagingDirectory)" `
381+
--file-list "$(Build.Repository.LocalPath)\config\filelist.txt" `
360382
--description ".NET nanoFramework firmware flasher" `
361-
--descriptionUrl "https://github.com/$env:Build_Repository_Name"
383+
--description-url "https://github.com/$env:Build_Repository_Name" `
384+
--azure-key-vault-tenant-id "$(SignTenantId)" `
385+
--azure-key-vault-client-id "$(SignClientId)" `
386+
--azure-key-vault-client-secret "$(SignClientSecret)" `
387+
--azure-key-vault-certificate "$(SignKeyVaultCertificate)" `
388+
--azure-key-vault-url "$(SignKeyVaultUrl)" `
389+
--timestamp-url http://timestamp.digicert.com
362390
displayName: Sign packages
363391
continueOnError: true
364392
condition: >-
@@ -388,7 +416,7 @@ jobs:
388416
eq(variables['System.PullRequest.PullRequestId'], ''),
389417
eq(variables['UPDATE_DEPENDENTS'], 'false')
390418
)
391-
displayName: Push nanoff NuGet package to NuGet
419+
displayName: Push nanoff dotnet tool to NuGet
392420
continueOnError: true
393421
inputs:
394422
command: push
@@ -406,7 +434,7 @@ jobs:
406434
eq(variables['System.PullRequest.PullRequestId'], ''),
407435
eq(variables['UPDATE_DEPENDENTS'], 'false')
408436
)
409-
displayName: Push library NuGet package to NuGet
437+
displayName: Push NuGet package with library to NuGet
410438
continueOnError: true
411439
inputs:
412440
command: push
@@ -435,6 +463,7 @@ jobs:
435463
action: create
436464
isDraft: false
437465
addChangeLog: true
466+
changeLogType: issueBased
438467
changeLogLabels: |
439468
[
440469
{ "label" : "Type: bug", "displayName" : "Bugs fixed", "state" : "closed" },
@@ -448,6 +477,7 @@ jobs:
448477
- task: PowerShell@2
449478
condition: >-
450479
or(
480+
eq(variables['System.PullRequest.PullRequestId'], ''),
451481
eq(variables['UPDATE_DEPENDENTS'], 'true'),
452482
eq(variables['run_update_dependents'], 'true')
453483
)

azure-pipelines/update-dependents.ps1

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
44
# 'encoded token' is the Base64 of the string "nfbot:personal-token"
5-
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$env:GH_TOKEN"))))"
5+
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$env:GH_TOKEN")))"
66

77
# init/reset these
88
$commitMessage = ""
@@ -55,21 +55,21 @@ $commitMessage += "`n[version update]`n`n"
5555
# better add this warning line
5656
$commitMessage += "### :warning: This is an automated update. Merge only after all tests pass. :warning:`n"
5757

58-
Write-Debug "Git branch"
59-
60-
# create branch to perform updates
61-
git branch $newBranchName
62-
63-
Write-Debug "Checkout branch"
64-
65-
# checkout branch
66-
git checkout $newBranchName
67-
6858
# check if anything was changed
6959
$repoStatus = "$(git status --short --porcelain)"
7060

7161
if ($repoStatus -ne "")
7262
{
63+
Write-Debug "Git branch"
64+
65+
# create branch to perform updates
66+
git branch $newBranchName
67+
68+
Write-Debug "Checkout branch"
69+
70+
# checkout branch
71+
git checkout $newBranchName
72+
7373
Write-Debug "Add changes"
7474

7575
# commit changes
@@ -114,5 +114,5 @@ if ($repoStatus -ne "")
114114
}
115115
else
116116
{
117-
Write-Host "Nothing udpate at nanoFramework.Tools.FirmwareFlasher."
117+
Write-Host "Nothing udpate at $repoName."
118118
}

common.ps1

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
# Common functions used by the other scripts
3+
4+
function Check-DirectoryExists {
5+
param (
6+
[string]$rootDirectory
7+
)
8+
9+
return Test-Path -Path $rootDirectory -PathType Container
10+
}
11+
12+
function Find-ReplaceInFiles {
13+
param (
14+
[string]$rootDirectory,
15+
[string]$sourceString,
16+
[string]$targetString
17+
)
18+
19+
Get-ChildItem -Recurse -File $rootDirectory | ForEach-Object {
20+
$filePath = $_.FullName
21+
22+
Find-ReplaceInFile -filePath $filePath -sourceString $sourceString -targetString $targetString
23+
}
24+
25+
Write-Host "String replacement completed."
26+
}
27+
28+
function Find-ReplaceInFile {
29+
param (
30+
[string]$filePath,
31+
[string]$sourceString,
32+
[string]$targetString
33+
)
34+
35+
# Get the original encoding of the file
36+
$sr = New-Object System.IO.StreamReader($filePath, $true)
37+
[char[]] $buffer = new-object char[] 3
38+
$sr.Read($buffer, 0, 3)
39+
$originalEncoding = $sr.CurrentEncoding
40+
$sr.Close()
41+
42+
# Making it simple as we only want to preserve UTF8 encoding
43+
if ( $originalEncoding.BodyName -eq "utf-8" ) {
44+
$fileEncoding = "UTF8"
45+
}
46+
else {
47+
$fileEncoding = "ASCII"
48+
}
49+
50+
# Read the content of the file using the original encoding
51+
$content = Get-Content -Path $filePath -Raw -Encoding $fileEncoding
52+
53+
# Perform the replacement
54+
$newContent = $content -replace [regex]::Escape($sourceString), $targetString
55+
56+
if ($content -ne $newContent) {
57+
Write-Host "Replacing in $filePath"
58+
59+
# Save the modified content back to the file using the original encoding
60+
Set-Content -Path $filePath -Value $newContent -Encoding $fileEncoding
61+
}
62+
}

lib/esp32bootloader/bootloader.bin

1.06 KB
Binary file not shown.
-3 KB
Binary file not shown.
0 Bytes
Binary file not shown.
-3 KB
Binary file not shown.

0 commit comments

Comments
 (0)