user23787: I have an arduino code which is working fine. Now I am planning to make a PCB out of it. But I do not want to use the complete Arduino board. I just want to use the Atmega328p microcontroller. So my plan is to connect the USBasp programmer to the new Atmega328p and upload the code. So before this code, do I need to upload the bootloader or uploading the code first will run fine.

user26916: Tools > Burn Bootloader in the Arduino IDE does two things:

Set fuses according to the settings in boards.txt for the Tools > Board selection
Install the bootloader.

The latter is pointless since when you do an Upload Using Programmer the bootloader will be overwritten but the former is very important to do the first time you use a new chip(or anytime you want to change the fuses) to be sure that the correct fuses are set, which likely will be different from the default settings of the chip when you get it. Upload Using Programmer does not set fuses, the only way to do this via the Arduino IDE is Tools > Burn Bootloader.
So yes, you should Burn Bootloader.

23787: <p>I have an arduino code which is working fine. Now I am planning to make a PCB out of it. But I do not want to use the complete Arduino board. I just want to use the <code>Atmega328p</code> microcontroller. So my plan is to connect the USBasp programmer to the new Atmega328p and upload the code. So before this code, do I need to upload the bootloader or uploading the code first will run fine.</p>
 26916: <p><strong>Tools > Burn Bootloader</strong> in the Arduino IDE does two things:</p>

<ul>
<li>Set fuses according to the settings in boards.txt for the <strong>Tools > Board</strong> selection</li>
<li>Install the bootloader.</li>
</ul>

<p>The latter is pointless since when you do an <strong>Upload Using Programmer</strong> the bootloader will be overwritten but the former is very important to do the first time you use a new chip(or anytime you want to change the fuses) to be sure that the correct fuses are set, which likely will be different from the default settings of the chip when you get it. <strong>Upload Using Programmer</strong> does not set fuses, the only way to do this via the Arduino IDE is <strong>Tools > Burn Bootloader</strong>.</p>

<p>So yes, you should Burn Bootloader.</p>
