From a4d2ee307c4eeae5f5e57f76481f279895f9457d Mon Sep 17 00:00:00 2001
From: BytesGalore <Martin.Landsmann@HAW-Hamburg.de>
Date: Mon, 13 Oct 2014 10:53:20 +0200
Subject: [PATCH] cpu: added `extern "C"` to headers

---
 cpu/arm7_common/include/VIC.h                    |  2 +-
 cpu/arm7_common/include/arm7_common.h            |  2 +-
 cpu/arm7_common/include/hwtimer_cpu.h            |  2 +-
 cpu/arm7_common/include/iap.h                    |  2 +-
 cpu/atmega2560/include/cpu-conf.h                |  7 +++++++
 cpu/atmega2560/include/hwtimer_cpu.h             |  8 ++++++++
 cpu/atmega_common/avr-libc-extra/time.h          |  8 ++++----
 cpu/atmega_common/include/cpu.h                  |  8 ++++++++
 cpu/atmega_common/include/sys/time.h             |  8 ++++++++
 cpu/atmega_common/include/sys/types.h            |  8 ++++++++
 cpu/cc430/include/cc430-adc.h                    |  8 ++++++++
 cpu/cc430/include/cc430-rtc.h                    |  7 +++++++
 cpu/cortex-m0_common/include/core_cm0.h          |  8 ++++++++
 cpu/cortex-m0_common/include/core_cm0plus.h      |  8 ++++++++
 cpu/cortex-m0_common/include/core_cmFunc.h       |  6 ++++++
 cpu/cortex-m0_common/include/core_cmInstr.h      |  7 +++++++
 cpu/cortex-m0_common/include/cpu.h               |  9 +++++++++
 cpu/cortex-m3_common/include/core_cm3.h          |  8 ++++++++
 cpu/cortex-m3_common/include/core_cmFunc.h       |  6 ++++++
 cpu/cortex-m3_common/include/core_cmInstr.h      |  7 +++++++
 cpu/cortex-m3_common/include/cpu.h               |  8 ++++++++
 cpu/cortex-m4_common/include/core_cm4.h          |  8 ++++++++
 cpu/cortex-m4_common/include/core_cmFunc.h       |  6 ++++++
 cpu/cortex-m4_common/include/core_cmInstr.h      |  7 +++++++
 cpu/cortex-m4_common/include/cpu.h               |  9 +++++++++
 cpu/lpc1768/include/LPC17xx.h                    |  6 ++++++
 cpu/lpc2387/include/cpu-conf.h                   |  7 +++++++
 cpu/lpc2387/include/cpu.h                        |  8 ++++++++
 cpu/lpc2387/include/i2c.h                        |  8 ++++++++
 cpu/lpc2387/include/lpc2387-adc.h                |  8 ++++++++
 cpu/lpc2387/include/lpc2387-rtc.h                |  8 ++++++++
 cpu/lpc2387/include/lpc2387.h                    |  8 ++++++++
 cpu/lpc2387/include/lpc23xx.h                    |  7 +++++++
 cpu/mc1322x/asm/include/asm.h                    |  8 ++++++++
 cpu/mc1322x/include/cpu-conf.h                   |  8 ++++++++
 cpu/mc1322x/include/cpu.h                        |  8 ++++++++
 cpu/mc1322x/include/gpio.h                       |  8 ++++++++
 cpu/mc1322x/include/mc1322x.h                    | 10 ++++++++--
 cpu/mc1322x/maca/include/maca.h                  |  7 +++++++
 cpu/mc1322x/maca/include/maca_packet.h           |  8 ++++++++
 cpu/msp430-common/include/cpu-conf.h             |  8 ++++++++
 cpu/msp430-common/include/cpu.h                  |  8 ++++++++
 cpu/msp430-common/include/hwtimer_cpu.h          |  8 ++++++++
 cpu/msp430-common/include/msp430_types.h         |  8 ++++++++
 cpu/msp430-common/include/sys/time.h             |  8 ++++++++
 cpu/msp430-common/include/time.h                 |  8 ++++++++
 cpu/native/include/clang_compat.h                |  8 ++++++++
 cpu/native/include/cpu-conf.h                    |  8 ++++++++
 cpu/native/include/cpu.h                         |  8 ++++++++
 cpu/native/include/hwtimer_cpu.h                 |  8 ++++++++
 cpu/native/include/native_internal.h             |  7 +++++++
 cpu/native/include/nativenet.h                   | 10 ++++++++++
 cpu/native/include/nativenet_internal.h          |  9 +++++++++
 cpu/native/include/tap.h                         |  8 ++++++++
 cpu/nrf51822/include/cpu-conf.h                  |  8 ++++++++
 cpu/nrf51822/include/hwtimer_cpu.h               |  7 +++++++
 cpu/nrf51822/include/nrf51.h                     |  7 +++++++
 cpu/nrf51822/include/nrf51_bitfields.h           |  7 +++++++
 cpu/sam3x8e/include/component/component_adc.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_can.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_chipid.h |  7 +++++++
 cpu/sam3x8e/include/component/component_dacc.h   |  7 +++++++
 cpu/sam3x8e/include/component/component_dmac.h   |  7 +++++++
 cpu/sam3x8e/include/component/component_efc.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_emac.h   |  7 +++++++
 cpu/sam3x8e/include/component/component_gpbr.h   |  7 +++++++
 cpu/sam3x8e/include/component/component_hsmci.h  |  7 +++++++
 cpu/sam3x8e/include/component/component_matrix.h |  7 +++++++
 cpu/sam3x8e/include/component/component_pdc.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_pio.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_pmc.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_pwm.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_rstc.h   |  7 +++++++
 cpu/sam3x8e/include/component/component_rtc.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_rtt.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_sdramc.h |  7 +++++++
 cpu/sam3x8e/include/component/component_smc.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_spi.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_ssc.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_supc.h   |  7 +++++++
 cpu/sam3x8e/include/component/component_tc.h     |  7 +++++++
 cpu/sam3x8e/include/component/component_trng.h   |  7 +++++++
 cpu/sam3x8e/include/component/component_twi.h    |  7 +++++++
 cpu/sam3x8e/include/component/component_uart.h   |  7 +++++++
 cpu/sam3x8e/include/component/component_uotghs.h |  7 +++++++
 cpu/sam3x8e/include/component/component_usart.h  |  7 +++++++
 cpu/sam3x8e/include/component/component_wdt.h    |  7 +++++++
 cpu/sam3x8e/include/cpu-conf.h                   |  6 ++++++
 cpu/sam3x8e/include/hwtimer_cpu.h                |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_adc.h      |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_can0.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_can1.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_chipid.h   |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_dacc.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_dmac.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_efc0.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_efc1.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_emac.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_gpbr.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_hsmci.h    |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_matrix.h   |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_pioa.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_piob.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_pioc.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_piod.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_pioe.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_piof.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_pmc.h      |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_pwm.h      |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_rstc.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_rtc.h      |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_rtt.h      |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_sdramc.h   |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_smc.h      |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_spi0.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_spi1.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_ssc.h      |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_supc.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_tc0.h      |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_tc1.h      |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_tc2.h      |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_trng.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_twi0.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_twi1.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_uart.h     |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_uotghs.h   |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_usart0.h   |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_usart1.h   |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_usart2.h   |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_usart3.h   |  8 ++++++++
 cpu/sam3x8e/include/instance/instance_wdt.h      |  8 ++++++++
 cpu/sam3x8e/include/pio/pio_sam3x8e.h            |  8 ++++++++
 cpu/sam3x8e/include/sam3x8e.h                    |  9 ++++-----
 cpu/sam3x8e/include/system_sam3xa.h              |  7 ++++---
 cpu/samd21/include/component/component_ac.h      |  8 ++++++++
 cpu/samd21/include/component/component_adc.h     |  8 ++++++++
 cpu/samd21/include/component/component_dac.h     |  8 ++++++++
 cpu/samd21/include/component/component_dmac.h    |  8 ++++++++
 cpu/samd21/include/component/component_dsu.h     |  8 ++++++++
 cpu/samd21/include/component/component_eic.h     |  8 ++++++++
 cpu/samd21/include/component/component_evsys.h   |  8 ++++++++
 cpu/samd21/include/component/component_gclk.h    |  8 ++++++++
 cpu/samd21/include/component/component_i2s.h     |  8 ++++++++
 cpu/samd21/include/component/component_mtb.h     |  8 ++++++++
 cpu/samd21/include/component/component_nvmctrl.h |  8 ++++++++
 cpu/samd21/include/component/component_pac.h     |  8 ++++++++
 cpu/samd21/include/component/component_pm.h      |  8 ++++++++
 cpu/samd21/include/component/component_port.h    |  8 ++++++++
 cpu/samd21/include/component/component_rfctrl.h  |  8 ++++++++
 cpu/samd21/include/component/component_rtc.h     |  8 ++++++++
 cpu/samd21/include/component/component_sercom.h  |  8 ++++++++
 cpu/samd21/include/component/component_sysctrl.h |  8 ++++++++
 cpu/samd21/include/component/component_tc.h      |  8 ++++++++
 cpu/samd21/include/component/component_tcc.h     |  8 ++++++++
 cpu/samd21/include/component/component_usb.h     |  8 ++++++++
 cpu/samd21/include/component/component_wdt.h     |  8 ++++++++
 cpu/samd21/include/cpu-conf.h                    |  6 ++++++
 cpu/samd21/include/hwtimer_cpu.h                 |  7 +++++++
 cpu/samd21/include/instance/instance_ac.h        |  8 ++++++++
 cpu/samd21/include/instance/instance_adc.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_dac.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_dmac.h      |  8 ++++++++
 cpu/samd21/include/instance/instance_dsu.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_eic.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_evsys.h     |  8 ++++++++
 cpu/samd21/include/instance/instance_gclk.h      |  8 ++++++++
 cpu/samd21/include/instance/instance_i2s.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_mtb.h       |  7 +++++++
 cpu/samd21/include/instance/instance_nvmctrl.h   |  8 ++++++++
 cpu/samd21/include/instance/instance_pac0.h      |  8 ++++++++
 cpu/samd21/include/instance/instance_pac1.h      |  8 ++++++++
 cpu/samd21/include/instance/instance_pac2.h      |  8 ++++++++
 cpu/samd21/include/instance/instance_pm.h        |  8 ++++++++
 cpu/samd21/include/instance/instance_port.h      |  8 ++++++++
 cpu/samd21/include/instance/instance_rfctrl.h    |  8 ++++++++
 cpu/samd21/include/instance/instance_rtc.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_sercom0.h   |  8 ++++++++
 cpu/samd21/include/instance/instance_sercom1.h   |  8 ++++++++
 cpu/samd21/include/instance/instance_sercom2.h   |  8 ++++++++
 cpu/samd21/include/instance/instance_sercom3.h   |  8 ++++++++
 cpu/samd21/include/instance/instance_sercom4.h   |  8 ++++++++
 cpu/samd21/include/instance/instance_sercom5.h   |  8 ++++++++
 cpu/samd21/include/instance/instance_sysctrl.h   |  8 ++++++++
 cpu/samd21/include/instance/instance_tc3.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_tc4.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_tc5.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_tc6.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_tc7.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_tcc0.h      |  8 ++++++++
 cpu/samd21/include/instance/instance_tcc1.h      |  8 ++++++++
 cpu/samd21/include/instance/instance_tcc2.h      |  8 ++++++++
 cpu/samd21/include/instance/instance_usb.h       |  8 ++++++++
 cpu/samd21/include/instance/instance_wdt.h       |  8 ++++++++
 cpu/samd21/include/pio/pio_samr21g18a.h          |  8 ++++++++
 cpu/samd21/include/samd21.h                      | 14 +++++++-------
 cpu/stm32f0/include/cpu-conf.h                   |  7 +++++++
 cpu/stm32f0/include/hwtimer_cpu.h                |  8 ++++++++
 cpu/stm32f1/include/cpu-conf.h                   |  8 ++++++++
 cpu/stm32f1/include/hwtimer_cpu.h                |  8 ++++++++
 cpu/stm32f1/include/stm32f10x.h                  | 16 ++++++++++++++++
 cpu/stm32f3/include/cpu-conf.h                   |  8 ++++++++
 cpu/stm32f3/include/hwtimer_cpu.h                |  8 ++++++++
 cpu/stm32f4/include/cpu-conf.h                   |  8 ++++++++
 cpu/stm32f4/include/hwtimer_cpu.h                |  8 ++++++++
 cpu/x86/include/cpu.h                            |  8 ++++++++
 cpu/x86/include/hwtimer_cpu.h                    |  8 ++++++++
 cpu/x86/include/ucontext.h                       |  8 ++++++++
 cpu/x86/include/x86_cmos.h                       |  8 ++++++++
 cpu/x86/include/x86_hwtimer.h                    |  8 ++++++++
 cpu/x86/include/x86_interrupts.h                 |  8 ++++++++
 cpu/x86/include/x86_kernel_memory.h              |  8 ++++++++
 cpu/x86/include/x86_memory.h                     |  8 ++++++++
 cpu/x86/include/x86_pci.h                        |  8 ++++++++
 cpu/x86/include/x86_pci_init.h                   |  8 ++++++++
 cpu/x86/include/x86_pci_strings.h                |  8 ++++++++
 cpu/x86/include/x86_pic.h                        |  8 ++++++++
 cpu/x86/include/x86_pit.h                        |  8 ++++++++
 cpu/x86/include/x86_ports.h                      |  8 ++++++++
 cpu/x86/include/x86_reboot.h                     |  8 ++++++++
 cpu/x86/include/x86_registers.h                  |  8 ++++++++
 cpu/x86/include/x86_rtc.h                        |  8 ++++++++
 cpu/x86/include/x86_threading.h                  |  8 ++++++++
 cpu/x86/include/x86_uart.h                       |  8 ++++++++
 cpu/x86/include/x86_videoram.h                   |  8 ++++++++
 224 files changed, 1708 insertions(+), 25 deletions(-)

diff --git a/cpu/arm7_common/include/VIC.h b/cpu/arm7_common/include/VIC.h
index 8299e4a812..f293f7d4f2 100644
--- a/cpu/arm7_common/include/VIC.h
+++ b/cpu/arm7_common/include/VIC.h
@@ -9,7 +9,7 @@
 #define __ARM_COMMON_H
 
 #ifdef __cplusplus
- extern "C" {
+extern "C" {
 #endif
 
 /**
diff --git a/cpu/arm7_common/include/arm7_common.h b/cpu/arm7_common/include/arm7_common.h
index 7dca2e89fa..6f2379d545 100644
--- a/cpu/arm7_common/include/arm7_common.h
+++ b/cpu/arm7_common/include/arm7_common.h
@@ -27,7 +27,7 @@
 #include "bitarithm.h"
 
 #ifdef __cplusplus
- extern "C" {
+extern "C" {
 #endif
 
 /**
diff --git a/cpu/arm7_common/include/hwtimer_cpu.h b/cpu/arm7_common/include/hwtimer_cpu.h
index 780db3d0ca..8e1d3eb792 100644
--- a/cpu/arm7_common/include/hwtimer_cpu.h
+++ b/cpu/arm7_common/include/hwtimer_cpu.h
@@ -20,7 +20,7 @@
 #define HWTIMER_CPU_H_
 
 #ifdef __cplusplus
- extern "C" {
+extern "C" {
 #endif
 
 #define HWTIMER_MAXTIMERS 4
diff --git a/cpu/arm7_common/include/iap.h b/cpu/arm7_common/include/iap.h
index 217157ccd1..0995908dae 100644
--- a/cpu/arm7_common/include/iap.h
+++ b/cpu/arm7_common/include/iap.h
@@ -12,7 +12,7 @@
 #include <stdint.h>
 
 #ifdef __cplusplus
- extern "C" {
+extern "C" {
 #endif
 
 /* IAP-Commands  */
diff --git a/cpu/atmega2560/include/cpu-conf.h b/cpu/atmega2560/include/cpu-conf.h
index d5f9b0f9c1..4e92af4c7a 100644
--- a/cpu/atmega2560/include/cpu-conf.h
+++ b/cpu/atmega2560/include/cpu-conf.h
@@ -20,6 +20,9 @@
 #define __CPU_CONF_H
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @name Kernel configuration
@@ -48,5 +51,9 @@
 #endif
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CPU_CONF_H */
 /** @} */
diff --git a/cpu/atmega2560/include/hwtimer_cpu.h b/cpu/atmega2560/include/hwtimer_cpu.h
index ed88022c03..8dc7dd8a11 100644
--- a/cpu/atmega2560/include/hwtimer_cpu.h
+++ b/cpu/atmega2560/include/hwtimer_cpu.h
@@ -19,6 +19,10 @@
 #ifndef __HWTIMER_CPU_H
 #define __HWTIMER_CPU_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Hardware timer configuration
  * @{
@@ -28,5 +32,9 @@
 #define HWTIMER_MAXTICKS    (0xFFFF)    /**< 16-bit timer */
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __HWTIMER_CPU_H */
 /** @} */
diff --git a/cpu/atmega_common/avr-libc-extra/time.h b/cpu/atmega_common/avr-libc-extra/time.h
index 8cab93208a..8dc096c382 100644
--- a/cpu/atmega_common/avr-libc-extra/time.h
+++ b/cpu/atmega_common/avr-libc-extra/time.h
@@ -101,13 +101,13 @@
 #ifndef TIME_H
 #define TIME_H
 
-#ifdef __cplusplus
-extern          "C" {
-#endif
-
 #include <inttypes.h>
 #include <stdlib.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
     /** \ingroup avr_time */
     /* @{ */
 
diff --git a/cpu/atmega_common/include/cpu.h b/cpu/atmega_common/include/cpu.h
index 4bae2e1b09..7716a86934 100644
--- a/cpu/atmega_common/include/cpu.h
+++ b/cpu/atmega_common/include/cpu.h
@@ -33,6 +33,11 @@
  * TODO: remove once core was adjusted
  */
 #include "irq.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define eINT            enableIRQ
 #define dINT            disableIRQ
 
@@ -41,6 +46,9 @@
  */
 void cpu_init(void);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __ATMEGA_COMMON_H */
 /** @} */
diff --git a/cpu/atmega_common/include/sys/time.h b/cpu/atmega_common/include/sys/time.h
index db422d78fa..2958d697f8 100644
--- a/cpu/atmega_common/include/sys/time.h
+++ b/cpu/atmega_common/include/sys/time.h
@@ -9,7 +9,15 @@
 
 #include <sys/types.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct timeval {
     time_t         tv_sec;
     suseconds_t    tv_usec;
 };
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/cpu/atmega_common/include/sys/types.h b/cpu/atmega_common/include/sys/types.h
index 42b4c964f6..f3786cbdb7 100644
--- a/cpu/atmega_common/include/sys/types.h
+++ b/cpu/atmega_common/include/sys/types.h
@@ -12,7 +12,15 @@
 #ifndef AVR_TYPES_H
 #define AVR_TYPES_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef int16_t suseconds_t;
 typedef signed int ssize_t;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* ifndef AVR_TYPES_H */
diff --git a/cpu/cc430/include/cc430-adc.h b/cpu/cc430/include/cc430-adc.h
index 1e0e33f52d..cd01612da3 100644
--- a/cpu/cc430/include/cc430-adc.h
+++ b/cpu/cc430/include/cc430-adc.h
@@ -36,9 +36,17 @@
 #ifndef CC430_ADC_H
 #define CC430_ADC_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern uint16_t adc12_single_conversion(uint16_t ref, uint16_t sht, uint16_t channel);
 
 extern uint16_t adc12_result;
 extern uint8_t  adc12_data_ready;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/cpu/cc430/include/cc430-rtc.h b/cpu/cc430/include/cc430-rtc.h
index 3fd9af7a89..ead80ecefb 100644
--- a/cpu/cc430/include/cc430-rtc.h
+++ b/cpu/cc430/include/cc430-rtc.h
@@ -11,6 +11,10 @@
 #include "rtc.h"
 #include "time.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @ingroup     cc430
  */
@@ -52,5 +56,8 @@ void rtc_set_alarm(struct tm *localti, rtc_alarm_mask_t mask);
  */
 void rtc_remove_alarm(void);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
diff --git a/cpu/cortex-m0_common/include/core_cm0.h b/cpu/cortex-m0_common/include/core_cm0.h
index 1b6b54ef44..cb809423ac 100644
--- a/cpu/cortex-m0_common/include/core_cm0.h
+++ b/cpu/cortex-m0_common/include/core_cm0.h
@@ -123,10 +123,18 @@
   #endif
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #include <stdint.h>                      /* standard types definitions                      */
 #include <core_cmInstr.h>                /* Core Instruction Access                         */
 #include <core_cmFunc.h>                 /* Core Function Access                            */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #endif /* __CORE_CM0_H_GENERIC */
 
 #ifndef __CMSIS_GENERIC
diff --git a/cpu/cortex-m0_common/include/core_cm0plus.h b/cpu/cortex-m0_common/include/core_cm0plus.h
index a135574deb..d948786fba 100644
--- a/cpu/cortex-m0_common/include/core_cm0plus.h
+++ b/cpu/cortex-m0_common/include/core_cm0plus.h
@@ -107,10 +107,18 @@
   #endif
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #include <stdint.h>                      /* standard types definitions                      */
 #include <core_cmInstr.h>                /* Core Instruction Access                         */
 #include <core_cmFunc.h>                 /* Core Function Access                            */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #endif /* __CORE_CM0PLUS_H_GENERIC */
 
 #ifndef __CMSIS_GENERIC
diff --git a/cpu/cortex-m0_common/include/core_cmFunc.h b/cpu/cortex-m0_common/include/core_cmFunc.h
index b4495de3c7..4da273e71a 100644
--- a/cpu/cortex-m0_common/include/core_cmFunc.h
+++ b/cpu/cortex-m0_common/include/core_cmFunc.h
@@ -23,6 +23,9 @@
 #ifndef __CORE_CMFUNC_H
 #define __CORE_CMFUNC_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* ###########################  Core Function Access  ########################### */
 /** \ingroup  CMSIS_Core_FunctionInterface   
@@ -604,5 +607,8 @@ __attribute__( ( always_inline ) ) static __INLINE void __set_FPSCR(uint32_t fps
 
 /*@} end of CMSIS_Core_RegAccFunctions */
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __CORE_CMFUNC_H */
diff --git a/cpu/cortex-m0_common/include/core_cmInstr.h b/cpu/cortex-m0_common/include/core_cmInstr.h
index 40ec15e180..267b43f89e 100644
--- a/cpu/cortex-m0_common/include/core_cmInstr.h
+++ b/cpu/cortex-m0_common/include/core_cmInstr.h
@@ -23,6 +23,9 @@
 #ifndef __CORE_CMINSTR_H
 #define __CORE_CMINSTR_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* ##########################  Core Instruction Access  ######################### */
 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
@@ -581,4 +584,8 @@ __attribute__( ( always_inline ) ) static __INLINE uint8_t __CLZ(uint32_t value)
 
 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CORE_CMINSTR_H */
diff --git a/cpu/cortex-m0_common/include/cpu.h b/cpu/cortex-m0_common/include/cpu.h
index 6f4e0c1048..824b8ec8cf 100644
--- a/cpu/cortex-m0_common/include/cpu.h
+++ b/cpu/cortex-m0_common/include/cpu.h
@@ -33,6 +33,11 @@
  * TODO: remove once core was adjusted
  */
 #include "irq.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define eINT            enableIRQ
 #define dINT            disableIRQ
 
@@ -41,5 +46,9 @@
  */
 void cpu_init(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CPU_H */
 /** @} */
diff --git a/cpu/cortex-m3_common/include/core_cm3.h b/cpu/cortex-m3_common/include/core_cm3.h
index 484909b53d..a7435ddff6 100644
--- a/cpu/cortex-m3_common/include/core_cm3.h
+++ b/cpu/cortex-m3_common/include/core_cm3.h
@@ -117,10 +117,18 @@
     /* add preprocessor checks */
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #include <stdint.h>                      /*!< standard types definitions                      */
 #include "core_cmInstr.h"                /*!< Core Instruction Access                         */
 #include "core_cmFunc.h"                 /*!< Core Function Access                            */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #endif /* __CORE_CM3_H_GENERIC */
 
 #ifndef __CMSIS_GENERIC
diff --git a/cpu/cortex-m3_common/include/core_cmFunc.h b/cpu/cortex-m3_common/include/core_cmFunc.h
index 85818e7b77..df6c42a0ab 100644
--- a/cpu/cortex-m3_common/include/core_cmFunc.h
+++ b/cpu/cortex-m3_common/include/core_cmFunc.h
@@ -23,6 +23,9 @@
 #ifndef __CORE_CMFUNC_H
 #define __CORE_CMFUNC_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* ###########################  Core Function Access  ########################### */
 /** \ingroup  CMSIS_Core_FunctionInterface
@@ -604,5 +607,8 @@ __attribute__( ( always_inline ) ) static __INLINE void __set_FPSCR(uint32_t fps
 
 /*@} end of CMSIS_Core_RegAccFunctions */
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __CORE_CMFUNC_H */
diff --git a/cpu/cortex-m3_common/include/core_cmInstr.h b/cpu/cortex-m3_common/include/core_cmInstr.h
index 7163acd2ef..960aa760bd 100644
--- a/cpu/cortex-m3_common/include/core_cmInstr.h
+++ b/cpu/cortex-m3_common/include/core_cmInstr.h
@@ -23,6 +23,9 @@
 #ifndef __CORE_CMINSTR_H
 #define __CORE_CMINSTR_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* ##########################  Core Instruction Access  ######################### */
 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
@@ -581,4 +584,8 @@ __attribute__( ( always_inline ) ) static __INLINE uint8_t __CLZ(uint32_t value)
 
 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CORE_CMINSTR_H */
diff --git a/cpu/cortex-m3_common/include/cpu.h b/cpu/cortex-m3_common/include/cpu.h
index d3155c0e09..8fe47d80d8 100644
--- a/cpu/cortex-m3_common/include/cpu.h
+++ b/cpu/cortex-m3_common/include/cpu.h
@@ -30,6 +30,11 @@
  * TODO: remove once core was adjusted
  */
 #include "irq.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define eINT            enableIRQ
 #define dINT            disableIRQ
 
@@ -38,6 +43,9 @@
  */
 void cpu_init(void);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __CORTEXM_COMMON_H */
 /** @} */
diff --git a/cpu/cortex-m4_common/include/core_cm4.h b/cpu/cortex-m4_common/include/core_cm4.h
index 2c8b0882c3..7be7902249 100644
--- a/cpu/cortex-m4_common/include/core_cm4.h
+++ b/cpu/cortex-m4_common/include/core_cm4.h
@@ -165,11 +165,19 @@
   #endif
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #include <stdint.h>                      /* standard types definitions                      */
 #include <core_cmInstr.h>                /* Core Instruction Access                         */
 #include <core_cmFunc.h>                 /* Core Function Access                            */
 #include <core_cm4_simd.h>               /* Compiler specific SIMD Intrinsics               */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #endif /* __CORE_CM4_H_GENERIC */
 
 #ifndef __CMSIS_GENERIC
diff --git a/cpu/cortex-m4_common/include/core_cmFunc.h b/cpu/cortex-m4_common/include/core_cmFunc.h
index b4495de3c7..4da273e71a 100644
--- a/cpu/cortex-m4_common/include/core_cmFunc.h
+++ b/cpu/cortex-m4_common/include/core_cmFunc.h
@@ -23,6 +23,9 @@
 #ifndef __CORE_CMFUNC_H
 #define __CORE_CMFUNC_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* ###########################  Core Function Access  ########################### */
 /** \ingroup  CMSIS_Core_FunctionInterface   
@@ -604,5 +607,8 @@ __attribute__( ( always_inline ) ) static __INLINE void __set_FPSCR(uint32_t fps
 
 /*@} end of CMSIS_Core_RegAccFunctions */
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __CORE_CMFUNC_H */
diff --git a/cpu/cortex-m4_common/include/core_cmInstr.h b/cpu/cortex-m4_common/include/core_cmInstr.h
index 40ec15e180..267b43f89e 100644
--- a/cpu/cortex-m4_common/include/core_cmInstr.h
+++ b/cpu/cortex-m4_common/include/core_cmInstr.h
@@ -23,6 +23,9 @@
 #ifndef __CORE_CMINSTR_H
 #define __CORE_CMINSTR_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* ##########################  Core Instruction Access  ######################### */
 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
@@ -581,4 +584,8 @@ __attribute__( ( always_inline ) ) static __INLINE uint8_t __CLZ(uint32_t value)
 
 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CORE_CMINSTR_H */
diff --git a/cpu/cortex-m4_common/include/cpu.h b/cpu/cortex-m4_common/include/cpu.h
index 3cb02b6d18..031e900c3c 100644
--- a/cpu/cortex-m4_common/include/cpu.h
+++ b/cpu/cortex-m4_common/include/cpu.h
@@ -32,6 +32,11 @@
  * TODO: remove once core was adjusted
  */
 #include "irq.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define eINT            enableIRQ
 #define dINT            disableIRQ
 
@@ -40,5 +45,9 @@
  */
 void cpu_init(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CORTEXM_COMMON_H */
 /** @} */
diff --git a/cpu/lpc1768/include/LPC17xx.h b/cpu/lpc1768/include/LPC17xx.h
index 497e7a8e4b..7c37e28a72 100644
--- a/cpu/lpc1768/include/LPC17xx.h
+++ b/cpu/lpc1768/include/LPC17xx.h
@@ -98,9 +98,15 @@ typedef enum IRQn
 #define __NVIC_PRIO_BITS          5         /*!< Number of Bits used for Priority Levels          */
 #define __Vendor_SysTickConfig    0         /*!< Set to 1 if different SysTick Config is used     */
 
+#ifdef __cplusplus
+}
+#endif
 
 #include "core_cm3.h"                       /* Cortex-M3 processor and core peripherals           */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /******************************************************************************/
 /*                Device Specific Peripheral registers structures             */
diff --git a/cpu/lpc2387/include/cpu-conf.h b/cpu/lpc2387/include/cpu-conf.h
index 60cfd7ef71..16745eb743 100644
--- a/cpu/lpc2387/include/cpu-conf.h
+++ b/cpu/lpc2387/include/cpu-conf.h
@@ -10,6 +10,10 @@
 #ifndef CPUCONF_H_
 #define CPUCONF_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @ingroup     conf
  * @ingroup     lpc2387
@@ -66,6 +70,9 @@
 #define UART0_BUFSIZE                   (128)
 #endif
 
+#ifdef __cplusplus
+}
+#endif
 
 /** @} */
 #endif /* CPUCONF_H_ */
diff --git a/cpu/lpc2387/include/cpu.h b/cpu/lpc2387/include/cpu.h
index b4d2565a1e..5c7fcf417a 100644
--- a/cpu/lpc2387/include/cpu.h
+++ b/cpu/lpc2387/include/cpu.h
@@ -20,10 +20,18 @@
 #include "lpc2387.h"
 #include "arm_cpu.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern uintptr_t __stack_start;     ///< end of user stack memory space
 
 void lpc2387_pclk_scale(uint32_t source, uint32_t target, uint32_t *pclksel, uint32_t *prescale);
 bool install_irq(int IntNumber, void (*HandlerAddr)(void), int Priority);
 
+#ifdef __cplusplus
+}
+#endif
+
 /** @} */
 #endif /* __CPU_H */
diff --git a/cpu/lpc2387/include/i2c.h b/cpu/lpc2387/include/i2c.h
index bbd4a61f25..c7e4aaaa65 100644
--- a/cpu/lpc2387/include/i2c.h
+++ b/cpu/lpc2387/include/i2c.h
@@ -34,6 +34,10 @@
 #include <stdbool.h>
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define I2C_BUFSIZE             0x23
 #define MAX_TIMEOUT             0x00FFFFFF
 
@@ -326,4 +330,8 @@ void i2c_enable_pull_up_resistor(uint8_t i2c_interface);
  */
 void i2c_disable_pull_up_resistor(uint8_t i2c_interface);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* end __I2C_H */
diff --git a/cpu/lpc2387/include/lpc2387-adc.h b/cpu/lpc2387/include/lpc2387-adc.h
index 9de97e3102..7c289d5cef 100644
--- a/cpu/lpc2387/include/lpc2387-adc.h
+++ b/cpu/lpc2387/include/lpc2387-adc.h
@@ -29,6 +29,10 @@
 #include <stdint.h>
 #include "adc_legacy.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define ADC_NUM                  (6)
 #define ADC_OFFSET            (0x10)
 #define ADC_INDEX                (4)
@@ -42,5 +46,9 @@
 void adc_init_1(void);
 void adc_init_2(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 /** @} */
 #endif /* LPC2387ADC_H_ */
diff --git a/cpu/lpc2387/include/lpc2387-rtc.h b/cpu/lpc2387/include/lpc2387-rtc.h
index 71da66ba69..d0ca6f8d51 100644
--- a/cpu/lpc2387/include/lpc2387-rtc.h
+++ b/cpu/lpc2387/include/lpc2387-rtc.h
@@ -35,6 +35,10 @@
 #include "rtc.h"
 #include "lpc2387.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ------------------------------------------------------------------------- */
 /**
  * @name LPC2387 RTC Compile-Time Configuration
@@ -104,5 +108,9 @@ void rtc_set_alarm(struct tm *localt, enum rtc_alarm_mask mask);
  */
 enum rtc_alarm_mask _rtc_get_alarm(struct tm *localt);
 
+#ifdef __cplusplus
+}
+#endif
+
 /** @} */
 #endif /* end __RTC_H */
diff --git a/cpu/lpc2387/include/lpc2387.h b/cpu/lpc2387/include/lpc2387.h
index 4e3c651a0d..d9ddfc840f 100644
--- a/cpu/lpc2387/include/lpc2387.h
+++ b/cpu/lpc2387/include/lpc2387.h
@@ -14,6 +14,10 @@
 #include "lpc23xx.h"
 #include "bitarithm.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define F_CCO                   288000000
 #define CL_CPU_DIV              4                                   ///< CPU clock divider
 #define F_CPU                   (F_CCO / CL_CPU_DIV)                ///< CPU target speed in Hz
@@ -208,4 +212,8 @@
 /** @} */
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif // __LPC2387_H
diff --git a/cpu/lpc2387/include/lpc23xx.h b/cpu/lpc2387/include/lpc23xx.h
index b1d1c019e5..b6de1a990f 100644
--- a/cpu/lpc2387/include/lpc23xx.h
+++ b/cpu/lpc2387/include/lpc23xx.h
@@ -15,6 +15,10 @@
 #ifndef __LPC23xx_H
 #define __LPC23xx_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Vectored Interrupt Controller (VIC) */
 #define VIC_BASE_ADDR   0xFFFFF000
 #define VICIRQStatus   (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x000))
@@ -1126,5 +1130,8 @@ with the spec. update in USB Device Section. */
 #define MAC_POWERDOWN       (*(volatile unsigned long *)(MAC_BASE_ADDR + 0xFF4)) /* Power-down reg */
 #define MAC_MODULEID        (*(volatile unsigned long *)(MAC_BASE_ADDR + 0xFFC)) /* Module ID reg (RO) */
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif  // __LPC23xx_H
diff --git a/cpu/mc1322x/asm/include/asm.h b/cpu/mc1322x/asm/include/asm.h
index 07a1fcfdec..db69eef9ce 100644
--- a/cpu/mc1322x/asm/include/asm.h
+++ b/cpu/mc1322x/asm/include/asm.h
@@ -12,6 +12,10 @@
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define ASM_BASE_ADDRESS 0x80008000
 
 struct ASM_struct {
@@ -100,4 +104,8 @@ void asm_ctr_cbc_mac_init(asm_keys_t *keys);
 void asm_ctr_cbc_mac_update(asm_data_t *data, asm_ctr_t *ctr);
 void asm_ctr_cbc_mac_finish(asm_data_t *data);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* ASM_H */
diff --git a/cpu/mc1322x/include/cpu-conf.h b/cpu/mc1322x/include/cpu-conf.h
index 70737d62bd..28c966f1b5 100644
--- a/cpu/mc1322x/include/cpu-conf.h
+++ b/cpu/mc1322x/include/cpu-conf.h
@@ -10,6 +10,10 @@
 #ifndef CPUCONF_H_
 #define CPUCONF_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @ingroup     conf
  * @ingroup     mc1322x
@@ -63,5 +67,9 @@
 #define UART0_BUFSIZE                   (64)
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 /** @} */
 #endif /* CPUCONF_H_ */
diff --git a/cpu/mc1322x/include/cpu.h b/cpu/mc1322x/include/cpu.h
index 8e27c7a870..cb1f9bafcc 100644
--- a/cpu/mc1322x/include/cpu.h
+++ b/cpu/mc1322x/include/cpu.h
@@ -26,8 +26,16 @@
 #include "arm_cpu.h"
 #include "mc1322x.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern uintptr_t __stack_start;     ///< end of user stack memory space
 bool install_irq(int int_number, void *handler_addr, int priority);
 
+#ifdef __cplusplus
+}
+#endif
+
 /** @} */
 #endif /* CPU_H */
diff --git a/cpu/mc1322x/include/gpio.h b/cpu/mc1322x/include/gpio.h
index 26cd66a239..ec022b150e 100644
--- a/cpu/mc1322x/include/gpio.h
+++ b/cpu/mc1322x/include/gpio.h
@@ -13,6 +13,10 @@
 // TODO: why do we need to include this for macro expansion?
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Structure-based GPIO access
    Example usage:
 
@@ -155,4 +159,8 @@ enum { _REP(0,0) };
 
 static volatile struct GPIO_struct * const GPIO = (void *) (0x80000000);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/cpu/mc1322x/include/mc1322x.h b/cpu/mc1322x/include/mc1322x.h
index 5b794a3d6b..82003d0268 100644
--- a/cpu/mc1322x/include/mc1322x.h
+++ b/cpu/mc1322x/include/mc1322x.h
@@ -12,6 +12,10 @@
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*-----------------------------------------------------------------*/
 /* System Management */
 #define SW_RST_VAL       (0x87651234)
@@ -303,8 +307,6 @@ static volatile struct TMR_struct * const TMR3 = (void *) (TMR3_BASE);
 /* Interrupts */
 #define INTBASE        (0x80020000)
 
-#include <stdint.h>
-
 /* Structure-based ITC access */
 #define __INTERRUPT_union(x)              \
                 union {                   \
@@ -442,4 +444,8 @@ extern void adc_isr(void) __attribute__((weak));
 
 extern void spi_isr(void) __attribute__((weak));
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* MC1322X_H */
diff --git a/cpu/mc1322x/maca/include/maca.h b/cpu/mc1322x/maca/include/maca.h
index 6b788d911d..c296438238 100644
--- a/cpu/mc1322x/maca/include/maca.h
+++ b/cpu/mc1322x/maca/include/maca.h
@@ -15,6 +15,10 @@
 
 #include "maca_packet.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*********************************************************/
 /* function definitions                                  */
 /*********************************************************/
@@ -530,5 +534,8 @@ static volatile struct MACA_struct * const MACA = (void *) (MACA_BASE_ADDRESS +
 #define MACA_TMRDIS_SFTOFF_ABORT 1
 
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif // MACA_H_
diff --git a/cpu/mc1322x/maca/include/maca_packet.h b/cpu/mc1322x/maca/include/maca_packet.h
index c1429c253a..092a93c8ec 100644
--- a/cpu/mc1322x/maca/include/maca_packet.h
+++ b/cpu/mc1322x/maca/include/maca_packet.h
@@ -12,6 +12,10 @@
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* does not include 2 byte FCS checksum */
 #ifndef MACA_MAX_PAYLOAD_SIZE
 #define MACA_MAX_PAYLOAD_SIZE 125
@@ -40,4 +44,8 @@ struct packet {
 };
 typedef struct packet maca_packet_t;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/cpu/msp430-common/include/cpu-conf.h b/cpu/msp430-common/include/cpu-conf.h
index 8ca97d1113..5a86a00438 100644
--- a/cpu/msp430-common/include/cpu-conf.h
+++ b/cpu/msp430-common/include/cpu-conf.h
@@ -9,6 +9,10 @@
 #ifndef CPUCONF_H_
 #define CPUCONF_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Kernel configuration
  * @{
@@ -36,4 +40,8 @@
 #endif
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* CPUCONF_H_ */
diff --git a/cpu/msp430-common/include/cpu.h b/cpu/msp430-common/include/cpu.h
index c2c8fef269..8611bb2cd4 100644
--- a/cpu/msp430-common/include/cpu.h
+++ b/cpu/msp430-common/include/cpu.h
@@ -31,6 +31,10 @@
 #include "msp430_types.h"
 #include "cpu-conf.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define WORDSIZE 16
 
 extern volatile int __inISR;
@@ -135,5 +139,9 @@ int inISR(void);
 
 void msp430_cpu_init(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 /** @} */
 #endif // _CPU_H
diff --git a/cpu/msp430-common/include/hwtimer_cpu.h b/cpu/msp430-common/include/hwtimer_cpu.h
index 934d219515..0aed689a2d 100644
--- a/cpu/msp430-common/include/hwtimer_cpu.h
+++ b/cpu/msp430-common/include/hwtimer_cpu.h
@@ -13,6 +13,10 @@
 
 #include "cpu.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef __MSP430_HAS_TA2__
 #define HWTIMER_MAXTIMERS 2
 #endif
@@ -32,4 +36,8 @@
 #define HWTIMER_SPEED  (F_RC_OSCILLATOR)
 #define HWTIMER_MAXTICKS (0xFFFFFFFF)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif // __HWTIMER_CPU_H
diff --git a/cpu/msp430-common/include/msp430_types.h b/cpu/msp430-common/include/msp430_types.h
index 839bfd5cb6..9bd0840f6a 100644
--- a/cpu/msp430-common/include/msp430_types.h
+++ b/cpu/msp430-common/include/msp430_types.h
@@ -15,6 +15,10 @@
 /** defining signed type for size_t */
 #include "kernel_types.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifndef EINVAL
 /**
  * @brief defines EINVAL if MSP430 toolchain is too old to provide it itself
@@ -47,4 +51,8 @@ struct timeval {
 /* TODO: remove once msp430 libc supports clockid_t */
 typedef int clockid_t;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* MSP430_TYPES_H */
diff --git a/cpu/msp430-common/include/sys/time.h b/cpu/msp430-common/include/sys/time.h
index 5bd63aed7b..9b0e16573a 100644
--- a/cpu/msp430-common/include/sys/time.h
+++ b/cpu/msp430-common/include/sys/time.h
@@ -11,4 +11,12 @@
 
 #include "msp430_types.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* TIME_H */
diff --git a/cpu/msp430-common/include/time.h b/cpu/msp430-common/include/time.h
index 6eaf10ab73..a2479934e3 100644
--- a/cpu/msp430-common/include/time.h
+++ b/cpu/msp430-common/include/time.h
@@ -9,6 +9,10 @@
 #ifndef MSPGCC_TIME_H
 #define MSPGCC_TIME_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct tm {
     int tm_sec;                   /* Seconds after the minute [0, 60] */
     int tm_min;                   /* Minutes after the hour [0, 59] */
@@ -21,4 +25,8 @@ struct tm {
     int tm_isdst;                 /* Daylight saving time is in effect */
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/cpu/native/include/clang_compat.h b/cpu/native/include/clang_compat.h
index 95faa44403..1459d3a16b 100644
--- a/cpu/native/include/clang_compat.h
+++ b/cpu/native/include/clang_compat.h
@@ -10,6 +10,10 @@
 
 #ifndef __CLANG_COMPAT_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #undef HTONS
 #undef HTONL
 #undef HTONLL
@@ -17,4 +21,8 @@
 #undef NTOHL
 #undef NTOHLL
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/cpu/native/include/cpu-conf.h b/cpu/native/include/cpu-conf.h
index b9d580da2d..3cf26d05e6 100644
--- a/cpu/native/include/cpu-conf.h
+++ b/cpu/native/include/cpu-conf.h
@@ -16,6 +16,10 @@
 #ifndef CPUCONF_H_
 #define CPUCONF_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* TODO: tighten stack sizes */
 #ifdef __MACH__ /* OSX */
 #define KERNEL_CONF_STACKSIZE_DEFAULT       (163840)
@@ -64,4 +68,8 @@
 #define CPUID_ID_LEN                    (4)
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* CPUCONF_H_ */
diff --git a/cpu/native/include/cpu.h b/cpu/native/include/cpu.h
index 14be112dbe..734a09e8d2 100644
--- a/cpu/native/include/cpu.h
+++ b/cpu/native/include/cpu.h
@@ -20,9 +20,17 @@
 #ifndef _CPU_H
 #define _CPU_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* TODO: remove once these have been removed from RIOT: */
 void dINT(void);
 void eINT(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 /** @} */
 #endif //_CPU_H
diff --git a/cpu/native/include/hwtimer_cpu.h b/cpu/native/include/hwtimer_cpu.h
index ea9c7e6309..5960884d02 100644
--- a/cpu/native/include/hwtimer_cpu.h
+++ b/cpu/native/include/hwtimer_cpu.h
@@ -17,8 +17,16 @@
 #ifndef HWTIMER_CPU_H_
 #define HWTIMER_CPU_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define HWTIMER_MAXTIMERS 4
 #define HWTIMER_SPEED 1000000
 #define HWTIMER_MAXTICKS (0xFFFFFFFF)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* HWTIMER_CPU_H_ */
diff --git a/cpu/native/include/native_internal.h b/cpu/native/include/native_internal.h
index 2bbfc5746d..edc3c46e4d 100644
--- a/cpu/native/include/native_internal.h
+++ b/cpu/native/include/native_internal.h
@@ -47,6 +47,9 @@
 
 #include "kernel_types.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * Prototype for native's internal callbacks
@@ -146,6 +149,10 @@ int unregister_interrupt(int sig);
 
 //#include <sys/param.h>
 
+#ifdef __cplusplus
+}
+#endif
+
 #include "kernel_internal.h"
 #include "sched.h"
 
diff --git a/cpu/native/include/nativenet.h b/cpu/native/include/nativenet.h
index e4d462c787..d7909fc074 100644
--- a/cpu/native/include/nativenet.h
+++ b/cpu/native/include/nativenet.h
@@ -42,6 +42,11 @@
 
 #ifndef NATIVE_MAX_DATA_LENGTH
 #include "tap.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef MODULE_SIXLOWPAN
 #define NATIVE_MAX_DATA_LENGTH (127)
 #else
@@ -155,5 +160,10 @@ uint16_t nativenet_get_pan(void);
  * Enable transceiver rx mode
  */
 void nativenet_switch_to_rx(void);
+
+#ifdef __cplusplus
+}
+#endif
+
 /** @} */
 #endif /* NATIVENET_H */
diff --git a/cpu/native/include/nativenet_internal.h b/cpu/native/include/nativenet_internal.h
index 4e10c8c065..04a072d5cb 100644
--- a/cpu/native/include/nativenet_internal.h
+++ b/cpu/native/include/nativenet_internal.h
@@ -19,6 +19,10 @@
 
 #include "tap.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define NNEV_PWRDWN     0x01
 #define NNEV_PWRUP      0x02
 #define NNEV_MONITOR    0x03
@@ -97,4 +101,9 @@ extern _nativenet_netdev_more_t _nativenet_default_dev_more;
 
 void _nativenet_handle_packet(radio_packet_t *packet);
 int8_t send_buf(radio_packet_t *packet);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* NATIVENET_INTERNAL_H */
diff --git a/cpu/native/include/tap.h b/cpu/native/include/tap.h
index 662d623484..0d44548dcc 100644
--- a/cpu/native/include/tap.h
+++ b/cpu/native/include/tap.h
@@ -21,6 +21,10 @@
 #include "board.h"
 #include "radio/types.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * create and/or open tap device "name"
  *
@@ -55,4 +59,8 @@ union eth_frame {
     unsigned char buffer[ETHER_MAX_LEN];
 } __attribute__((packed));
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _TAP_H */
diff --git a/cpu/nrf51822/include/cpu-conf.h b/cpu/nrf51822/include/cpu-conf.h
index 0765828c67..51cbd3bbbd 100644
--- a/cpu/nrf51822/include/cpu-conf.h
+++ b/cpu/nrf51822/include/cpu-conf.h
@@ -22,6 +22,10 @@
 #include "nrf51.h"
 #include "nrf51_bitfields.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Kernel configuration
  * @{
@@ -51,5 +55,9 @@
  */
 #define CPUID_ID_LEN                    (8)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CPU_CONF_H */
 /** @} */
diff --git a/cpu/nrf51822/include/hwtimer_cpu.h b/cpu/nrf51822/include/hwtimer_cpu.h
index 75c085b58a..428521f859 100644
--- a/cpu/nrf51822/include/hwtimer_cpu.h
+++ b/cpu/nrf51822/include/hwtimer_cpu.h
@@ -19,6 +19,10 @@
 #ifndef __HWTIMER_CPU_H
 #define __HWTIMER_CPU_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Hardware timer configuration
  * @{
@@ -29,6 +33,9 @@
 #define HWTIMER_MAXTICKS    (0xFFFFFF)      /**< 24-bit timer -> see PAN note */
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __HWTIMER_CPU_H */
 /** @} */
diff --git a/cpu/nrf51822/include/nrf51.h b/cpu/nrf51822/include/nrf51.h
index cb7fedfc4f..ebd6ec0567 100644
--- a/cpu/nrf51822/include/nrf51.h
+++ b/cpu/nrf51822/include/nrf51.h
@@ -116,8 +116,15 @@ typedef enum {
 #define __Vendor_SysTickConfig         0            /*!< Set to 1 if different SysTick Config is used                          */
 /** @} */ /* End of group Configuration_of_CMSIS */
 
+#ifdef __cplusplus
+}
+#endif
+
 #include <core_cm0.h>                               /*!< Cortex-M0 processor and core peripherals                              */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* ================================================================================ */
 /* ================       Device Specific Peripheral Section       ================ */
diff --git a/cpu/nrf51822/include/nrf51_bitfields.h b/cpu/nrf51822/include/nrf51_bitfields.h
index 75ed114e7a..25c9b5b889 100644
--- a/cpu/nrf51822/include/nrf51_bitfields.h
+++ b/cpu/nrf51822/include/nrf51_bitfields.h
@@ -34,6 +34,10 @@
 
 #include <core_cm0.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Peripheral: AAR */
 /* Description: Accelerated Address Resolver. */
 
@@ -6889,6 +6893,9 @@
 #define WDT_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */
 #define WDT_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */
 
+#ifdef __cplusplus
+}
+#endif
 
 /*lint --flb "Leave library region" */
 #endif
diff --git a/cpu/sam3x8e/include/component/component_adc.h b/cpu/sam3x8e/include/component/component_adc.h
index 7921ea6fe5..f8446e731a 100644
--- a/cpu/sam3x8e/include/component/component_adc.h
+++ b/cpu/sam3x8e/include/component/component_adc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_ADC_COMPONENT_
 #define _SAM3XA_ADC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Analog-to-digital Converter */
 /* ============================================================================= */
@@ -501,5 +505,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_ADC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_can.h b/cpu/sam3x8e/include/component/component_can.h
index 547e875a1e..0430683716 100644
--- a/cpu/sam3x8e/include/component/component_can.h
+++ b/cpu/sam3x8e/include/component/component_can.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_CAN_COMPONENT_
 #define _SAM3XA_CAN_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Controller Area Network */
 /* ============================================================================= */
@@ -295,5 +299,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_CAN_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_chipid.h b/cpu/sam3x8e/include/component/component_chipid.h
index 30f9aa667b..afa8b83689 100644
--- a/cpu/sam3x8e/include/component/component_chipid.h
+++ b/cpu/sam3x8e/include/component/component_chipid.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_CHIPID_COMPONENT_
 #define _SAM3XA_CHIPID_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Chip Identifier */
 /* ============================================================================= */
@@ -156,5 +160,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_CHIPID_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_dacc.h b/cpu/sam3x8e/include/component/component_dacc.h
index 59e93a8991..5200cb9ce3 100644
--- a/cpu/sam3x8e/include/component/component_dacc.h
+++ b/cpu/sam3x8e/include/component/component_dacc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_DACC_COMPONENT_
 #define _SAM3XA_DACC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Digital-to-Analog Converter Controller */
 /* ============================================================================= */
@@ -207,5 +211,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_DACC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_dmac.h b/cpu/sam3x8e/include/component/component_dmac.h
index 0549f8f90a..bd022eb075 100644
--- a/cpu/sam3x8e/include/component/component_dmac.h
+++ b/cpu/sam3x8e/include/component/component_dmac.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_DMAC_COMPONENT_
 #define _SAM3XA_DMAC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR DMA Controller */
 /* ============================================================================= */
@@ -364,5 +368,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_DMAC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_efc.h b/cpu/sam3x8e/include/component/component_efc.h
index bcc6161980..7843dd15b1 100644
--- a/cpu/sam3x8e/include/component/component_efc.h
+++ b/cpu/sam3x8e/include/component/component_efc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_EFC_COMPONENT_
 #define _SAM3XA_EFC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Embedded Flash Controller */
 /* ============================================================================= */
@@ -73,5 +77,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_EFC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_emac.h b/cpu/sam3x8e/include/component/component_emac.h
index b3325aefd4..d609545839 100644
--- a/cpu/sam3x8e/include/component/component_emac.h
+++ b/cpu/sam3x8e/include/component/component_emac.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_EMAC_COMPONENT_
 #define _SAM3XA_EMAC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Ethernet MAC 10/100 */
 /* ============================================================================= */
@@ -332,5 +336,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_EMAC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_gpbr.h b/cpu/sam3x8e/include/component/component_gpbr.h
index 8c75f61569..d66cbbe2da 100644
--- a/cpu/sam3x8e/include/component/component_gpbr.h
+++ b/cpu/sam3x8e/include/component/component_gpbr.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_GPBR_COMPONENT_
 #define _SAM3XA_GPBR_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR General Purpose Backup Register */
 /* ============================================================================= */
@@ -50,5 +54,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_GPBR_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_hsmci.h b/cpu/sam3x8e/include/component/component_hsmci.h
index 084ed9db4a..2d9f4d28cd 100644
--- a/cpu/sam3x8e/include/component/component_hsmci.h
+++ b/cpu/sam3x8e/include/component/component_hsmci.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_HSMCI_COMPONENT_
 #define _SAM3XA_HSMCI_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR High Speed MultiMedia Card Interface */
 /* ============================================================================= */
@@ -338,5 +342,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_HSMCI_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_matrix.h b/cpu/sam3x8e/include/component/component_matrix.h
index bc18f55260..970e7ad6c7 100644
--- a/cpu/sam3x8e/include/component/component_matrix.h
+++ b/cpu/sam3x8e/include/component/component_matrix.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_MATRIX_COMPONENT_
 #define _SAM3XA_MATRIX_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR AHB Bus Matrix */
 /* ============================================================================= */
@@ -282,5 +286,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_MATRIX_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_pdc.h b/cpu/sam3x8e/include/component/component_pdc.h
index b497b437a0..a67016ff36 100644
--- a/cpu/sam3x8e/include/component/component_pdc.h
+++ b/cpu/sam3x8e/include/component/component_pdc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PDC_COMPONENT_
 #define _SAM3XA_PDC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Peripheral DMA Controller */
 /* ============================================================================= */
@@ -95,5 +99,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_PDC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_pio.h b/cpu/sam3x8e/include/component/component_pio.h
index 4a2453af26..3c056b26c0 100644
--- a/cpu/sam3x8e/include/component/component_pio.h
+++ b/cpu/sam3x8e/include/component/component_pio.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PIO_COMPONENT_
 #define _SAM3XA_PIO_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Parallel Input/Output Controller */
 /* ============================================================================= */
@@ -1432,5 +1436,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_PIO_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_pmc.h b/cpu/sam3x8e/include/component/component_pmc.h
index b75c031e97..02fa575bf2 100644
--- a/cpu/sam3x8e/include/component/component_pmc.h
+++ b/cpu/sam3x8e/include/component/component_pmc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PMC_COMPONENT_
 #define _SAM3XA_PMC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Power Management Controller */
 /* ============================================================================= */
@@ -413,5 +417,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_PMC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_pwm.h b/cpu/sam3x8e/include/component/component_pwm.h
index 6e5e37f1d2..83958e880e 100644
--- a/cpu/sam3x8e/include/component/component_pwm.h
+++ b/cpu/sam3x8e/include/component/component_pwm.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PWM_COMPONENT_
 #define _SAM3XA_PWM_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller */
 /* ============================================================================= */
@@ -664,5 +668,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_PWM_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_rstc.h b/cpu/sam3x8e/include/component/component_rstc.h
index 16f5a39428..c9c103b955 100644
--- a/cpu/sam3x8e/include/component/component_rstc.h
+++ b/cpu/sam3x8e/include/component/component_rstc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_RSTC_COMPONENT_
 #define _SAM3XA_RSTC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Reset Controller */
 /* ============================================================================= */
@@ -70,5 +74,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_RSTC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_rtc.h b/cpu/sam3x8e/include/component/component_rtc.h
index cd56f8344a..307dc868ce 100644
--- a/cpu/sam3x8e/include/component/component_rtc.h
+++ b/cpu/sam3x8e/include/component/component_rtc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_RTC_COMPONENT_
 #define _SAM3XA_RTC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Real-time Clock */
 /* ============================================================================= */
@@ -165,5 +169,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_RTC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_rtt.h b/cpu/sam3x8e/include/component/component_rtt.h
index 9f6a8a1c56..40200d9adf 100644
--- a/cpu/sam3x8e/include/component/component_rtt.h
+++ b/cpu/sam3x8e/include/component/component_rtt.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_RTT_COMPONENT_
 #define _SAM3XA_RTT_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Real-time Timer */
 /* ============================================================================= */
@@ -66,5 +70,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_RTT_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_sdramc.h b/cpu/sam3x8e/include/component/component_sdramc.h
index 41c8d83f98..2d53882b4a 100644
--- a/cpu/sam3x8e/include/component/component_sdramc.h
+++ b/cpu/sam3x8e/include/component/component_sdramc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SDRAMC_COMPONENT_
 #define _SAM3XA_SDRAMC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR SDRAM Controller */
 /* ============================================================================= */
@@ -185,5 +189,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_SDRAMC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_smc.h b/cpu/sam3x8e/include/component/component_smc.h
index 9d60410444..d6f15314f9 100644
--- a/cpu/sam3x8e/include/component/component_smc.h
+++ b/cpu/sam3x8e/include/component/component_smc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SMC_COMPONENT_
 #define _SAM3XA_SMC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Static Memory Controller */
 /* ============================================================================= */
@@ -481,5 +485,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_SMC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_spi.h b/cpu/sam3x8e/include/component/component_spi.h
index f52009bb12..d2c189c204 100644
--- a/cpu/sam3x8e/include/component/component_spi.h
+++ b/cpu/sam3x8e/include/component/component_spi.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SPI_COMPONENT_
 #define _SAM3XA_SPI_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Serial Peripheral Interface */
 /* ============================================================================= */
@@ -156,5 +160,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_SPI_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_ssc.h b/cpu/sam3x8e/include/component/component_ssc.h
index 87730406cd..ed6f939ce8 100644
--- a/cpu/sam3x8e/include/component/component_ssc.h
+++ b/cpu/sam3x8e/include/component/component_ssc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SSC_COMPONENT_
 #define _SAM3XA_SSC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Synchronous Serial Controller */
 /* ============================================================================= */
@@ -267,5 +271,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_SSC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_supc.h b/cpu/sam3x8e/include/component/component_supc.h
index ce8b126ff9..a5d5093446 100644
--- a/cpu/sam3x8e/include/component/component_supc.h
+++ b/cpu/sam3x8e/include/component/component_supc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SUPC_COMPONENT_
 #define _SAM3XA_SUPC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Supply Controller */
 /* ============================================================================= */
@@ -309,5 +313,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_SUPC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_tc.h b/cpu/sam3x8e/include/component/component_tc.h
index 6feae004b7..d40dfdf720 100644
--- a/cpu/sam3x8e/include/component/component_tc.h
+++ b/cpu/sam3x8e/include/component/component_tc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_TC_COMPONENT_
 #define _SAM3XA_TC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Timer Counter */
 /* ============================================================================= */
@@ -300,5 +304,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_TC_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_trng.h b/cpu/sam3x8e/include/component/component_trng.h
index ec59ccb01d..cb89d342b9 100644
--- a/cpu/sam3x8e/include/component/component_trng.h
+++ b/cpu/sam3x8e/include/component/component_trng.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_TRNG_COMPONENT_
 #define _SAM3XA_TRNG_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR True Random Number Generator */
 /* ============================================================================= */
@@ -69,5 +73,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_TRNG_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_twi.h b/cpu/sam3x8e/include/component/component_twi.h
index 03bb3d3af9..f5b8e59216 100644
--- a/cpu/sam3x8e/include/component/component_twi.h
+++ b/cpu/sam3x8e/include/component/component_twi.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_TWI_COMPONENT_
 #define _SAM3XA_TWI_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Two-wire Interface */
 /* ============================================================================= */
@@ -214,5 +218,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_TWI_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_uart.h b/cpu/sam3x8e/include/component/component_uart.h
index af1d6d2cdf..34f63612b5 100644
--- a/cpu/sam3x8e/include/component/component_uart.h
+++ b/cpu/sam3x8e/include/component/component_uart.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_UART_COMPONENT_
 #define _SAM3XA_UART_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Universal Asynchronous Receiver Transmitter */
 /* ============================================================================= */
@@ -182,5 +186,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_UART_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_uotghs.h b/cpu/sam3x8e/include/component/component_uotghs.h
index f8ce058972..7b13dbb584 100644
--- a/cpu/sam3x8e/include/component/component_uotghs.h
+++ b/cpu/sam3x8e/include/component/component_uotghs.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_UOTGHS_COMPONENT_
 #define _SAM3XA_UOTGHS_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR USB On-The-Go Interface */
 /* ============================================================================= */
@@ -935,5 +939,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_UOTGHS_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_usart.h b/cpu/sam3x8e/include/component/component_usart.h
index fe4e086721..175e1336dc 100644
--- a/cpu/sam3x8e/include/component/component_usart.h
+++ b/cpu/sam3x8e/include/component/component_usart.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_USART_COMPONENT_
 #define _SAM3XA_USART_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Universal Synchronous Asynchronous Receiver Transmitter */
 /* ============================================================================= */
@@ -393,5 +397,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_USART_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/component/component_wdt.h b/cpu/sam3x8e/include/component/component_wdt.h
index 2536edbe8b..82840229cb 100644
--- a/cpu/sam3x8e/include/component/component_wdt.h
+++ b/cpu/sam3x8e/include/component/component_wdt.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_WDT_COMPONENT_
 #define _SAM3XA_WDT_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ============================================================================= */
 /**  SOFTWARE API DEFINITION FOR Watchdog Timer */
 /* ============================================================================= */
@@ -69,5 +73,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAM3XA_WDT_COMPONENT_ */
diff --git a/cpu/sam3x8e/include/cpu-conf.h b/cpu/sam3x8e/include/cpu-conf.h
index a67eebf8e9..70c774f9cb 100644
--- a/cpu/sam3x8e/include/cpu-conf.h
+++ b/cpu/sam3x8e/include/cpu-conf.h
@@ -20,6 +20,9 @@
 
 #include "sam3x8e.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @name Kernel configuration
@@ -47,6 +50,9 @@
 #endif
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __CPU_CONF_H */
 /** @} */
diff --git a/cpu/sam3x8e/include/hwtimer_cpu.h b/cpu/sam3x8e/include/hwtimer_cpu.h
index 1661393653..8d021ef10b 100644
--- a/cpu/sam3x8e/include/hwtimer_cpu.h
+++ b/cpu/sam3x8e/include/hwtimer_cpu.h
@@ -19,6 +19,10 @@
 #ifndef __HWTIMER_CPU_H
 #define __HWTIMER_CPU_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Hardware timer configuration
  * @{
@@ -29,5 +33,9 @@
 /** @} */
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __HWTIMER_CPU_H */
 /** @} */
diff --git a/cpu/sam3x8e/include/instance/instance_adc.h b/cpu/sam3x8e/include/instance/instance_adc.h
index a0f1280e56..52c9894764 100644
--- a/cpu/sam3x8e/include/instance/instance_adc.h
+++ b/cpu/sam3x8e/include/instance/instance_adc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_ADC_INSTANCE_
 #define _SAM3XA_ADC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for ADC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_ADC_CR               (0x400C0000U) /**< \brief (ADC) Control Register */
@@ -89,4 +93,8 @@
 #define REG_ADC_PTSR    (*(RoReg*)0x400C0124U) /**< \brief (ADC) Transfer Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_ADC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_can0.h b/cpu/sam3x8e/include/instance/instance_can0.h
index c9b52e8e13..457de9ba88 100644
--- a/cpu/sam3x8e/include/instance/instance_can0.h
+++ b/cpu/sam3x8e/include/instance/instance_can0.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_CAN0_INSTANCE_
 #define _SAM3XA_CAN0_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for CAN0 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_CAN0_MR               (0x400B4000U) /**< \brief (CAN0) Mode Register */
@@ -189,4 +193,8 @@
 #define REG_CAN0_MCR7    (*(WoReg*)0x400B42FCU) /**< \brief (CAN0) Mailbox Control Register (MB = 7) */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_CAN0_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_can1.h b/cpu/sam3x8e/include/instance/instance_can1.h
index ee8f8dad8b..05737ca25c 100644
--- a/cpu/sam3x8e/include/instance/instance_can1.h
+++ b/cpu/sam3x8e/include/instance/instance_can1.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_CAN1_INSTANCE_
 #define _SAM3XA_CAN1_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for CAN1 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_CAN1_MR               (0x400B8000U) /**< \brief (CAN1) Mode Register */
@@ -189,4 +193,8 @@
 #define REG_CAN1_MCR7    (*(WoReg*)0x400B82FCU) /**< \brief (CAN1) Mailbox Control Register (MB = 7) */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_CAN1_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_chipid.h b/cpu/sam3x8e/include/instance/instance_chipid.h
index 0715e43e30..72309edd83 100644
--- a/cpu/sam3x8e/include/instance/instance_chipid.h
+++ b/cpu/sam3x8e/include/instance/instance_chipid.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_CHIPID_INSTANCE_
 #define _SAM3XA_CHIPID_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for CHIPID peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_CHIPID_CIDR          (0x400E0940U) /**< \brief (CHIPID) Chip ID Register */
@@ -39,4 +43,8 @@
 #define REG_CHIPID_EXID (*(RoReg*)0x400E0944U) /**< \brief (CHIPID) Chip ID Extension Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_CHIPID_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_dacc.h b/cpu/sam3x8e/include/instance/instance_dacc.h
index 1541cc77e3..f9f962e4b5 100644
--- a/cpu/sam3x8e/include/instance/instance_dacc.h
+++ b/cpu/sam3x8e/include/instance/instance_dacc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_DACC_INSTANCE_
 #define _SAM3XA_DACC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for DACC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_DACC_CR            (0x400C8000U) /**< \brief (DACC) Control Register */
@@ -73,4 +77,8 @@
 #define REG_DACC_PTSR (*(RoReg*)0x400C8124U) /**< \brief (DACC) Transfer Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_DACC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_dmac.h b/cpu/sam3x8e/include/instance/instance_dmac.h
index 10e936b65c..767c8c337b 100644
--- a/cpu/sam3x8e/include/instance/instance_dmac.h
+++ b/cpu/sam3x8e/include/instance/instance_dmac.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_DMAC_INSTANCE_
 #define _SAM3XA_DMAC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for DMAC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_DMAC_GCFG            (0x400C4000U) /**< \brief (DMAC) DMAC Global Configuration Register */
@@ -135,4 +139,8 @@
 #define REG_DMAC_WPSR   (*(RoReg*)0x400C41E8U) /**< \brief (DMAC) DMAC Write Protect Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_DMAC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_efc0.h b/cpu/sam3x8e/include/instance/instance_efc0.h
index fb76726d20..e51ef4a643 100644
--- a/cpu/sam3x8e/include/instance/instance_efc0.h
+++ b/cpu/sam3x8e/include/instance/instance_efc0.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_EFC0_INSTANCE_
 #define _SAM3XA_EFC0_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for EFC0 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_EFC0_FMR           (0x400E0A00U) /**< \brief (EFC0) EEFC Flash Mode Register */
@@ -43,4 +47,8 @@
 #define REG_EFC0_FRR  (*(RoReg*)0x400E0A0CU) /**< \brief (EFC0) EEFC Flash Result Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_EFC0_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_efc1.h b/cpu/sam3x8e/include/instance/instance_efc1.h
index 31034e23c0..3f9adc862a 100644
--- a/cpu/sam3x8e/include/instance/instance_efc1.h
+++ b/cpu/sam3x8e/include/instance/instance_efc1.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_EFC1_INSTANCE_
 #define _SAM3XA_EFC1_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for EFC1 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_EFC1_FMR           (0x400E0C00U) /**< \brief (EFC1) EEFC Flash Mode Register */
@@ -43,4 +47,8 @@
 #define REG_EFC1_FRR  (*(RoReg*)0x400E0C0CU) /**< \brief (EFC1) EEFC Flash Result Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_EFC1_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_emac.h b/cpu/sam3x8e/include/instance/instance_emac.h
index 68cc2535f2..05fd7a04ff 100644
--- a/cpu/sam3x8e/include/instance/instance_emac.h
+++ b/cpu/sam3x8e/include/instance/instance_emac.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_EMAC_INSTANCE_
 #define _SAM3XA_EMAC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for EMAC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_EMAC_NCR            (0x400B0000U) /**< \brief (EMAC) Network Control Register */
@@ -125,4 +129,8 @@
 #define REG_EMAC_USRIO (*(RwReg*)0x400B00C0U) /**< \brief (EMAC) User Input/Output Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_EMAC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_gpbr.h b/cpu/sam3x8e/include/instance/instance_gpbr.h
index 628eb1d670..fc76ad786c 100644
--- a/cpu/sam3x8e/include/instance/instance_gpbr.h
+++ b/cpu/sam3x8e/include/instance/instance_gpbr.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_GPBR_INSTANCE_
 #define _SAM3XA_GPBR_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for GPBR peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_GPBR_GPBR            (0x400E1A90U) /**< \brief (GPBR) General Purpose Backup Register */
@@ -37,4 +41,8 @@
 #define REG_GPBR_GPBR   (*(RwReg*)0x400E1A90U) /**< \brief (GPBR) General Purpose Backup Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_GPBR_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_hsmci.h b/cpu/sam3x8e/include/instance/instance_hsmci.h
index db43127ec6..918e052e06 100644
--- a/cpu/sam3x8e/include/instance/instance_hsmci.h
+++ b/cpu/sam3x8e/include/instance/instance_hsmci.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_HSMCI_INSTANCE_
 #define _SAM3XA_HSMCI_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for HSMCI peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_HSMCI_CR                 (0x40000000U) /**< \brief (HSMCI) Control Register */
@@ -75,4 +79,8 @@
 #define REG_HSMCI_FIFO      (*(RwReg*)0x40000200U) /**< \brief (HSMCI) FIFO Memory Aperture0 */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_HSMCI_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_matrix.h b/cpu/sam3x8e/include/instance/instance_matrix.h
index a226f4a725..2f1445a26c 100644
--- a/cpu/sam3x8e/include/instance/instance_matrix.h
+++ b/cpu/sam3x8e/include/instance/instance_matrix.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_MATRIX_INSTANCE_
 #define _SAM3XA_MATRIX_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for MATRIX peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_MATRIX_MCFG             (0x400E0400U) /**< \brief (MATRIX) Master Configuration Register */
@@ -65,4 +69,8 @@
 #define REG_MATRIX_WPSR    (*(RoReg*)0x400E05E8U) /**< \brief (MATRIX) Write Protect Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_MATRIX_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_pioa.h b/cpu/sam3x8e/include/instance/instance_pioa.h
index b7c0867a44..0b127d054e 100644
--- a/cpu/sam3x8e/include/instance/instance_pioa.h
+++ b/cpu/sam3x8e/include/instance/instance_pioa.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PIOA_INSTANCE_
 #define _SAM3XA_PIOA_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PIOA peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PIOA_PER             (0x400E0E00U) /**< \brief (PIOA) PIO Enable Register */
@@ -121,4 +125,8 @@
 #define REG_PIOA_WPSR   (*(RoReg*)0x400E0EE8U) /**< \brief (PIOA) Write Protect Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_PIOA_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_piob.h b/cpu/sam3x8e/include/instance/instance_piob.h
index c9a608cd11..665fb2778c 100644
--- a/cpu/sam3x8e/include/instance/instance_piob.h
+++ b/cpu/sam3x8e/include/instance/instance_piob.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PIOB_INSTANCE_
 #define _SAM3XA_PIOB_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PIOB peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PIOB_PER             (0x400E1000U) /**< \brief (PIOB) PIO Enable Register */
@@ -121,4 +125,8 @@
 #define REG_PIOB_WPSR   (*(RoReg*)0x400E10E8U) /**< \brief (PIOB) Write Protect Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_PIOB_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_pioc.h b/cpu/sam3x8e/include/instance/instance_pioc.h
index ccbee7bf56..0302be8872 100644
--- a/cpu/sam3x8e/include/instance/instance_pioc.h
+++ b/cpu/sam3x8e/include/instance/instance_pioc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PIOC_INSTANCE_
 #define _SAM3XA_PIOC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PIOC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PIOC_PER             (0x400E1200U) /**< \brief (PIOC) PIO Enable Register */
@@ -121,4 +125,8 @@
 #define REG_PIOC_WPSR   (*(RoReg*)0x400E12E8U) /**< \brief (PIOC) Write Protect Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_PIOC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_piod.h b/cpu/sam3x8e/include/instance/instance_piod.h
index b6d81ef836..b1bd282339 100644
--- a/cpu/sam3x8e/include/instance/instance_piod.h
+++ b/cpu/sam3x8e/include/instance/instance_piod.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PIOD_INSTANCE_
 #define _SAM3XA_PIOD_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PIOD peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PIOD_PER             (0x400E1400U) /**< \brief (PIOD) PIO Enable Register */
@@ -121,4 +125,8 @@
 #define REG_PIOD_WPSR   (*(RoReg*)0x400E14E8U) /**< \brief (PIOD) Write Protect Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_PIOD_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_pioe.h b/cpu/sam3x8e/include/instance/instance_pioe.h
index c1cc542431..58827202f3 100644
--- a/cpu/sam3x8e/include/instance/instance_pioe.h
+++ b/cpu/sam3x8e/include/instance/instance_pioe.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PIOE_INSTANCE_
 #define _SAM3XA_PIOE_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PIOE peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PIOE_PER             (0x400E1600U) /**< \brief (PIOE) PIO Enable Register */
@@ -121,4 +125,8 @@
 #define REG_PIOE_WPSR   (*(RoReg*)0x400E16E8U) /**< \brief (PIOE) Write Protect Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_PIOE_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_piof.h b/cpu/sam3x8e/include/instance/instance_piof.h
index 3e52677370..b685592aae 100644
--- a/cpu/sam3x8e/include/instance/instance_piof.h
+++ b/cpu/sam3x8e/include/instance/instance_piof.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PIOF_INSTANCE_
 #define _SAM3XA_PIOF_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PIOF peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PIOF_PER             (0x400E1800U) /**< \brief (PIOF) PIO Enable Register */
@@ -121,4 +125,8 @@
 #define REG_PIOF_WPSR   (*(RoReg*)0x400E18E8U) /**< \brief (PIOF) Write Protect Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_PIOF_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_pmc.h b/cpu/sam3x8e/include/instance/instance_pmc.h
index 37e16dd3c0..b2366a4d1c 100644
--- a/cpu/sam3x8e/include/instance/instance_pmc.h
+++ b/cpu/sam3x8e/include/instance/instance_pmc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PMC_INSTANCE_
 #define _SAM3XA_PMC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PMC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PMC_SCER            (0x400E0600U) /**< \brief (PMC) System Clock Enable Register */
@@ -87,4 +91,8 @@
 #define REG_PMC_PCR    (*(RwReg*)0x400E070CU) /**< \brief (PMC) Peripheral Control Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_PMC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_pwm.h b/cpu/sam3x8e/include/instance/instance_pwm.h
index 1adda68f1b..7b6cefcfad 100644
--- a/cpu/sam3x8e/include/instance/instance_pwm.h
+++ b/cpu/sam3x8e/include/instance/instance_pwm.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_PWM_INSTANCE_
 #define _SAM3XA_PWM_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PWM peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PWM_CLK               (0x40094000U) /**< \brief (PWM) PWM Clock Register */
@@ -303,4 +307,8 @@
 #define REG_PWM_DTUPD7   (*(WoReg*)0x400942FCU) /**< \brief (PWM) PWM Channel Dead Time Update Register (ch_num = 7) */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_PWM_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_rstc.h b/cpu/sam3x8e/include/instance/instance_rstc.h
index a7e4f32da9..67724996ac 100644
--- a/cpu/sam3x8e/include/instance/instance_rstc.h
+++ b/cpu/sam3x8e/include/instance/instance_rstc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_RSTC_INSTANCE_
 #define _SAM3XA_RSTC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for RSTC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_RSTC_CR          (0x400E1A00U) /**< \brief (RSTC) Control Register */
@@ -41,4 +45,8 @@
 #define REG_RSTC_MR (*(RwReg*)0x400E1A08U) /**< \brief (RSTC) Mode Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_RSTC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_rtc.h b/cpu/sam3x8e/include/instance/instance_rtc.h
index 750633e598..f74951a594 100644
--- a/cpu/sam3x8e/include/instance/instance_rtc.h
+++ b/cpu/sam3x8e/include/instance/instance_rtc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_RTC_INSTANCE_
 #define _SAM3XA_RTC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for RTC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_RTC_CR              (0x400E1A60U) /**< \brief (RTC) Control Register */
@@ -61,4 +65,8 @@
 #define REG_RTC_WPMR   (*(RwReg*)0x400E1B44U) /**< \brief (RTC) Write Protect Mode Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_RTC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_rtt.h b/cpu/sam3x8e/include/instance/instance_rtt.h
index f41d3e2b43..f254377ab4 100644
--- a/cpu/sam3x8e/include/instance/instance_rtt.h
+++ b/cpu/sam3x8e/include/instance/instance_rtt.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_RTT_INSTANCE_
 #define _SAM3XA_RTT_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for RTT peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_RTT_MR          (0x400E1A30U) /**< \brief (RTT) Mode Register */
@@ -43,4 +47,8 @@
 #define REG_RTT_SR (*(RoReg*)0x400E1A3CU) /**< \brief (RTT) Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_RTT_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_sdramc.h b/cpu/sam3x8e/include/instance/instance_sdramc.h
index 68dfe637f9..26c12a57b3 100644
--- a/cpu/sam3x8e/include/instance/instance_sdramc.h
+++ b/cpu/sam3x8e/include/instance/instance_sdramc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SDRAMC_INSTANCE_
 #define _SAM3XA_SDRAMC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SDRAMC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SDRAMC_MR            (0x400E0200U) /**< \brief (SDRAMC) SDRAMC Mode Register */
@@ -57,4 +61,8 @@
 #define REG_SDRAMC_OCMS (*(RwReg*)0x400E022CU) /**< \brief (SDRAMC) SDRAMC OCMS Register 1 */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_SDRAMC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_smc.h b/cpu/sam3x8e/include/instance/instance_smc.h
index 1298d3ed9b..cf0b5a39d3 100644
--- a/cpu/sam3x8e/include/instance/instance_smc.h
+++ b/cpu/sam3x8e/include/instance/instance_smc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SMC_INSTANCE_
 #define _SAM3XA_SMC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SMC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SMC_CFG               (0x400E0000U) /**< \brief (SMC) SMC NFC Configuration Register */
@@ -181,4 +185,8 @@
 #define REG_SMC_WPSR     (*(RoReg*)0x400E01E8U) /**< \brief (SMC) Write Protection Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_SMC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_spi0.h b/cpu/sam3x8e/include/instance/instance_spi0.h
index aca3ffb245..87867da6ad 100644
--- a/cpu/sam3x8e/include/instance/instance_spi0.h
+++ b/cpu/sam3x8e/include/instance/instance_spi0.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SPI0_INSTANCE_
 #define _SAM3XA_SPI0_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SPI0 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SPI0_CR              (0x40008000U) /**< \brief (SPI0) Control Register */
@@ -57,4 +61,8 @@
 #define REG_SPI0_WPSR   (*(RoReg*)0x400080E8U) /**< \brief (SPI0) Write Protection Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_SPI0_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_spi1.h b/cpu/sam3x8e/include/instance/instance_spi1.h
index 48ecc0e861..3042f11cb6 100644
--- a/cpu/sam3x8e/include/instance/instance_spi1.h
+++ b/cpu/sam3x8e/include/instance/instance_spi1.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SPI1_INSTANCE_
 #define _SAM3XA_SPI1_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SPI1 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SPI1_CR              (0x4000C000U) /**< \brief (SPI1) Control Register */
@@ -57,4 +61,8 @@
 #define REG_SPI1_WPSR   (*(RoReg*)0x4000C0E8U) /**< \brief (SPI1) Write Protection Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_SPI1_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_ssc.h b/cpu/sam3x8e/include/instance/instance_ssc.h
index db174a274b..e14562dd8c 100644
--- a/cpu/sam3x8e/include/instance/instance_ssc.h
+++ b/cpu/sam3x8e/include/instance/instance_ssc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SSC_INSTANCE_
 #define _SAM3XA_SSC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SSC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SSC_CR            (0x40004000U) /**< \brief (SSC) Control Register */
@@ -71,4 +75,8 @@
 #define REG_SSC_WPSR (*(RoReg*)0x400040E8U) /**< \brief (SSC) Write Protect Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_SSC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_supc.h b/cpu/sam3x8e/include/instance/instance_supc.h
index 154fcdae59..690f37d506 100644
--- a/cpu/sam3x8e/include/instance/instance_supc.h
+++ b/cpu/sam3x8e/include/instance/instance_supc.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_SUPC_INSTANCE_
 #define _SAM3XA_SUPC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SUPC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SUPC_CR            (0x400E1A10U) /**< \brief (SUPC) Supply Controller Control Register */
@@ -47,4 +51,8 @@
 #define REG_SUPC_SR   (*(RoReg*)0x400E1A24U) /**< \brief (SUPC) Supply Controller Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_SUPC_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_tc0.h b/cpu/sam3x8e/include/instance/instance_tc0.h
index 08be078743..2cf5838b42 100644
--- a/cpu/sam3x8e/include/instance/instance_tc0.h
+++ b/cpu/sam3x8e/include/instance/instance_tc0.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_TC0_INSTANCE_
 #define _SAM3XA_TC0_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TC0 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TC0_CCR0           (0x40080000U) /**< \brief (TC0) Channel Control Register (channel = 0) */
@@ -117,4 +121,8 @@
 #define REG_TC0_WPMR  (*(RwReg*)0x400800E4U) /**< \brief (TC0) Write Protect Mode Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_TC0_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_tc1.h b/cpu/sam3x8e/include/instance/instance_tc1.h
index a4b9510c0e..2ca975006c 100644
--- a/cpu/sam3x8e/include/instance/instance_tc1.h
+++ b/cpu/sam3x8e/include/instance/instance_tc1.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_TC1_INSTANCE_
 #define _SAM3XA_TC1_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TC1 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TC1_CCR0           (0x40084000U) /**< \brief (TC1) Channel Control Register (channel = 0) */
@@ -117,4 +121,8 @@
 #define REG_TC1_WPMR  (*(RwReg*)0x400840E4U) /**< \brief (TC1) Write Protect Mode Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_TC1_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_tc2.h b/cpu/sam3x8e/include/instance/instance_tc2.h
index 5846918af8..ded617654a 100644
--- a/cpu/sam3x8e/include/instance/instance_tc2.h
+++ b/cpu/sam3x8e/include/instance/instance_tc2.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_TC2_INSTANCE_
 #define _SAM3XA_TC2_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TC2 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TC2_CCR0           (0x40088000U) /**< \brief (TC2) Channel Control Register (channel = 0) */
@@ -117,4 +121,8 @@
 #define REG_TC2_WPMR  (*(RwReg*)0x400880E4U) /**< \brief (TC2) Write Protect Mode Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_TC2_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_trng.h b/cpu/sam3x8e/include/instance/instance_trng.h
index af78925764..3c88156b31 100644
--- a/cpu/sam3x8e/include/instance/instance_trng.h
+++ b/cpu/sam3x8e/include/instance/instance_trng.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_TRNG_INSTANCE_
 #define _SAM3XA_TRNG_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TRNG peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TRNG_CR             (0x400BC000U) /**< \brief (TRNG) Control Register */
@@ -47,4 +51,8 @@
 #define REG_TRNG_ODATA (*(RoReg*)0x400BC050U) /**< \brief (TRNG) Output Data Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_TRNG_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_twi0.h b/cpu/sam3x8e/include/instance/instance_twi0.h
index fa20773ab7..b01fd7a96c 100644
--- a/cpu/sam3x8e/include/instance/instance_twi0.h
+++ b/cpu/sam3x8e/include/instance/instance_twi0.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_TWI0_INSTANCE_
 #define _SAM3XA_TWI0_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TWI0 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TWI0_CR            (0x4008C000U) /**< \brief (TWI0) Control Register */
@@ -77,4 +81,8 @@
 #define REG_TWI0_PTSR (*(RoReg*)0x4008C124U) /**< \brief (TWI0) Transfer Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_TWI0_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_twi1.h b/cpu/sam3x8e/include/instance/instance_twi1.h
index 3427f611a4..b8e3c117fc 100644
--- a/cpu/sam3x8e/include/instance/instance_twi1.h
+++ b/cpu/sam3x8e/include/instance/instance_twi1.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_TWI1_INSTANCE_
 #define _SAM3XA_TWI1_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TWI1 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TWI1_CR            (0x40090000U) /**< \brief (TWI1) Control Register */
@@ -77,4 +81,8 @@
 #define REG_TWI1_PTSR (*(RoReg*)0x40090124U) /**< \brief (TWI1) Transfer Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_TWI1_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_uart.h b/cpu/sam3x8e/include/instance/instance_uart.h
index 9c8e1d5f7e..c2c44ad80c 100644
--- a/cpu/sam3x8e/include/instance/instance_uart.h
+++ b/cpu/sam3x8e/include/instance/instance_uart.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_UART_INSTANCE_
 #define _SAM3XA_UART_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for UART peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_UART_CR            (0x400E0800U) /**< \brief (UART) Control Register */
@@ -73,4 +77,8 @@
 #define REG_UART_PTSR (*(RoReg*)0x400E0924U) /**< \brief (UART) Transfer Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_UART_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_uotghs.h b/cpu/sam3x8e/include/instance/instance_uotghs.h
index fabdab1e96..e64d3d0e76 100644
--- a/cpu/sam3x8e/include/instance/instance_uotghs.h
+++ b/cpu/sam3x8e/include/instance/instance_uotghs.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_UOTGHS_INSTANCE_
 #define _SAM3XA_UOTGHS_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for UOTGHS peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_UOTGHS_DEVCTRL                 (0x400AC000U) /**< \brief (UOTGHS) Device General Control Register */
@@ -231,4 +235,8 @@
 #define REG_UOTGHS_FSM            (*(RoReg*)0x400AC82CU) /**< \brief (UOTGHS) General Finite State Machine Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_UOTGHS_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_usart0.h b/cpu/sam3x8e/include/instance/instance_usart0.h
index d5ece717b9..24de27815c 100644
--- a/cpu/sam3x8e/include/instance/instance_usart0.h
+++ b/cpu/sam3x8e/include/instance/instance_usart0.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_USART0_INSTANCE_
 #define _SAM3XA_USART0_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for USART0 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_USART0_CR          (0x40098000U) /**< \brief (USART0) Control Register */
@@ -93,4 +97,8 @@
 #define REG_USART0_PTSR (*(RoReg*)0x40098124U) /**< \brief (USART0) Transfer Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_USART0_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_usart1.h b/cpu/sam3x8e/include/instance/instance_usart1.h
index daf475b627..1982061ddd 100644
--- a/cpu/sam3x8e/include/instance/instance_usart1.h
+++ b/cpu/sam3x8e/include/instance/instance_usart1.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_USART1_INSTANCE_
 #define _SAM3XA_USART1_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for USART1 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_USART1_CR          (0x4009C000U) /**< \brief (USART1) Control Register */
@@ -93,4 +97,8 @@
 #define REG_USART1_PTSR (*(RoReg*)0x4009C124U) /**< \brief (USART1) Transfer Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_USART1_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_usart2.h b/cpu/sam3x8e/include/instance/instance_usart2.h
index 08910932e5..7c052575c4 100644
--- a/cpu/sam3x8e/include/instance/instance_usart2.h
+++ b/cpu/sam3x8e/include/instance/instance_usart2.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_USART2_INSTANCE_
 #define _SAM3XA_USART2_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for USART2 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_USART2_CR          (0x400A0000U) /**< \brief (USART2) Control Register */
@@ -93,4 +97,8 @@
 #define REG_USART2_PTSR (*(RoReg*)0x400A0124U) /**< \brief (USART2) Transfer Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_USART2_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_usart3.h b/cpu/sam3x8e/include/instance/instance_usart3.h
index df12c98bb4..2d4b5ea4d9 100644
--- a/cpu/sam3x8e/include/instance/instance_usart3.h
+++ b/cpu/sam3x8e/include/instance/instance_usart3.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_USART3_INSTANCE_
 #define _SAM3XA_USART3_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for USART3 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_USART3_CR          (0x400A4000U) /**< \brief (USART3) Control Register */
@@ -93,4 +97,8 @@
 #define REG_USART3_PTSR (*(RoReg*)0x400A4124U) /**< \brief (USART3) Transfer Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_USART3_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/instance/instance_wdt.h b/cpu/sam3x8e/include/instance/instance_wdt.h
index a122b9aa17..d0a0361e21 100644
--- a/cpu/sam3x8e/include/instance/instance_wdt.h
+++ b/cpu/sam3x8e/include/instance/instance_wdt.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3XA_WDT_INSTANCE_
 #define _SAM3XA_WDT_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for WDT peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_WDT_CR          (0x400E1A50U) /**< \brief (WDT) Control Register */
@@ -41,4 +45,8 @@
 #define REG_WDT_SR (*(RoReg*)0x400E1A58U) /**< \brief (WDT) Status Register */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3XA_WDT_INSTANCE_ */
diff --git a/cpu/sam3x8e/include/pio/pio_sam3x8e.h b/cpu/sam3x8e/include/pio/pio_sam3x8e.h
index 29c095476d..3a3e3451cd 100644
--- a/cpu/sam3x8e/include/pio/pio_sam3x8e.h
+++ b/cpu/sam3x8e/include/pio/pio_sam3x8e.h
@@ -30,6 +30,10 @@
 #ifndef _SAM3X8E_PIO_
 #define _SAM3X8E_PIO_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define PIO_PA0              (1u << 0)  /**< \brief Pin Controlled by PA0 */
 #define PIO_PA1              (1u << 1)  /**< \brief Pin Controlled by PA1 */
 #define PIO_PA2              (1u << 2)  /**< \brief Pin Controlled by PA2 */
@@ -549,4 +553,8 @@
 #define PIO_PD9_IDX          105
 #define PIO_PD10_IDX         106
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAM3X8E_PIO_ */
diff --git a/cpu/sam3x8e/include/sam3x8e.h b/cpu/sam3x8e/include/sam3x8e.h
index b1810fb963..6adb53e68c 100644
--- a/cpu/sam3x8e/include/sam3x8e.h
+++ b/cpu/sam3x8e/include/sam3x8e.h
@@ -257,6 +257,10 @@ void WDT_Handler        ( void );
  * \brief CMSIS includes
  */
 
+#ifdef __cplusplus
+}
+#endif
+
 #include <core_cm3.h>
 #if !defined DONT_USE_CMSIS_INIT
 #include "system_sam3xa.h"
@@ -573,11 +577,6 @@ void WDT_Handler        ( void );
 #define CHIP_FREQ_FWS_2                 (53000000UL) /**< \brief Maximum operating frequency when FWS is 2 */
 #define CHIP_FREQ_FWS_3                 (78000000UL) /**< \brief Maximum operating frequency when FWS is 3 */
 
-
-#ifdef __cplusplus
-}
-#endif
-
 /*@}*/
 
 #endif /* _SAM3X8E_ */
diff --git a/cpu/sam3x8e/include/system_sam3xa.h b/cpu/sam3x8e/include/system_sam3xa.h
index b703c8ead6..1bdf1d959f 100644
--- a/cpu/sam3x8e/include/system_sam3xa.h
+++ b/cpu/sam3x8e/include/system_sam3xa.h
@@ -42,14 +42,15 @@
 
 /* @cond 0 */
 /**INDENT-OFF**/
-#ifdef __cplusplus
-extern "C" {
-#endif
 /**INDENT-ON**/
 /* @endcond */
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern uint32_t SystemCoreClock;    /* System Clock Frequency (Core Clock) */
 
 /**
diff --git a/cpu/samd21/include/component/component_ac.h b/cpu/samd21/include/component/component_ac.h
index a124b3df5c..a4ee084d0f 100644
--- a/cpu/samd21/include/component/component_ac.h
+++ b/cpu/samd21/include/component/component_ac.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_AC_COMPONENT_
 #define _SAMR21_AC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR AC */
 /* ========================================================================== */
@@ -556,4 +560,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_AC_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_adc.h b/cpu/samd21/include/component/component_adc.h
index 26034e97e4..175c95037e 100644
--- a/cpu/samd21/include/component/component_adc.h
+++ b/cpu/samd21/include/component/component_adc.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_ADC_COMPONENT_
 #define _SAMR21_ADC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR ADC */
 /* ========================================================================== */
@@ -696,4 +700,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_ADC_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_dac.h b/cpu/samd21/include/component/component_dac.h
index a6ba828cd3..cf837ebe64 100644
--- a/cpu/samd21/include/component/component_dac.h
+++ b/cpu/samd21/include/component/component_dac.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_DAC_COMPONENT_
 #define _SAMR21_DAC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR DAC */
 /* ========================================================================== */
@@ -283,4 +287,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_DAC_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_dmac.h b/cpu/samd21/include/component/component_dmac.h
index 730414a288..b078bde9a9 100644
--- a/cpu/samd21/include/component/component_dmac.h
+++ b/cpu/samd21/include/component/component_dmac.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_DMAC_COMPONENT_
 #define _SAMR21_DMAC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR DMAC */
 /* ========================================================================== */
@@ -1030,4 +1034,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_DMAC_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_dsu.h b/cpu/samd21/include/component/component_dsu.h
index 6e004b61fa..a134a277e5 100644
--- a/cpu/samd21/include/component/component_dsu.h
+++ b/cpu/samd21/include/component/component_dsu.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_DSU_COMPONENT_
 #define _SAMR21_DSU_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR DSU */
 /* ========================================================================== */
@@ -548,4 +552,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_DSU_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_eic.h b/cpu/samd21/include/component/component_eic.h
index 69b3497659..e32cf82e64 100644
--- a/cpu/samd21/include/component/component_eic.h
+++ b/cpu/samd21/include/component/component_eic.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_EIC_COMPONENT_
 #define _SAMR21_EIC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR EIC */
 /* ========================================================================== */
@@ -678,4 +682,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_EIC_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_evsys.h b/cpu/samd21/include/component/component_evsys.h
index bea440b478..23da6019b9 100644
--- a/cpu/samd21/include/component/component_evsys.h
+++ b/cpu/samd21/include/component/component_evsys.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_EVSYS_COMPONENT_
 #define _SAMR21_EVSYS_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR EVSYS */
 /* ========================================================================== */
@@ -601,4 +605,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_EVSYS_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_gclk.h b/cpu/samd21/include/component/component_gclk.h
index dab90ba72e..25279f3366 100644
--- a/cpu/samd21/include/component/component_gclk.h
+++ b/cpu/samd21/include/component/component_gclk.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_GCLK_COMPONENT_
 #define _SAMR21_GCLK_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR GCLK */
 /* ========================================================================== */
@@ -231,4 +235,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_GCLK_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_i2s.h b/cpu/samd21/include/component/component_i2s.h
index 677fdb3feb..377037c74e 100644
--- a/cpu/samd21/include/component/component_i2s.h
+++ b/cpu/samd21/include/component/component_i2s.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_I2S_COMPONENT_
 #define _SAMR21_I2S_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR I2S */
 /* ========================================================================== */
@@ -636,4 +640,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_I2S_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_mtb.h b/cpu/samd21/include/component/component_mtb.h
index a8fd7d8e8b..8410724e0d 100644
--- a/cpu/samd21/include/component/component_mtb.h
+++ b/cpu/samd21/include/component/component_mtb.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_MTB_COMPONENT_
 #define _SAMR21_MTB_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR MTB */
 /* ========================================================================== */
@@ -393,4 +397,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_MTB_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_nvmctrl.h b/cpu/samd21/include/component/component_nvmctrl.h
index f4a46230b1..887865ca2e 100644
--- a/cpu/samd21/include/component/component_nvmctrl.h
+++ b/cpu/samd21/include/component/component_nvmctrl.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_NVMCTRL_COMPONENT_
 #define _SAMR21_NVMCTRL_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR NVMCTRL */
 /* ========================================================================== */
@@ -527,4 +531,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_NVMCTRL_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_pac.h b/cpu/samd21/include/component/component_pac.h
index 134062bafe..517ff65f79 100644
--- a/cpu/samd21/include/component/component_pac.h
+++ b/cpu/samd21/include/component/component_pac.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_PAC_COMPONENT_
 #define _SAMR21_PAC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR PAC */
 /* ========================================================================== */
@@ -101,4 +105,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_PAC_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_pm.h b/cpu/samd21/include/component/component_pm.h
index ade1d93d1a..b79110336d 100644
--- a/cpu/samd21/include/component/component_pm.h
+++ b/cpu/samd21/include/component/component_pm.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_PM_COMPONENT_
 #define _SAMR21_PM_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR PM */
 /* ========================================================================== */
@@ -521,4 +525,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_PM_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_port.h b/cpu/samd21/include/component/component_port.h
index 565d4eb8f3..aeec7f7a70 100644
--- a/cpu/samd21/include/component/component_port.h
+++ b/cpu/samd21/include/component/component_port.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_PORT_COMPONENT_
 #define _SAMR21_PORT_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR PORT */
 /* ========================================================================== */
@@ -392,4 +396,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_PORT_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_rfctrl.h b/cpu/samd21/include/component/component_rfctrl.h
index 3316568e6d..d0fc3914ae 100644
--- a/cpu/samd21/include/component/component_rfctrl.h
+++ b/cpu/samd21/include/component/component_rfctrl.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_RFCTRL_COMPONENT_
 #define _SAMR21_RFCTRL_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR RFCTRL */
 /* ========================================================================== */
@@ -101,4 +105,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_RFCTRL_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_rtc.h b/cpu/samd21/include/component/component_rtc.h
index 1b36178488..a377ca0ee4 100644
--- a/cpu/samd21/include/component/component_rtc.h
+++ b/cpu/samd21/include/component/component_rtc.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_RTC_COMPONENT_
 #define _SAMR21_RTC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR RTC */
 /* ========================================================================== */
@@ -1059,4 +1063,8 @@ typedef union {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_RTC_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_sercom.h b/cpu/samd21/include/component/component_sercom.h
index 7c2b6639f9..c3a9d1f0b1 100644
--- a/cpu/samd21/include/component/component_sercom.h
+++ b/cpu/samd21/include/component/component_sercom.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_SERCOM_COMPONENT_
 #define _SAMR21_SERCOM_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR SERCOM */
 /* ========================================================================== */
@@ -1505,4 +1509,8 @@ typedef union {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_SERCOM_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_sysctrl.h b/cpu/samd21/include/component/component_sysctrl.h
index c7fdb2005e..7eecf0d877 100644
--- a/cpu/samd21/include/component/component_sysctrl.h
+++ b/cpu/samd21/include/component/component_sysctrl.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_SYSCTRL_COMPONENT_
 #define _SAMR21_SYSCTRL_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR SYSCTRL */
 /* ========================================================================== */
@@ -945,4 +949,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_SYSCTRL_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_tc.h b/cpu/samd21/include/component/component_tc.h
index 64c422f343..f37e67a83c 100644
--- a/cpu/samd21/include/component/component_tc.h
+++ b/cpu/samd21/include/component/component_tc.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_TC_COMPONENT_
 #define _SAMR21_TC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR TC */
 /* ========================================================================== */
@@ -681,4 +685,8 @@ typedef union {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_TC_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_tcc.h b/cpu/samd21/include/component/component_tcc.h
index 13c8a10798..33e7aa104a 100644
--- a/cpu/samd21/include/component/component_tcc.h
+++ b/cpu/samd21/include/component/component_tcc.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_TCC_COMPONENT_
 #define _SAMR21_TCC_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR TCC */
 /* ========================================================================== */
@@ -1605,4 +1609,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_TCC_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_usb.h b/cpu/samd21/include/component/component_usb.h
index 7c1e2efc44..1722d45522 100644
--- a/cpu/samd21/include/component/component_usb.h
+++ b/cpu/samd21/include/component/component_usb.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_USB_COMPONENT_
 #define _SAMR21_USB_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR USB */
 /* ========================================================================== */
@@ -1764,4 +1768,8 @@ typedef union {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_USB_COMPONENT_ */
diff --git a/cpu/samd21/include/component/component_wdt.h b/cpu/samd21/include/component/component_wdt.h
index f968382fe1..de11d9a8fb 100644
--- a/cpu/samd21/include/component/component_wdt.h
+++ b/cpu/samd21/include/component/component_wdt.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_WDT_COMPONENT_
 #define _SAMR21_WDT_COMPONENT_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========================================================================== */
 /**  SOFTWARE API DEFINITION FOR WDT */
 /* ========================================================================== */
@@ -300,4 +304,8 @@ typedef struct {
 
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_WDT_COMPONENT_ */
diff --git a/cpu/samd21/include/cpu-conf.h b/cpu/samd21/include/cpu-conf.h
index b2dd64aee5..c0416ac8ab 100644
--- a/cpu/samd21/include/cpu-conf.h
+++ b/cpu/samd21/include/cpu-conf.h
@@ -20,6 +20,9 @@
 
 #include "samd21.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @name Kernel configuration
@@ -47,6 +50,9 @@
 #endif
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __CPU_CONF_H */
 /** @} */
diff --git a/cpu/samd21/include/hwtimer_cpu.h b/cpu/samd21/include/hwtimer_cpu.h
index 293f9915aa..1373400d9e 100644
--- a/cpu/samd21/include/hwtimer_cpu.h
+++ b/cpu/samd21/include/hwtimer_cpu.h
@@ -19,6 +19,10 @@
 #ifndef __HWTIMER_CPU_H
 #define __HWTIMER_CPU_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Hardware timer configuration
  * @{
@@ -28,6 +32,9 @@
 #define HWTIMER_MAXTICKS    (0xFFFF)        /**< 16-bit timer */
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __HWTIMER_CPU_H */
 /** @} */
diff --git a/cpu/samd21/include/instance/instance_ac.h b/cpu/samd21/include/instance/instance_ac.h
index 4bc3047729..2ff10bb824 100644
--- a/cpu/samd21/include/instance/instance_ac.h
+++ b/cpu/samd21/include/instance/instance_ac.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_AC_INSTANCE_
 #define _SAMR21_AC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for AC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_AC_CTRLA               (0x42004400U) /**< \brief (AC) Control A */
@@ -84,4 +88,8 @@
 #define AC_NUM_CMP                  AC_CMP_NUM
 #define AC_PAIRS                    1
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_AC_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_adc.h b/cpu/samd21/include/instance/instance_adc.h
index 4eca25bad2..62c9001310 100644
--- a/cpu/samd21/include/instance/instance_adc.h
+++ b/cpu/samd21/include/instance/instance_adc.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_ADC_INSTANCE_
 #define _SAMR21_ADC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for ADC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_ADC_CTRLA              (0x42004000U) /**< \brief (ADC) Control A */
@@ -96,4 +100,8 @@
 #define ADC_RESULT_BITS             16
 #define ADC_RESULT_MSB              (ADC_RESULT_BITS-1)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_ADC_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_dac.h b/cpu/samd21/include/instance/instance_dac.h
index 4469da400e..95484be394 100644
--- a/cpu/samd21/include/instance/instance_dac.h
+++ b/cpu/samd21/include/instance/instance_dac.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_DAC_INSTANCE_
 #define _SAMR21_DAC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for DAC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_DAC_CTRLA              (0x42004800U) /**< \brief (DAC) Control A */
@@ -71,4 +75,8 @@
 #define DAC_DMAC_ID_EMPTY           40
 #define DAC_GCLK_ID                 33
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_DAC_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_dmac.h b/cpu/samd21/include/instance/instance_dmac.h
index 329d75d622..5212af3d69 100644
--- a/cpu/samd21/include/instance/instance_dmac.h
+++ b/cpu/samd21/include/instance/instance_dmac.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_DMAC_INSTANCE_
 #define _SAMR21_DMAC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for DMAC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_DMAC_CTRL              (0x41004800U) /**< \brief (DMAC) Control */
@@ -104,4 +108,8 @@
 #define DMAC_TRIG_BITS              len(bin(DMAC_TRIG_NUM - 1))-2
 #define DMAC_TRIG_NUM               45
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_DMAC_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_dsu.h b/cpu/samd21/include/instance/instance_dsu.h
index 461e597e4b..f76acad251 100644
--- a/cpu/samd21/include/instance/instance_dsu.h
+++ b/cpu/samd21/include/instance/instance_dsu.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_DSU_INSTANCE_
 #define _SAMR21_DSU_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for DSU peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_DSU_CTRL               (0x41002000U) /**< \brief (DSU) Control */
@@ -96,4 +100,8 @@
 /* ========== Instance parameters for DSU peripheral ========== */
 #define DSU_CLK_HSB_ID              3
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_DSU_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_eic.h b/cpu/samd21/include/instance/instance_eic.h
index 225815e961..8442ca935a 100644
--- a/cpu/samd21/include/instance/instance_eic.h
+++ b/cpu/samd21/include/instance/instance_eic.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_EIC_INSTANCE_
 #define _SAMR21_EIC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for EIC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_EIC_CTRL               (0x40001800U) /**< \brief (EIC) Control */
@@ -75,4 +79,8 @@
 #define EIC_CONFIG_NUM              ((EIC_EXTINT_NUM+7)/8)
 #define EIC_GCLK_ID                 5
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_EIC_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_evsys.h b/cpu/samd21/include/instance/instance_evsys.h
index eec071aa0e..06adf54f41 100644
--- a/cpu/samd21/include/instance/instance_evsys.h
+++ b/cpu/samd21/include/instance/instance_evsys.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_EVSYS_INSTANCE_
 #define _SAMR21_EVSYS_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for EVSYS peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_EVSYS_CTRL             (0x42000400U) /**< \brief (EVSYS) Control */
@@ -194,4 +198,8 @@
 #define EVSYS_ID_USER_DAC_START     27
 #define EVSYS_ID_USER_PTC_STCONV    28
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_EVSYS_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_gclk.h b/cpu/samd21/include/instance/instance_gclk.h
index 918827766a..cbe784d8e2 100644
--- a/cpu/samd21/include/instance/instance_gclk.h
+++ b/cpu/samd21/include/instance/instance_gclk.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_GCLK_INSTANCE_
 #define _SAMR21_GCLK_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for GCLK peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_GCLK_CTRL              (0x40000C00U) /**< \brief (GCLK) Control */
@@ -76,4 +80,8 @@
 #define GCLK_SOURCE_XOSC            0
 #define GCLK_SOURCE_XOSC32K         5
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_GCLK_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_i2s.h b/cpu/samd21/include/instance/instance_i2s.h
index 95da07b65b..620fa0bb8a 100644
--- a/cpu/samd21/include/instance/instance_i2s.h
+++ b/cpu/samd21/include/instance/instance_i2s.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_I2S_INSTANCE_
 #define _SAMR21_I2S_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for I2S peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_I2S_CTRLA              (0x42005000U) /**< \brief (I2S) Control A */
@@ -91,4 +95,8 @@
 #define I2S_MAX_SLOTS               8
 #define I2S_SER_NUM                 2
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_I2S_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_mtb.h b/cpu/samd21/include/instance/instance_mtb.h
index ed60b0d789..295c15fb16 100644
--- a/cpu/samd21/include/instance/instance_mtb.h
+++ b/cpu/samd21/include/instance/instance_mtb.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_MTB_INSTANCE_
 #define _SAMR21_MTB_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for MTB peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_MTB_POSITION           (0x41006000U) /**< \brief (MTB) MTB Position */
@@ -99,5 +103,8 @@
 #define REG_MTB_CID3               (*(RoReg  *)0x41006FFCU) /**< \brief (MTB) CoreSight */
 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SAMR21_MTB_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_nvmctrl.h b/cpu/samd21/include/instance/instance_nvmctrl.h
index 4ff83ab23c..b89c7d2ca5 100644
--- a/cpu/samd21/include/instance/instance_nvmctrl.h
+++ b/cpu/samd21/include/instance/instance_nvmctrl.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_NVMCTRL_INSTANCE_
 #define _SAMR21_NVMCTRL_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for NVMCTRL peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_NVMCTRL_CTRLA          (0x41004000U) /**< \brief (NVMCTRL) Control A */
@@ -89,4 +93,8 @@
 #define NVMCTRL_USER_PAGE_OFFSET    0x00800000
 #define NVMCTRL_USER_WORD_IMPLEMENTED_MASK 0xC01FFFFFFFFFFFFF
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_NVMCTRL_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_pac0.h b/cpu/samd21/include/instance/instance_pac0.h
index 77bd579d95..4e07714335 100644
--- a/cpu/samd21/include/instance/instance_pac0.h
+++ b/cpu/samd21/include/instance/instance_pac0.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_PAC0_INSTANCE_
 #define _SAMR21_PAC0_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PAC0 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PAC0_WPCLR             (0x40000000U) /**< \brief (PAC0) Write Protection Clear */
@@ -56,4 +60,8 @@
 /* ========== Instance parameters for PAC0 peripheral ========== */
 #define PAC0_WPROT_DEFAULT_VAL      0x00000000
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_PAC0_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_pac1.h b/cpu/samd21/include/instance/instance_pac1.h
index f9e5bc6176..78d2408914 100644
--- a/cpu/samd21/include/instance/instance_pac1.h
+++ b/cpu/samd21/include/instance/instance_pac1.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_PAC1_INSTANCE_
 #define _SAMR21_PAC1_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PAC1 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PAC1_WPCLR             (0x41000000U) /**< \brief (PAC1) Write Protection Clear */
@@ -56,4 +60,8 @@
 /* ========== Instance parameters for PAC1 peripheral ========== */
 #define PAC1_WPROT_DEFAULT_VAL      0x00000000
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_PAC1_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_pac2.h b/cpu/samd21/include/instance/instance_pac2.h
index 96baca9a9e..4d3986a8e3 100644
--- a/cpu/samd21/include/instance/instance_pac2.h
+++ b/cpu/samd21/include/instance/instance_pac2.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_PAC2_INSTANCE_
 #define _SAMR21_PAC2_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PAC2 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PAC2_WPCLR             (0x42000000U) /**< \brief (PAC2) Write Protection Clear */
@@ -56,4 +60,8 @@
 /* ========== Instance parameters for PAC2 peripheral ========== */
 #define PAC2_WPROT_DEFAULT_VAL      0x00800000
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_PAC2_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_pm.h b/cpu/samd21/include/instance/instance_pm.h
index 0b8999dd05..b221daeaf1 100644
--- a/cpu/samd21/include/instance/instance_pm.h
+++ b/cpu/samd21/include/instance/instance_pm.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_PM_INSTANCE_
 #define _SAMR21_PM_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PM peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PM_CTRL                (0x40000400U) /**< \brief (PM) Control */
@@ -84,4 +88,8 @@
 #define PM_CTRL_MCSEL_XOSC          2
 #define PM_PM_CLK_APB_NUM           2
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_PM_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_port.h b/cpu/samd21/include/instance/instance_port.h
index a3dde0b51e..346641d98f 100644
--- a/cpu/samd21/include/instance/instance_port.h
+++ b/cpu/samd21/include/instance/instance_port.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_PORT_INSTANCE_
 #define _SAMR21_PORT_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for PORT peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_PORT_DIR0              (0x41004400U) /**< \brief (PORT) Data Direction 0 */
@@ -159,4 +163,8 @@
 #define PORT_SLEWLIM_DEFAULT_VAL    { 0x00000000, 0x00000000, 0x00000000 }
 #define PORT_SLEWLIM_IMPLEMENTED    { 0x00000000, 0x00000000, 0x00000000 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_PORT_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_rfctrl.h b/cpu/samd21/include/instance/instance_rfctrl.h
index 147859d84b..44ecdce79d 100644
--- a/cpu/samd21/include/instance/instance_rfctrl.h
+++ b/cpu/samd21/include/instance/instance_rfctrl.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_RFCTRL_INSTANCE_
 #define _SAMR21_RFCTRL_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for RFCTRL peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_RFCTRL_FECFG           (0x42005400U) /**< \brief (RFCTRL) Front-end control bus configuration */
@@ -54,4 +58,8 @@
 /* ========== Instance parameters for RFCTRL peripheral ========== */
 #define RFCTRL_FBUSMSB              5
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_RFCTRL_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_rtc.h b/cpu/samd21/include/instance/instance_rtc.h
index edf93ad21d..bd3f95d4b8 100644
--- a/cpu/samd21/include/instance/instance_rtc.h
+++ b/cpu/samd21/include/instance/instance_rtc.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_RTC_INSTANCE_
 #define _SAMR21_RTC_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for RTC peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_RTC_READREQ            (0x40001402U) /**< \brief (RTC) Read Request */
@@ -114,4 +118,8 @@
 #define RTC_NUM_OF_COMP16           RTC_COMP16_NUM
 #define RTC_NUM_OF_COMP32           RTC_COMP32_NUM
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_RTC_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_sercom0.h b/cpu/samd21/include/instance/instance_sercom0.h
index 4cc63093f1..b4fc31278e 100644
--- a/cpu/samd21/include/instance/instance_sercom0.h
+++ b/cpu/samd21/include/instance/instance_sercom0.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_SERCOM0_INSTANCE_
 #define _SAMR21_SERCOM0_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SERCOM0 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SERCOM0_I2CM_CTRLA     (0x42000800U) /**< \brief (SERCOM0) I2CM Control A */
@@ -140,4 +144,8 @@
 #define SERCOM0_GCLK_ID_SLOW        19
 #define SERCOM0_INT_MSB             6
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_SERCOM0_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_sercom1.h b/cpu/samd21/include/instance/instance_sercom1.h
index 23ba9d3d8d..e1ac9049b2 100644
--- a/cpu/samd21/include/instance/instance_sercom1.h
+++ b/cpu/samd21/include/instance/instance_sercom1.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_SERCOM1_INSTANCE_
 #define _SAMR21_SERCOM1_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SERCOM1 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SERCOM1_I2CM_CTRLA     (0x42000C00U) /**< \brief (SERCOM1) I2CM Control A */
@@ -140,4 +144,8 @@
 #define SERCOM1_GCLK_ID_SLOW        19
 #define SERCOM1_INT_MSB             6
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_SERCOM1_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_sercom2.h b/cpu/samd21/include/instance/instance_sercom2.h
index 0c1f0ae58a..57c1876b0a 100644
--- a/cpu/samd21/include/instance/instance_sercom2.h
+++ b/cpu/samd21/include/instance/instance_sercom2.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_SERCOM2_INSTANCE_
 #define _SAMR21_SERCOM2_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SERCOM2 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SERCOM2_I2CM_CTRLA     (0x42001000U) /**< \brief (SERCOM2) I2CM Control A */
@@ -140,4 +144,8 @@
 #define SERCOM2_GCLK_ID_SLOW        19
 #define SERCOM2_INT_MSB             6
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_SERCOM2_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_sercom3.h b/cpu/samd21/include/instance/instance_sercom3.h
index fc540c3c39..14f7be90f0 100644
--- a/cpu/samd21/include/instance/instance_sercom3.h
+++ b/cpu/samd21/include/instance/instance_sercom3.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_SERCOM3_INSTANCE_
 #define _SAMR21_SERCOM3_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SERCOM3 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SERCOM3_I2CM_CTRLA     (0x42001400U) /**< \brief (SERCOM3) I2CM Control A */
@@ -140,4 +144,8 @@
 #define SERCOM3_GCLK_ID_SLOW        19
 #define SERCOM3_INT_MSB             6
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_SERCOM3_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_sercom4.h b/cpu/samd21/include/instance/instance_sercom4.h
index 0f27f91097..d02a7cc29d 100644
--- a/cpu/samd21/include/instance/instance_sercom4.h
+++ b/cpu/samd21/include/instance/instance_sercom4.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_SERCOM4_INSTANCE_
 #define _SAMR21_SERCOM4_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SERCOM4 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SERCOM4_I2CM_CTRLA     (0x42001800U) /**< \brief (SERCOM4) I2CM Control A */
@@ -140,4 +144,8 @@
 #define SERCOM4_GCLK_ID_SLOW        19
 #define SERCOM4_INT_MSB             6
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_SERCOM4_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_sercom5.h b/cpu/samd21/include/instance/instance_sercom5.h
index 6398dc99e2..eb35db608a 100644
--- a/cpu/samd21/include/instance/instance_sercom5.h
+++ b/cpu/samd21/include/instance/instance_sercom5.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_SERCOM5_INSTANCE_
 #define _SAMR21_SERCOM5_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SERCOM5 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SERCOM5_I2CM_CTRLA     (0x42001C00U) /**< \brief (SERCOM5) I2CM Control A */
@@ -140,4 +144,8 @@
 #define SERCOM5_GCLK_ID_SLOW        19
 #define SERCOM5_INT_MSB             6
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_SERCOM5_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_sysctrl.h b/cpu/samd21/include/instance/instance_sysctrl.h
index f38cf955b2..d3725ac8a8 100644
--- a/cpu/samd21/include/instance/instance_sysctrl.h
+++ b/cpu/samd21/include/instance/instance_sysctrl.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_SYSCTRL_INSTANCE_
 #define _SAMR21_SYSCTRL_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for SYSCTRL peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_SYSCTRL_INTENCLR       (0x40000800U) /**< \brief (SYSCTRL) Interrupt Enable Clear */
@@ -117,4 +121,8 @@
 #define SYSCTRL_XOSC_VERSION        0x111
 #define SYSCTRL_XOSC32K_VERSION     0x111
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_SYSCTRL_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_tc3.h b/cpu/samd21/include/instance/instance_tc3.h
index 8970251af0..bb3d8523c4 100644
--- a/cpu/samd21/include/instance/instance_tc3.h
+++ b/cpu/samd21/include/instance/instance_tc3.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_TC3_INSTANCE_
 #define _SAMR21_TC3_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TC3 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TC3_CTRLA              (0x42002C00U) /**< \brief (TC3) Control A */
@@ -108,4 +112,8 @@
 #define TC3_PERIOD_EXT              0
 #define TC3_SHADOW_EXT              0
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_TC3_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_tc4.h b/cpu/samd21/include/instance/instance_tc4.h
index ba8f647c16..77ba185c3e 100644
--- a/cpu/samd21/include/instance/instance_tc4.h
+++ b/cpu/samd21/include/instance/instance_tc4.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_TC4_INSTANCE_
 #define _SAMR21_TC4_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TC4 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TC4_CTRLA              (0x42003000U) /**< \brief (TC4) Control A */
@@ -108,4 +112,8 @@
 #define TC4_PERIOD_EXT              0
 #define TC4_SHADOW_EXT              0
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_TC4_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_tc5.h b/cpu/samd21/include/instance/instance_tc5.h
index 48c03b4c67..cf4cd5be03 100644
--- a/cpu/samd21/include/instance/instance_tc5.h
+++ b/cpu/samd21/include/instance/instance_tc5.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_TC5_INSTANCE_
 #define _SAMR21_TC5_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TC5 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TC5_CTRLA              (0x42003400U) /**< \brief (TC5) Control A */
@@ -108,4 +112,8 @@
 #define TC5_PERIOD_EXT              0
 #define TC5_SHADOW_EXT              0
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_TC5_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_tc6.h b/cpu/samd21/include/instance/instance_tc6.h
index 70d7428fcf..66a2c22957 100644
--- a/cpu/samd21/include/instance/instance_tc6.h
+++ b/cpu/samd21/include/instance/instance_tc6.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_TC6_INSTANCE_
 #define _SAMR21_TC6_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TC6 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TC6_CTRLA              (0x42003800U) /**< \brief (TC6) Control A */
@@ -108,4 +112,8 @@
 #define TC6_PERIOD_EXT              0
 #define TC6_SHADOW_EXT              0
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_TC6_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_tc7.h b/cpu/samd21/include/instance/instance_tc7.h
index a7bcab9ea8..53ab6050b1 100644
--- a/cpu/samd21/include/instance/instance_tc7.h
+++ b/cpu/samd21/include/instance/instance_tc7.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_TC7_INSTANCE_
 #define _SAMR21_TC7_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TC7 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TC7_CTRLA              (0x42003C00U) /**< \brief (TC7) Control A */
@@ -108,4 +112,8 @@
 #define TC7_PERIOD_EXT              0
 #define TC7_SHADOW_EXT              0
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_TC7_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_tcc0.h b/cpu/samd21/include/instance/instance_tcc0.h
index 858b55eaf7..b16c25f12d 100644
--- a/cpu/samd21/include/instance/instance_tcc0.h
+++ b/cpu/samd21/include/instance/instance_tcc0.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_TCC0_INSTANCE_
 #define _SAMR21_TCC0_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TCC0 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TCC0_CTRLA             (0x42002000U) /**< \brief (TCC0) Control A */
@@ -128,4 +132,8 @@
 #define TCC0_SIZE                   24
 #define TCC0_SWAP                   1
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_TCC0_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_tcc1.h b/cpu/samd21/include/instance/instance_tcc1.h
index db32a65914..8406aed03a 100644
--- a/cpu/samd21/include/instance/instance_tcc1.h
+++ b/cpu/samd21/include/instance/instance_tcc1.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_TCC1_INSTANCE_
 #define _SAMR21_TCC1_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TCC1 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TCC1_CTRLA             (0x42002400U) /**< \brief (TCC1) Control A */
@@ -116,4 +120,8 @@
 #define TCC1_SIZE                   24
 #define TCC1_SWAP                   0
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_TCC1_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_tcc2.h b/cpu/samd21/include/instance/instance_tcc2.h
index 0ca2925e93..e0ef2a7459 100644
--- a/cpu/samd21/include/instance/instance_tcc2.h
+++ b/cpu/samd21/include/instance/instance_tcc2.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_TCC2_INSTANCE_
 #define _SAMR21_TCC2_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for TCC2 peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_TCC2_CTRLA             (0x42002800U) /**< \brief (TCC2) Control A */
@@ -112,4 +116,8 @@
 #define TCC2_SIZE                   16
 #define TCC2_SWAP                   0
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_TCC2_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_usb.h b/cpu/samd21/include/instance/instance_usb.h
index 51461bd029..7ce50e26a4 100644
--- a/cpu/samd21/include/instance/instance_usb.h
+++ b/cpu/samd21/include/instance/instance_usb.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_USB_INSTANCE_
 #define _SAMR21_USB_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for USB peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_USB_CTRLA              (0x41005000U) /**< \brief (USB) Control A */
@@ -339,4 +343,8 @@
 #define USB_GCLK_ID                 6
 #define USB_PIPE_NUM                8
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_USB_INSTANCE_ */
diff --git a/cpu/samd21/include/instance/instance_wdt.h b/cpu/samd21/include/instance/instance_wdt.h
index d9dd85bc62..f47a71a6e5 100644
--- a/cpu/samd21/include/instance/instance_wdt.h
+++ b/cpu/samd21/include/instance/instance_wdt.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21_WDT_INSTANCE_
 #define _SAMR21_WDT_INSTANCE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ========== Register definition for WDT peripheral ========== */
 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
 #define REG_WDT_CTRL               (0x40001000U) /**< \brief (WDT) Control */
@@ -68,4 +72,8 @@
 /* ========== Instance parameters for WDT peripheral ========== */
 #define WDT_GCLK_ID                 3
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21_WDT_INSTANCE_ */
diff --git a/cpu/samd21/include/pio/pio_samr21g18a.h b/cpu/samd21/include/pio/pio_samr21g18a.h
index c5b6e76158..2949cd68c9 100644
--- a/cpu/samd21/include/pio/pio_samr21g18a.h
+++ b/cpu/samd21/include/pio/pio_samr21g18a.h
@@ -44,6 +44,10 @@
 #ifndef _SAMR21G18A_PIO_
 #define _SAMR21G18A_PIO_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define PIN_PA00                           0  /**< \brief Pin Number for PA00 */
 #define PORT_PA00                  (1u <<  0) /**< \brief PORT Mask  for PA00 */
 #define PIN_PA01                           1  /**< \brief Pin Number for PA01 */
@@ -1006,4 +1010,8 @@
 #define PINMUX_PA15F_RFCTRL_FECTRL5  ((PIN_PA15F_RFCTRL_FECTRL5 << 16) | MUX_PA15F_RFCTRL_FECTRL5)
 #define PORT_PA15F_RFCTRL_FECTRL5  (1u << 15)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SAMR21G18A_PIO_ */
diff --git a/cpu/samd21/include/samd21.h b/cpu/samd21/include/samd21.h
index d7bc359131..805b01e76e 100644
--- a/cpu/samd21/include/samd21.h
+++ b/cpu/samd21/include/samd21.h
@@ -55,12 +55,13 @@
 */
 /*@{*/
 
+#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
+#include <stdint.h>
+
 #ifdef __cplusplus
  extern "C" {
 #endif
 
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-#include <stdint.h>
 #ifndef __cplusplus
 typedef volatile const uint32_t RoReg;   /**< Read only 32-bit register (volatile const unsigned int) */
 typedef volatile const uint16_t RoReg16; /**< Read only 16-bit register (volatile const unsigned int) */
@@ -237,6 +238,10 @@ void I2S_Handler                 ( void );
  * \brief CMSIS includes
  */
 
+#ifdef __cplusplus
+}
+#endif
+
 #include <core_cm0plus.h>
 #if !defined DONT_USE_CMSIS_INIT
 #include "system_samd21.h"
@@ -542,11 +547,6 @@ void I2S_Handler                 ( void );
 /**  ELECTRICAL DEFINITIONS FOR SAMR21G18A */
 /* ************************************************************************** */
 
-
-#ifdef __cplusplus
-}
-#endif
-
 /*@}*/
 
 #endif /* SAMR21G18A_H */
diff --git a/cpu/stm32f0/include/cpu-conf.h b/cpu/stm32f0/include/cpu-conf.h
index e7e89aa213..cafe961872 100644
--- a/cpu/stm32f0/include/cpu-conf.h
+++ b/cpu/stm32f0/include/cpu-conf.h
@@ -25,6 +25,9 @@
 #include "stm32f051x8.h"
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @name Kernel configuration
@@ -55,5 +58,9 @@
 #endif
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CPU_CONF_H */
 /** @} */
diff --git a/cpu/stm32f0/include/hwtimer_cpu.h b/cpu/stm32f0/include/hwtimer_cpu.h
index b8a8049338..75bf11fa5e 100644
--- a/cpu/stm32f0/include/hwtimer_cpu.h
+++ b/cpu/stm32f0/include/hwtimer_cpu.h
@@ -19,6 +19,10 @@
 #ifndef __HWTIMER_CPU_H
 #define __HWTIMER_CPU_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Hardware timer configuration
  * @{
@@ -28,5 +32,9 @@
 #define HWTIMER_MAXTICKS    (0xFFFFFFFF)    /**< 32-bit timer */
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __HWTIMER_CPU_H */
 /** @} */
diff --git a/cpu/stm32f1/include/cpu-conf.h b/cpu/stm32f1/include/cpu-conf.h
index 7919efea52..d60bafe135 100644
--- a/cpu/stm32f1/include/cpu-conf.h
+++ b/cpu/stm32f1/include/cpu-conf.h
@@ -25,6 +25,10 @@
 
 #include "stm32f10x.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Kernel configuration
  *
@@ -71,5 +75,9 @@ void cpu_clock_scale(uint32_t source, uint32_t target, uint32_t *prescale);
 
 #define TRANSCEIVER_BUFFER_SIZE (3)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CPU_CONF_H */
 /** @} */
diff --git a/cpu/stm32f1/include/hwtimer_cpu.h b/cpu/stm32f1/include/hwtimer_cpu.h
index 6af375c721..aa789a8bda 100644
--- a/cpu/stm32f1/include/hwtimer_cpu.h
+++ b/cpu/stm32f1/include/hwtimer_cpu.h
@@ -19,6 +19,10 @@
 #ifndef HWTIMER_CPU_H_
 #define HWTIMER_CPU_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Hardware timer configuration
  * @{
@@ -29,5 +33,9 @@
 #define HWTIMER_WAIT_OVERHEAD (3)
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* HWTIMER_CPU_H_ */
 /** @} */
diff --git a/cpu/stm32f1/include/stm32f10x.h b/cpu/stm32f1/include/stm32f10x.h
index 1dbc05d565..69b50baa27 100644
--- a/cpu/stm32f1/include/stm32f10x.h
+++ b/cpu/stm32f1/include/stm32f10x.h
@@ -477,9 +477,17 @@ typedef enum IRQn
   * @}
   */
 
+#ifdef __cplusplus
+}
+#endif
+
 #include "core_cm3.h"
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @addtogroup cpu_specific_Exported_types
   * @{
   */
@@ -8294,10 +8302,18 @@ typedef struct
   * @}
   */
 
+#ifdef __cplusplus
+}
+#endif
+
 #ifdef USE_STDPERIPH_DRIVER
   #include "stm32f10x_conf.h"
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** @addtogroup cpu_specific_Exported_macro
   * @{
   */
diff --git a/cpu/stm32f3/include/cpu-conf.h b/cpu/stm32f3/include/cpu-conf.h
index bae8ac40ad..c32b4c577b 100644
--- a/cpu/stm32f3/include/cpu-conf.h
+++ b/cpu/stm32f3/include/cpu-conf.h
@@ -51,5 +51,13 @@
 #endif
 /** @} */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CPU_CONF_H */
 /** @} */
diff --git a/cpu/stm32f3/include/hwtimer_cpu.h b/cpu/stm32f3/include/hwtimer_cpu.h
index bd36f3851a..ca3157f625 100644
--- a/cpu/stm32f3/include/hwtimer_cpu.h
+++ b/cpu/stm32f3/include/hwtimer_cpu.h
@@ -19,6 +19,10 @@
 #ifndef __HWTIMER_CPU_H
 #define __HWTIMER_CPU_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Hardware timer configuration
  * @{
@@ -28,5 +32,9 @@
 #define HWTIMER_MAXTICKS    (0xFFFFFFFF)    /**< 32-bit timer */
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __HWTIMER_CPU_H */
 /** @} */
diff --git a/cpu/stm32f4/include/cpu-conf.h b/cpu/stm32f4/include/cpu-conf.h
index 0bcc430890..a5a08691a7 100644
--- a/cpu/stm32f4/include/cpu-conf.h
+++ b/cpu/stm32f4/include/cpu-conf.h
@@ -53,5 +53,13 @@
 #endif
 /** @} */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __CPU_CONF_H */
 /** @} */
diff --git a/cpu/stm32f4/include/hwtimer_cpu.h b/cpu/stm32f4/include/hwtimer_cpu.h
index 498cb78647..eb495bc3cc 100644
--- a/cpu/stm32f4/include/hwtimer_cpu.h
+++ b/cpu/stm32f4/include/hwtimer_cpu.h
@@ -19,6 +19,10 @@
 #ifndef __HWTIMER_CPU_H
 #define __HWTIMER_CPU_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @name Hardware timer configuration
  * @{
@@ -28,5 +32,9 @@
 #define HWTIMER_MAXTICKS    (0xFFFFFFFF)    /**< 32-bit timer */
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __HWTIMER_CPU_H */
 /** @} */
diff --git a/cpu/x86/include/cpu.h b/cpu/x86/include/cpu.h
index c2c78c6201..f8eb6e6cde 100644
--- a/cpu/x86/include/cpu.h
+++ b/cpu/x86/include/cpu.h
@@ -39,6 +39,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 static inline void __attribute__((always_inline)) dINT(void)
 {
     asm volatile ("cli");
@@ -116,6 +120,10 @@ void x86_init_board(void);
  */
 bool x86_get_memory_region(uint64_t *start, uint64_t *len, unsigned long *cnt);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/hwtimer_cpu.h b/cpu/x86/include/hwtimer_cpu.h
index f1872ab092..6840f622ea 100644
--- a/cpu/x86/include/hwtimer_cpu.h
+++ b/cpu/x86/include/hwtimer_cpu.h
@@ -29,6 +29,10 @@
 #ifndef CPU__X86__HWTIMER_CPU__H__
 #define CPU__X86__HWTIMER_CPU__H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Number of configured hardware timers.
  *
@@ -53,6 +57,10 @@
  */
 #define HWTIMER_MAXTICKS (0xFFFFFFFFu)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/ucontext.h b/cpu/x86/include/ucontext.h
index c9d572cb0d..ef1c42a88e 100644
--- a/cpu/x86/include/ucontext.h
+++ b/cpu/x86/include/ucontext.h
@@ -31,6 +31,10 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Common stacksize for a signal handler.
  *
@@ -161,6 +165,10 @@ void makecontext(ucontext_t *ucp, makecontext_fun_t func, int argc, ...);
  */
 int swapcontext(ucontext_t *oucp, const ucontext_t *ucp);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_cmos.h b/cpu/x86/include/x86_cmos.h
index 7aef69de29..e8de2ab0aa 100644
--- a/cpu/x86/include/x86_cmos.h
+++ b/cpu/x86/include/x86_cmos.h
@@ -32,6 +32,10 @@
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define CMOS_ADDRESS (0x70)
 #define CMOS_DATA    (0x71)
 
@@ -58,6 +62,10 @@ void x86_cmos_write(int reg, uint8_t value);
  */
 void x86_cmos_serial(uint8_t (*serial)[CMOS_SERIAL_LEN]);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_hwtimer.h b/cpu/x86/include/x86_hwtimer.h
index 138a28461f..f1175df8e5 100644
--- a/cpu/x86/include/x86_hwtimer.h
+++ b/cpu/x86/include/x86_hwtimer.h
@@ -29,6 +29,10 @@
 #ifndef CPU__X86__HWTIMER__H__
 #define CPU__X86__HWTIMER__H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Do timestamping to enable the use of the hwtimer module.
  *
@@ -37,6 +41,10 @@
  */
 void x86_init_hwtimer(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_interrupts.h b/cpu/x86/include/x86_interrupts.h
index 7a1ae7a2f2..eb46c573a7 100644
--- a/cpu/x86/include/x86_interrupts.h
+++ b/cpu/x86/include/x86_interrupts.h
@@ -33,6 +33,10 @@
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Initialize interrupts.
  *
@@ -152,6 +156,10 @@ static inline void __attribute__((always_inline)) x86_restore_flags(unsigned lon
  */
 void x86_print_registers(struct x86_pushad *orig_ctx, unsigned long error_code);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_kernel_memory.h b/cpu/x86/include/x86_kernel_memory.h
index b9cf1032b3..8c86abe569 100644
--- a/cpu/x86/include/x86_kernel_memory.h
+++ b/cpu/x86/include/x86_kernel_memory.h
@@ -28,6 +28,10 @@
 #ifndef KERNEL_MEMORY_H__
 #define KERNEL_MEMORY_H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   First byte inside the elf segments.
  *
@@ -111,6 +115,10 @@ extern char _kernel_memory_end;
  */
 extern char _heap_start;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_memory.h b/cpu/x86/include/x86_memory.h
index 23ef3c661d..b9bb81352f 100644
--- a/cpu/x86/include/x86_memory.h
+++ b/cpu/x86/include/x86_memory.h
@@ -31,6 +31,10 @@
 #include <stdbool.h>
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Maximum static size of the kernel.
  *
@@ -170,6 +174,10 @@ void x86_release_virtual_pages(uint32_t virtual_start, unsigned pages);
  */
 void x86_init_gdt(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_pci.h b/cpu/x86/include/x86_pci.h
index 146ddf7dd5..0c41e9773a 100644
--- a/cpu/x86/include/x86_pci.h
+++ b/cpu/x86/include/x86_pci.h
@@ -35,6 +35,10 @@
 #include <stdbool.h>
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Initialize the Peripheral Component Interconnect.
  *
@@ -410,6 +414,10 @@ void x86_pci_write16(unsigned bus, unsigned dev, unsigned fun, unsigned reg, uin
  */
 void x86_pci_set_irq(struct x86_known_pci_device *d, uint8_t irq_num);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_pci_init.h b/cpu/x86/include/x86_pci_init.h
index 3dd4e59fd3..71ce5af20e 100644
--- a/cpu/x86/include/x86_pci_init.h
+++ b/cpu/x86/include/x86_pci_init.h
@@ -19,8 +19,16 @@
 #ifndef __X86__PCI_INIT__H
 #define __X86__PCI_INIT__H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* no PCI devices are implemented, yet */
 
 void x86_init_pci_devices(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/cpu/x86/include/x86_pci_strings.h b/cpu/x86/include/x86_pci_strings.h
index f0b4efa38e..b34a3be4d7 100644
--- a/cpu/x86/include/x86_pci_strings.h
+++ b/cpu/x86/include/x86_pci_strings.h
@@ -28,6 +28,10 @@
 #ifndef CPU__X86__PCI_NAMES__H__
 #define CPU__X86__PCI_NAMES__H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief        Get a string representation of the device class.
  * @param[out]   baseclass_name   Name of the base class. Supply NULL if you do not care.
@@ -48,6 +52,10 @@ const char *x86_pci_subclass_to_string(unsigned baseclass, unsigned subclass, un
  */
 const char *x86_pci_device_id_to_string(unsigned vendor_id, unsigned device_id, const char **vendor_name);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_pic.h b/cpu/x86/include/x86_pic.h
index d381a46475..1f83595287 100644
--- a/cpu/x86/include/x86_pic.h
+++ b/cpu/x86/include/x86_pic.h
@@ -30,6 +30,10 @@
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Initialize the Programmable Interrupt Controller.
  *
@@ -163,6 +167,10 @@ void x86_pic_enable_irq(unsigned num);
  */
 void x86_pic_disable_irq(unsigned num);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_pit.h b/cpu/x86/include/x86_pit.h
index a2d88dee77..44d441a7c7 100644
--- a/cpu/x86/include/x86_pit.h
+++ b/cpu/x86/include/x86_pit.h
@@ -37,6 +37,10 @@
 #include <stdbool.h>
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define PIT_CHANNEL_0_PORT (0x40) /**< Channel 0 */
 #define PIT_CHANNEL_1_PORT (0x41) /**< Channel 1, DO NOT USE */
 #define PIT_CHANNEL_2_PORT (0x42) /**< Channel 2, do not use if you can help it */
@@ -109,6 +113,10 @@ void x86_pit_set2(unsigned channel, unsigned mode, uint16_t max);
  */
 bool x86_pit_set(unsigned channel, unsigned mode, unsigned hz);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_ports.h b/cpu/x86/include/x86_ports.h
index 364b89f503..c4fbc8e810 100644
--- a/cpu/x86/include/x86_ports.h
+++ b/cpu/x86/include/x86_ports.h
@@ -29,6 +29,10 @@
 #include <stdlib.h>
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief        Reads and returns a byte from PORT.
  * @param[in]    port   Port to read from.
@@ -183,4 +187,8 @@ static inline void  __attribute__((always_inline)) io_wait(void)
                  "2:");
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/cpu/x86/include/x86_reboot.h b/cpu/x86/include/x86_reboot.h
index ae7077888a..a2785118d1 100644
--- a/cpu/x86/include/x86_reboot.h
+++ b/cpu/x86/include/x86_reboot.h
@@ -30,6 +30,10 @@
 
 #include "kernel.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Prototype for a x86 reboot function.
  *
@@ -84,6 +88,10 @@ bool x86_shutdown(void);
  */
 void x86_set_shutdown_fun(x86_shutdown_t fun);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_registers.h b/cpu/x86/include/x86_registers.h
index f84b2b18fe..0809580082 100644
--- a/cpu/x86/include/x86_registers.h
+++ b/cpu/x86/include/x86_registers.h
@@ -30,6 +30,10 @@
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* see "Intel® Quark SoC X1000 Core Developer’s Manual", § 4.4.1.1 (p. 47) */
 #define CR0_PE (1u << 0)  /**< 1 = protected mode */
 #define CR0_MP (1u << 1)  /**< 1 = monitor coprocessor (FWAIT causes an interrupt) */
@@ -247,6 +251,10 @@ static inline uint64_t X86_CR_ATTR cpuid_caps(void)
     return ((uint64_t) ecx << 32) | edx;
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_rtc.h b/cpu/x86/include/x86_rtc.h
index 2024d411fd..48abbd716b 100644
--- a/cpu/x86/include/x86_rtc.h
+++ b/cpu/x86/include/x86_rtc.h
@@ -36,6 +36,10 @@
 
 #include <stdbool.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   A timestamp.
  *
@@ -206,6 +210,10 @@ void x86_rtc_set_periodic_callback(x86_rtc_callback_t cb);
  */
 void x86_rtc_set_update_callback(x86_rtc_callback_t cb);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_threading.h b/cpu/x86/include/x86_threading.h
index 9c6c1da89f..496a6bd02c 100644
--- a/cpu/x86/include/x86_threading.h
+++ b/cpu/x86/include/x86_threading.h
@@ -31,6 +31,10 @@
 
 #include <stdbool.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Initialize threading.
  *
@@ -44,6 +48,10 @@ void x86_init_threading(void);
  */
 extern bool x86_in_isr;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_uart.h b/cpu/x86/include/x86_uart.h
index 48be9d10da..0ac0cfb4bb 100644
--- a/cpu/x86/include/x86_uart.h
+++ b/cpu/x86/include/x86_uart.h
@@ -35,6 +35,10 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Early initialization of the UART system, before there are interrupts.
  *
@@ -171,6 +175,10 @@ enum iir_t {
     IIR_FIFO_ENABLED = 3 << 6, /* FIFO enabled */
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
diff --git a/cpu/x86/include/x86_videoram.h b/cpu/x86/include/x86_videoram.h
index 371f41026e..4d21fab1d9 100644
--- a/cpu/x86/include/x86_videoram.h
+++ b/cpu/x86/include/x86_videoram.h
@@ -28,6 +28,10 @@
 #ifndef CPU__X86__VIDEORAM_H__
 #define CPU__X86__VIDEORAM_H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Print out a single character on the graphical device.
  *
@@ -57,6 +61,10 @@ void videoram_puts(const char *s);
  */
 void videoram_put_hex(unsigned long v);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /** @} */
-- 
GitLab