Skip to content

Commit b6d4b3e

Browse files
authored
Merge branch 'main' into IDF5_4
2 parents 8439fef + 9f60398 commit b6d4b3e

File tree

4 files changed

+73
-39
lines changed

4 files changed

+73
-39
lines changed

azure-pipelines-nightly.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,7 @@ jobs:
301301
steps:
302302
- template: azure-pipelines-templates/build-preparations.yml
303303
- template: azure-pipelines-templates/nb-gitversioning.yml
304-
- template: azure-pipelines-templates/download-install-cmake.yml
305304
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
306-
- template: azure-pipelines-templates/download-install-ninja.yml
307305
- template: azure-pipelines-templates/download-srecord.yml
308306
- template: azure-pipelines-templates/download-hexdfu.yml
309307
- template: azure-pipelines-templates/build-chibios-stm32-targets.yml
@@ -733,9 +731,7 @@ jobs:
733731
steps:
734732
- template: azure-pipelines-templates/build-preparations.yml
735733
- template: azure-pipelines-templates/nb-gitversioning.yml
736-
- template: azure-pipelines-templates/download-install-cmake.yml
737734
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
738-
- template: azure-pipelines-templates/download-install-ninja.yml
739735
- template: azure-pipelines-templates/download-hexdfu.yml
740736
- template: azure-pipelines-templates/download-srecord.yml
741737
- template: azure-pipelines-templates/build-azurertos-targets.yml

azure-pipelines.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,7 @@ jobs:
416416
steps:
417417
- template: azure-pipelines-templates/build-preparations.yml
418418
- template: azure-pipelines-templates/nb-gitversioning.yml
419-
- template: azure-pipelines-templates/download-install-cmake.yml
420419
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
421-
- template: azure-pipelines-templates/download-install-ninja.yml
422420
- template: azure-pipelines-templates/download-srecord.yml
423421
- template: azure-pipelines-templates/download-hexdfu.yml
424422
- template: azure-pipelines-templates/build-chibios-stm32-targets.yml
@@ -628,9 +626,7 @@ jobs:
628626
steps:
629627
- template: azure-pipelines-templates/build-preparations.yml
630628
- template: azure-pipelines-templates/nb-gitversioning.yml
631-
- template: azure-pipelines-templates/download-install-cmake.yml
632629
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
633-
- template: azure-pipelines-templates/download-install-ninja.yml
634630
- template: azure-pipelines-templates/download-srecord.yml
635631
- template: azure-pipelines-templates/build-freertos-nxp-targets.yml
636632
- template: azure-pipelines-templates/pack-publish-artifacts.yml
@@ -779,9 +775,7 @@ jobs:
779775
steps:
780776
- template: azure-pipelines-templates/build-preparations.yml
781777
- template: azure-pipelines-templates/nb-gitversioning.yml
782-
- template: azure-pipelines-templates/download-install-cmake.yml
783778
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
784-
- template: azure-pipelines-templates/download-install-ninja.yml
785779
- template: azure-pipelines-templates/download-hexdfu.yml
786780
- template: azure-pipelines-templates/download-srecord.yml
787781
- template: azure-pipelines-templates/build-azurertos-targets.yml
@@ -855,6 +849,13 @@ jobs:
855849
856850
- template: azure-pipelines-templates/install-nuget.yml@templates
857851

852+
- task: Cache@2
853+
displayName: Cache NuGet packages
854+
continueOnError: true
855+
inputs:
856+
key: 'nuget | **/targets/netcore/nanoFramework.nanoCLR.Host/packages.lock.json | **/targets/netcore/nanoFramework.nanoCLR.CLI/packages.lock.json'
857+
path: $(UserProfile)/.nuget/packages
858+
858859
- task: DotNetCoreCLI@2
859860
displayName: Restore NuGet packages
860861
inputs:
@@ -1078,6 +1079,13 @@ jobs:
10781079

10791080
- template: azure-pipelines-templates/install-nuget.yml@templates
10801081

1082+
- task: Cache@2
1083+
displayName: Cache NuGet packages
1084+
continueOnError: true
1085+
inputs:
1086+
key: 'nuget | **/targets/netcore/nanoFramework.nanoCLR.Host/packages.lock.json | **/targets/netcore/nanoFramework.nanoCLR.CLI/packages.lock.json'
1087+
path: $(UserProfile)/.nuget/packages
1088+
10811089
- task: DotNetCoreCLI@2
10821090
displayName: Restore NuGet packages
10831091
inputs:

src/CLR/Debugger/Debugger.cpp

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -998,12 +998,18 @@ bool CLR_DBG_Debugger::Monitor_WriteMemory(WP_Message *msg)
998998
{
999999
NATIVE_PROFILE_CLR_DEBUGGER();
10001000

1001-
auto *cmd = (CLR_DBG_Commands_Monitor_WriteMemory *)msg->m_payload;
1002-
CLR_DBG_Commands_Monitor_WriteMemory_Reply errorCode = AccessMemoryErrorCode_NoError;
1001+
CLR_DBG_Commands_Monitor_WriteMemory *cmd = (CLR_DBG_Commands_Monitor_WriteMemory *)msg->m_payload;
1002+
CLR_DBG_Commands_Monitor_WriteMemory_Reply cmdReply;
1003+
uint32_t errorCode;
10031004

1005+
// command reply is to be loaded with the error code and sent back to the caller
10041006
g_CLR_DBG_Debugger->AccessMemory(cmd->address, cmd->length, cmd->data, AccessMemory_Write, &errorCode);
10051007

1006-
WP_ReplyToCommand(msg, true, false, &errorCode, sizeof(errorCode));
1008+
// copy over the error code to the command reply
1009+
cmdReply = errorCode;
1010+
1011+
// the execution of this command is always successful, and the reply carries the error code
1012+
WP_ReplyToCommand(msg, true, false, &cmdReply, sizeof(cmdReply));
10071013

10081014
return true;
10091015
}
@@ -1012,13 +1018,17 @@ bool CLR_DBG_Debugger::Monitor_CheckMemory(WP_Message *msg)
10121018
{
10131019
NATIVE_PROFILE_CLR_DEBUGGER();
10141020

1015-
auto *cmd = (CLR_DBG_Commands_Monitor_CheckMemory *)msg->m_payload;
1016-
CLR_DBG_Commands_Monitor_CheckMemory_Reply errorCode = AccessMemoryErrorCode_NoError;
1021+
CLR_DBG_Commands_Monitor_CheckMemory *cmd = (CLR_DBG_Commands_Monitor_CheckMemory *)msg->m_payload;
1022+
CLR_DBG_Commands_Monitor_CheckMemory_Reply cmdReply;
1023+
uint32_t errorCode;
10171024

1025+
// access memory execution will load the command reply with the error code
10181026
g_CLR_DBG_Debugger
1019-
->AccessMemory(cmd->address, cmd->length, (unsigned char *)&errorCode, AccessMemory_Check, &errorCode);
1027+
->AccessMemory(cmd->address, cmd->length, (unsigned char *)&cmdReply, AccessMemory_Check, &errorCode);
10201028

1021-
WP_ReplyToCommand(msg, errorCode == AccessMemoryErrorCode_NoError, false, &errorCode, sizeof(errorCode));
1029+
// the execution of this command will fail if there is an error code, never the less, the error code is returned to
1030+
// the caller
1031+
WP_ReplyToCommand(msg, errorCode == AccessMemoryErrorCode_NoError, false, &cmdReply, sizeof(cmdReply));
10221032

10231033
return true;
10241034
}
@@ -1027,12 +1037,18 @@ bool CLR_DBG_Debugger::Monitor_EraseMemory(WP_Message *msg)
10271037
{
10281038
NATIVE_PROFILE_CLR_DEBUGGER();
10291039

1030-
auto *cmd = (CLR_DBG_Commands_Monitor_EraseMemory *)msg->m_payload;
1031-
CLR_DBG_Commands_Monitor_EraseMemory_Reply errorCode = AccessMemoryErrorCode_NoError;
1040+
CLR_DBG_Commands_Monitor_EraseMemory *cmd = (CLR_DBG_Commands_Monitor_EraseMemory *)msg->m_payload;
1041+
CLR_DBG_Commands_Monitor_EraseMemory_Reply cmdReply;
1042+
uint32_t errorCode;
10321043

1044+
// command reply is to be loaded with the error code and sent back to the caller
10331045
g_CLR_DBG_Debugger->AccessMemory(cmd->address, cmd->length, NULL, AccessMemory_Erase, &errorCode);
10341046

1035-
WP_ReplyToCommand(msg, true, false, &errorCode, sizeof(errorCode));
1047+
// copy over the error code to the command reply
1048+
cmdReply = errorCode;
1049+
1050+
// the execution of this command is always successful, and the reply carries the error code
1051+
WP_ReplyToCommand(msg, true, false, &cmdReply, sizeof(cmdReply));
10361052

10371053
return true;
10381054
}

targets/netcore/nanoFramework.nanoCLR.CLI/ClrInstanceOperationsProcessor.cs

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,38 @@ private static async Task<ExitCode> UpdateNanoCLRAsync(
143143
_httpClient.DefaultRequestHeaders.Add("Accept", "*/*");
144144

145145
string repoName = usePreview ? _refTargetsDevRepo : _refTargetsStableRepo;
146+
List<CloudsmithPackageInfo> packageInfo;
147+
string responseBody;
146148

147-
// get latest version available for download
148-
HttpResponseMessage response = await _httpClient.GetAsync($"{repoName}/?query=name:^WIN_DLL_nanoCLR version:^latest$");
149-
string responseBody = await response.Content.ReadAsStringAsync();
149+
if (string.IsNullOrEmpty(targetVersion))
150+
{
151+
// no specific version requested, get latest version available for download
152+
HttpResponseMessage response = await _httpClient.GetAsync($"{repoName}/?query=name:^WIN_DLL_nanoCLR version:^latest$");
153+
154+
responseBody = await response.Content.ReadAsStringAsync();
150155

151-
if (responseBody == "[]")
156+
if (responseBody == "[]")
157+
{
158+
Console.WriteLine($"Error getting latest available nanoCLR package.");
159+
return ExitCode.E9005;
160+
}
161+
}
162+
else
152163
{
153-
Console.WriteLine($"Error getting latest available nanoCLR package.");
154-
return ExitCode.E9005;
164+
// specific version requested, get details for that version
165+
HttpResponseMessage response = await _httpClient.GetAsync($"{repoName}/?query=name:^WIN_DLL_nanoCLR version:{targetVersion}");
166+
167+
responseBody = await response.Content.ReadAsStringAsync();
168+
169+
if (responseBody == "[]")
170+
{
171+
Console.WriteLine($"Error getting package details for v{targetVersion}.");
172+
return ExitCode.E9005;
173+
}
155174
}
156175

157-
var packageInfo = JsonSerializer.Deserialize<List<CloudsmithPackageInfo>>(responseBody);
176+
// parse the response
177+
packageInfo = JsonSerializer.Deserialize<List<CloudsmithPackageInfo>>(responseBody);
158178

159179
if (packageInfo.Count != 1)
160180
{
@@ -165,18 +185,12 @@ private static async Task<ExitCode> UpdateNanoCLRAsync(
165185
{
166186
Version availableFwVersion = Version.Parse(packageInfo[0].Version);
167187

168-
// only perform version check if preview wasn't requested
169-
if (!usePreview && (availableFwVersion < installedVersion))
170-
{
171-
Console.WriteLine($"Current version {installedVersion} higher than available version {packageInfo[0].Version}");
172-
}
173-
174-
if (usePreview
175-
|| (availableFwVersion > installedVersion)
176-
|| (!string.IsNullOrEmpty(targetVersion)
177-
&& (Version.Parse(targetVersion) > Version.Parse(currentVersion))))
188+
// update if the version is different from the installed one (either the requested target version or the latest available in the repo)
189+
if ((!string.IsNullOrEmpty(targetVersion)
190+
&& (Version.Parse(targetVersion) != installedVersion))
191+
|| (availableFwVersion > installedVersion))
178192
{
179-
response = await _httpClient.GetAsync(packageInfo[0].DownloadUrl);
193+
HttpResponseMessage response = await _httpClient.GetAsync(packageInfo[0].DownloadUrl);
180194
response.EnsureSuccessStatusCode();
181195

182196
// need to unload the DLL before updating it
@@ -194,7 +208,7 @@ private static async Task<ExitCode> UpdateNanoCLRAsync(
194208
}
195209
else
196210
{
197-
Console.WriteLine($"Already at v{packageInfo[0].Version}");
211+
Console.WriteLine($"At v{packageInfo[0].Version}, skipping update");
198212
}
199213

200214
return ExitCode.OK;

0 commit comments

Comments
 (0)