-
Notifications
You must be signed in to change notification settings - Fork 3k
Added documentation for the configuration system #1984
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
Conversation
Like libraries, targets can define their own configuration data. Additionally, tables can override the configuration of the target(s) they inherit from (for more details about how do define a target and target inheritance, check [this link](mbed_targets.md)). Target configuration data is defined in `targets.json` using `config`, as described [here](#defining-configuration-parameters). An example for a hypothetical `Base` target is given below: | ||
|
||
``` | ||
"Base": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Targets already provide base configuration for generic macros, labels, features and device peripheral configuration (via device_has).
If this is the case then we need to turn ALL targets in targets.json into configuration data and I don't think that this is sensible or needed. I'd rather expect that the targets.json already implement common data which is well documented.
-1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the case then we need to turn ALL targets in targets.json into configuration data and I don't think that this is sensible or needed.
We definitely don't need to do that. Targets have their own legacy configuration, which is there before the configuration system existed. The configuration system doesn't try to change that, it just adds the mechanisms to add more specific configuration in a structured way (which means that there are clear rules for overriding configuration data up to the application layer). There is some overlap between configuation data and the previous mechanism, as you say, but it doesn't mean in any way that we need to convert them.
Also, if you want to -1 something, it makes much more sense to -1 the implementation, not the associated docs (especially since this was already reviewed and approved elsewhere).
-1 See comments above. Either this has to be consistent, e.g. ALL targets are turned into config data or shouldn't be introduced/encouraged at all. |
No. Some attributes are simply target attributes (data associated with the target, set in stone and not meant to be overriden) and others are configuration parameters (data that has a default value, but it is well understood that this value is meant to be overridable if needed). Think about the |
There is no difference in the defined macros between
and
I would expect that:
We already have established Target attributes to handle this:
And last but not least, the fact that a code allows certain behavior doesn't mean we should encourage it. targets.json is intended to provide common/default configuration across all targets for same ARM architecture. The proposed documentation encourages target/platform specific configuration that is moving away from compatibility across all targets and rather encourages platform specific behavior of the ARM mbed as IOT platform. -1 |
There is a big difference. Configuration parameters are structured, namespaced, overridable and self-explanatory if provided with a
I don't believe that's the case. It is my understanding that not all platforms are capable of async storage operations.
Why, if the target is the one that knows its hardware capabilities, thus can hint about the value of this parameter by giving it a sensible default value?
Following this logic, the configuration system shouldn't exist at all, since it eventually compiles into macro definitions that can be declared directly as macros in the first place.
Completeley agreed with this one. However, right now, it is my understanding ASYNC_STORAGE is not applicable to a lot of targets, thus it doesn't belong in Target (yet).
Again, two different things here:
And it does precisely that. |
See the comprehensive post I added above. Configuration parameters belong to the applications and the library, not the target. The configuration system allows removing and adding of either "macros", "device_has" or "features" from the application and libraries. The targets are already preconfigured for everyone, and if a feature is not common across targets (and in fact is supported on just 1 target) then it shouldn't be enabled by default. As an example If I'm working on a prototype with mbed, then I would expect that I can change the target at any time (one of the mbed core features!). And I don't have to worry that I might have to rewrite my own application or libraries, just because the default configuration of the board/platform I'm using has an isolated feature turned on. |
I have yet to see a good reason why this should be the case.
As far as targets are concerned, that's already happening automatically using targets.json. You don't need the configuration system for that.
Why on the earth would I not want to use some feature of my hardware if it is there ?! All hardware is not created equal.
How is "default UART speed" a feature? It is configuration data. The feature (or however you want to call it) is the hardware UART implementation, and it's always there. It doesn't mean that the feature itself doesn't have any configuration of its own. As it happens, some of this configuration might well be target-specific, so it belongs in the target.
Now I'm completely lost:
|
All platforms on mbed use default UART baud rate of 9600. Let's say an application uses a library that produces a lot of data over UART (perhaps a trace library doing lots of print/info/debug) then the application should define suitable UART values. We don't want to encourage different defaults for UART on different targets, especially knowing that all targets support all speeds and this is requirement of the mbed Enabled program (https://developer.mbed.org/handbook/mbed-Enabled). The examples you gave above (both UART and the whole PR documentation) encourage target specific configurations, which negate common and well adopted defaults. Again, these should be configurable through the application, not the target. To put this in perspective - do you expect me to check the documentation of every platform regarding the default virtual com port/UART speed? Thought mbed provides common defaults across all targets ?? And FYI, there are established defaults, see https://developer.mbed.org/handbook/Serial ("9600 8N1, and this is common notation for Serial port settings.")
Not at all. "labels", "features", "device_has" and "macros" are all parts of one and same configuration system (config system is not just config.py), which emits macros to the code base that is built. Not sure why you're separating these?
Different features is one thing, different configuration is another. For one and same mbed feature, like UART, STORAGE, etc, the default configuration should be the same across all targets, which then can be overridden by the application. See the UART example above. |
They do now. Now assume that at some point we change that to 115200 (as we've been asked many times before) and one of the targets can't provide that speed, because its only clock source is a 32khz oscillator and the UART implementation can't generate that that baud rate, for example. This is a hardware limitation that only the target knows about. If the target has any kind of hardware limitation that prevents it from achiving the default serial speed, the only way to make your
They don't encourage target specific configurations, they just give you the means to do that in a well defined way. Defining common configuration parameters and their default values in a base target definition (such as
Not for every platform, but I do expect a platform that can't comply with the default for whatever reason to specify that explicitly in its documentation page.
This is a dangerous assumption. It implies that you can always find a good enough default that'll work equally well on all targets. I agree we should strive to do that, but it might not be always possible. For UART, that's indeed quite simple (although not guaranteed). For other "features", it might not be that easy, and that's when this kind of mechanism can be really useful. |
Glad that you agree on striving for common OS parameters. I'm happy for us to discuss this on case by case basis. For now I don't think we should encourage different OS configurations based targets, especially for common settings like UART or enforcing ASYNC/SYNC modes through compile time configuration. |
We aren't encouraging it. We're providing the mechanisms to make it happen, if needed. Read the docs that you -1'ed, you might see that they provide a complete story for the configuration, front (application) to back (targets). What I don't buy is you rejecting a mechanism just because you think it can be used to "encourage" bad behaviour. I can make the same reasoning about various pieces of code in our code base, yet they seem to work fine in practice. All things considered, we have control over what gets in the tree or not, so we can control this kind of behaviour if it proves that it leads to bad behaviours indeed. |
We could really use some docs on the config system as evidenced by #2072. Can these changes be brought in soon? @bogdanm @screamerbg |
Obviously, I don't have a problem with that :) |
+1 |
…..c5ee9e4 c5ee9e4 Remove content from unit tests f7ca82a Merge branch 'release_internal' into release_external b400a6a Fix for pr ARMmbed#1984 (ARMmbed#1987) 30d25bc Fix compiler warnings (ARMmbed#1986) d46d7b3 Prioritise thread control messages (ARMmbed#1984) e59dbd8 Update domain address lifetime (ARMmbed#1985) 8a5cb75 Merge pull request ARMmbed#1980 from ARMmbed/sync_with_MbedOS bd6feab Update coding style ff14e80 (via Mbed OS) nanostack: icmpv6: fix build warning f5e3423 (via Mbed OS) Require dependencies from nanostack mbed_lib.json 3aec837 Restore ws_management_api.h to the latest version cd7ae3f (via Mbed OS) Review changes corrected 4f23008 (via Mbed OS) This is a initial version of Wi-Sun interface implementation. To get Wi-Sun mesh network working, also nanostack with Wi-Sun support is needed. ws_empty_functions.c and ws_management_api.h are temporary included here, so that wisun_tasklet will compiled without problems. They will replaced with the official versions with next nanostack release. e029444 Merge pull request ARMmbed#1981 from ARMmbed/iotthd-3111 d7e8aea Path control size from 5->7. a5fe76f randomise challenge tlv for parent request retries. (ARMmbed#1977) a1c8277 Merge pull request ARMmbed#1978 from ARMmbed/IOTTHD-3219 62f8b41 Fix compiler warnings 1ec7a84 Fix issues found by coverity 5fe7120 Merge pull request ARMmbed#1974 from ARMmbed/iotthd-3100 51358f9 Removed Unncessary debug print. 136d1b1 Merge pull request ARMmbed#1973 from ARMmbed/IOTTHD-3018 4e557ae DHCPv6 update: 85b33e1 Update BBR prefix assignment (ARMmbed#1972) 899b2c5 DHCPv6 client and server update: 9009eaf Update copyright year to test files 6a56318 Update copyright year to Nanostack files a83472e Added Wi-Sun certificate and security test interfaces 7f4ebf1 Corrected compiler warnings 52e4c3f Added supplicant PAE NVM storage 92df57b Added key data access functions to key storage 5972bc3 Merge pull request ARMmbed#1959 from ARMmbed/ws_eapol_ie_update 98af118 Merge pull request ARMmbed#1965 from ARMmbed/IOTTHD-3193 fc76d1e Merge pull request ARMmbed#1963 from ARMmbed/rename_socket_h ba3a649 Added WS flagging to EAP header parser 048f14a Rename address.h 5739b4a Fixed aro registration error 887d931 Rename socket.h to ns_socket.h 7ebaa8e Add Nanostack configuration for WS (ARMmbed#1961) ed87161 Code style fix. e20028a Fix compiler warnings (ARMmbed#1957) b86f885 EAPOL data flow IE update 65472de Fixed Function protype typo. f539287 Added support for write/READ EA-IE header IE Element's ce72b55 Merge pull request ARMmbed#1958 from ARMmbed/tls_conf_err 1e8b18c Added handling for mbed TLS configuration error bdfea40 WS: Use common channel number calc function 4802aae Merge pull request ARMmbed#1930 from ARMmbed/IOTTHD-3027 2b8c846 PAE BR address write/read interface 9777ad1 Remove yotta references (ARMmbed#1954) af8890b Merge pull request ARMmbed#1949 from ARMmbed/eapol_eap_and_tls c546d4f WS: Fixed EU domain channel numbers in neighbor class cff6f0b WS: Missing return value fix ebcdba5 Changed EAP-TLS identity to anonymous 34d2f15 Corrected defects and coding style 79c7157 WS: Default domain config update 0724863 Merge branch 'master' into IOTTHD-3027 65ccc41 WS: RF config set in own functions 76d235e MAC: Fixed virtual driver warnings 88641c1 Updates to PAEs and other security protocols f57138f Security key storage and certificate info updates b7177c5 TLS security protocol and mbed TLS security protocol library 9c9e3c9 EAP-TLS protocol implementation 9c5fc92 WS: Fixed code style acce0dd Added empty function for test 4b28192 Added support for ARO registration failure 9d251fa Added empty function fr new interface 61f520f Added api to configure network size parameters 4d26258 Flagged mbed TLS KW header and corrected bool definitions 3d903fa Corrected NIST AES KW flagging 2f4e099 Removed temporary KW functions and corrected ut and style 6481549 Added GKH MIC validation and encryption cc3ce58 Moved 4WH functions to library and added constants 650771c Added unit test to NIST AES KW library 6a82e7d added parent priority handling. (ARMmbed#1942) 7b7f1c1 Merge pull request ARMmbed#1945 from ARMmbed/fix_synch_parent_warn 38b28e2 Fix coverity error (ARMmbed#1943) c4afedc thread_mle_message_handler: fix build warning (ARMmbed#1940) a5be64a Follow Mbed OS coding style (ARMmbed#1941) 6298cef Sync mbed_lib.json with Mbed OS (ARMmbed#1935) afe3ec6 Added Wi-Sun flagging to eapol helper 28d10d6 Merge pull request ARMmbed#1901 from ARMmbed/kmp_pae_init 3f56121 Disabled EAPOL flags 97f07a9 Tuned EAPOL timers for small networks 6e063b6 added Wi-SUN neighbor table management to Wi-SUN 7f4c61d Corrected KMP api start on authenticator 91ca2e6 Corrected KMP timer active check and security protocol address get 65d983f If mbedtls NIST AES KW is not enabled defined it as null algorithm 16dbe27 Added unit test stub for PAE controller a524936 Moved EAPOL relay port and IP address configuration to bootstrap 68fa4f6 Added extra debug info flags to new security libraries c4411ea Removed extra memory frees from KMP socket and eapol if and fixed KMP comments 8088a86 Added and fixed security protocols comments cc32457 Modified PAEs to use protocol core timer function call 03469f3 Modified PAE entities to be bound to interface 369c8a0 Added 4WH integrity protection and encryption ebae1d5 Added HMAC-SHA1, IEEE 802.11 PRF and NIST AES KW libraries 2d50887 Corrected Wi-SUN security component initializations 8a8b6ef Added configuration flags for supplicant and authenticator PAEs and EAPOL relay 3868ff1 PAE and security protocols timer support c61066a Corrected GKH to set eapol-KEY message group key negotation bit correctly dfe52d9 Added 4WH,GKH and EAP-TLS module and modified kmp service 782f3fb Relay message flow optimization bbd6ee1 Integrate EAPOL new encode and decode functionality 1802ee7 EAPOL message parser and write helper function. da15653 EAPOL relay and KMP changes fad633f EAPOL relay cc97054 Unicast Shedule update a099524 EAPOL authtentication start fix 3f32a7a Fix valgrind uninitilaized data use. 6e9f6a4 Corrected memory errors and some compiler warnings c5f1af3 Initial EAPOL changes e48aa79 WS: Use Tack in Ack wait time 59a65ea Change FHSS timing defaults be06ecb FHSS WS: Fixed synch parent warning a3aa38b Thread extension commission updates (ARMmbed#1870) 3e89d0a Multicast registrations update (ARMmbed#1931) e18055a MAC: Update symbol rate when RF configuration changed 9eada28 WS: Store RF configuration 35145a3 MAC: RF configuration delivery implemented d6b2bbc Merge pull request ARMmbed#1928 from ARMmbed/IOTTHD-3028 80683e2 MAC/WS: Implemented Ack wait duration set 0e9ead2 Remove excess tracing (ARMmbed#1927) ae210cd Merge pull request ARMmbed#1923 from ARMmbed/IOTTHD-3080 17fad47 Merge pull request ARMmbed#1924 from ARMmbed/IOTTHD-1608 6fd6bd5 Update thread neighbor table initialisation (ARMmbed#1926) c09d38a Merge pull request ARMmbed#1925 from ARMmbed/fix_protocol_if_fhss 9ac5301 MAC MLME: Removed BEA TX trace which was causing stack overflow 5dee7b1 FHSS: Use debug callback in TX/RX slot switch f779fad WS/Protocol: Fixed getting interface pointer using FHSS api 4177fa4 Prevalidate CoAP msg source address 5451b1a FHSS unit tests: Updated timestamp callback a2997b1 FHSS: Removed debug trace which was causing crash 3b6a921 FHSS: Debug callback update ec1c41d FHSS: Use given TX time in synch calculation f0c0f66 MAC: Write FHSS synch info with tx time 78ea0eb FHSS: Debug callbacks added c4ef759 MAC: Write FHSS synch info before calling PHY TX function 9cca341 FHSS: Use timestamp delivered by MAC be46564 Add CoAP message validation 883eb46 Add callback for CoAP message prevalidation (ARMmbed#1918) 59bbe31 Merge pull request ARMmbed#1917 from ARMmbed/IOTTHD-3029 ac4a76e Fixed promiscuous/sniffer mode bc2fb64 FHSS WS: time convert to support negative values 7dce509 FHSS WS: Clock drift compensation implemented ac7c90a Fix Thread resolution client initialisation (ARMmbed#1915) b744186 Set the default unicast channel function as Direct Hash 612c4b5 Update DHCP to follow Wi-SUN specification eeb5168 IPv6 route metrics update (ARMmbed#1912) 1debcca Fix compilation warnings noticed in mbed-os (ARMmbed#1909) 0a18231 Change ARO routes to be direct route instead of on-link 7fb321e Merge pull request ARMmbed#1906 from ARMmbed/parent_update_fix b5afc35 Fixed missing broadcast synch information loose with default zeroes. 3dbc874 Add missing closing bracket 0d746f0 Changed Wi-SUN HW type to match specification 2804bf4 Enabled roaming and routing between multiple Wi-SUN BR git-subtree-dir: features/nanostack/sal-stack-nanostack git-subtree-split: c5ee9e4
No description provided.