Skip to content

Compilation Error #359

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

Closed
Vicky-S opened this issue Oct 26, 2018 · 7 comments · Fixed by #965
Closed

Compilation Error #359

Vicky-S opened this issue Oct 26, 2018 · 7 comments · Fixed by #965
Assignees

Comments

@Vicky-S
Copy link

Vicky-S commented Oct 26, 2018

I have installed STM32 core from Arduino boards manager in another computer. While compiling basic sketch im getting the below error. How to solve it?

"& was unexpected at this time.

exit status 1
Error compiling for board Generic STM32F103 series."

@fpistm
Copy link
Member

fpistm commented Oct 26, 2018

Hi @Vicky-S
Without more explanation this will be difficult to reproduce as currently all automatic build are ok, so I guess this is an issue with your environment.
Which host OS?
Which Arduino IDE?
Full build log,... (pleas enable the Show verbose output during: "compilation" and the compiler warning "All" in the preferences windows)
All relevant information (build options,...)...

@Vicky-S
Copy link
Author

Vicky-S commented Oct 26, 2018

OS : Windows 10
Arduino IDE : 1.8.7

Verbose Output:
Arduino: 1.8.7 (Windows 10), Board: "Generic STM32F103 series, BluePill F103C8, 64k (default), STLink, Enabled with generic Serial, Smallest (-Os default)"

C:\Program Files\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\Arduino\hardware -hardware C:\Users\R&D\AppData\Local\Arduino15\packages -tools C:\Program Files\Arduino\tools-builder -tools C:\Program Files\Arduino\hardware\tools\avr -tools C:\Users\R&D\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files\Arduino\libraries -libraries C:\Users\R&D\Desktop\LTSketchbook\libraries -fqbn=STM32:stm32:GenF103:pnum=BLUEPILL_F103C8,flash=C8,upload_method=STLinkMethod,xserial=generic,opt=osstd -ide-version=10807 -build-path C:\Users\R&D\AppData\Local\Temp\arduino_build_253507 -warnings=none -build-cache C:\Users\R&D\AppData\Local\Temp\arduino_cache_848226 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\arm-none-eabi-gcc\6-2017-q2-update -prefs=runtime.tools.arm-none-eabi-gcc-6-2017-q2-update.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\arm-none-eabi-gcc\6-2017-q2-update -prefs=runtime.tools.STM32Tools.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\STM32Tools\1.1.0 -prefs=runtime.tools.STM32Tools-1.1.0.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\STM32Tools\1.1.0 -prefs=runtime.tools.CMSIS.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\CMSIS\5.3.0 -prefs=runtime.tools.CMSIS-5.3.0.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\CMSIS\5.3.0 -verbose C:\Users\R&D\Desktop\LTSketchbook\Blink\Blink\Blink.ino
C:\Program Files\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files\Arduino\hardware -hardware C:\Users\R&D\AppData\Local\Arduino15\packages -tools C:\Program Files\Arduino\tools-builder -tools C:\Program Files\Arduino\hardware\tools\avr -tools C:\Users\R&D\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files\Arduino\libraries -libraries C:\Users\R&D\Desktop\LTSketchbook\libraries -fqbn=STM32:stm32:GenF103:pnum=BLUEPILL_F103C8,flash=C8,upload_method=STLinkMethod,xserial=generic,opt=osstd -ide-version=10807 -build-path C:\Users\R&D\AppData\Local\Temp\arduino_build_253507 -warnings=none -build-cache C:\Users\R&D\AppData\Local\Temp\arduino_cache_848226 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\arm-none-eabi-gcc\6-2017-q2-update -prefs=runtime.tools.arm-none-eabi-gcc-6-2017-q2-update.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\arm-none-eabi-gcc\6-2017-q2-update -prefs=runtime.tools.STM32Tools.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\STM32Tools\1.1.0 -prefs=runtime.tools.STM32Tools-1.1.0.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\STM32Tools\1.1.0 -prefs=runtime.tools.CMSIS.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\CMSIS\5.3.0 -prefs=runtime.tools.CMSIS-5.3.0.path=C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\tools\CMSIS\5.3.0 -verbose C:\Users\R&D\Desktop\LTSketchbook\Blink\Blink\Blink.ino
Using board 'GenF103' from platform in folder: C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.3.0
Using core 'arduino' from platform in folder: C:\Users\R&D\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.3.0
Build options changed, rebuilding all
cmd /c if not exist "C:\Users\R&D\Desktop\LTSketchbook\Blink\Blink/build_opt.h" mkdir "C:\Users\R&D\AppData\Local\Temp\arduino_build_253507\sketch" & type NUL > "C:\Users\R&D\AppData\Local\Temp\arduino_build_253507/sketch/build_opt.h"
& was unexpected at this time.

exit status 1
Error compiling for board Generic STM32F103 series.

@fpistm
Copy link
Member

fpistm commented Oct 26, 2018

Thanks for the log.
So issue is linked to your path:
cmd /c if not exist "C:\Users\R&D\Desktop\LTSketchbook\Blink\Blink/build_opt.h" mkdir "C:\Users\R&D\AppData\Local\Temp\arduino_build_253507\sketch" & type NUL > "C:\Users\R&D\AppData\Local\Temp\arduino_build_253507/sketch/build_opt.h"
You have a special char '&' in the path \R&D\ that's why you get this error.
As the path is handled by Arduino ({build.opt.sourcepath}) I think I could not find any generic solution.
I advise you to avoid any special char in path to avoid this kind of issue or if you find a fix to submit a PR.

@Vicky-S
Copy link
Author

Vicky-S commented Oct 27, 2018

ok.

@fpistm
Copy link
Member

fpistm commented Oct 27, 2018

After some check, I could not handle this as this is a limitation of the cmd.exe.

Processing quotation marks

If you specify /c or /k, cmd processes the remainder of String, and quotation marks are preserved only if all of the following conditions are met:

    You do not use /s.
    You use exactly one set of quotation marks.
    You do not use any special characters within the quotation marks (for example: & < > ( ) @ ^ | ).
    You use one or more white-space characters within the quotation marks.
    The String within quotation marks is the name of an executable file.

If the previous conditions are not met, String is processed by examining the first character to verify whether it is an opening quotation mark. If the first character is an opening quotation mark, it is stripped along with the closing quotation mark. Any text following the closing quotation marks is preserved.

So, only way is to avoid & in your path.

@fpistm fpistm self-assigned this Oct 27, 2018
@Vicky-S
Copy link
Author

Vicky-S commented Oct 27, 2018

ok. But I cant rename it. I can change my user name however the path remains same. How to correct this error?

@fpistm
Copy link
Member

fpistm commented Oct 27, 2018

Use the portable feature of arduino by creating a folder named "portable" in the arduino install dir

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