Skip to content

Commit 43db702

Browse files
committed
Changed and added templates for RISC-V
1 parent 06c776d commit 43db702

Some content is hidden

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

47 files changed

+2081
-6
lines changed

src/Helper/IoTHelper.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,12 @@ export class IoTHelper {
229229
return result;
230230
}
231231

232+
//to Unix
232233
static SetLineEnding(content:string):string
233234
{
234235
//https://github.com/Neoklosch/crlf-helper/
236+
//Unix(LF)
237+
//Windows (CR LF)
235238
//CRLF: /\r\n/g
236239
const re = new RegExp("\r\n", 'g');
237240
//LF: '\n',
@@ -240,6 +243,39 @@ export class IoTHelper {
240243
return content;
241244
}
242245

246+
static SetLineEndingWindows(content:string):string
247+
{
248+
//https://github.com/Neoklosch/crlf-helper/
249+
//Unix(LF)
250+
//Windows (CR LF)
251+
//CRLF: /\r\n/g
252+
const re = new RegExp("\n", 'g');
253+
//LF: '\n',
254+
const value='\r\n';
255+
content=content.replace(re,value);
256+
return content;
257+
}
258+
259+
static SetLineEndingFiles(filesPath:string[], targerEnd:string="windows"/*unix, windows*/):IotResult
260+
{
261+
let result:IotResult;
262+
let lastFile:string|undefined;
263+
try {
264+
filesPath.forEach(path =>{
265+
lastFile=path;
266+
let data:string= fs.readFileSync(path,'utf8');
267+
data=this.SetLineEndingWindows(data);
268+
//save in file
269+
fs.writeFileSync(path, data,undefined);
270+
});
271+
result= new IotResult(StatusResult.Ok, `SetLineEndingFiles OK.`);
272+
} catch (err: any){
273+
result = new IotResult(StatusResult.Error,`ERROR SetLineEndingFiles for file ${lastFile}.`,err);
274+
}
275+
//result
276+
return result;
277+
}
278+
243279
static ShowExplorer(path:string)
244280
{
245281
const fullpath=`explorer ${path}`;

src/Helper/dotnetHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class dotnetHelper {
5858
static GetDotNetTargets(): Map<string,string[]> {
5959
//from https://learn.microsoft.com/en-us/dotnet/standard/frameworks
6060
let dictionary = new Map<string,string[]>();
61-
dictionary.set("8.0",["net8.0",".NET 8 (LTS) (preview for RISC-V)"]);
61+
dictionary.set("8.0",["net8.0",".NET 8 (LTS) ARM32/ARM64/x86, RISC-V (Preview of Jan 15 2024)"]);
6262
dictionary.set("7.0",["net7.0",".NET 7"]);
6363
dictionary.set("6.0",["net6.0",".NET 6 (LTS)"]);
6464
dictionary.set("5.0",["net5.0",".NET 5 (support ended)"]);

src/Templates/IotTemplate.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ export class IotTemplate extends EntityBase<IotTemplateAttribute> {
131131
}
132132
//Not necessary. Time setting
133133
IoTHelper.SetTimeFiles(IoTHelper.GetAllFile(dstPath));
134+
//SetLineEndingWindows
135+
IoTHelper.SetLineEndingFiles([`${dstPath}\\.vscode\\launch.json`,`${dstPath}\\.vscode\\tasks.json`])
134136
//
135137
result= new IotResult(StatusResult.Ok, `Project successfully created!`);
136138
} catch (err: any){
@@ -188,6 +190,8 @@ export class IotTemplate extends EntityBase<IotTemplateAttribute> {
188190
}
189191
//Not necessary. Time setting
190192
IoTHelper.SetTimeFiles(IoTHelper.GetAllFile(`${dstPath}\\.vscode`));
193+
//SetLineEndingWindows
194+
IoTHelper.SetLineEndingFiles([`${dstPath}\\.vscode\\launch.json`,`${dstPath}\\.vscode\\tasks.json`])
191195
//
192196
result= new IotResult(StatusResult.Ok, `Launch and tasks added successfully`);
193197
//launch.id
10.4 KB
Binary file not shown.

templates/system/dotnet-console-coreclr-cross-riscv64/template.fastiot.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#Base Entity
33
id: dotnet-console-coreclr-cross-riscv64 # unique
44
version: "0.1"
5-
releaseDate: "2024-04-11" # YYYY-MM-DD
5+
releaseDate: "2024-04-14" # YYYY-MM-DD
66
author: DevDotNet.ORG
77
emailAuthor: fastiot@devdotnet.org
88
license: MIT
@@ -25,7 +25,7 @@ tags:
2525
#Template
2626
language: C#
2727
typeProj: dotnet # template type is related to processing logic
28-
projName: DotnetConsoleApp # default value shown to the user
28+
projName: DotnetConsoleAppCoreCLRInfo # default value shown to the user
2929
mainFileProj: dotnetapp.csproj # relative path to the project file as in Linux i.e. folder1/dotnetapp.csproj or dotnetapp.csproj
3030
mainFileProjLabel: Visual Studio C# Project
3131
filesToProcess:

templates/system/dotnet-console-coreclr-cross-riscv64/template/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Runtime.InteropServices;
33

4-
namespace dotnet_console_coreclr_cross_riscv64_v1
4+
namespace %{project.dotnet.namespace}
55
{
66
class Program
77
{
10.3 KB
Binary file not shown.
2.89 KB
Loading
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#YAML
2+
#Base Entity
3+
id: dotnet-console-coreclr-native-riscv64 # unique
4+
version: "0.1"
5+
releaseDate: "2024-04-14" # YYYY-MM-DD
6+
author: DevDotNet.ORG
7+
emailAuthor: fastiot@devdotnet.org
8+
license: MIT
9+
label: .NET Console Application Runtime Info for RISC-V (assembly on RISC-V)
10+
detail: Checking native launch in CoreCLR. Debugging is not available, only copying to the device and launching.
11+
description: >
12+
Minimal console application sample.
13+
The application is compiled on the PC.
14+
forVersionExt: 0.4.1
15+
platform: # win32, linux. Only Windows is currently supported
16+
- win32
17+
endDeviceArchitecture: # armv6l, armv7l, aarch64, riscv64, x86_64
18+
- riscv64
19+
dependOnPackages: # Coming in one of the next version
20+
- dotnetruntime-%{dotnetTarget}
21+
- vsdbg
22+
tags:
23+
- console
24+
- dotnet
25+
#Template
26+
language: C#
27+
typeProj: dotnet # template type is related to processing logic
28+
projName: DotnetConsoleAppCoreCLRInfo # default value shown to the user
29+
mainFileProj: dotnetapp.csproj # relative path to the project file as in Linux i.e. folder1/dotnetapp.csproj or dotnetapp.csproj
30+
mainFileProjLabel: Visual Studio C# Project
31+
filesToProcess:
32+
- dotnetapp.csproj # relative path to the file as in Linux
33+
- Program.cs
34+
fileNameReplacement:
35+
- dotnetapp.csproj=%{project.name}.csproj # relative path to the file as in Linux
36+
- .gitignore_=.gitignore

0 commit comments

Comments
 (0)