Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How hardware components are integrated with cFS applications? #766

Closed
Gonta01 opened this issue May 15, 2024 · 6 comments
Closed

How hardware components are integrated with cFS applications? #766

Gonta01 opened this issue May 15, 2024 · 6 comments

Comments

@Gonta01
Copy link

Gonta01 commented May 15, 2024

There are CFS-101 TRAINING GUIDE where in details is described how to create own application. The examples are based on temperature monitoring.

The issue is how temperature is transmitted from hardware layer up to applications for real board? What should be added and at what layer? Should PSP, BSP layers be somehow modified?
The issue is not only related to temperature but any interaction with any hardware isn't clear (at least for me).

Are there any examples, guide or documents that could clarify this issue?

@skliper
Copy link
Contributor

skliper commented May 15, 2024

I typically only add elements to the PSP if they are required by the core, and BSP only if it's required for startup. This keeps the PSP and BSP as simple as possible (less technical debt, might not need to clone and own, etc). For custom hardware specific logic that is only used by an app (or apps) I put it in a library to provide a layer of abstraction from the app. Just load your libraries first. Note that also provides an easy layer to simulate things if you have such a use case (if you are running on a PC w/o the real hardware the library can simulate the hardware behavior.

So a lib with:
xxx_lib/
sim/src/simulation implementation
sim/public_include/sim only apis if needed
fsw/scc/hardware implementation
fsw/public_include/common apis

then the app just adds the dependency and you should be good to go. See sample_app/lib for makefile examples.

@open-stemware
Copy link

I couldn't have asked for a better lead in... There are two cFS Basecamp projects that provide working examples for what was just described.

Raspberry Pi LED Control is an example of a hardware interface library serving as a device driver for an app that controls an LED.

Payload Manager is an example of simulating a hardware device when the hardware is not available, or a hardware simulator is not available for testing error paths.

@Gonta01
Copy link
Author

Gonta01 commented May 15, 2024

@skliper

See sample_app/lib for makefile examples.

Do you mean sample_lib or sample_app?
I haven't understood to what exactly you are referring.

@skliper
Copy link
Contributor

skliper commented May 15, 2024

@Gonta01 - Yes, for CMake example of an app calling a lib and how to add them to cFS. Although it sounds like @open-stemware has examples more specific to your use case.

@open-stemware
Copy link

In case you don't want to work through the Basecamp projects here are links to the lib/app repos used in each project:

Raspberry Pi LED Control
PI IO Lib
LED Control App

Payload Manager
Payload Manager App
Payload Sim App
Payload Sim Library

@Gonta01
Copy link
Author

Gonta01 commented May 16, 2024

@open-stemware thank you a lot for you answers and provided links.

@Gonta01 Gonta01 closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants