-
Notifications
You must be signed in to change notification settings - Fork 723
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
[dv,sw] Makefile refactor #230
Conversation
SW_BUILD_DIR ?= $(SW_ROOT_DIR)/$(SW_DIR) | ||
|
||
LIB_NAME ?= ot | ||
LIB_TARGET ?= $(LIB_BUILD_DIR)/lib${LIB_NAME}.a |
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.
could we allow the individual lib*/srcs.mk to add to this variable? I'm envisioning in the future if we have multiple libs we need to create, it would be nice to only have to modify the sw/Makefile only for the new includes, and have everything else just work out.
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.
Yes, any / all srcs.mk files can append more targets to LIB_TARGET to add more custom targets if needed. Might have to make some fixes to the rules though, but it could definitely work.
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.
sgtm, probably not a high priority for now :) Maybe if the readme just has a comment on how this could be done that would be more than enough.
|
||
# SW_OPTS are options for SW apps that come with their own Makefile (example coremark) | ||
CL_SW_OPTS += | ||
SW_OPTS += ${CL_SW_OPTS} |
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.
is this one consumed by the sw_build step?
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.
SW_OPTS are Makeflags for external apps such as coremark which have its own Makefile. SW_FLAGS are compiler flags we can pass to our own local sw. Both are consumed by sw_build step.
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.
ah that makes sense. but i don't see SW_OPTS used anywhere though.
Speaking of which, the coremark case doesn't seem to quite work right now (at least in my trial). Looks like the LIB_DIR variable isn't passing on correctly, it could just be my environment. I haven't looked too closely.
I won't comment too much more on this for now, i'll try to digest the meson usage, since both you and Miguel say that's better.
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.
I fixed the hw/dv/tools/rules.mk to set Makeflags to SW_OPTS, so it should now work.
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.
thanks!
# compile sw sources | ||
# TOOD: figure out a way to 'templatise' .o/.ppo ruleset for each dir containing srcs | ||
|
||
$(SW_BUILD_DIR)/%.o: $(SW_DIR)/$$*.c |
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.
for this one, i think @eunchan does something like it in his private repo makefile where he assumes there are multiple 'tops'.
Might be good to reference that.
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.
sorry not multiple tops, multiple IPs.
ah sounds good.
…On Fri, Sep 20, 2019 at 10:57 AM sriyerg ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In sw/Makefile
<#230 (comment)>:
> @@ -0,0 +1,21 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+
+# Generate a baremetal application for the microcontroller
+SW_ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
+SW_DIR ?=
+
+# sources
+LOCAL_SW ?= $(shell test -e ${SW_DIR}/srcs.mk && echo -n 1)
+
+ifeq ($(LOCAL_SW), 1)
Yeah, if LOCAL_SW is 0, then its an external all (such as coremark which
ships with its own Make flow. ).
Hi @sriyerg <https://github.com/sriyerg>, for reference #201
<#201> is the Meson build system
implementation we have been discussing.
I think the meson flow is much better. I am working on trying it out.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#230?email_source=notifications&email_token=AAH2RSUXBJEVSZFISQCM4CTQKUFJ3A5CNFSM4IYTP652YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCFORLZI#discussion_r326740215>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAH2RSXTFVO4TN2IC4RSRH3QKUFJ3ANCNFSM4IYTP65Q>
.
|
this LGTM overall, but I guess you're still working on adding more things? Let me know if it's ready for final approval and you want to finish the rest off in a different PR. |
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.
LGTM
@moidx
Miguel could you scan through quickly? I know we may change this to meson later, but just wanted to make sure there isn't anything that really stands out to you.
@sriyerg
I just realized we'll probably need to follow on with another PR quickly to change all the documented instructions, since right now they all go to the actual directory (for example boot_rom) to build.
Could you actually file an issue on that and maybe have it as a P0 or P1 so we don't forget?
Filed issue #244 for updating the SW commands in documentation. I will work on it once this PR is merged. |
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.
Added a couple fo nit comments. Also, can you squash some of the changes or modify the commit descriptions so that they have enough details once submitted? Squash and merge is not supported in this repo.
Also, It'd be nice if you remove the old Makefiles after updating the documentation.
Thanks!
sw/tests/hmac/sha256_test.c
Outdated
@@ -7,6 +7,7 @@ | |||
|
|||
#include "common.h" | |||
#include "flash_ctrl.h" | |||
#include "flash_ctrl_regs.h" |
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.
This is fixed in #228. Can you rebase and revert this change?
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.
Done, thanks.
sw/rules.mk
Outdated
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
########################################################################## | ||
## The following variables must be set prior to invoking this Makefile ## |
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.
Are these comments still accurate? If not, can you remove it and add a comment describing what should go here?
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.
Updated, thanks.
i actually thought Sri removed all the old makefiles already. It was one of the things we discussed earlier today. |
The deletion was done in a separate commit within this PR. My suggestion to delete later is based on the fact that after we merge these changes the documentation will be broken. It is always preferred to keep the repo in green state at the commit level, so that it is easier to maintain the history. It is not a big deal right now, but we should start thinking about staging things this way to avoid running into maintenance issues later. |
ah yeah, Sri and I talked about that also. He actually opened an issue already to follow on with another PR to fix the documentation. I mostly favored removing the old makefiles because it would probably cause quite a bit confusion having them both there. |
[sw] Makefile refactor - added centrallized Makefile infra for maximizing reuse across SW test, lib and boot_rom targets - existing Make flows still remain (for the timebeing; will remove it once all approve of this) - all make commands are to be run from sw/ area - updated with chip_info generation - TODOs - add some documentation - need to fix support for external apps, eg coremark [dv,sw] coremark port now works - updates to get external app (coremark) compiling with the refactored flow - added ability to compile targets with external Makefiles with STANDALONE_SW var - added sw/benchmarks/srcs.mk to supply STANDALONE_CMD to build custom app [dv,sw] removed existing Makefiles (deprecated)
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.
LGTM
@moidx
Miguel could you scan through quickly? I know we may change this to meson later, but just wanted to make sure there isn't anything that really stands out to you.@sriyerg
I just realized we'll probably need to follow on with another PR quickly to change all the documented instructions, since right now they all go to the actual directory (for example boot_rom) to build.Could you actually file an issue on that and maybe have it as a P0 or P1 so we don't forget?
I work on doc as a part of another PR - I am dependent on this one for msging flow updates.
sw/rules.mk
Outdated
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
########################################################################## | ||
## The following variables must be set prior to invoking this Makefile ## |
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.
Updated, thanks.
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.
LGTM. Thanks for working on this @sriyerg
test, lib and boot_rom targets
once all approve of this)