Protecting AVR from beeing read

I use an USBAsp with Arduino IDE. Can I modify the avrdude.conf so that the lock bits would be programmed together with the skatch. I mean in the memory lock section:

memory "lock"
** size = 1;**
** read = “0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0”,**
** “x x x x x x x x x x o o o o o o”;**
** write = “1 0 1 0 1 1 0 0 1 1 1 x x x x x”,**
** “x x x x x x x x 1 1 i i i i i i”;**
** min_write_delay = 9000;**
** max_write_delay = 9000;**
** ;**

I want to lock the AVR chip to be read from external programmer. I´m using Atmega1284P.

Set the lock bits in the boards.txt file and reburn the bootloader, that should set the lock bits. Or try Nick Gammon's fuse calculator program. http://www.gammon.com.au/forum/?id=11653

I´m not using a bootloader. I´m using USBasp. In boards.txt there´s only options to bootloader.

That’s fine, burn bootloader can be used to just set fuses and lock bits. you can also do it through extreme burner avr with the asp.

You have to set the flash lock bits after you have uploaded your program.

platform.txt about line 88. tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i" "-U lock:w:0x3c:h"

Add the highlighted text to the above line in your platform.txt file. Untested but should work.

Thank you very much. Worked, but I had to change to "-Ulock:w:0x3c:m". BTW, now Platform.txt is located in "C:\Program Files (x86)\Arduino\hardware\arduino\avr" (Arduino 1.6.4). In older version it was located in "...\Sketchbook\Hardware(board)\avr". Is that right?