0

I used some code from a github based which is used to handle testing and compiling of code. In it there is an extension to the command available to Ceedling (The test harness that I will be using) which uses Ruby in a file called "rakefile.rb".

I am trying to run the following command:

desc "Convert the output binary to a hex file"
task :convert => :release do
  cmd = "\"C:/Program Files (x86)/Microchip/xc16/v1.23/bin\"\\\\xc16-bin2hex ./build/release/Output.elf -a -omf=elf"
  puts "Generating Output.hex..."
  puts cmd
  sh cmd
end

If I put the code, below, in to my "Start Command Prompt With Ruby" program, then the output is correct and the action is taken:

"C:/Program Files (x86)/Microchip/xc16/v1.23/bin"\\xc16-bin2hex ./build/release/Output.elf -a -omf=elf

If I don't include the \" and the \'s then the program will not work.

At present I get the output:

Generating Output.hex...
"C:/Program Files (x86)/Microchip/xc16/v1.23/bin"\\xc16-bin2hex ./build/release/Output.elf -a -omf=elf
rake aborted!
Command failed with status (127): ["C:/Program Files (x86)/Microchip/xc16/v1....]
rakefile.rb:16:in `block in <top (required)>'
C:/Ruby24-x64/bin/ceedling:23:in `load'
C:/Ruby24-x64/bin/ceedling:23:in `<main>'
Tasks: TOP => convert
(See full trace by running task with --trace)

What am I doing wrong and where can I read more about the basics of Ruby?

8
  • first step would be to run it with the --trace flag as the error message suggests. If I had to guess I'd say it's an issue with the file path and escape characters i.e. forward slashes vs back slashes Commented Jun 7, 2018 at 14:30
  • Shouldn't the file path use backslashes for windows? i.e C:\Program Files (x86)\Microchip\xc16\v1.23\bin Or are you using cygwin or some other unix like terminal? Commented Jun 7, 2018 at 14:33
  • How do i use the trace facility? I have tried Ceedling convert --trace and all the combinations of that but it's not recognized Also using the backslashes makes no difference to the output. I am using Command Prompt with Ruby Commented Jun 7, 2018 at 14:35
  • I'm not sure what Ceedling is, but this looks like a rake task, so I'd use bundle exec rake $your_task_name --trace or drop the bundle exec portion if you aren't using bundler Commented Jun 7, 2018 at 14:38
  • Ceedling does use rake. I get 'exec is not recognized as an internal or external command, operable program or batch file' It can't locate a bundle Commented Jun 7, 2018 at 14:40

1 Answer 1

1

From the error you posted in the chat it looks like the root issue is the rake task not finding sh,
which is an executable that runs a linux shell scripting language.

I'd say the easiest option is to either

  1. install sh on windows via cygwin, mingw or gitbash (see this answer)

    or

  2. Run linux on a vm or container

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.