Skip to content

Commit

Permalink
Merge pull request #108 from K-Society/develop
Browse files Browse the repository at this point in the history
Breaking changes:

Removed references:

KSociety.Wmi
Autofac
SetExternalLoaderPath and GetExternalLoaders enhancement.
OpenFile enhancement.
  • Loading branch information
maniglia authored Jan 17, 2024
2 parents bd6b641 + d4d5b9a commit 5971cf4
Show file tree
Hide file tree
Showing 33 changed files with 21,113 additions and 509 deletions.
47 changes: 40 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,38 @@ You can get KSociety.SharpCubeProgrammer by [grabbing the latest NuGet package](

- Register SharpCubeProgrammer as service with Autofac IoC:

Create the module for Autofac in a dedicated file (in this example under the Bindings folder) with the following contents:

```csharp
builder.RegisterModule(new KSociety.SharpCubeProgrammer.Bindings.ProgrammerApi());
namespace MyNamespace.Bindings
{
using Autofac;
using KSociety.SharpCubeProgrammer;
using KSociety.SharpCubeProgrammer.Interface;

public class ProgrammerApi : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<CubeProgrammerApi>().As<ICubeProgrammerApi>().SingleInstance();
}
}
}
```

- Get ST-Link list and connect:
Register the module:

```csharp
var stLinkList = _cubeProgrammerApi.GetStLinkList();
var stLink = (KSociety.SharpCubeProgrammer.Struct.DebugConnectParameters)stLinkList.First().Clone();
var connectionResult = _cubeProgrammerApi.ConnectStLink(stLink);
builder.RegisterModule(new Bindings.ProgrammerApi());
```

- GeneralInfo:
- Connect:

```csharp
var tryConnectionResult = CubeProgrammerApi.TryConnectStLink();
```

- General Info:

```csharp
var generalInfo = _cubeProgrammerApi.GetDeviceGeneralInf();
Expand All @@ -158,11 +177,25 @@ var downloadFile = _cubeProgrammerApi.DownloadFile(firmwarePath, "0x08000000", 1
var execute = _cubeProgrammerApi.Execute("0x08000000");
```

- Send Option Bytes:

```csharp
var sendOptionBytesCmd = CubeProgrammerApi.SendOptionBytesCmd("-ob RDP=170");
```

- Disconnect:

```csharp
CubeProgrammerApi.Disconnect();
```


## License
The project is under Microsoft Reciprocal License [(MS-RL)](http://www.opensource.org/licenses/MS-RL)

## Dependencies

List of technologies, frameworks and libraries used for implementation:

- [KSociety.Wmi](https://github.com/K-Society/KSociety.Wmi) (WMI)
- [Microsoft.Bcl.AsyncInterfaces](https://www.nuget.org/packages/Microsoft.Bcl.AsyncInterfaces)
- [Microsoft.Extensions.Logging.Abstractions](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions)
Binary file added Test/NUCLEO-L452RE.bin
Binary file not shown.
16,449 changes: 16,449 additions & 0 deletions Test/NUCLEO-L452RE.hex

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Test/NUCLEO-WBA52CG.bin

Large diffs are not rendered by default.

Binary file added Test/STM32H750B-DK.bin
Binary file not shown.
4,113 changes: 4,113 additions & 0 deletions Test/STM32H750B-DK.hex

Large diffs are not rendered by default.

46 changes: 39 additions & 7 deletions docs/KSociety.SharpCubeProgrammer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,38 @@ You can get KSociety.SharpCubeProgrammer by [grabbing the latest NuGet package](

- Register SharpCubeProgrammer as service with Autofac IoC:

Create the module for Autofac in a dedicated file (in this example under the Bindings folder) with the following contents:

```csharp
builder.RegisterModule(new KSociety.SharpCubeProgrammer.Bindings.ProgrammerApi());
namespace MyNamespace.Bindings
{
using Autofac;
using KSociety.SharpCubeProgrammer;
using KSociety.SharpCubeProgrammer.Interface;

public class ProgrammerApi : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<CubeProgrammerApi>().As<ICubeProgrammerApi>().SingleInstance();
}
}
}
```

- Get ST-Link list and connect:
Register the module:

```csharp
var stLinkList = _cubeProgrammerApi.GetStLinkList();
var stLink = (KSociety.SharpCubeProgrammer.Struct.DebugConnectParameters)stLinkList.First().Clone();
var connectionResult = _cubeProgrammerApi.ConnectStLink(stLink);
builder.RegisterModule(new Bindings.ProgrammerApi());
```

- GeneralInfo:
- Connect:

```csharp
var tryConnectionResult = CubeProgrammerApi.TryConnectStLink();
```

- General Info:

```csharp
var generalInfo = _cubeProgrammerApi.GetDeviceGeneralInf();
Expand All @@ -157,11 +176,24 @@ var downloadFile = _cubeProgrammerApi.DownloadFile(firmwarePath, "0x08000000", 1
var execute = _cubeProgrammerApi.Execute("0x08000000");
```

- Send Option Bytes:

```csharp
var sendOptionBytesCmd = CubeProgrammerApi.SendOptionBytesCmd("-ob RDP=170");
```

- Disconnect:

```csharp
CubeProgrammerApi.Disconnect();
```

## License
The project is under Microsoft Reciprocal License [(MS-RL)](http://www.opensource.org/licenses/MS-RL)

## Dependencies

List of technologies, frameworks and libraries used for implementation:

- [KSociety.Wmi](https://github.com/K-Society/KSociety.Wmi) (WMI)
- [Microsoft.Bcl.AsyncInterfaces](https://www.nuget.org/packages/Microsoft.Bcl.AsyncInterfaces)
- [Microsoft.Extensions.Logging.Abstractions](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions)
Loading

0 comments on commit 5971cf4

Please sign in to comment.