7bnx / Cortex-Builder

Write, Build, Debug for ARM cortex in Visual Studio Code
MIT License
3 stars 2 forks source link

Unable to write under Win10 #2

Open zilion2000 opened 3 years ago

zilion2000 commented 3 years ago

Works fine without this commands at the end: " & echo. & echo Done" Write command throws this error below:

> Executing task in folder Cortex-Builder: openocd -f C:\ProgramData\chocolatey\lib\openocd\tools\OpenOCD-20190828-0.10.0\share\openocd\scripts\interface\stlink.cfg -f C:\ProgramData\chocolatey\lib\openocd\tools\OpenOCD-20190828-0.10.0\share\openocd\scripts\target\stm32f1x.cfg -c "init; reset halt; flash write_image erase output/Cortex-Builder.hex; reset; exit" & echo. & echo Done < At line:1 char:328 + ... _image erase output/Cortex-Builder.hex; reset; exit & echo. & echo Do ... + ~ The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : AmpersandNotAllowed The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command openocd -f C:\ProgramData\chocolatey\lib\openocd\tools\OpenOCD-20190828-0.10.0\share\openocd\scripts\interface\stlink.cfg -f C:\ProgramData\chocolatey\lib\openocd\tools\OpenOCD-20190828-0.10.0\share\openocd\scripts\target\stm32f1x.cfg -c "init; reset halt; flash write_image erase output/Cortex-Builder.hex; reset; exit" & echo. & echo Done" terminated with exit code: 1.

Where I can remove this?

zilion2000 commented 3 years ago

Found this in TerminalCommands: const _windowsEchoEnd = " & echo. & echo Done";

This is causing the problem.

zilion2000 commented 3 years ago

Also I have problem with invoking openocd. It runs fine under powershell, but in your plugin it's executed like this:

Executing task in folder Cortex-Builder: openocd -f C:\ProgramData\chocolatey\lib\openocd\tools\OpenOCD-20190828-0.10.0\share\openocd\scripts\interface\stlink.cfg -f C:\ProgramData\chocolatey\lib\openocd\tools\OpenOCD-20190828-0.10.0\share\openocd\scripts\target\stm32f1x.cfg -c "program output/Cortex-Builder.elf verify reset exit" <

Open On-Chip Debugger 0.10.0 (2019-08-28) [https://github.com/sysprogs/openocd] Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Unexpected command line argument: output/Cortex-Builder.elf The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command openocd -f C:\ProgramData\chocolatey\lib\openocd\tools\OpenOCD-20190828-0.10.0\share\openocd\scripts\interface\stlink.cfg -f C:\ProgramData\chocolatey\lib\openocd\tools\OpenOCD-20190828-0.10.0\share\openocd\scripts\target\stm32f1x.cfg -c "program output/Cortex-Builder.elf verify reset exit"" terminated with exit code: 1.

It would be fine without "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command", but I don't know yet where to remove this.

7bnx commented 3 years ago

Hi! Thanks for feedback.

I decided to force command execution, like write, reset, via Cmd.exe, not user defined shell(powershell and etc).

Hope it will help.

zilion2000 commented 3 years ago

Well, I don't like it :) Now your extension is Windows specific again. May I propose you another approach: please make Flash, Reset and Erase in Makefile and then invoke them like "make flash"? If openocd is defined in PATH, and $(OCD_INTERFACE) and $(OCD_TARGET) is put by your extension, then all will be system independent.

Example:

flash: all openocd -f $(OCD_INTERFACE) -f $(OCD_TARGET) -c "program $(OUTPUT_PATH)/$(TARGET).hex verify reset exit"

7bnx commented 3 years ago

Sounds good. I will try to implement it in the future.