8000 Allow Overriding Linkerfile for SBT Projects by Jake-Carter · Pull Request #592 · analogdevicesinc/msdk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow Overriding Linkerfile for SBT Projects #592

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

Merged
merged 4 commits into from
Jun 5, 2023

Conversation

Jake-Carter
Copy link
Contributor
@Jake-Carter Jake-Carter commented May 22, 2023

This PR allows setting the LINKERFILE build config variable when SBT=1.

Ex:

 ~/repos/fork/msdk/Examples/MAX32520/Hello_World
❯ make LINKERFILE=max32520_ram.ld
Loaded project.mk
Auto-located linkerfile: /home/jakecarter/repos/fork/msdk/Libraries/CMSIS/Device/Maxim/MAX32520/Source/GCC/max32520_ram.ld
arm-none-eabi-size --format=berkeley /home/jakecarter/repos/fork/msdk/Examples/MAX32520/Hello_World/build/max32520.elf
   text    data     bss     dec     hex filename
  34572    2580     372   37524    9294 /home/jakecarter/repos/fork/msdk/Examples/MAX32520/Hello_World/build/max32520.elf

Ex: (Trying to set a non-existent linkerfile)

 ~/repos/fork/msdk/Examples/MAX32520/Hello_World
❯ make LINKERFILE=myfile.ld
Loaded project.mk
/home/jakecarter/repos/fork/msdk/Libraries/CMSIS/Device/Maxim/MAX32520/Source/GCC/max32520.mk:64: Failed to locate linkerfile: myfile.ld
make: *** No rule to make target 'myfile.ld', needed by '/home/jakecarter/repos/fork/msdk/Examples/MAX32520/Hello_World/build/max32520.elf'.  Stop.

The changes have been applied to the Hello_World project for the MAX32520 for easier testing/review. The same changes will be applied to all micros on approval.

  • Move default LINKERFILE selection to part-specific makefile (ex: max32520.mk).
  • Use ?= in sbt-config.mk to allow user override

Resolves https://jira.maxim-ic.com/browse/MSDK-1100

@Jake-Carter Jake-Carter added the build system This issue or pull request is related to the MSDK build system label May 22, 2023
@Jake-Carter Jake-Carter requested a review from ozersa May 22, 2023 22:37
ifeq "$(RISCV_CORE)" "" # RISCV
# Default linkerfile is only specified for standard Arm-core projects.
# Otherwise, gcc_riscv.mk sets the appropriate riscv linkerfile.
LINKERFILE ?= $(TARGET_LC).ld
Copy link
Contributor

Choose a reason for hiding this comment

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

Should SBT==1 check here, before setting LINKERFILE?
Otherwise it seems not works for ME10/ME14/ME12/ME18 which has secure + non-secure version MCUs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since SBT-config.mk is included before max32xxx.mk we shouldn't need it. This check will be the default value if nothing has been set through the entire build process

@Jake-Carter Jake-Carter requested a review from ozersa May 30, 2023 23:30
@Jake-Carter
Copy link
Contributor Author

@ozersa I just updated all projects. I think it should be more reliable now, and I tested the common SBT projects/micros. Let me know if you find any other issues

Copy link
Contributor
@ozersa ozersa left a comment

Choose a reason for hiding this comment

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

Approved.

- Note, this commit also renormalized line endings.  The actual change was
"ifeq ($(MAKECMDGOALS),scpa)" vs "ifeq ($(MAKECMDGOALS), scpa)" (extra space after the comma)
@Jacob-Scheiffler
Copy link
Contributor
Jacob-Scheiffler commented Jun 2, 2023

I'm confused as heck, mostly cause I'm not super familiar with the build system. Why is the linkerfile selection removed from the project makefiles? Shouldn't we still need to set up the linkerpath somewhere?

@Jake-Carter
Copy link
Contributor Author

I'm confused as heck, mostly cause I'm not super familiar with the build system. Why is the linkerfile selection removed from the project makefiles? Shouldn't we still need to set up the linkerpath somewhere?

For future readers: The default is specified by the target-specific makefile (ex. max32520.mk). The previous section that has been removed by this PR was a workaround for a bug on MSYS2 when MAXIM_PATH was not set. The bug was resolved as of #173.

@Jake-Carter Jake-Carter merged commit d637453 into analogdevicesinc:main Jun 5, 2023
@Jake-Carter Jake-Carter deleted the dev/sbt-linkerfile branch June 5, 2023 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system This issue or pull request is related to the MSDK build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0