Closed jfm92 closed 6 years ago
Hi, I've run into some other problem, for which I cannot find a description, but this post seems relevant.
Let's say, I have two custom apps: APP1 and APP2. APP2 has underlying functionality of APP1, but different frontend. So in APP2 I'd like to include "app1.h", i.e. reuse source of APP1. Currently, of course, compilation fails, as "app1.h" is inaccessible for APP2.
How could I reuse sources from one app in another? Let's say, I don't care about actually linking same object files twice (no need for shared library). How can this be achieved? How to make APP1's headers/sources visible "publicly", what is the correct way of doing this? (The way of putting reused source elsewere is not an option, only in APP1's directory.)
@jfm92 may be you could help here I suggest you also checking NuttX page and its google group.
I've come up with a solution like this:
CFLAGS += -I $(APPDIR)/examples/APP1
However, this does not look very nice for me, even though... it works.
When you develop an App for NuttX, you can choose if your App is an example, a system utility, can utility.. The only difference beteween the diferents options, is in which folder you save your app. To this guide, we're going to develop the App in the example folder.
So go to:
App/Examples
And create a folder with the name of your App (In this case it'll be custom_app). Each App have four basicall file:Kconfig
The next image is the configuration of this App in the menu:
You can add some configuration options to your app that it'll appear in the menuconfig: In this case you can see the options of the priority of the task when it's running the App and the stack size.
Make.defs
This file is like a linker.
Makefile
Now go to the previous folder,open the Kconfig file and add this line: source "/home/juan/nuttxspace_add_app/apps/examples/custom_app/Kconfig"
Main file
Now everything it's setup and it's only left to program your App. This is a basic skeleton of an empty App
(The file is already attached)
And this is a very simple example of how it works the device control in NuttX and how to apply to your app.
This app, open both sensors (Pressure and Humidity/temperature), read the value of both and show in the console.
custom_app_files.zip