-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Architecture: APP specific configuration files required #9825
Comments
I think an application specific configuration file is a good idea. If you make use of the order of include directories in the gcc command line, you could even have transparent fallbacks for when a board specific configuration does not exist. |
I think using a custom |
@aabadie good point. Additionally, using include_next in the right place could even let you augment the default params without overwriting them. |
Using
in the application source directory, e.g.,
in applications's makefile as first line before any other makefile is included, the default parameters defined in This approach should be documented anywhere within an programmers guide. Even tough this approach works, it doesn't make an application specific configuration unnecessary in following cases:
Item 2 becomes necessary for a general purpose board where you just have a number of GPIOs and the board doesn't define which GPIOs are used for what purposes. For such boards, RIOT's board maintainer would choose a default configuration according to his needs or his ideas. That is, he defines a default configuration of GPIOs that are defined as PWM channels, as ADC channels, as I2C signals a.s.o. If this default configuration doesn't match the requirements of an application developer, at least some of the default configurations would have to be overridden. Unfortunately, the driver approach doesn't work for Item 3 may be required to control configurations other than driver parameters or board configurations, e.g. For example, what portion of the build-in flash memory is used for a built-in SPIFFs device. In other projects something like |
You could still do a lot with board.h and include_next, if you use |
We should consider the possibilities offered by cross file arrays (#9105). Most driver.c include "driver_params.h", which in turn defines an array with one set of "default" settings. Initialization is up the caller (application has to call "driver_init(&driver_struct, driver_params"). Using XFA, the user could anywhere (e.g., app_config.c), do something like
... and driver code could, through auto_init, automatically initialize all instances that have a corresponding struct entry in the driver's parameter cross file array. The same principle works for periph instances. |
BTW, there's a newly created "configuration task force" tackling exactly this issue, which is about to create a mailing list. |
Why not just reuse an existing one (devel would be a good candidate) and keep the discussions public ? Other developers may not want to be part of the task force but could still interested in following the discussions. |
Yes, I did remember that there was an email related to configuration in near past, but I couldn't find it in the mail archive. |
BTW, I have seen for a lot of boards that peripheral configurations are done in
That is, an instance of this structure is created in each unit that includes |
Yes. With XFA, one (or multiple) .c file defines array entries (which must have a unique symbol name), and XFA sorts it into a linker section specific to that type. periph/uart code would use XFA to get a pointer to the combined uart_config array. |
@aabadie I am with you. Since I also had the same issue with this I would like to follow this discussion. Even if I currently don't know how to solve. My solution before was just: Cloning RIOT into my app folder, adding a new board, changing the config, adding a feature. In my case: A radio driver. Worked fine, but I also think that there is room for improvement. Since I want to test the new CC11x driver in the future, I would be happy to do it in the new way :) But on the other side I am not against this way. Eventually I want to design a new board with my sensors on it. Therefore it could be kind of the correct way to define a new board. Even if it is kind of inconvenient while prototyping. So maybe it is just a documentation issue. |
@Citrullin @aabadie @gschorcht I just opened a GH issue for tracking the status of the TF and some discussions at #9856 |
A very simplistic approach could be this:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
The issue can be closed. Kconfig will be used to for application specific configuration. |
Following the discussion in #8066, I would like to open another topic concerning the configuration of boards and MCUs. This topic came to mind when I tried to cope with the default configurations in device drivers for external devices like sensors.
Most drivers of such devices define their interface parameters, e.g. the pins used, in the
driver_x_params.h
header files according to the schemeSince these header files include
board.h
, the only way to override this default configuration is to changeboard.h
. This is the right way for boards with on-board devices.However, for off-board devices, especially with general purpose boards like the Arduino Uno that might be used in different applications, it seems not be the right way to change
board.h
. Especially becauseboard.h
is part of the repository and changes in board definitions would affect all applications.From my point of view, a third configuration file beside the MCU and the board configuration is needed that contains application specific configurations.
There could be an optional file
application_conf.h
that is always included automatically by the make infrastructure if it exists. It could reside outside the RIOT repository in application's source directory.To be able to compile the same application for different boards with different configurations, the file name of the application specific configuration file might contain also the board name, e.g., 'application_arduino_due_conf.h'.
Comments are very welcome.
The text was updated successfully, but these errors were encountered: