Parameters for External tools

Go To Last Post
18 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
I am using AS6 with Avrdude as an external programmer. The problem I have is that the IDE does not pass the project variables to the command line.

I call Avrdude with the fallowing parameters (from - Tools-External tools etc)

-c arduino -P com31 -p atmega328p -B 10 -F -U flash:w:$(TargetName).hex:i

I would expect that the $(TartgetName) will insert the correct file name but it is blank. I can chose any of the provided selection and it remains blank.
Is there a setup issue or am I just missing it somewhere?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess there is an issue in Atmel Studio which prevents user from using the default msbuild replacements like $(TargetName), $(TargetDir), etc., when an external tool is added from "Tools -> External Tools -> Arguments"

Issue id in local server AVRSV-2125 for your reference

Regards,
Deena

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Deena,
Hopefully the fix will not involve a complete download again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Hopefully the fix will not involve a complete download again.

Yep, that probably depends on when the issue is fixed viz during a major release or minor release :)

Regards,
Deena

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here is what I use and it works well:

 ... -U flash:w:"$(ProjectDir)Debug\$(ItemFileName).hex":i

Also see this post:

https://www.avrfreaks.net/index.p...

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It in not a bug after all. When I read Larry's reply, I realized there was a problem. Here it is

I called like this:

-c arduino -P com31 -p atmega328p -B 10 -F -U flash:w:$(TargetName).hex:i

And Larry called like this:

flash:w:"$(ProjectDir)Debug\$(ItemFileName).hex":i

Notice the hyphens? :-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

marius@mc wrote:
It in not a bug after all. When I read Larry's reply, I realized there was a problem. Here it is

Sorry marius@mc, even with hyphens your command line does not work. This is a known bug in AS6.

That is "why" I posted my workaround.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Larry,
The strange thing is that it does work for me.

from this
-c arduino -P com31 -p atmega328p -B 10 -F -U flash:w:"$(ProjectDir)Debug\$(ItemFileName).hex":i

I got this

C:\WinAVR\bin\avrdude.exe -c arduino -P com31 -p atmega328p -B 10 -F -U flash:w:"C:\Users\Marius\Documents\Atmel Studio\UsbCnc_328\UsbCnc_328\Debug\UsbCnc_328.hex":i

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bear in mind that $(ItemFileName) may not be the same as your Target File name.

One day, Atmel might implement the macros properly.

Meanwhile it is not impossible to simply add the avrdude command in the 'Post build' command of each project. Or you could browse for the Hex File as part of the 'External Tool' configuration.

Please do not use -F in an avrdude command. It is the electronic equivalent of cutting the end off a condom.
Hey-ho, some people like to live dangerously!

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David,
I did not even notice the -F as I just copied the line from the output of my make file. The make file is normally very specific.
From the IDE this could be mean disaster.

Thanks for noticing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

marius@mc wrote:
@Larry,
The strange thing is that it does work for me.

I thought you were still using this with the hyphens added:

-c arduino -P com31 -p atmega328p -B 10 -F -U flash:w:"$(TargetName).hex":i

TargetName is null/empty when I try to use it.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

larryvc wrote:

I thought you were still using this with the hyphens added:

Larry I am using it with the hyphens. If I don't, the fields are empty.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ypu know guys Im having the same problem and Im wondering how in the world to fix this im using a USB isp its for AVRs but IM still having trouble

Brandon A Whitt

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If it helps, in the past I have used the command:

srec_cat $(MSBuildProjectDirectory)\$(Configuration)\$(Output File Name).hex -intel -fill 0xFF 0x0000 0x37FE --l-e-crc16 0x37FE -o AVRAP001.bin -binary

Forget most of this but note the three $(something)'s in that to actually find the output file name for the build. Now maybe $(TargetName) conglomerates all those things but, then again, maybe it doesn't and I KNOW the abbove three part path/name does work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Newbie here

 I type in the following argument.

 

-C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -p atmega328p -c arduino -P COM9 -b 115200 -U flash:w:"$C:\Users\Jody n John\Documents\Atmel Studio\7.0\GccCppProject1\GccCppProject1\GccCppProject1.hex":i

 and the command 

 

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe

and when I use my external tool I got this error.

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0x1e950f
avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
avrdude.exe: erasing chip
avrdude.exe: reading input file "$C:\Users\JJ\Documents\Atmel Studio\7.0\GccCppProject1\GccCppProject1\GccCppProject1.hex"
avrdude.exe: can't open input file $C:\Users\JJ\Documents\Atmel Studio\7.0\GccCppProject1\GccCppProject1\GccCppProject1.hex: Invalid argument
avrdude.exe: read from file '$C:\Users\JJ\Documents\Atmel Studio\7.0\GccCppProject1\GccCppProject1\GccCppProject1.hex' failed

avrdude.exe: safemode: Fuses OK (H:00, E:00, L:00)

avrdude.exe done.  Thank you.

 

I am not sure what I am missing or type in wrong can someone clue me in.

 Thanks

 JJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you really type in all that gobbledygook?

Life is much easier if you use the macros in AS7 External Tools.
I posted an example recently.

From memory, the early releases of AS6 did not create the $(TargetName) properly.
If you use the Target directory, you solve most of the file path issues. e.g. spaces in path.

The first job is to choose intuitive names for your project(s)

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I read on one website where they said to add all the gobbledygook and thought to try it. Like I said I am new and I thought writing all the extra kind of suck. I will do a search  on here for post about the macros.

 Thanks

 for your reply.

John

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:

Do you really type in all that gobbledygook?

Life is much easier if you use the macros in AS7 External Tools.
I posted an example recently.

 

doratouno wrote:

 I will do a search  on here for post about the macros.

 

I used the approach used in David's example and it worked with Studio 6.2 (Link).