Author Topic: calling avrdude in a user defined tool  (Read 12477 times)

Offline noobiept

  • Single posting newcomer
  • *
  • Posts: 8
calling avrdude in a user defined tool
« on: July 22, 2011, 11:12:51 pm »
Hello, I'm trying to have a tool that calls avrdude to send the program to the board.

The command parameters I have: -p m328p -c arduino -P /dev/ttyACM0 -U flash:w:${TARGET_OUTPUT_BASENAME}.elf.hex

Is there a macro for the microcontroller? - to have instead of m328p.


Anyway, I already have the tool defined, but I'm having a problem with permissions.

When I call the tool, it tells me that I don't have permissions. Ok, I used to execute this as root in the terminal, but I'm not sure how do I do that here.

I've also tried to add permissions: chmod 777 /dev/ttyACM0 and it works, but when I turn off the board and reconnect it, the permissions I set are lost! I think this is probably how linux works...

any ideas?

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: calling avrdude in a user defined tool
« Reply #1 on: July 22, 2011, 11:48:22 pm »
U can try my modified AVR wizard attached at this post:
http://forums.codeblocks.org/index.php/topic,13616.msg97519.html#msg97519
It saves the avr type to use on the 'tools' commands. U can find information about how to manage this here:
http://forums.codeblocks.org/index.php/topic,13616.msg93862.html#msg93862

Offline noobiept

  • Single posting newcomer
  • *
  • Posts: 8
Re: calling avrdude in a user defined tool
« Reply #2 on: July 23, 2011, 12:55:25 am »
Hey, I don't really know how to add a new template, I tried copying to /usr/share/codeblocks/templates/wizard/ but doesn't show in codeblocks.

Anyway, how would this deal with the permissions problem?

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: calling avrdude in a user defined tool
« Reply #3 on: July 23, 2011, 02:35:32 am »
Right click on the template u want to edit on the new project menu and copy paste the code. That won't deal with the permissions problem, it's out of scope. The new template will make ur tools menu more general like u won't have to change ur mcu type on the 'avrdude' tool command everytime u start a new project. U may need to change other options though. I suggest u read all the topic I gave links.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
Re: calling avrdude in a user defined tool
« Reply #4 on: July 23, 2011, 11:28:53 am »
Anyway, how would this deal with the permissions problem?

Which owner and group has the device (/dev/ttyACM0) ?
If you want to use it as normal user, you have to be member of the appropriate group in almost any cases.

Offline noobiept

  • Single posting newcomer
  • *
  • Posts: 8
Re: calling avrdude in a user defined tool
« Reply #5 on: July 23, 2011, 02:10:26 pm »
Ok, I'll read it with more attention and try it out. thanks!



When I write: ls -l /dev/ttyACM0

I get:
crw-rw---- 1 root dialout 166, 0 2011-07-23 13:02 /dev/ttyACM0

I see that its in the dialout group, and my user is in it too.
If i write: groups username
I'm in : adm dialout cdrom plugdev lpadmin admin sambashare

Offline noobiept

  • Single posting newcomer
  • *
  • Posts: 8
Re: calling avrdude in a user defined tool
« Reply #6 on: July 23, 2011, 02:22:07 pm »
Wait, it is working... I just noticed that on the other computer I have I wasn't in the dialout group like in this one. It works now.

Sorry for the trouble, I'll still try out that template.
thanks!