Atmel Studio and IAR Settings

The common settings for Atmel Studio and IARâ„¢ will be listed in this section.

  1. The essential fuse settings:
    1. The boot reset vector must be enabled.
    2. Set Low Fuse Byte to use External Clock @ 16 MHz to make the ATmega328PB example (BAUD RATE 38400) download from Atmel START work properly.
  2. The SPMCSR register address has to be defined using SPMREG (refer to the table below) macro in reg.h file, this register address will change if the register is located in the indirect memory region, the address of this register can be found in the register summary section of the data sheet.
    Figure 1. Setting SPMREG Address in reg.h
  3. Other register addresses defined in reg.h file have to be modified according to the device data sheet.
  4. Symbol __RAMPZ__ (refer to the table below) has to be defined in compiler and assembler for the devices with flash size greater than 64 KB.
  5. Symbol __MEMSPM__ (refer to the table below) has to be defined in assembler for the devices whose SPMCSR register is located above the direct memory access region (i.e. if SPMCSR register is located above 0x3F). For e.g. ATmega128 has SPMCSR located at 0x68 and hence the definition is required for accessing it.
  6. Symbol BOOT_ADDR=<bootloader section start address> (refer to the table below) has to be defined in the compiler for the devices with flash size greater than 64 KB.
Table 1. Summary of Symbol Settings
Setting M8 M16 M32 M64 M128 M256 M162 M169 M328PB M168PA
__RAMPZ__ No No No No Yes Yes No No No No
__MEMSPM__ No No No No Yes No No No No No
BOOT_ADDR No No No No 0x1E000 0x3E000 No No No No
BOOT_START(IAR) 0x1800 0x3800 0x7000 0xE000 0x1E000 0x3E000 0x3800 0x3800 0x7000 0x3800
.text(Atmel Studio) 0x1800 0x3800 0x7000 0xE000 0x1E000 0x3E000 0x3800 0x3800 0x7000 0x3800
SPMREG 0x37 0x37 0x37 0x37 0x68 0x37 0x37 0x37 0x37 0x37
Note: The value of BOOT_ADDR,BOOT_START and .text in the table above is the value when the boot size is maximum. You can change this value according to the actual boot size.