Skip to content

Move target specific macros to mbed_config.h #2347

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

Closed
wants to merge 2 commits into from

Conversation

sarahmarshy
Copy link
Contributor

@sarahmarshy sarahmarshy commented Aug 2, 2016

Fixes ARMmbed/mbed-os-example-client#61. Prevents uvision armasm command from growing too long with -D defines for preprocessing.

@bridadan
Copy link
Contributor

bridadan commented Aug 2, 2016

/morph export-build

@sg-
Copy link
Contributor

sg- commented Aug 2, 2016

@bogdanm @screamerbg

@mbed-bot
Copy link

mbed-bot commented Aug 2, 2016

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph export-build

@sarahmarshy
Copy link
Contributor Author

sarahmarshy commented Aug 3, 2016

Looks like I wasn't properly merged with master when making this patch. This commit:
c6c8d42#diff-1a2a8477037910723cb693931b3479ffR91

--preinclude for armasm as per infocenter is not valid. Maybe it is for a newer armasm, but uvision does not like it as assembler flag. I ran the export-build before and after this commit, and that is where it breaks.

@sarahmarshy
Copy link
Contributor Author

/morph export-build

@mbed-bot
Copy link

mbed-bot commented Aug 3, 2016

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph export-build

@bogdanm
Copy link
Contributor

bogdanm commented Aug 3, 2016

I get what you're trying to do here, but conceptually, the config system doesn't know anything about toolchain macros (or about toolchains for that matter), it only deals with configuration data. While your fix would probably work, I find the idea of having toolchain macros listed in mbed_config.h confusing. Of course, if there's no other way to fix this, we'll end up doing this anyway.

@sarahmarshy
Copy link
Contributor Author

sarahmarshy commented Aug 3, 2016

@bogdanm Do you think an option might be to export another header file to be preincluded? Some of the device properties seem to be well placed in a configuration file. However, I am not intimately familiar with the configuration system, so I don't know what the conceptual boundaries are.

@sg-
Copy link
Contributor

sg- commented Aug 4, 2016

After reviewing this I think the path forward is:

  • only core macros and target.macros will be passes to an assembler (mbed compile and mbed export)
  • device_has and target / toolchain / features macros are emitted as -D (mbed compile and mbed export)
  • configuration data is passed as --preinclude=mbed_config.h to C and C++ compilers (mbed compile and mbed export)

@bridadan
Copy link
Contributor

bridadan commented Aug 4, 2016

@sg- The major implication I see for this is that if someone is writing their project in assembly (yikes) then they won't have access to the macros you mentioned. Though if they are writing their project in assembly, they're probably fine with this and they want all the control over what gets defined any way.

It may also be possible to still get the macros and write assembly by using a .c file with inline assembly? May be a viable workaround...

As long as this behavior is clearly documented in the config system's documentation in big, bold letters, this seems reasonable to me 👍

@sarahmarshy
Copy link
Contributor Author

Moved here: #2377

@sarahmarshy sarahmarshy closed this Aug 4, 2016
@bogdanm
Copy link
Contributor

bogdanm commented Aug 5, 2016

Cc @AlessandroA. Are you guys happy with the solution proposed by @sg- above? To me, it looks like a preprocessed assembler source should see the same set of macros that a C/C++ source file sees, but maybe I'm just being paranoid.

@AlessandroA
Copy link
Contributor

I agree with @bogdanm that the macros for preprocessed assembly files should be the same of the C/C++ files. It's not currently a requirement for uVisor, but I am confident these subtle differences in the build systems will eventually bite us.

Whenever is possible, I'd opt for consistency.

IIUC the limitation here is the armasm command length, right? If all toolchains support --preinclude or anything equivalent, we could keep all non-config definitions in a separate file and force-include them. In that sense, no symbol would be defined as a command line argument.

@sg-
Copy link
Contributor

sg- commented Aug 5, 2016

The problem is:

  • assemblers dont support --preinclide (other than gcc)
  • the various IDEs invocation environment or pattern cause the path length. Command line builds are OK

In general and historically:

  • macros are macros, they should be everywhere
  • device_has emits macros used for porting and turning on/off c hal implementations and C++ classes that call these implementations. Should be no regression or assembly usecase for these
  • FEATURES / TOOLCHAIN / TARGET are used for scanning directories to build. Just so happens they also emit -D but TBH this was probably not by design, rather something that slipped in.
  • config this is a whole new thing for MCUs. If I think about how the rest of the microcontroller world does this (right or wrong), its usually a header file that must be included in all translation units. Id go as far to guess that assemblers will barf on the majority of config data we try to pass it anyways (ie not legal defines).

Is there a specific case I've not considered? I think the above behavior is pretty consistent. Just don't use a hammer to thread a needle.

@AlessandroA
Copy link
Contributor

@sg- At the moment FEATURE_UVISOR and TARGET_UVISOR_SUPPORTED are required to conditionally select code, both in ASM files and C/C++ files.

Commit 88564a9 removed those symbols for ASM compilation, introducing a regression in the uVisor app (see #2385).

FEATURE, TOOLCHAIN and TARGET are extensively used in mbed OS to conditionally select code. I don't see a reason for creating an exception for ASM files ("the tool doesn't allow it" is not good enough IMO).

If we agree that we need these symbols, then we can find other solutions (even a naive one — including a header at the beginning of the ASM files that need it). If you think we shouldn't use these symbols in code, then we should remove them altogether, not just from ASM files.

@bogdanm
Copy link
Contributor

bogdanm commented Aug 8, 2016

At the moment FEATURE_UVISOR and TARGET_UVISOR_SUPPORTED are required to conditionally select code, both in ASM files and C/C++ files.

This is what I thought originally that we're making too many assumptions about which macros are needed by the ASM code. The truth is that we can't know that in advance, so the only way to be sure that we're not messing things up is to make all macros available to ASM code, just like we do for C and C++ code. @sg-

@sg-
Copy link
Contributor

sg- commented Aug 8, 2016

macros are macros, TARGET_ TOOLCHAIN_ and FEATURE_ are not (even though we've misled you to think they are :) These are used for an inclusion method to compile. If you've relied on these its easy enough to macros_add FEATURE_UVISOR and TARGET_UVISOR_SUPPORTED

artokin pushed a commit to artokin/mbed-os that referenced this pull request May 11, 2020
…..9a21668

9a21668 Merge branch 'release_internal' into release_external
8e72b80 MAC CCA thr: Check if channel out of range (ARMmbed#2363)
146a0a3 Corrected trace on authenticator
d04a96d Merge pull request ARMmbed#2361 from ARMmbed/sync_with_mbedos
2c2b915 Added empty function for ns time callback
76ac0de Remove NCS36510 target
0258ac3 Remove KW24D target
788f01b Netsocket/lwIP Stack: Remove support for ARM Compiler 5
2fbc7a1 Corrected invalid memory read on access revoke
941b9b4 Updates to stagger/latency (ARMmbed#2358)
c2abaaa Corrected defects
1811194 Corrected warning trace, validations and ut stubs
69e2d19 Added NS filesystem and interface to application
c5b6993 refactored packet ingress
a05605e Unsecured packets will be acked by default automatically.
36dfb29 MAC: Implemented automatic CCA threshold (ARMmbed#2353)
0396b97 Revert EAPOL simplify failure handling and focus this problem later on.
b2fe3d4 Ignoring authentication failure if security protocol already started
11de56d Added info API for Wi-SUN border router
87a4f69 Added EAPOL key storage to authenticator and unified GTK storage (ARMmbed#2345)
ff1ca25 EAPOL failure simplify and EAPOL relay agent add trace when eapol temp pool is empty
6667b31 Update NA trace
34cdafe Temporary EAPOL neighbour entry Update and MAC MLME update
d092f83 Iotthd 3995 (ARMmbed#2347)
e2ea4e4 Disabled BR (TLS server) EC calculation queue
5759851 Changed the rate limiting function to calculate the values runtime
899e755 Make it possible to update tr51 table to larger dynamically
8436669 Added configuration for DHCP lifetime value
da732bc When network name or PAN ID is changed authenticator updates MAC keys

git-subtree-dir: features/nanostack/sal-stack-nanostack
git-subtree-split: 9a21668
artokin pushed a commit to artokin/mbed-os that referenced this pull request Jun 8, 2020
…..b3fe574

b3fe574 Remove test files from the release
b2bf24c Merge branch 'release_internal' into release_external
0ed25a7 Fix errors found from coverity scan (ARMmbed#2386)
7a138f7 Added IID for border router info structure
4021b0c LLC secure data duplicate check update and EAPOL relay duplicate fix
b190a97 Remove Thread-protocol from README (ARMmbed#2383)
ae8ae32 EAPOL relay agent rx filter from joiner side
0d4eb7a Removed dead code part
fc644f5 RPL new parent accept update and NUD operation
f5920e2 ETX API update and RPL ETX threshold callback update.
1fdee20 Wi-sun keep all candidates alive by NUD.
bd746da Key storage settings are no longer cleared on delete
bd388fc Changed EAPOL initial-Key retries from 2 to 4 on large NW
a3d80a3 WS bootstrap: Default CCA threshold to -60dBm (ARMmbed#2377)
72b26a7 Created extra large network setup for Wi-SUN
38dd4a6 Corrected PTK and PMK lifetime handling
64f2a77 Cleared EAPOL temporary trace print's.
02ec23f Timed parent selection is now imim-imin*2 earlier there was just 5 seconds randomize.
3b2d906 Added check for network name and DODAG ID IID (EUI-64) (ARMmbed#2373)
ee45f4b Updated initial key trickles
184425b Fixed parent target address set.
07ec237 Updated Discovery and RPL setup large & medium size network
a94d8f2 RPL version num update
9e2ac1d Double default eapol entry size for test purpose.
6b8beef Clear all neighbors only on eapol next target check
faa19e1 Corrected next address set
8a917fb Continue trickle on initial EAPOL-key TX failure
cfdb193 Merge pull request ARMmbed#2368 from ARMmbed/sync_with_mbedos
f7a15fa (via MbedOS) ws: added support for brazilian regulatory domain
c397edb Changed large network initial-key trickle parameters
758f534 Added maximum frame counter storing interval
b0ea148 Corrected key storage configuration setting
be3c94e WS RPL paret soft filter update
8b1d537 Adjusted EAPOL limits and timers
9a21668 Merge branch 'release_internal' into release_external
8e72b80 MAC CCA thr: Check if channel out of range (ARMmbed#2363)
146a0a3 Corrected trace on authenticator
d04a96d Merge pull request ARMmbed#2361 from ARMmbed/sync_with_mbedos
2c2b915 Added empty function for ns time callback
76ac0de Remove NCS36510 target
0258ac3 Remove KW24D target
788f01b Netsocket/lwIP Stack: Remove support for ARM Compiler 5
2fbc7a1 Corrected invalid memory read on access revoke
941b9b4 Updates to stagger/latency (ARMmbed#2358)
c2abaaa Corrected defects
1811194 Corrected warning trace, validations and ut stubs
69e2d19 Added NS filesystem and interface to application
c5b6993 refactored packet ingress
a05605e Unsecured packets will be acked by default automatically.
36dfb29 MAC: Implemented automatic CCA threshold (ARMmbed#2353)
0396b97 Revert EAPOL simplify failure handling and focus this problem later on.
b2fe3d4 Ignoring authentication failure if security protocol already started
11de56d Added info API for Wi-SUN border router
87a4f69 Added EAPOL key storage to authenticator and unified GTK storage (ARMmbed#2345)
ff1ca25 EAPOL failure simplify and EAPOL relay agent add trace when eapol temp pool is empty
6667b31 Update NA trace
34cdafe Temporary EAPOL neighbour entry Update and MAC MLME update
d092f83 Iotthd 3995 (ARMmbed#2347)
e2ea4e4 Disabled BR (TLS server) EC calculation queue
5759851 Changed the rate limiting function to calculate the values runtime
899e755 Make it possible to update tr51 table to larger dynamically
8436669 Added configuration for DHCP lifetime value
da732bc When network name or PAN ID is changed authenticator updates MAC keys

git-subtree-dir: features/nanostack/sal-stack-nanostack
git-subtree-split: b3fe574
artokin pushed a commit to artokin/mbed-os that referenced this pull request Jun 8, 2020
…..b3fe574

b3fe574 Remove test files from the release
b2bf24c Merge branch 'release_internal' into release_external
0ed25a7 Fix errors found from coverity scan (ARMmbed#2386)
7a138f7 Added IID for border router info structure
4021b0c LLC secure data duplicate check update and EAPOL relay duplicate fix
b190a97 Remove Thread-protocol from README (ARMmbed#2383)
ae8ae32 EAPOL relay agent rx filter from joiner side
0d4eb7a Removed dead code part
fc644f5 RPL new parent accept update and NUD operation
f5920e2 ETX API update and RPL ETX threshold callback update.
1fdee20 Wi-sun keep all candidates alive by NUD.
bd746da Key storage settings are no longer cleared on delete
bd388fc Changed EAPOL initial-Key retries from 2 to 4 on large NW
a3d80a3 WS bootstrap: Default CCA threshold to -60dBm (ARMmbed#2377)
72b26a7 Created extra large network setup for Wi-SUN
38dd4a6 Corrected PTK and PMK lifetime handling
64f2a77 Cleared EAPOL temporary trace print's.
02ec23f Timed parent selection is now imim-imin*2 earlier there was just 5 seconds randomize.
3b2d906 Added check for network name and DODAG ID IID (EUI-64) (ARMmbed#2373)
ee45f4b Updated initial key trickles
184425b Fixed parent target address set.
07ec237 Updated Discovery and RPL setup large & medium size network
a94d8f2 RPL version num update
9e2ac1d Double default eapol entry size for test purpose.
6b8beef Clear all neighbors only on eapol next target check
faa19e1 Corrected next address set
8a917fb Continue trickle on initial EAPOL-key TX failure
cfdb193 Merge pull request ARMmbed#2368 from ARMmbed/sync_with_mbedos
f7a15fa (via MbedOS) ws: added support for brazilian regulatory domain
c397edb Changed large network initial-key trickle parameters
758f534 Added maximum frame counter storing interval
b0ea148 Corrected key storage configuration setting
be3c94e WS RPL paret soft filter update
8b1d537 Adjusted EAPOL limits and timers
9a21668 Merge branch 'release_internal' into release_external
8e72b80 MAC CCA thr: Check if channel out of range (ARMmbed#2363)
146a0a3 Corrected trace on authenticator
d04a96d Merge pull request ARMmbed#2361 from ARMmbed/sync_with_mbedos
2c2b915 Added empty function for ns time callback
76ac0de Remove NCS36510 target
0258ac3 Remove KW24D target
788f01b Netsocket/lwIP Stack: Remove support for ARM Compiler 5
2fbc7a1 Corrected invalid memory read on access revoke
941b9b4 Updates to stagger/latency (ARMmbed#2358)
c2abaaa Corrected defects
1811194 Corrected warning trace, validations and ut stubs
69e2d19 Added NS filesystem and interface to application
c5b6993 refactored packet ingress
a05605e Unsecured packets will be acked by default automatically.
36dfb29 MAC: Implemented automatic CCA threshold (ARMmbed#2353)
0396b97 Revert EAPOL simplify failure handling and focus this problem later on.
b2fe3d4 Ignoring authentication failure if security protocol already started
11de56d Added info API for Wi-SUN border router
87a4f69 Added EAPOL key storage to authenticator and unified GTK storage (ARMmbed#2345)
ff1ca25 EAPOL failure simplify and EAPOL relay agent add trace when eapol temp pool is empty
6667b31 Update NA trace
34cdafe Temporary EAPOL neighbour entry Update and MAC MLME update
d092f83 Iotthd 3995 (ARMmbed#2347)
e2ea4e4 Disabled BR (TLS server) EC calculation queue
5759851 Changed the rate limiting function to calculate the values runtime
899e755 Make it possible to update tr51 table to larger dynamically
8436669 Added configuration for DHCP lifetime value
da732bc When network name or PAN ID is changed authenticator updates MAC keys

git-subtree-dir: features/nanostack/sal-stack-nanostack
git-subtree-split: b3fe574
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

Successfully merging this pull request may close these issues.

6 participants