How to Use BSP Library in a Project? - embedded

I'd like to create a program by which I can record and listen sound by using my board, STM32F746G-Disco. I'd like to use BSP library, however, I have some questions.
When I looked at the stm32746g_discovery_audio.c file, I saw that there are 2 global variables named haudio_out_sai and haudio_in_sai, and there are some functions that configures these sai components. Then do I need to enable and configure SAI components in CubeMX? Because in the documentation of the library, it is said that the functions configure the related components about the audio, but these functions don't take any SAI parameters so I cannot initialize them with the variables that CubeMX defines.

Related

Which component does dynamic linking?

My question is equivalent to: "What exactly is Dynamic Linker? Which part of an OS does it belong to?".
I know that dynamic linking is done by a component called "dynamic linker" which is also a part of an Operating System. I was wodering if this component can be seen as a part of
Linker (the same that does static linking),
Loader,
RunTime Environment (given that dynamic linking is done while program is "running")
or is it completely different component?
I know that dynamic linking is done by a component called "dynamic linker" which is also a part of an Operating System.
The dynamic linker is a part of the OS only on some OSes, namely Windows.
On UNIX, it is not part of the OS, but rather a part of libc, and you could have multiple dynamic linkers on a single system.
The dynamic loader is part of the runtime environment. It closely cooperates with the static linker (which must prepare the data structures used by the loader) and the OS kernel, but is never a "part" of either.

File name convention for C# v10 global using declarations

Is there a consensus within the C# development community on the .cs filename in which global using statements are declared?
I was going to adopt the filename GlobalUsings.cs but then found that a hidden file called MyProject.GlobalUsings.g.cs is created behind the scenes by the VS2022 toolchain. This is to support the related new C# 10 feature called Implicit global using directives.
Blazor has supported a similar feature for .razor files and the Blazor solution template automatically creates a file called _Imports.razor. That name is derived from the Razor syntax to declare a using reference.
Short Answer
Usings.cs or maybe GlobalUsings.cs.
More Info
There are actually 2 new features. They seem really simple at first, but the more you read about it, the more complicated it becomes.
Global using directives. You can use global in front of any using directive in any file to make it global in the project.
Implicit usings. This automatically adds a set of common global using directives depending on the project type. You can enable this in a project that is upgraded to .NET 6 buy putting this in the project csproj file: <PropertyGroup><ImplicitUsings>enable</ImplicitUsings>...
Implicit usings is enabled by default on new .NET 6 projects, so it sounds like the convention is:
Use implicit usings.
You may still need a file to store global usings that are not implicit. I like your idea of GlobalUsings.cs. It's self-documenting.
In fact, this naming is recommended by the Welcome to C# 10 Blog. I highly recommend reading it; it was really helpful to me.
EDIT:
This seems to keep changing. .NET 6 project templates are now including a Usings.cs file.

How to write ESF/Kura Assets (Wires)

Can anyone please provide links to tutorials or documentation on how to write Assets (Wires) to be deployed in the ESF Admin. (I am using a Eurotech edge computing device.)
I have successfully written and deployed a Java API (ConfigurableComponent) as a Bundle. I can see that it is Active. I just need help with how to write a Java API that becomes an Asset
Thanks.
I'm not familiarized with ESF, but as Kura is similar and compatible, let me provide you an answer based on that.
At least in Kura, there is only one available Asset which is not expected to be replaced or extended (org.eclipse.kura.wire.WireAsset). What you can do is create a Driver with a different configuration for the Assets variables. In most cases this is the best option and more than enough to create any additional connection.
The creation of a Driver is quite complicated to be summarized here but I suggest you to use the following references:
Official documentation on how to create a configurable component from scratch.
S7 driver in Kura project to evolve from the configurable component to the whole Driver implementation.
In general terms, once you have created a configurable component, you must implement the Driver class in the component. Don't forget to define it in the OSGI-INF XML file. Use the S7 example for this.
The definition of your Asset can be modified by returning a Channel Descriptor in the Driver method getChannelDescriptor where you describe the variables as in this example on S7 descriptor.

Can you load shared objects (libraries) and call their functions (FFI) from ABAP?

Is there a possibility to load a dynamic shared object/library from a file on the application server and load it's functions (i.e. a Foreign Function Interface) from ABAP?
I am aware that you can call kernel functions with the CALL statement, but perhaps there are functions in the kernel that support loading libraries and calling their functions?
I'm not aware of a kernel function that would let you do that. There may be one but kernel functions are certainly not publicly documented so you'd need to do your own exploration of the disp+work executable to see if one exists. And if you find one, you'd then need to determine what the parameters are. Not an easy task. If you're up for exploring, I'd probably do it on a Linux system and use objdump and elfsh as my starting toolset.
If I was trying to implement something like what you describe, I'd write a generic "library loader" RFC server in C using the NetWeaver RFC SDK. I'd use C, because it would give the most flexibility loading the external library. You'd need to handle the OS-specific portions of loading the library (eg, using dlopen() on a Unix system, LoadLibrary() / LoadLibraryEx on Windows), but you could then wrap the library functions in generic function module calls (ala, RFC_READ_TABLE) and call them dynamically.

Converting static linked library to dynamic linked library under windows

I am in the midst of evaluating the benefits of changing our program from 30+ statically linked libraries to 30+ dynamically linked libraries. We hope by changing to DLL, it will reduce the link time.
One immediate problem is the requirement to add __declspec in front of all the classes to create the lib file for other dlls to link. Is there a way to get around that? Is there a flag in the compiler to force a lib generation so to make all classes inside the DLL available for export? If not, is there any existing script/program that will do that? That will certainly make the switch from statically linked library to a dynamic one a lot easier. If not, what is the rationale behind __declspec? Why not an option to make all dll functions exportable?
Thank you.
Perhaps it's too late, but have you looked into using a DEF file?
There is one another way to solve your problem.
You just need to create one definition file(.def) and export all the methods or class you want to share.
U will also have to set :
Properties->Linker->Input->Module Definition File -> add name of your created .def file.
Now use run time dynamic linking:
In project where you want to call the exported methods use LoadLibrary to get handle of your Dll and call the required method using GetProcAddress.