Skip to content

Enable target-specific toolchain options hook #3894

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

tung7970
Copy link
Contributor

@tung7970 tung7970 commented Mar 6, 2017

Description

Enable target-specific toolchain options hook

Some target, e.g. REALTEK_RTL8195AM, requires special compiler/linker options. Without target-specific options hook, these options have to be added in global files. This PR includes two commits:

  1. Enable all toolchain hooks, make hook naming consistent and scriptable
  2. Enable target-specific toolchain hook.

Status

READY

Migrations

NO

Related PRs

#3758

Todos

  • Tests
  • Documentation

Deploy notes

NO

Steps to test or reproduce

Outline the steps to test or reproduce the PR here.

tung7970 added 2 commits March 6, 2017 22:54
Currently, only post_binary_hook is enabled. This patch
enables the reset of the toolchain hooks. This is in preparation
for target-specific option hook.

While at it, clean up the naming of the hooks and supporting
functions to make it consistent and scriptable.

Signed-off-by: Tony Wu <[email protected]>
Some target, e.g. REALTEK_RTL8195AM, requires special compiler
and linker options. This patch adds a target-specific options
hook so that target can set those options through target's json
and python files.

Signed-off-by: Tony Wu <[email protected]>
@tung7970 tung7970 mentioned this pull request Mar 6, 2017
3 tasks
@bulislaw
Copy link
Member

bulislaw commented Mar 6, 2017

@theotherjimmy @0xc0170

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does a post-target hook mean?

@theotherjimmy
Copy link
Contributor

Also, See #3875. Hooks in python make exporting very hard. I am hesitant to merge another one.

@tung7970
Copy link
Contributor Author

tung7970 commented Mar 6, 2017

Initially, I named it post_init_hook, it's hooked after toolchain's initialized. Target-specific options can be added in that hook, instead of in global toolchain files.

Maybe post_init_hook is a better name ?

@theotherjimmy
Copy link
Contributor

Sure, post_init_hook is a better name. Why do you need this exactly?

@tung7970
Copy link
Contributor Author

tung7970 commented Mar 6, 2017

This is for RTL8195AM board, which requires -fno-short-enum for gcc, and similar option for armcc and iar. Without this patch, these target-specific options have to added to global toolchain files.

Or is there a way to do that under current framework ?

@theotherjimmy
Copy link
Contributor

There is no way to do this under the current framework. That is intentional. We don't want there to be any difference between the compiler flags per platform, as that would make writing the general purpose library part of mbed-os very difficult to do correctly and with a small footprint.

Why do you need -fno-stort-enum?

@tung7970
Copy link
Contributor Author

tung7970 commented Mar 6, 2017

It's explained in #3758

@tung7970
Copy link
Contributor Author

tung7970 commented Mar 7, 2017

Replacing 'typedef enum' with enum + explicit typedef works fine for RTL8195AM. This PR is not needed anymore if toolchain hook is not desired.

Thanks.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 7, 2017

Replacing 'typedef enum' with enum + explicit typedef works fine for RTL8195AM. This PR is not needed anymore if toolchain hook is not desired.

Thanks for the update and resolving the issue with enum sizes !

@theotherjimmy will have a look at this extension. Edit: already did above.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 7, 2017

@theotherjimmy We dont allow targets to change toolchains behaviour. We can close this one?

@theotherjimmy
Copy link
Contributor

Yes. Closing now.

@tung7970 tung7970 deleted the feature-hooks branch March 7, 2017 18:08
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.

4 participants