Skip to content
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

Build System: Resolve CPU-specific logic in common build files #457

Merged
merged 1 commit into from
Mar 6, 2020

Conversation

patacongo
Copy link
Contributor

  • tools/Config.mk - Add empty definition POSTBUILD
  • tools/Makefile.unix/win - Replace CXD56xx specific logic with $(call POSTBUILD)
  • boards/arm/cxd56xx/scripts/cxd56xx_Config.mk - Add POSTBUILD definitions with logic removed from Makefile.unix/win
  • boards/arm/cxd56xx/spresense/scripts/Make.defs - Include cxd56xx_Config.mk immediately after tools/Config.mk so that the empty POSTBUILD definition will be replaced with the correct one

NOTE: There is a precedent for this approach. This is the way that other architecture-specific build options are implemented. See, for example, tools/zds/zds_Config.mk

@patacongo
Copy link
Contributor Author

patacongo commented Mar 6, 2020

NOTE: Please review, verify, and merge if possible. I am not really set up to do verifcation on Spresense at this time. This should resolve Issue #442 and provide guidance for completion of #437

This is the same base solution that was used for another architecture so has a solid precedence, works very well, and is very simple.

@jerpelea
Copy link
Contributor

jerpelea commented Mar 6, 2020

after typo fix +1

@jerpelea
Copy link
Contributor

jerpelea commented Mar 6, 2020

it was built and verified here with the local typo fix
should I merge it or do you want to wait for the second opinion?

@patacongo
Copy link
Contributor Author

patacongo commented Mar 6, 2020

should I merge it or do you want to wait for the second opinion?

My preference would be to do the merge now. My only hesitation is that Xiang did offer a different solution. This solution is superior to the one Xiang offered, however.

But perhaps he is not available due to the time difference. In that case, I would elect to continue with the merge. Then we can get the ESP32 PR on the way too.

@patacongo
Copy link
Contributor Author

I have also verified that builds for a few other architectures that do no redefine POSTBUILD also build with not problem.

@patacongo patacongo linked an issue Mar 6, 2020 that may be closed by this pull request
@@ -35,6 +35,7 @@

include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/boards/arm/cxd56xx/scripts/cxd56xx_Config.mk
Copy link
Contributor

Choose a reason for hiding this comment

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

How about remove cxd56xx_ prefix? because:
1.The path already have cxd56xx
2.Align with tools/Config.mk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay. Doing that now. Should also change zds_Config.mk for the same reason. I was following the pattern set by zds_Config.mk. I will push new changes momentarily.

@@ -0,0 +1,41 @@
############################################################################
# board/arm/cxd56xx/script/cxd56xx_Config.defs
Copy link
Contributor

Choose a reason for hiding this comment

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

defs to mk

* tools/Config.mk - Add empty definition POSTBUILD
* tools/Makefile.unix/win - Replace CXD56xx specific logic with $(call POSTBUILD)
* boards/arm/cxd56xx/scripts/Config.mk - Add POSTBUILD definitions with logic removed from Makefile.unix/win
* boards/arm/cxd56xx/spresense/scripts/Make.defs - Include the CXD56xx Config.mk immediately after tools/Config.mk so that the empty POSTBUILD definition will be replaced with the correct one

NOTE: There is a precedent for this approach.  This is the way that other architecture-specific build options are implemented.  See, for example, tools/zds/Config.mk
@patacongo
Copy link
Contributor Author

@xiaoxiang781216 Updated. Please review and merge if possible.

@xiaoxiang781216 xiaoxiang781216 merged commit 3ee1af5 into apache:master Mar 6, 2020
@patacongo
Copy link
Contributor Author

Thanks. Just saw the PR trigger running. Nice job guys! Congratulations! That was a lot of work.

@xiaoxiang781216
Copy link
Contributor

should I merge it or do you want to wait for the second opinion?

My preference would be to do the merge now. My only hesitation is that Xiang did offer a different solution. This solution is superior to the one Xiang offered, however.

But perhaps he is not available due to the time difference. In that case, I would elect to continue with the merge. Then we can get the ESP32 PR on the way too.

This solution look very good, I can migrate our internal post build process to this elegant mechanism now.

@patacongo
Copy link
Contributor Author

patacongo commented Mar 6, 2020

Overriding the define's in tools/Config.mk is a very powerful customization technique.

You could do many different things there, such as copying binaries onto and TFTP server, compressing binaries, etc. ... whatever meets the needs of the platform.

@patacongo patacongo deleted the postbuild branch March 6, 2020 19:01
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.

tools/Makefile.unix: Remove FORBIDDEN CXD56 code in common Makefile.
5 participants