Kconfig: Expose Gcoap configurations#12887
Conversation
2cfb09d to
c941996
Compare
|
Rebased to master, 'system' and 'net' Kconfig files are merged now. |
cgundogan
left a comment
There was a problem hiding this comment.
On a side note: I really like this interface. It is very simple to discover available configurations :) Much better than searching for the correct header file or doxygen page, IMO ..
There seems to be something off here. I tested the gcoap example:
make allworks perfectly.
make menuconfigI change the port and save the config. Another make all gives now:
% make
Building application "gcoap_example" for "native" with MCU "native".
In file included from <command-line>:
RIOT/examples/gcoap/bin/native/generated/autoconf.h:82: error: "CONFIG_GCOAP_RESEND_BUFS_MAX" redefined [-Werror]
82 | #define CONFIG_GCOAP_RESEND_BUFS_MAX 1
|
<command-line>: note: this is the location of the previous definition
In file included from <command-line>:
RIOT/examples/gcoap/bin/native/riotbuild/riotbuild.h:2: error: "CONFIG_GCOAP_RESEND_BUFS_MAX" redefined [-Werror]
2 | #define CONFIG_GCOAP_RESEND_BUFS_MAX 2
|
In file included from <command-line>:
RIOT/examples/gcoap/bin/native/generated/autoconf.h:82: note: this is the location of the previous definition
82 | #define CONFIG_GCOAP_RESEND_BUFS_MAX 1
|
cc1: all warnings being treated as errors
make[1]: *** [RIOT/Makefile.base:100: RIOT/examples/gcoap/bin/native/application_gcoap_example/gcoap_cli.o] Error 1
make: *** [RIOT/examples/gcoap/../../Makefile.include:515: RIOT/examples/gcoap/bin/native/application_gcoap_example.a] Error 2Any ideas what might be wrong?
👍
Yes, as this was one of the first PRs we still didn't have the Kconfig symbols available in Makefiles, so it is expected to have errors if configurations are set via CFLAGS. I will update this to check for Kconfig usage and avoid conflicts. |
c941996 to
cc4ab70
Compare
|
@cgundogan I rebased so I can use the change of #12913 |
cgundogan
left a comment
There was a problem hiding this comment.
I retested after the rebase. I could rebuild after make menuconfig without any errors. I also confirmed that changes done via kconfig propagate to the binary: I changed the GCOAP_PORT in the menu and could interact with the resource endpoint using the new port.
cgundogan
left a comment
There was a problem hiding this comment.
Tested the fixup commit: observable tick length ranges now from 1..3 and kconfig does not allow values outside this range.
ACK. Please squash!
Macros that changed: GCOAP_MSG_QUEUE_SIZE -> CONFIG_GCOAP_MSG_QUEUE_SIZE GCOAP_NO_AUTO_INIT -> CONFIG_GCOAP_NO_AUTO_INIT GCOAP_NO_RETRANS_BACKOFF -> CONFIG_GCOAP_NO_RETRANS_BACKOFF GCOAP_NON_TIMEOUT -> CONFIG_GCOAP_NON_TIMEOUT GCOAP_OBS_CLIENTS_MAX -> CONFIG_GCOAP_OBS_CLIENTS_MAX GCOAP_OBS_OPTIONS_BUF -> CONFIG_GCOAP_OBS_OPTIONS_BUF GCOAP_OBS_REGISTRATIONS_MAX -> CONFIG_GCOAP_OBS_REGISTRATIONS_MAX GCOAP_OBS_VALUE_WIDTH -> CONFIG_GCOAP_OBS_VALUE_WIDTH GCOAP_PDU_BUF_SIZE -> CONFIG_GCOAP_PDU_BUF_SIZE GCOAP_PORT -> CONFIG_GCOAP_PORT GCOAP_RECV_TIMEOUT -> CONFIG_GCOAP_RECV_TIMEOUT GCOAP_REQ_OPTIONS_BUF -> CONFIG_GCOAP_REQ_OPTIONS_BUF GCOAP_REQ_WAITING_MAX -> CONFIG_GCOAP_REQ_WAITING_MAX GCOAP_RESEND_BUFS_MAX -> CONFIG_GCOAP_RESEND_BUFS_MAX GCOAP_RESP_OPTIONS_BUF -> CONFIG_GCOAP_RESP_OPTIONS_BUF GCOAP_TOKENLEN -> CONFIG_GCOAP_TOKENLEN
This adds a check in the Makefile so configurations are set via CFLAGS only if Kconfig is not being used as the configurator for the module. Otherwise there may be a conflict.
ad75697 to
cf7a738
Compare
@cgundogan squashed |
| menu "Timeouts and retries" | ||
|
|
||
| config GCOAP_RECV_TIMEOUT | ||
| int "Incoming message timeout" |
There was a problem hiding this comment.
general question on KConfig: are these converted to explicitly typed literals (1000000LU)?
There was a problem hiding this comment.
No, Kconfig does not add suffixes to these literals, the header file will just contain 1000000. If needed, could we add a cast when using the macro?
There was a problem hiding this comment.
So all type checking by the compiler is removed?
There was a problem hiding this comment.
So all type checking by the compiler is removed?
no, the compiler checks the type. What is removed is the possibility to set types for integer literals. This only affects CONFIG symbols that are used in arithmetic expressions. Also, the compiler still throws an error if integer widths do not match. Using an explicit cast (...) solves this problem.
There was a problem hiding this comment.
Murdock shows green lights. Let's merge this now, but we can still continue the discussion in this thread for this particular kconfig property, if needed.
Contribution description
This PR adds the
CONFIG_prefix to Gcoap's configuration macros and then exposes those options to Kconfig.The approach is to have a menuconfig entry for the module (
KCONFIG_MODULE_GCOAP) which enables/disables the configuration of Gcoap via Kconfig. This entry will only show when the module is being used (depends on MODULE_GCOAP).MODULE_symbols are declared in theKconfig.depfile generated fromUSEMODULES:RIOT/makefiles/kconfig.mk
Lines 54 to 58 in c6b9f95
Testing procedure
make all). In this case the applied configurations should be the ones declared ingcoap.h.make menuconfigin Gcoap's example application should reveal the menuconfig interface and Gcoap's configurations. Configurations selected via this interface should be applied to the application.Issues/PRs references
#12888