8.3 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 8-2. 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 8-1. Summary of Symbol Settings
SettingM8M16M32M64M128M256M162M169M328PBM168PA
__RAMPZ__NoNoNoNoYesYesNoNoNoNo
__MEMSPM__NoNoNoNoYesNoNoNoNoNo
BOOT_ADDRNoNoNoNo0x1E0000x3E000NoNoNoNo
BOOT_START(IAR)0x18000x38000x70000xE0000x1E0000x3E0000x38000x38000x70000x3800
.text(Atmel Studio)0x18000x38000x70000xE0000x1E0000x3E0000x38000x38000x70000x3800
SPMREG0x370x370x370x370x680x370x370x370x370x37
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.