diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/bacnet.ewp b/bacnet-stack/ports/bdk-atxx4-mstp/bacnet.ewp
index 97c41ed8..31b246d2 100644
--- a/bacnet-stack/ports/bdk-atxx4-mstp/bacnet.ewp
+++ b/bacnet-stack/ports/bdk-atxx4-mstp/bacnet.ewp
@@ -123,7 +123,7 @@
@@ -802,7 +802,7 @@
diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/hardware.h b/bacnet-stack/ports/bdk-atxx4-mstp/hardware.h
index 74b4ff83..be86f8d7 100644
--- a/bacnet-stack/ports/bdk-atxx4-mstp/hardware.h
+++ b/bacnet-stack/ports/bdk-atxx4-mstp/hardware.h
@@ -32,8 +32,13 @@
/* IAR compiler specific configuration */
#if defined(__ICCAVR__)
+#if defined(__ATmega644P__)
#include
#endif
+#if defined(__ATmega1284P__)
+#include
+#endif
+#endif
/* AVR-GCC compiler specific configuration */
#if defined(__GNUC__)
diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/iar2gcc.h b/bacnet-stack/ports/bdk-atxx4-mstp/iar2gcc.h
index 0e49077f..a41fadbd 100644
--- a/bacnet-stack/ports/bdk-atxx4-mstp/iar2gcc.h
+++ b/bacnet-stack/ports/bdk-atxx4-mstp/iar2gcc.h
@@ -308,6 +308,28 @@ unsigned char __uint8_eeprom_load(
#define WDTO_2S 7
#endif
+/* power macros in GCC-AVR */
+#if (defined(__ICCAVR__) && (defined(__ATmega644P__))) || \
+ (defined(__CROSSWORKS_AVR) && (__TARGET_PROCESSOR == ATmega644P))
+#define power_adc_enable() (PRR &= (uint8_t)~(1 << PRADC))
+#define power_spi_enable() (PRR &= (uint8_t)~(1 << PRSPI))
+#define power_usart0_enable() (PRR &= (uint8_t)~(1 << PRUSART0))
+#define power_usart1_enable() (PRR &= (uint8_t)~(1 << PRUSART1))
+#define power_timer0_enable() (PRR &= (uint8_t)~(1 << PRTIM0))
+#define power_timer1_enable() (PRR &= (uint8_t)~(1 << PRTIM1))
+#define power_timer2_enable() (PRR &= (uint8_t)~(1 << PRTIM2))
+#endif
+#if (defined(__ICCAVR__) && (defined(__ATmega1284P__))) || \
+ (defined(__CROSSWORKS_AVR) && (__TARGET_PROCESSOR == ATmega1284P))
+#define power_adc_enable() (PRR0 &= (uint8_t)~(1 << PRADC))
+#define power_spi_enable() (PRR0 &= (uint8_t)~(1 << PRSPI))
+#define power_usart0_enable() (PRR0 &= (uint8_t)~(1 << PRUSART0))
+#define power_usart1_enable() (PRR0 &= (uint8_t)~(1 << PRUSART1))
+#define power_timer0_enable() (PRR0 &= (uint8_t)~(1 << PRTIM0))
+#define power_timer1_enable() (PRR0 &= (uint8_t)~(1 << PRTIM1))
+#define power_timer2_enable() (PRR0 &= (uint8_t)~(1 << PRTIM2))
+#endif
+
#if defined(__CROSSWORKS_AVR)
#define inline
#endif