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

Update Makefiles to use proper BOARD definitions #833

Open
reinforce opened this issue Feb 19, 2025 · 8 comments · May be fixed by #834
Open

Update Makefiles to use proper BOARD definitions #833

reinforce opened this issue Feb 19, 2025 · 8 comments · May be fixed by #834

Comments

@reinforce
Copy link

Hello all
I'm trying to build uCNC using makefiles and avr-gcc for Arduino Uno. It seems that makefiles use old-style board definitions (-D BOARD=UNO) , while PlatformIO ini use boardmap file (-D BOARD="src/hal/boards/avr/boardmap_uno.h").

Is it possible to use something like this: reinforce@d7e2755 ?
Build command in this case still will be like: BOARD=UNO-SHIELD-V3 make clean all

I can create pull request if this is ok.

@Paciente8159
Copy link
Owner

The makefile is outdated but I will check it and give you some feedback soon.

@Paciente8159 Paciente8159 linked a pull request Feb 19, 2025 that will close this issue
@Paciente8159
Copy link
Owner

Check the changes to the make file and how to use it in #834.
Thanks

@reinforce
Copy link
Author

Thanks for your answer.

Building with your changes fails with
/bin/sh: -c: line 1: syntax error near unexpected token '('

Need to escape special characters like ( and ) in makefile.

Is BOARDMAP_FILE really needed? You dropped it since e13316e commit

build_flags = ${common_avr.build_flags} -D BOARD=\"src/hal/boards/avr/boardmap_uno.h\"

@Paciente8159
Copy link
Owner

Previous versions of µCNC had that style of BOARD definition (up to version 1.9).
I dropped it because it was causing issues with Arduino IDE overrides and was leading to code being including for compilation that should not be there.

I was able to compile with make BOARD=BOARDMAP_FILE(src/hal/boards/avr/boardmap_uno_shield_v3.h) clean all yesterday but now on another PC I'm getting issues.

I've added a makefile helper and modified the code a bit.
You now should be able to do it like this:
make BOARD_TYPE=UNO clean all or in your case make BOARD_TYPE=UNO_SHIELD_V3 clean all

@reinforce
Copy link
Author

Thanks for your work.

  • It seems that a mistake in build command. Should be make BOARD=UNO_SHIELD_V3 clean all
  • Compiler warns about extra tokens at end of #include directive and build fails with
    fatal error: src/boards/avr/boardmap_: No such file or directory

System info:
Gentoo Linux 6.6.74-gentoo-x86_64
gcc version 7.3.0 (AVR_8_bit_GNU_Toolchain_3.7.0_1796)
GNU Make 4.4.1

@Paciente8159
Copy link
Owner

On windows I am able to compile it. But you seem to hit a wall in linux. I will try running that on WSL to see if I can manage to reproduce the same issue.

@Paciente8159
Copy link
Owner

I modified slightly the makefile helper. I was able to compile this on WSL (ubuntu).

make BOARD_TYPE=UNO_SHIELD_V3 clean all

@reinforce
Copy link
Author

Thanks for your work!

I looked at old commits of the project and it seems that makefile_helper.h partially repeats code from boarddefs.h and boards.h, and it would be nice to go back to the old board definition. Defining board maps in one place is a good option, working for both makefiles and the PlatformIO.
Also, instead of defining BOARD_TYPE and to avoid confusion between board definitions, I propose to use the BOARD for naming and BOARDMAP definition to specify board maps.
reinforce@a67d346

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 a pull request may close this issue.

2 participants