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

fix(Build): Allow Users to Give Absolute Paths to SRCS #666

Merged
merged 3 commits into from
Jul 17, 2023

Conversation

Jake-Carter
Copy link
Contributor

@Jake-Carter Jake-Carter commented Jul 13, 2023

Pull Request Template

Description

This PR allows user's to individually add source files to the build by giving an absolute path to SRCS.

Details

Documentation has been written under the assumption that this worked.

SRCS += /my/absolute/path/to/file.c

However, we create our object file rules using "stripped" names...

# gcc.mk
# Create output object file names
SRCS_NOPATH := $(foreach NAME,$(SRCS),$(basename $(notdir $(NAME))).c)
BINS_NOPATH := $(foreach NAME,$(BINS),$(basename $(notdir $(NAME))).bin)
OBJS_NOPATH := $(SRCS_NOPATH:.c=.o)
OBJS_NOPATH += $(BINS_NOPATH:.bin=.o)
OBJS        := $(OBJS_NOPATH:%.o=$(BUILD_DIR)/%.o)
OBJS        += $(PROJ_OBJS)
# ...

... so VPATH was also needed. This is redundant and has larger implications with AUTOSEARCH.

SRCS += /my/absolute/path/to/file.c
VPATH += /my/absolute/path/to
# ^ This shouldn't be necessary

Test

  1. Add a file to some external directory with the following contents:
#warning "Hello file!"
  1. Add the absolute path of the file to SRCS in project.mk of any project
# project.mk...
# **********************************************************

# Add your config here!

SRCS += /home/jakecarter/test.c
  1. Run the build
~/repos/fork/msdk/Examples/MAX78000/Hello_World (fix/srcs-abspath*) » make                       jakecarter@HYB-oGob9vaIij8
Loaded project.mk
  CC    /home/jakecarter/test.c
/home/jakecarter/test.c:1:2: warning: #warning "Hello file!" [-Wcpp]
    1 | #warning "Hello file!"
      |  ^~~~~~~
  CC    main.c
  CC    /home/jakecarter/repos/fork/msdk/Libraries/Boards/MAX78000/EvKit_V1/Source/board.c
  CC    /home/jakecarter/repos/fork/msdk/Libraries/MiscDrivers/stdio.c
  CC    /home/jakecarter/repos/fork/msdk/Libraries/MiscDrivers/LED/led.c
  CC    /home/jakecarter/repos/fork/msdk/Libraries/MiscDrivers/PushButton/pb.c
  CC    /home/jakecarter/repos/fork/msdk/Libraries/MiscDrivers/Display/tft_ssd2119.c
  CC    /home/jakecarter/repos/fork/msdk/Libraries/MiscDrivers/Touchscreen/tsc2046.c
  CC    /home/jakecarter/repos/fork/msdk/Libraries/MiscDrivers/Camera/camera.c
  CC    /home/jakecarter/repos/fork/msdk/Libraries/MiscDrivers/Camera/ov7692.c
  CC    /home/jakecarter/repos/fork/msdk/Libraries/MiscDrivers/Camera/sccb.c
  AS    /home/jakecarter/repos/fork/msdk/Libraries/CMSIS/Device/Maxim/MAX78000/Source/GCC/startup_max78000.S
  CC    /home/jakecarter/repos/fork/msdk/Libraries/CMSIS/Device/Maxim/MAX78000/Source/heap.c
  CC    /home/jakecarter/repos/fork/msdk/Libraries/CMSIS/Device/Maxim/MAX78000/Source/system_max78000.c
  LD    /home/jakecarter/repos/fork/msdk/Examples/MAX78000/Hello_World/build/max78000.elf
arm-none-eabi-size --format=berkeley /home/jakecarter/repos/fork/msdk/Examples/MAX78000/Hello_World/build/max78000.elf
   text    data     bss     dec     hex filename
  36092    2504    1228   39824    9b90 /home/jakecarter/repos/fork/msdk/Examples/MAX78000/Hello_World/build/max78000.elf

Checklist Before Requesting Review

  • PR Title follows correct guidelines.
  • Description of changes and all other relevant information.
  • (Optional) Link any related Github issues using a keyword
  • (Optional) Provide info on any relevant functional testing/validation. For API changes or significant features, this is not optional.

@EricB-ADI
Copy link
Contributor

Build examples is failing for MAX78000

@Jake-Carter
Copy link
Contributor Author

Build examples is failing for MAX78000

@EricB-ADI Fixed in #667

Copy link
Contributor

@sihyung-maxim sihyung-maxim left a comment

Choose a reason for hiding this comment

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

The PR title checker is going to fail until your other PR with the Build scope addition is merged into main.

@Jake-Carter Jake-Carter merged commit 54dd724 into analogdevicesinc:main Jul 17, 2023
10 checks passed
@Jake-Carter Jake-Carter deleted the fix/srcs-abspath branch July 17, 2023 19:29
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.

3 participants