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

Problem building the project in VS code #196

Open
Jimis333 opened this issue Jan 3, 2023 · 1 comment
Open

Problem building the project in VS code #196

Jimis333 opened this issue Jan 3, 2023 · 1 comment

Comments

@Jimis333
Copy link

Jimis333 commented Jan 3, 2023

I have been trying to build it with VS code. I'm not very familiar with VS code and makefiles but I managed to find the extension "Makefile Tools" to build it. I'm stuck at the error shown in the picture. If someone could help I would appreciate it.
My goal is to try and deactivate the double tap Reset button.The problem is that Feather M0 is entering sometimes in bootloader mode while I connect the power.
g06MO

@davepruitt
Copy link

davepruitt commented Feb 10, 2023

I had a similar issue several months ago. They didn't really make their makefile very Windows-friendly. There are some key differences in the Windows versions of mkdir and echo that are causing these errors to occur.

(1) mkdir in windows doesn't use the "-p" option, and also it wants all slashes to be "\" rather than "/" like in Linux.
(2) echo doesn't seem like it wants to escape double-quotes.

Here is what I have done to fix the issues:

(1) In order to make the BUILD_PATH variable more Windows friendly, I decided to create a 2nd variable in my makefile called BUILD_PATH_WINDOWS.

In the original makefile, you should see a line that looks like this (roughly around line 48 or so?):

BUILD_PATH=build/$(BOARD)

I changed it to read like this:

BUILD_PATH=build/$(BOARD)
BUILD_PATH_WINDOWS=build\$(BOARD)

Now that you have created a BUILD_PATH_WINDOWS variable, find the line in the makefile that is dirs: It should be around line 156 or so. It reads like this:

dirs:
	@echo "Building $(BOARD)"
	-@mkdir -p $(BUILD_PATH)

To make it work nicely on Windows, I changed it to read like this:

dirs:
	@echo "Building $(BOARD)"
	-@mkdir $(BUILD_PATH_WINDOWS)

Finally, you will want to change the commands sitting around line 169 of the makefile, which originally read like this:

$(BUILD_PATH)/uf2_version.h: Makefile
	echo "#define UF2_VERSION_BASE \"$(UF2_VERSION_BASE)\""> $@

For me, I changed them to read like this:

$(BUILD_PATH)/uf2_version.h: Makefile
	echo #define UF2_VERSION_BASE "$(UF2_VERSION_BASE)"> $@

This is because of how the "echo" command behaves in Windows compared to Unix.

After making these changes you should have a working makefile.

There is one possible other change you may need to make. On lines 177 and 187 of the makefile, they run some Python scripts. This means you need Python 3 installed (which they don't make clear in the "Requirements" section of the "Readme" for this repository. In the makefile, they specifically use the command "python3". This may be an issue depending on how you've installed Python.

For me, my installation of Python is through Miniconda, and when it installed Python on my computer, it just called it "python.exe" rather than "python3.exe". So I had to change the makefile to use the python command rather than the python3 command, since there is not uniformity in how Python installations name the main Python executable. Make sure that your Python executable is in your Windows path so that the makefile can find it.

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

No branches or pull requests

2 participants