I have been programming Atmel processors for over 10 years with other development packages and I have all the chip programming tools.
Now is there a way to take an Arduino Uno project and program the hex code into a raw MEGA328 that does not contain the Arduino boot loader? Again I have an official SPI programmer.
I assume just putting a raw MEGA 328 in a Uno board won't work as the boot loader is missing on the raw chip.
And I would rather not have the Arduino boot loader in the final product release.
Yes you can. It is however important that you set the fuses correctly. A raw board 328 runs on an 8 MHz internal crystal, an Uno on a 16MHz external crystal. The easy way is to first burn the Uno bootloader via ICSP; it's a once-off exercise for the board.
Once the fuses are set you can upload the program via ISCP using "upload using programmer" in the IDE; this will wipe the bootloader but will not have an effect on the fuses.
It also should be possible to set the fuses directly while uploading a sketch via ICSP; this can't be done from the IDE but with a correct AVRdude command on the command line. I've never done that.
Yes, you can upload Arduino code to a raw ATMEGA328 using the Arduino IDE using various ICSP programmers. Whether it will work with your particular programmer I don't know but I believe it works with standard ATMEL ICSP programmers. This method does not install a bootloader. The bootloader is only useful if you want to use serial (UART) programming.
What you will need to use is an Arduino "core". A core is a set of libraries/functions which provide the standard Arduino functions like digitalWrite() and millis(). Cores for the common Arduino models like Uno and Nano are pre-installed in the IDE. You will need to install a core for your bare ATMEGA328. I recommend this one:
Yes, just take the .hex file and program into a raw Mega328.
The BOOTRST and IVSEL fuses default to "no bootloader". Application code always starts at 0x0000, so the .hex file generated by the Arduino IDE is compatible. I think the only caveat is that the Arduino will subtract the bootloader size from the Flash size when calculating the size available for the application.
Of course, you need to set other fuses appropriate for your DIY board.
If you don't want to use the IDE for the upload using programmer, you can use Sketch → Export Compiled Binary. In IDE 1.x this will dump the hex file in the sketch directory, in IDE 2.x this will dump it in the build directory in the sketch directory.
I do read all the answers. But different responses here seem to contradict each other. Post# 5, that says just load the .HEX file in the chip and of course set the fuses correctly.
You are suggesting the core package from GIT. So do I need that core package or can I just dump the raw .HEX as suggested in post 5?
Note that I don't need IDE access to the final embedded Mega328. If I need to modify the code I will still use the Uno board and then just reprogram the target 328 with the new hex file.
The "core package" (the correct term is actually "platform") adds support to Arduino IDE for a specific board model or microcontroller. You need an appropriate platform if you want to use Arduino IDE to compile sketches for, or upload to, a given board.
However, if you aren't using Arduino IDE, then the platform is not required.
I am developing the code on an Uno board, using Arduino libraries, and will code and test updates on the Uno as well.
But the final product will not have Arduino support. Just the raw Hex file programmed into a Mega328. But of course that HEX file will need any Arduino libraries included in the binary code, which I assume has to be the case in a HEX file.
I have the Atmel/Intel hardware tools to program Atmel chips in the standard SPI mode. I have developed many projects with another compiler package (ICC AVR) which is just a C compiler that generates HEX files. No interactive IDE per se. So I fully understand the physical HEX file programming procedures.
If you are using Arduino IDE for that purpose, you need to have an appropriate platform installed.
You can use Arduino IDE's "Upload Using Programmer" feature to flash the hex file to the board using the programmer if you like. In this case, you need to have an appropriate platform installed.
Or you can use some other tool (e.g., AVRDUDE) to program the chip directly instead of using Arduino IDE. In this case, an Arduino boards platform is not relevant.