all: Unify header guard usage.

The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.

This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.

The rules are as follows.

Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _

In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.

py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
diff --git a/cc3200/bootmgr/bootmgr.h b/cc3200/bootmgr/bootmgr.h
index 4b31433..e5285d4 100644
--- a/cc3200/bootmgr/bootmgr.h
+++ b/cc3200/bootmgr/bootmgr.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __BOOTMGR_H__
-#define __BOOTMGR_H__
+#ifndef MICROPY_INCLUDED_CC3200_BOOTMGR_BOOTMGR_H
+#define MICROPY_INCLUDED_CC3200_BOOTMGR_BOOTMGR_H
 
 //****************************************************************************
 //
@@ -66,4 +65,4 @@
 }
 #endif
 
-#endif //__BOOTMGR_H__
+#endif // MICROPY_INCLUDED_CC3200_BOOTMGR_BOOTMGR_H
diff --git a/cc3200/bootmgr/flc.h b/cc3200/bootmgr/flc.h
index 4b2aca9..7c04c7b 100644
--- a/cc3200/bootmgr/flc.h
+++ b/cc3200/bootmgr/flc.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __FLC_H__
-#define __FLC_H__
+#ifndef MICROPY_INCLUDED_CC3200_BOOTMGR_FLC_H
+#define MICROPY_INCLUDED_CC3200_BOOTMGR_FLC_H
 
 /******************************************************************************
 
@@ -93,4 +92,4 @@
 }
 #endif
 
-#endif /* __FLC_H__ */
+#endif // MICROPY_INCLUDED_CC3200_BOOTMGR_FLC_H
diff --git a/cc3200/ftp/ftp.h b/cc3200/ftp/ftp.h
index 13b044d..7d16002 100644
--- a/cc3200/ftp/ftp.h
+++ b/cc3200/ftp/ftp.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef FTP_H_
-#define FTP_H_
+#ifndef MICROPY_INCLUDED_CC3200_FTP_FTP_H
+#define MICROPY_INCLUDED_CC3200_FTP_FTP_H
 
 /******************************************************************************
  DECLARE EXPORTED FUNCTIONS
@@ -36,4 +35,4 @@
 extern void ftp_disable (void);
 extern void ftp_reset (void);
 
-#endif /* FTP_H_ */
+#endif // MICROPY_INCLUDED_CC3200_FTP_FTP_H
diff --git a/cc3200/ftp/updater.h b/cc3200/ftp/updater.h
index b581d0f..dcca704 100644
--- a/cc3200/ftp/updater.h
+++ b/cc3200/ftp/updater.h
@@ -23,10 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-
-#ifndef UPDATER_H_
-#define UPDATER_H_
+#ifndef MICROPY_INCLUDED_CC3200_FTP_UPDATER_H
+#define MICROPY_INCLUDED_CC3200_FTP_UPDATER_H
 
 extern void updater_pre_init (void);
 extern bool updater_check_path (void *path);
@@ -35,4 +33,4 @@
 extern void updater_finnish (void);
 extern bool updater_verify (uint8_t *rbuff, uint8_t *hasbuff);
 
-#endif /* UPDATER_H_ */
+#endif // MICROPY_INCLUDED_CC3200_FTP_UPDATER_H
diff --git a/cc3200/hal/cc3200_hal.h b/cc3200/hal/cc3200_hal.h
index fcb85b2..9953f0e 100644
--- a/cc3200/hal/cc3200_hal.h
+++ b/cc3200/hal/cc3200_hal.h
@@ -24,9 +24,6 @@
  * THE SOFTWARE.
  */
 
-#ifndef CC3200_LAUNCHXL_HAL_CC3200_HAL_H_
-#define CC3200_LAUNCHXL_HAL_CC3200_HAL_H_
-
 #include <stdint.h>
 #include <stdbool.h>
 
@@ -69,5 +66,3 @@
 
 #define mp_hal_delay_us(usec) UtilsDelay(UTILS_DELAY_US_TO_COUNT(usec))
 #define mp_hal_ticks_cpu() (SysTickPeriodGet() - SysTickValueGet())
-
-#endif /* CC3200_LAUNCHXL_HAL_CC3200_HAL_H_ */
diff --git a/cc3200/misc/antenna.h b/cc3200/misc/antenna.h
index b3b1c61..3bb87e3 100644
--- a/cc3200/misc/antenna.h
+++ b/cc3200/misc/antenna.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef _ANTENNA_H_
-#define _ANTENNA_H_
+#ifndef MICROPY_INCLUDED_CC3200_MISC_ANTENNA_H
+#define MICROPY_INCLUDED_CC3200_MISC_ANTENNA_H
 
 typedef enum {
     ANTENNA_TYPE_INTERNAL = 0,
@@ -35,4 +34,4 @@
 extern void antenna_init0 (void);
 extern void antenna_select (antenna_type_t antenna_type);
 
-#endif /* _ANTENNA_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MISC_ANTENNA_H
diff --git a/cc3200/misc/mperror.h b/cc3200/misc/mperror.h
index e38d129..46a9b8c 100644
--- a/cc3200/misc/mperror.h
+++ b/cc3200/misc/mperror.h
@@ -24,9 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef MPERROR_H_
-#define MPERROR_H_
+#ifndef MICROPY_INCLUDED_CC3200_MISC_MPERROR_H
+#define MICROPY_INCLUDED_CC3200_MISC_MPERROR_H
 
 extern void NORETURN __fatal_error(const char *msg);
 
@@ -39,4 +38,4 @@
 void mperror_enable_heartbeat (bool enable);
 bool mperror_is_heartbeat_enabled (void);
 
-#endif // MPERROR_H_
+#endif // MICROPY_INCLUDED_CC3200_MISC_MPERROR_H
diff --git a/cc3200/misc/mpexception.h b/cc3200/misc/mpexception.h
index 2f9d187..d23381c 100644
--- a/cc3200/misc/mpexception.h
+++ b/cc3200/misc/mpexception.h
@@ -24,9 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef MPEXCEPTION_H_
-#define MPEXCEPTION_H_
+#ifndef MICROPY_INCLUDED_CC3200_MISC_MPEXCEPTION_H
+#define MICROPY_INCLUDED_CC3200_MISC_MPEXCEPTION_H
 
 extern const char mpexception_value_invalid_arguments[];
 extern const char mpexception_num_type_invalid_arguments[];
@@ -40,4 +39,4 @@
 extern void mpexception_nlr_jump (void *o);
 extern void mpexception_keyboard_nlr_jump (void);
 
-#endif /* MPEXCEPTION_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MISC_MPEXCEPTION_H
diff --git a/cc3200/misc/mpirq.h b/cc3200/misc/mpirq.h
index 3fd21ee..8b4ab2f 100644
--- a/cc3200/misc/mpirq.h
+++ b/cc3200/misc/mpirq.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef MPIRQ_H_
-#define MPIRQ_H_
+#ifndef MICROPY_INCLUDED_CC3200_MISC_MPIRQ_H
+#define MICROPY_INCLUDED_CC3200_MISC_MPIRQ_H
 
 /******************************************************************************
  DEFINE CONSTANTS
@@ -72,4 +71,4 @@
 void mp_irq_handler (mp_obj_t self_in);
 uint mp_irq_translate_priority (uint priority);
 
-#endif /* MPIRQ_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MISC_MPIRQ_H
diff --git a/cc3200/mods/modnetwork.h b/cc3200/mods/modnetwork.h
index 8a886c3..8e1196e 100644
--- a/cc3200/mods/modnetwork.h
+++ b/cc3200/mods/modnetwork.h
@@ -24,9 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef MODNETWORK_H_
-#define MODNETWORK_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODNETWORK_H
+#define MICROPY_INCLUDED_CC3200_MODS_MODNETWORK_H
 
 /******************************************************************************
  DEFINE CONSTANTS
@@ -71,4 +70,4 @@
  ******************************************************************************/
 void mod_network_init0(void);
 
-#endif  // MODNETWORK_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_MODNETWORK_H
diff --git a/cc3200/mods/modubinascii.h b/cc3200/mods/modubinascii.h
index c04b700..3e784e9 100644
--- a/cc3200/mods/modubinascii.h
+++ b/cc3200/mods/modubinascii.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef MODUBINASCII_H_
-#define MODUBINASCII_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODUBINASCII_H
+#define MICROPY_INCLUDED_CC3200_MODS_MODUBINASCII_H
 
 
-#endif /* MODUBINASCII_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_MODUBINASCII_H
diff --git a/cc3200/mods/moduos.h b/cc3200/mods/moduos.h
index 4c8bc96..148cddf 100644
--- a/cc3200/mods/moduos.h
+++ b/cc3200/mods/moduos.h
@@ -24,9 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef MODUOS_H_
-#define MODUOS_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODUOS_H
+#define MICROPY_INCLUDED_CC3200_MODS_MODUOS_H
 
 #include "py/obj.h"
 
@@ -45,4 +44,4 @@
  ******************************************************************************/
 void osmount_unmount_all (void);
 
-#endif // MODUOS_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_MODUOS_H
diff --git a/cc3200/mods/modusocket.h b/cc3200/mods/modusocket.h
index 851f8e5..80c1f24 100644
--- a/cc3200/mods/modusocket.h
+++ b/cc3200/mods/modusocket.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef MODUSOCKET_H_
-#define MODUSOCKET_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODUSOCKET_H
+#define MICROPY_INCLUDED_CC3200_MODS_MODUSOCKET_H
 
 extern const mp_obj_dict_t socket_locals_dict;
 extern const mp_stream_p_t socket_stream_p;
@@ -36,4 +35,4 @@
 extern void modusocket_enter_sleep (void);
 extern void modusocket_close_all_user_sockets (void);
 
-#endif /* MODUSOCKET_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_MODUSOCKET_H
diff --git a/cc3200/mods/modwlan.h b/cc3200/mods/modwlan.h
index 3bfd1fb..d37d276 100644
--- a/cc3200/mods/modwlan.h
+++ b/cc3200/mods/modwlan.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef MODWLAN_H_
-#define MODWLAN_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODWLAN_H
+#define MICROPY_INCLUDED_CC3200_MODS_MODWLAN_H
 
 /******************************************************************************
  DEFINE CONSTANTS
@@ -97,4 +96,4 @@
 extern void wlan_set_current_time (uint32_t seconds_since_2000);
 extern void wlan_off_on (void);
 
-#endif /* MODWLAN_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_MODWLAN_H
diff --git a/cc3200/mods/pybadc.h b/cc3200/mods/pybadc.h
index b77c4af..50640ee 100644
--- a/cc3200/mods/pybadc.h
+++ b/cc3200/mods/pybadc.h
@@ -24,10 +24,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef PYBADC_H_
-#define PYBADC_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBADC_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBADC_H
 
 extern const mp_obj_type_t pyb_adc_type;
 
-#endif /* PYBADC_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBADC_H
diff --git a/cc3200/mods/pybi2c.h b/cc3200/mods/pybi2c.h
index 7adffb2..d547f63 100644
--- a/cc3200/mods/pybi2c.h
+++ b/cc3200/mods/pybi2c.h
@@ -24,10 +24,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef PYBI2C_H_
-#define PYBI2C_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBI2C_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBI2C_H
 
 extern const mp_obj_type_t pyb_i2c_type;
 
-#endif  // PYBI2C_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBI2C_H
diff --git a/cc3200/mods/pybpin.h b/cc3200/mods/pybpin.h
index ad02cc7..6b4b7b1 100644
--- a/cc3200/mods/pybpin.h
+++ b/cc3200/mods/pybpin.h
@@ -24,9 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef PYBPIN_H_
-#define PYBPIN_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBPIN_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBPIN_H
 
 enum {
     PORT_A0 = GPIOA0_BASE,
@@ -138,4 +137,4 @@
 uint8_t pin_find_peripheral_type (const mp_obj_t pin, uint8_t fn, uint8_t unit);
 int8_t pin_find_af_index (const pin_obj_t* pin, uint8_t fn, uint8_t unit, uint8_t type);;
 
-#endif  // PYBPIN_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBPIN_H
diff --git a/cc3200/mods/pybrtc.h b/cc3200/mods/pybrtc.h
index 5111b78..3fd11ec 100644
--- a/cc3200/mods/pybrtc.h
+++ b/cc3200/mods/pybrtc.h
@@ -24,9 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef PYBRTC_H_
-#define PYBRTC_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBRTC_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBRTC_H
 
 // RTC triggers
 #define PYB_RTC_ALARM0                      (0x01)
@@ -56,4 +55,4 @@
 extern void pyb_rtc_repeat_alarm (pyb_rtc_obj_t *self);
 extern void pyb_rtc_disable_alarm (void);
 
-#endif  // PYBRTC_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBRTC_H
diff --git a/cc3200/mods/pybsd.h b/cc3200/mods/pybsd.h
index a06df6d..084d7ca 100644
--- a/cc3200/mods/pybsd.h
+++ b/cc3200/mods/pybsd.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef PYBSD_H_
-#define PYBSD_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBSD_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBSD_H
 
 /******************************************************************************
  DEFINE PUBLIC TYPES
@@ -41,4 +41,4 @@
 extern pybsd_obj_t pybsd_obj;
 extern const mp_obj_type_t pyb_sd_type;
 
-#endif // PYBSD_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBSD_H
diff --git a/cc3200/mods/pybsleep.h b/cc3200/mods/pybsleep.h
index d34895a..513e6fa 100644
--- a/cc3200/mods/pybsleep.h
+++ b/cc3200/mods/pybsleep.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef PYBSLEEP_H_
-#define PYBSLEEP_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBSLEEP_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBSLEEP_H
 
 /******************************************************************************
  DEFINE CONSTANTS
@@ -70,4 +69,4 @@
 pybsleep_reset_cause_t pyb_sleep_get_reset_cause (void);
 pybsleep_wake_reason_t pyb_sleep_get_wake_reason (void);
 
-#endif /* PYBSLEEP_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBSLEEP_H
diff --git a/cc3200/mods/pybspi.h b/cc3200/mods/pybspi.h
index 48e0edd..b533b60 100644
--- a/cc3200/mods/pybspi.h
+++ b/cc3200/mods/pybspi.h
@@ -24,10 +24,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef PYBSPI_H_
-#define PYBSPI_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBSPI_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBSPI_H
 
 extern const mp_obj_type_t pyb_spi_type;
 
-#endif  // PYBSPI_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBSPI_H
diff --git a/cc3200/mods/pybtimer.h b/cc3200/mods/pybtimer.h
index 4e9de13..a1b30cd 100644
--- a/cc3200/mods/pybtimer.h
+++ b/cc3200/mods/pybtimer.h
@@ -24,6 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBTIMER_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBTIMER_H
 
 /******************************************************************************
  DECLARE EXPORTED DATA
@@ -35,3 +37,4 @@
  ******************************************************************************/
 void timer_init0 (void);
 
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBTIMER_H
diff --git a/cc3200/mods/pybuart.h b/cc3200/mods/pybuart.h
index 19bc936..5644098 100644
--- a/cc3200/mods/pybuart.h
+++ b/cc3200/mods/pybuart.h
@@ -24,9 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef PYBUART_H_
-#define PYBUART_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBUART_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBUART_H
 
 typedef enum {
     PYB_UART_0      =  0,
@@ -43,4 +42,4 @@
 bool uart_tx_char(pyb_uart_obj_t *self, int c);
 bool uart_tx_strn(pyb_uart_obj_t *uart_obj, const char *str, uint len);
 
-#endif  // PYBUART_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBUART_H
diff --git a/cc3200/mods/pybwdt.h b/cc3200/mods/pybwdt.h
index f87f0a7..2844587 100644
--- a/cc3200/mods/pybwdt.h
+++ b/cc3200/mods/pybwdt.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef PYBWDT_H_
-#define PYBWDT_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBWDT_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBWDT_H
 
 #include "py/obj.h"
 
@@ -36,4 +35,4 @@
 void pybwdt_srv_sleeping (bool state);
 void pybwdt_sl_alive (void);
 
-#endif /* PYBWDT_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBWDT_H
diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h
index 4bd583a..78f8c09 100644
--- a/cc3200/mpconfigport.h
+++ b/cc3200/mpconfigport.h
@@ -25,9 +25,6 @@
  * THE SOFTWARE.
  */
 
-#ifndef __INCLUDED_MPCONFIGPORT_H
-#define __INCLUDED_MPCONFIGPORT_H
-
 #include <stdint.h>
 
 #ifndef BOOTLOADER
@@ -235,5 +232,3 @@
 #define MICROPY_PORT_WLAN_AP_KEY                    "www.wipy.io"
 #define MICROPY_PORT_WLAN_AP_SECURITY               SL_SEC_TYPE_WPA_WPA2
 #define MICROPY_PORT_WLAN_AP_CHANNEL                5
-
-#endif // __INCLUDED_MPCONFIGPORT_H
diff --git a/cc3200/mptask.h b/cc3200/mptask.h
index e0d2f0e..9276cfc 100644
--- a/cc3200/mptask.h
+++ b/cc3200/mptask.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef MPTASK_H_
-#define MPTASK_H_
+#ifndef MICROPY_INCLUDED_CC3200_MPTASK_H
+#define MICROPY_INCLUDED_CC3200_MPTASK_H
 
 /******************************************************************************
  DEFINE CONSTANTS
@@ -44,4 +43,4 @@
  ******************************************************************************/
 extern void TASK_Micropython (void *pvParameters);
 
-#endif /* MPTASK_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MPTASK_H
diff --git a/cc3200/mpthreadport.h b/cc3200/mpthreadport.h
index 2b49232..dc9ba99 100644
--- a/cc3200/mpthreadport.h
+++ b/cc3200/mpthreadport.h
@@ -23,8 +23,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_CC3200_MPTHREADPORT_H__
-#define __MICROPY_INCLUDED_CC3200_MPTHREADPORT_H__
 
 #ifndef BOOTLOADER
 #include "FreeRTOS.h"
@@ -39,5 +37,3 @@
 
 void mp_thread_init(void);
 void mp_thread_gc_others(void);
-
-#endif // __MICROPY_INCLUDED_CC3200_MPTHREADPORT_H__
diff --git a/cc3200/serverstask.h b/cc3200/serverstask.h
index 2786ff6..77a3af2 100644
--- a/cc3200/serverstask.h
+++ b/cc3200/serverstask.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef SERVERSTASK_H_
-#define SERVERSTASK_H_
+#ifndef MICROPY_INCLUDED_CC3200_SERVERSTASK_H
+#define MICROPY_INCLUDED_CC3200_SERVERSTASK_H
 
 /******************************************************************************
  DEFINE CONSTANTS
@@ -73,4 +72,4 @@
 extern void servers_set_timeout (uint32_t timeout);
 extern uint32_t servers_get_timeout (void);
 
-#endif /* SERVERSTASK_H_ */
+#endif // MICROPY_INCLUDED_CC3200_SERVERSTASK_H
diff --git a/cc3200/telnet/telnet.h b/cc3200/telnet/telnet.h
index aa55313..1e3173b 100644
--- a/cc3200/telnet/telnet.h
+++ b/cc3200/telnet/telnet.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef TELNET_H_
-#define TELNET_H_
+#ifndef MICROPY_INCLUDED_CC3200_TELNET_TELNET_H
+#define MICROPY_INCLUDED_CC3200_TELNET_TELNET_H
 
 /******************************************************************************
  DECLARE EXPORTED FUNCTIONS
@@ -39,4 +38,4 @@
 extern void telnet_disable (void);
 extern void telnet_reset (void);
 
-#endif /* TELNET_H_ */
+#endif // MICROPY_INCLUDED_CC3200_TELNET_TELNET_H
diff --git a/cc3200/util/cryptohash.h b/cc3200/util/cryptohash.h
index d9f624d..df3a847 100644
--- a/cc3200/util/cryptohash.h
+++ b/cc3200/util/cryptohash.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef CRYPTOHASH_H_
-#define CRYPTOHASH_H_
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
+#define MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
 
 /******************************************************************************
  DECLARE PUBLIC FUNCTIONS
@@ -35,4 +34,4 @@
 extern void CRYPTOHASH_SHAMD5Update (uint8_t *data, uint32_t datalen);
 extern void CRYPTOHASH_SHAMD5Read (uint8_t *hash);
 
-#endif /* CRYPTOHASH_H_ */
+#endif // MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
diff --git a/cc3200/util/fifo.h b/cc3200/util/fifo.h
index c8590f5..ee7571c 100644
--- a/cc3200/util/fifo.h
+++ b/cc3200/util/fifo.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef FIFO_H_
-#define FIFO_H_
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
+#define MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
 
 typedef struct {
     void *pvElements;
@@ -47,4 +46,4 @@
 extern bool FIFO_IsFull (FIFO_t *fifo);
 extern void FIFO_Flush (FIFO_t *fifo);
 
-#endif /* FIFO_H_ */
+#endif // MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
diff --git a/cc3200/util/gccollect.h b/cc3200/util/gccollect.h
index 281e84a..3c4232b 100644
--- a/cc3200/util/gccollect.h
+++ b/cc3200/util/gccollect.h
@@ -24,6 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
+#define MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
 
 // variables defining memory layout
 extern uint32_t _etext;
@@ -39,3 +41,5 @@
 extern uint32_t _estack;
 
 void gc_collect(void);
+
+#endif // MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
diff --git a/cc3200/util/gchelper.h b/cc3200/util/gchelper.h
index 1f7d2fe..0277a75 100644
--- a/cc3200/util/gchelper.h
+++ b/cc3200/util/gchelper.h
@@ -24,11 +24,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef GC_HELPER_H_
-#define GC_HELPER_H_
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
+#define MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
 
 extern mp_uint_t gc_helper_get_sp(void);
 extern mp_uint_t gc_helper_get_regs_and_sp(mp_uint_t *regs);
 
-#endif /* GC_HELPER_H_ */
+#endif // MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
diff --git a/cc3200/util/random.h b/cc3200/util/random.h
index 67fd1ff..60b0b86 100644
--- a/cc3200/util/random.h
+++ b/cc3200/util/random.h
@@ -23,13 +23,12 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __RANDOM_H
-#define __RANDOM_H
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
+#define MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
 
 void rng_init0 (void);
 uint32_t rng_get (void);
 
 MP_DECLARE_CONST_FUN_OBJ_0(machine_rng_get_obj);
 
-#endif // __RANDOM_H
+#endif // MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
diff --git a/cc3200/util/sleeprestore.h b/cc3200/util/sleeprestore.h
index 51416f0..1c5509d 100644
--- a/cc3200/util/sleeprestore.h
+++ b/cc3200/util/sleeprestore.h
@@ -23,11 +23,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef SLEEPRESTORE_H_
-#define SLEEPRESTORE_H_
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
+#define MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
 
 extern void sleep_store(void);
 extern void sleep_restore(void);
 
-#endif /* SLEEPRESTORE_H_ */
+#endif // MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
diff --git a/cc3200/util/socketfifo.h b/cc3200/util/socketfifo.h
index 69b1765..1309201 100644
--- a/cc3200/util/socketfifo.h
+++ b/cc3200/util/socketfifo.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef SOCKETFIFO_H_
-#define SOCKETFIFO_H_
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H
+#define MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H
 
 /*----------------------------------------------------------------------------
  ** Imports
@@ -60,4 +59,4 @@
 extern void SOCKETFIFO_Flush (void);
 extern unsigned int SOCKETFIFO_Count (void);
 
-#endif /* SOCKETFIFO_H_ */
+#endif // MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H
diff --git a/cc3200/version.h b/cc3200/version.h
index c8315d7..83e3f8c 100644
--- a/cc3200/version.h
+++ b/cc3200/version.h
@@ -23,10 +23,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

  * THE SOFTWARE.

  */

-

-#ifndef VERSION_H_

-#define VERSION_H_

+#ifndef MICROPY_INCLUDED_CC3200_VERSION_H

+#define MICROPY_INCLUDED_CC3200_VERSION_H

 

 #define WIPY_SW_VERSION_NUMBER                              "1.2.0"

 

-#endif /* VERSION_H_ */

+#endif // MICROPY_INCLUDED_CC3200_VERSION_H

diff --git a/drivers/dht/dht.h b/drivers/dht/dht.h
index 2095403..883e077 100644
--- a/drivers/dht/dht.h
+++ b/drivers/dht/dht.h
@@ -1,3 +1,8 @@
+#ifndef MICROPY_INCLUDED_DRIVERS_DHT_DHT_H
+#define MICROPY_INCLUDED_DRIVERS_DHT_DHT_H
+
 #include "py/obj.h"
 
 MP_DECLARE_CONST_FUN_OBJ_2(dht_readinto_obj);
+
+#endif // MICROPY_INCLUDED_DRIVERS_DHT_DHT_H
diff --git a/drivers/memory/spiflash.h b/drivers/memory/spiflash.h
index d2e8174..967352b 100644
--- a/drivers/memory/spiflash.h
+++ b/drivers/memory/spiflash.h
@@ -23,7 +23,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
 #ifndef MICROPY_INCLUDED_DRIVERS_MEMORY_SPIFLASH_H
 #define MICROPY_INCLUDED_DRIVERS_MEMORY_SPIFLASH_H
 
diff --git a/esp8266/esp_mphal.h b/esp8266/esp_mphal.h
index d783f1f..1d1d6de 100644
--- a/esp8266/esp_mphal.h
+++ b/esp8266/esp_mphal.h
@@ -24,9 +24,6 @@
  * THE SOFTWARE.
  */
 
-#ifndef _INCLUDED_MPHAL_H_
-#define _INCLUDED_MPHAL_H_
-
 #include "py/ringbuf.h"
 #include "lib/utils/interrupt_char.h"
 #include "xtirq.h"
@@ -96,5 +93,3 @@
 
 void *ets_get_esf_buf_ctlblk(void);
 int ets_esf_free_bufs(int idx);
-
-#endif // _INCLUDED_MPHAL_H_
diff --git a/esp8266/espapa102.h b/esp8266/espapa102.h
index 82c9202..dd7c5ab 100644
--- a/esp8266/espapa102.h
+++ b/esp8266/espapa102.h
@@ -23,5 +23,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_ESP8266_ESPAPA102_H
+#define MICROPY_INCLUDED_ESP8266_ESPAPA102_H
 
 void esp_apa102_write(uint8_t clockPin, uint8_t dataPin, uint8_t *pixels, uint32_t numBytes);
+
+#endif // MICROPY_INCLUDED_ESP8266_ESPAPA102_H
diff --git a/esp8266/espneopixel.h b/esp8266/espneopixel.h
index 4b20afd..c444740 100644
--- a/esp8266/espneopixel.h
+++ b/esp8266/espneopixel.h
@@ -1 +1,6 @@
+#ifndef MICROPY_INCLUDED_ESP8266_ESPNEOPIXEL_H
+#define MICROPY_INCLUDED_ESP8266_ESPNEOPIXEL_H
+
 void esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32_t numBytes, bool is800KHz);
+
+#endif // MICROPY_INCLUDED_ESP8266_ESPNEOPIXEL_H
diff --git a/esp8266/esppwm.h b/esp8266/esppwm.h
index 242a9a2..1ee4a2f 100644
--- a/esp8266/esppwm.h
+++ b/esp8266/esppwm.h
@@ -1,5 +1,5 @@
-#ifndef __ESPPWM_H__
-#define __ESPPWM_H__
+#ifndef MICROPY_INCLUDED_ESP8266_ESPPWM_H
+#define MICROPY_INCLUDED_ESP8266_ESPPWM_H
 
 #include <stdbool.h>
 #include <stdint.h>
@@ -14,4 +14,4 @@
 int pwm_add(uint8_t pin_id, uint32_t pin_mux, uint32_t pin_func);
 bool pwm_delete(uint8_t channel);
 
-#endif
+#endif // MICROPY_INCLUDED_ESP8266_ESPPWM_H
diff --git a/esp8266/ets_alt_task.h b/esp8266/ets_alt_task.h
index dba0c5f..33a9d3a 100644
--- a/esp8266/ets_alt_task.h
+++ b/esp8266/ets_alt_task.h
@@ -1,4 +1,9 @@
+#ifndef MICROPY_INCLUDED_ESP8266_ETS_ALT_TASK_H
+#define MICROPY_INCLUDED_ESP8266_ETS_ALT_TASK_H
+
 extern int ets_loop_iter_disable;
 extern uint32_t system_time_high_word;
 
 bool ets_loop_iter(void);
+
+#endif // MICROPY_INCLUDED_ESP8266_ETS_ALT_TASK_H
diff --git a/esp8266/etshal.h b/esp8266/etshal.h
index 90af63b..3478777 100644
--- a/esp8266/etshal.h
+++ b/esp8266/etshal.h
@@ -1,5 +1,5 @@
-#ifndef _INCLUDED_ETSHAL_H_
-#define _INCLUDED_ETSHAL_H_
+#ifndef MICROPY_INCLUDED_ESP8266_ETSHAL_H
+#define MICROPY_INCLUDED_ESP8266_ETSHAL_H
 
 #include <os_type.h>
 
@@ -42,4 +42,4 @@
 uint32_t SPIWrite(uint32_t offset, const void *buf, uint32_t len);
 uint32_t SPIEraseSector(int sector);
 
-#endif // _INCLUDED_ETSHAL_H_
+#endif // MICROPY_INCLUDED_ESP8266_ETSHAL_H
diff --git a/esp8266/gccollect.h b/esp8266/gccollect.h
index d81cba1..0aee427 100644
--- a/esp8266/gccollect.h
+++ b/esp8266/gccollect.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_ESP8266_GCCOLLECT_H
+#define MICROPY_INCLUDED_ESP8266_GCCOLLECT_H
 
 extern uint32_t _text_start;
 extern uint32_t _text_end;
@@ -39,3 +41,5 @@
 
 void gc_collect(void);
 void esp_native_code_gc_collect(void);
+
+#endif // MICROPY_INCLUDED_ESP8266_GCCOLLECT_H
diff --git a/esp8266/modmachine.h b/esp8266/modmachine.h
index 414aaa8..eae351f 100644
--- a/esp8266/modmachine.h
+++ b/esp8266/modmachine.h
@@ -1,5 +1,5 @@
-#ifndef __MICROPY_INCLUDED_ESP8266_MODPYB_H__
-#define __MICROPY_INCLUDED_ESP8266_MODPYB_H__
+#ifndef MICROPY_INCLUDED_ESP8266_MODMACHINE_H
+#define MICROPY_INCLUDED_ESP8266_MODMACHINE_H
 
 #include "py/obj.h"
 
@@ -38,4 +38,4 @@
 uint64_t pyb_rtc_get_us_since_2000();
 void rtc_prepare_deepsleep(uint64_t sleep_us);
 
-#endif // __MICROPY_INCLUDED_ESP8266_MODPYB_H__
+#endif // MICROPY_INCLUDED_ESP8266_MODMACHINE_H
diff --git a/esp8266/uart.h b/esp8266/uart.h
index f6850c4..ebcd8b0 100644
--- a/esp8266/uart.h
+++ b/esp8266/uart.h
@@ -1,5 +1,5 @@
-#ifndef _INCLUDED_UART_H_
-#define _INCLUDED_UART_H_
+#ifndef MICROPY_INCLUDED_ESP8266_UART_H
+#define MICROPY_INCLUDED_ESP8266_UART_H
 
 #include <eagle_soc.h>
 
@@ -103,4 +103,4 @@
 int uart_rx_any(uint8 uart);
 int uart_tx_any_room(uint8 uart);
 
-#endif // _INCLUDED_UART_H_
+#endif // MICROPY_INCLUDED_ESP8266_UART_H
diff --git a/esp8266/xtirq.h b/esp8266/xtirq.h
index 856ff07..595052f 100644
--- a/esp8266/xtirq.h
+++ b/esp8266/xtirq.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_ESP8266_XTIRQ_H__
-#define __MICROPY_INCLUDED_ESP8266_XTIRQ_H__
+#ifndef MICROPY_INCLUDED_ESP8266_XTIRQ_H
+#define MICROPY_INCLUDED_ESP8266_XTIRQ_H
 
 #include <stdint.h>
 
@@ -57,4 +56,4 @@
     restore_irq_pri(irq_state);
 }
 
-#endif // __MICROPY_INCLUDED_ESP8266_XTIRQ_H__
+#endif // MICROPY_INCLUDED_ESP8266_XTIRQ_H
diff --git a/extmod/lwip-include/arch/cc.h b/extmod/lwip-include/arch/cc.h
index 0a7907d..400dc6e 100644
--- a/extmod/lwip-include/arch/cc.h
+++ b/extmod/lwip-include/arch/cc.h
@@ -1,5 +1,5 @@
-#ifndef __CC_H__
-#define __CC_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_CC_H
+#define MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_CC_H
 
 #include <stdint.h>
 
@@ -38,4 +38,4 @@
 #define PACK_STRUCT_BEGIN
 #define PACK_STRUCT_END
 
-#endif /* __ARCH_CC_H__ */
+#endif // MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_CC_H
diff --git a/extmod/lwip-include/arch/perf.h b/extmod/lwip-include/arch/perf.h
index 5171070..d310fc3 100644
--- a/extmod/lwip-include/arch/perf.h
+++ b/extmod/lwip-include/arch/perf.h
@@ -1,7 +1,7 @@
-#ifndef __PERF_H__
-#define __PERF_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_PERF_H
+#define MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_PERF_H
 
 #define PERF_START    /* null definition */
 #define PERF_STOP(x)  /* null definition */
 
-#endif /* __PERF_H__ */
+#endif // MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_PERF_H
diff --git a/extmod/lwip-include/lwipopts.h b/extmod/lwip-include/lwipopts.h
index e4a33b2..2122f30 100644
--- a/extmod/lwip-include/lwipopts.h
+++ b/extmod/lwip-include/lwipopts.h
@@ -1,5 +1,5 @@
-#ifndef __LWIPOPTS_H__
-#define __LWIPOPTS_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_LWIPOPTS_H
+#define MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_LWIPOPTS_H
 
 #include <py/mpconfig.h>
 #include <py/misc.h>
@@ -32,5 +32,4 @@
 // things like this into a port-provided header file.
 #define sys_now mp_hal_ticks_ms
 
-#endif
-
+#endif // MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_LWIPOPTS_H
diff --git a/extmod/machine_i2c.h b/extmod/machine_i2c.h
index d49ff01..f5af665 100644
--- a/extmod/machine_i2c.h
+++ b/extmod/machine_i2c.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H__
-#define __MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H
+#define MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H
 
 #include "py/obj.h"
 
@@ -54,4 +53,4 @@
 int mp_machine_soft_i2c_readfrom(mp_obj_base_t *self_in, uint16_t addr, uint8_t *dest, size_t len, bool stop);
 int mp_machine_soft_i2c_writeto(mp_obj_base_t *self_in, uint16_t addr, const uint8_t *src, size_t len, bool stop);
 
-#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H__
+#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H
diff --git a/extmod/machine_mem.h b/extmod/machine_mem.h
index fddd7d4..4bc9ac1 100644
--- a/extmod/machine_mem.h
+++ b/extmod/machine_mem.h
@@ -23,10 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-
-#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H__
-#define __MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H
+#define MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H
 
 #include "py/obj.h"
 
@@ -48,4 +46,4 @@
 uintptr_t MICROPY_MACHINE_MEM_GET_WRITE_ADDR(mp_obj_t addr_o, uint align);
 #endif
 
-#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H__
+#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H
diff --git a/extmod/machine_pinbase.h b/extmod/machine_pinbase.h
index ece3384..c96abbc 100644
--- a/extmod/machine_pinbase.h
+++ b/extmod/machine_pinbase.h
@@ -23,13 +23,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-
-#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H__
-#define __MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H
+#define MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H
 
 #include "py/obj.h"
 
 extern const mp_obj_type_t machine_pinbase_type;
 
-#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H__
+#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H
diff --git a/extmod/machine_pulse.h b/extmod/machine_pulse.h
index cc1c4ed..e303dca 100644
--- a/extmod/machine_pulse.h
+++ b/extmod/machine_pulse.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H__
-#define __MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H
+#define MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H
 
 #include "py/obj.h"
 #include "py/mphal.h"
@@ -34,4 +33,4 @@
 
 MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_time_pulse_us_obj);
 
-#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H__
+#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H
diff --git a/extmod/machine_signal.h b/extmod/machine_signal.h
index 7f88cba..df1c3e2 100644
--- a/extmod/machine_signal.h
+++ b/extmod/machine_signal.h
@@ -23,13 +23,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-
-#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H__
-#define __MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H
+#define MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H
 
 #include "py/obj.h"
 
 extern const mp_obj_type_t machine_signal_type;
 
-#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H__
+#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H
diff --git a/extmod/machine_spi.h b/extmod/machine_spi.h
index 88a3e19..e24e41e 100644
--- a/extmod/machine_spi.h
+++ b/extmod/machine_spi.h
@@ -23,7 +23,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
 #ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_SPI_H
 #define MICROPY_INCLUDED_EXTMOD_MACHINE_SPI_H
 
diff --git a/extmod/misc.h b/extmod/misc.h
index d7ead06..6c13592 100644
--- a/extmod/misc.h
+++ b/extmod/misc.h
@@ -24,6 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_EXTMOD_MISC_H
+#define MICROPY_INCLUDED_EXTMOD_MISC_H
 
 // This file contains cumulative declarations for extmod/ .
 
@@ -38,3 +40,5 @@
 #else
 #define mp_uos_dupterm_tx_strn(s, l)
 #endif
+
+#endif // MICROPY_INCLUDED_EXTMOD_MISC_H
diff --git a/extmod/modubinascii.h b/extmod/modubinascii.h
index 33d0f1c..6c0156f 100644
--- a/extmod/modubinascii.h
+++ b/extmod/modubinascii.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef MICROPY_EXTMOD_MODUBINASCII
-#define MICROPY_EXTMOD_MODUBINASCII
+#ifndef MICROPY_INCLUDED_EXTMOD_MODUBINASCII_H
+#define MICROPY_INCLUDED_EXTMOD_MODUBINASCII_H
 
 extern mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args);
 extern mp_obj_t mod_binascii_unhexlify(mp_obj_t data);
@@ -39,4 +38,4 @@
 MP_DECLARE_CONST_FUN_OBJ_1(mod_binascii_b2a_base64_obj);
 MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_binascii_crc32_obj);
 
-#endif /* MICROPY_EXTMOD_MODUBINASCII */
+#endif // MICROPY_INCLUDED_EXTMOD_MODUBINASCII_H
diff --git a/extmod/modwebsocket.h b/extmod/modwebsocket.h
index 7da1475..2720147 100644
--- a/extmod/modwebsocket.h
+++ b/extmod/modwebsocket.h
@@ -1,5 +1,10 @@
+#ifndef MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H
+#define MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H
+
 #define FRAME_OPCODE_MASK 0x0f
 enum {
     FRAME_CONT, FRAME_TXT, FRAME_BIN,
     FRAME_CLOSE = 0x8, FRAME_PING, FRAME_PONG
 };
+
+#endif // MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H
diff --git a/extmod/utime_mphal.h b/extmod/utime_mphal.h
index 644387b..88a9ed4 100644
--- a/extmod/utime_mphal.h
+++ b/extmod/utime_mphal.h
@@ -24,6 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_EXTMOD_UTIME_MPHAL_H
+#define MICROPY_INCLUDED_EXTMOD_UTIME_MPHAL_H
 
 #include "py/obj.h"
 
@@ -35,3 +37,5 @@
 MP_DECLARE_CONST_FUN_OBJ_0(mp_utime_ticks_cpu_obj);
 MP_DECLARE_CONST_FUN_OBJ_2(mp_utime_ticks_diff_obj);
 MP_DECLARE_CONST_FUN_OBJ_2(mp_utime_ticks_add_obj);
+
+#endif // MICROPY_INCLUDED_EXTMOD_UTIME_MPHAL_H
diff --git a/extmod/vfs.h b/extmod/vfs.h
index edaeb53..f2efdbe 100644
--- a/extmod/vfs.h
+++ b/extmod/vfs.h
@@ -23,7 +23,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
 #ifndef MICROPY_INCLUDED_EXTMOD_VFS_H
 #define MICROPY_INCLUDED_EXTMOD_VFS_H
 
diff --git a/extmod/vfs_fat.h b/extmod/vfs_fat.h
index 6c7c05a..63c4abb 100644
--- a/extmod/vfs_fat.h
+++ b/extmod/vfs_fat.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_EXTMOD_VFS_FAT_H
+#define MICROPY_INCLUDED_EXTMOD_VFS_FAT_H
 
 #include "py/lexer.h"
 #include "py/obj.h"
@@ -58,3 +60,5 @@
 MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_open_obj);
 
 mp_obj_t fat_vfs_ilistdir2(struct _fs_user_mount_t *vfs, const char *path, bool is_str_type);
+
+#endif // MICROPY_INCLUDED_EXTMOD_VFS_FAT_H
diff --git a/extmod/virtpin.h b/extmod/virtpin.h
index 0410103..706affc 100644
--- a/extmod/virtpin.h
+++ b/extmod/virtpin.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_EXTMOD_VIRTPIN_H
+#define MICROPY_INCLUDED_EXTMOD_VIRTPIN_H
 
 #include "py/obj.h"
 
@@ -41,3 +43,5 @@
 
 // If a port exposes a Pin object, it's constructor should be like this
 mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
+
+#endif // MICROPY_INCLUDED_EXTMOD_VIRTPIN_H
diff --git a/lib/mp-readline/readline.h b/lib/mp-readline/readline.h
index f73934d..f53fdea 100644
--- a/lib/mp-readline/readline.h
+++ b/lib/mp-readline/readline.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_LIB_MP_READLINE_READLINE_H
+#define MICROPY_INCLUDED_LIB_MP_READLINE_READLINE_H
 
 #define CHAR_CTRL_A (1)
 #define CHAR_CTRL_B (2)
@@ -42,3 +44,5 @@
 void readline_init(vstr_t *line, const char *prompt);
 void readline_note_newline(const char *prompt);
 int readline_process_char(int c);
+
+#endif // MICROPY_INCLUDED_LIB_MP_READLINE_READLINE_H
diff --git a/lib/netutils/netutils.h b/lib/netutils/netutils.h
index 45e0216..1e147af 100644
--- a/lib/netutils/netutils.h
+++ b/lib/netutils/netutils.h
@@ -24,8 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_LIB_NETUTILS_H__
-#define __MICROPY_INCLUDED_LIB_NETUTILS_H__
+#ifndef MICROPY_INCLUDED_LIB_NETUTILS_NETUTILS_H
+#define MICROPY_INCLUDED_LIB_NETUTILS_NETUTILS_H
 
 #define NETUTILS_IPV4ADDR_BUFSIZE    4
 
@@ -47,4 +47,4 @@
 // puts IP in out_ip (which must take at least IPADDR_BUF_SIZE bytes).
 mp_uint_t netutils_parse_inet_addr(mp_obj_t addr_in, uint8_t *out_ip, netutils_endian_t endian);
 
-#endif // __MICROPY_INCLUDED_LIB_NETUTILS_H__
+#endif // MICROPY_INCLUDED_LIB_NETUTILS_NETUTILS_H
diff --git a/lib/timeutils/timeutils.h b/lib/timeutils/timeutils.h
index c3f1fc2..1dc486e 100644
--- a/lib/timeutils/timeutils.h
+++ b/lib/timeutils/timeutils.h
@@ -24,9 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_LIB_TIMEUTILS_H__
-#define __MICROPY_INCLUDED_LIB_TIMEUTILS_H__
+#ifndef MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
+#define MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
 
 typedef struct _timeutils_struct_time_t {
     uint16_t    tm_year;    // i.e. 2014
@@ -52,4 +51,4 @@
 mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday,
     mp_int_t hours, mp_int_t minutes, mp_int_t seconds);
 
-#endif // __MICROPY_INCLUDED_LIB_TIMEUTILS_H__
+#endif // MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
diff --git a/lib/utils/interrupt_char.h b/lib/utils/interrupt_char.h
index ae0bf57..ca50d4d 100644
--- a/lib/utils/interrupt_char.h
+++ b/lib/utils/interrupt_char.h
@@ -23,7 +23,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_LIB_UTILS_INTERRUPT_CHAR_H
+#define MICROPY_INCLUDED_LIB_UTILS_INTERRUPT_CHAR_H
 
 extern int mp_interrupt_char;
 void mp_hal_set_interrupt_char(int c);
 void mp_keyboard_interrupt(void);
+
+#endif // MICROPY_INCLUDED_LIB_UTILS_INTERRUPT_CHAR_H
diff --git a/lib/utils/pyexec.h b/lib/utils/pyexec.h
index 0c7567e..69cdb47 100644
--- a/lib/utils/pyexec.h
+++ b/lib/utils/pyexec.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H__
-#define __MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H__
+#ifndef MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H
+#define MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H
 
 typedef enum {
     PYEXEC_MODE_RAW_REPL,
@@ -51,4 +51,4 @@
 
 MP_DECLARE_CONST_FUN_OBJ_1(pyb_set_repl_info_obj);
 
-#endif // __MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H__
+#endif // MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H
diff --git a/pic16bit/board.h b/pic16bit/board.h
index 0eb0224..f79dd34 100644
--- a/pic16bit/board.h
+++ b/pic16bit/board.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PIC16BIT_BOARD_H__
-#define __MICROPY_INCLUDED_PIC16BIT_BOARD_H__
+#ifndef MICROPY_INCLUDED_PIC16BIT_BOARD_H
+#define MICROPY_INCLUDED_PIC16BIT_BOARD_H
 
 void cpu_init(void);
 
@@ -40,4 +40,4 @@
 int uart_rx_char(void);
 void uart_tx_char(int chr);
 
-#endif // __MICROPY_INCLUDED_PIC16BIT_BOARD_H__
+#endif // MICROPY_INCLUDED_PIC16BIT_BOARD_H
diff --git a/pic16bit/modpyb.h b/pic16bit/modpyb.h
index 6c68cbd..910ec1b 100644
--- a/pic16bit/modpyb.h
+++ b/pic16bit/modpyb.h
@@ -23,11 +23,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PIC16BIT_MODPYB_H__
-#define __MICROPY_INCLUDED_PIC16BIT_MODPYB_H__
+#ifndef MICROPY_INCLUDED_PIC16BIT_MODPYB_H
+#define MICROPY_INCLUDED_PIC16BIT_MODPYB_H
 
 extern const mp_obj_type_t pyb_led_type;
 extern const mp_obj_type_t pyb_switch_type;
 extern const mp_obj_module_t pyb_module;
 
-#endif // __MICROPY_INCLUDED_PIC16BIT_MODPYB_H__
+#endif // MICROPY_INCLUDED_PIC16BIT_MODPYB_H
diff --git a/pic16bit/pic16bit_mphal.h b/pic16bit/pic16bit_mphal.h
index a858f7e..ffcca41 100644
--- a/pic16bit/pic16bit_mphal.h
+++ b/pic16bit/pic16bit_mphal.h
@@ -23,13 +23,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PIC16BIT_PIC16BIT_MPHAL_H__
-#define __MICROPY_INCLUDED_PIC16BIT_PIC16BIT_MPHAL_H__
 
 #include "py/mpstate.h"
 
 void mp_hal_init(void);
 
 void mp_hal_set_interrupt_char(int c);
-
-#endif // __MICROPY_INCLUDED_PIC16BIT_PIC16BIT_MPHAL_H__
diff --git a/pic16bit/unistd.h b/pic16bit/unistd.h
index cdd9fe0..5b60c8a 100644
--- a/pic16bit/unistd.h
+++ b/pic16bit/unistd.h
@@ -1,5 +1,10 @@
+#ifndef MICROPY_INCLUDED_PIC16BIT_UNISTD_H
+#define MICROPY_INCLUDED_PIC16BIT_UNISTD_H
+
 // XC16 compiler doesn't seem to have unistd.h file
 
 #define SEEK_CUR 1
 
 typedef int ssize_t;
+
+#endif // MICROPY_INCLUDED_PIC16BIT_UNISTD_H
diff --git a/py/asmarm.h b/py/asmarm.h
index e273b98..c590092 100644
--- a/py/asmarm.h
+++ b/py/asmarm.h
@@ -24,8 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_ASMARM_H__
-#define __MICROPY_INCLUDED_PY_ASMARM_H__
+#ifndef MICROPY_INCLUDED_PY_ASMARM_H
+#define MICROPY_INCLUDED_PY_ASMARM_H
 
 #include "py/misc.h"
 #include "py/asmbase.h"
@@ -202,4 +202,4 @@
 
 #endif // GENERIC_ASM_API
 
-#endif // __MICROPY_INCLUDED_PY_ASMARM_H__
+#endif // MICROPY_INCLUDED_PY_ASMARM_H
diff --git a/py/asmthumb.h b/py/asmthumb.h
index 52e663b..589c481 100644
--- a/py/asmthumb.h
+++ b/py/asmthumb.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_ASMTHUMB_H__
-#define __MICROPY_INCLUDED_PY_ASMTHUMB_H__
+#ifndef MICROPY_INCLUDED_PY_ASMTHUMB_H
+#define MICROPY_INCLUDED_PY_ASMTHUMB_H
 
 #include "py/misc.h"
 #include "py/asmbase.h"
@@ -318,4 +318,4 @@
 
 #endif // GENERIC_ASM_API
 
-#endif // __MICROPY_INCLUDED_PY_ASMTHUMB_H__
+#endif // MICROPY_INCLUDED_PY_ASMTHUMB_H
diff --git a/py/asmx64.h b/py/asmx64.h
index 4499c53..a384cca 100644
--- a/py/asmx64.h
+++ b/py/asmx64.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_ASMX64_H__
-#define __MICROPY_INCLUDED_PY_ASMX64_H__
+#ifndef MICROPY_INCLUDED_PY_ASMX64_H
+#define MICROPY_INCLUDED_PY_ASMX64_H
 
 #include "py/mpconfig.h"
 #include "py/misc.h"
@@ -197,4 +197,4 @@
 
 #endif // GENERIC_ASM_API
 
-#endif // __MICROPY_INCLUDED_PY_ASMX64_H__
+#endif // MICROPY_INCLUDED_PY_ASMX64_H
diff --git a/py/asmx86.h b/py/asmx86.h
index 0b44af6..fd34228 100644
--- a/py/asmx86.h
+++ b/py/asmx86.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_ASMX86_H__
-#define __MICROPY_INCLUDED_PY_ASMX86_H__
+#ifndef MICROPY_INCLUDED_PY_ASMX86_H
+#define MICROPY_INCLUDED_PY_ASMX86_H
 
 #include "py/mpconfig.h"
 #include "py/misc.h"
@@ -195,4 +195,4 @@
 
 #endif // GENERIC_ASM_API
 
-#endif // __MICROPY_INCLUDED_PY_ASMX86_H__
+#endif // MICROPY_INCLUDED_PY_ASMX86_H
diff --git a/py/bc.h b/py/bc.h
index 88045dc..c55d31f 100644
--- a/py/bc.h
+++ b/py/bc.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_BC_H__
-#define __MICROPY_INCLUDED_PY_BC_H__
+#ifndef MICROPY_INCLUDED_PY_BC_H
+#define MICROPY_INCLUDED_PY_BC_H
 
 #include "py/runtime.h"
 #include "py/obj.h"
@@ -119,4 +119,4 @@
 
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_BC_H__
+#endif // MICROPY_INCLUDED_PY_BC_H
diff --git a/py/bc0.h b/py/bc0.h
index b5650ab..be8ac6c 100644
--- a/py/bc0.h
+++ b/py/bc0.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_BC0_H__
-#define __MICROPY_INCLUDED_PY_BC0_H__
+#ifndef MICROPY_INCLUDED_PY_BC0_H
+#define MICROPY_INCLUDED_PY_BC0_H
 
 // Micro Python byte-codes.
 // The comment at the end of the line (if it exists) tells the arguments to the byte-code.
@@ -116,4 +116,4 @@
 #define MP_BC_UNARY_OP_MULTI             (0xd0) // + op(7)
 #define MP_BC_BINARY_OP_MULTI            (0xd7) // + op(36)
 
-#endif // __MICROPY_INCLUDED_PY_BC0_H__
+#endif // MICROPY_INCLUDED_PY_BC0_H
diff --git a/py/binary.h b/py/binary.h
index 997d878..04cc6d8 100644
--- a/py/binary.h
+++ b/py/binary.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_BINARY_H__
-#define __MICROPY_INCLUDED_PY_BINARY_H__
+#ifndef MICROPY_INCLUDED_PY_BINARY_H
+#define MICROPY_INCLUDED_PY_BINARY_H
 
 #include "py/obj.h"
 
@@ -41,4 +41,4 @@
 long long mp_binary_get_int(mp_uint_t size, bool is_signed, bool big_endian, const byte *src);
 void mp_binary_set_int(mp_uint_t val_sz, bool big_endian, byte *dest, mp_uint_t val);
 
-#endif // __MICROPY_INCLUDED_PY_BINARY_H__
+#endif // MICROPY_INCLUDED_PY_BINARY_H
diff --git a/py/builtin.h b/py/builtin.h
index ec326d0..4915383 100644
--- a/py/builtin.h
+++ b/py/builtin.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_BUILTIN_H__
-#define __MICROPY_INCLUDED_PY_BUILTIN_H__
+#ifndef MICROPY_INCLUDED_PY_BUILTIN_H
+#define MICROPY_INCLUDED_PY_BUILTIN_H
 
 #include "py/obj.h"
 
@@ -120,4 +120,4 @@
 
 extern const char *MICROPY_PY_BUILTINS_HELP_TEXT;
 
-#endif // __MICROPY_INCLUDED_PY_BUILTIN_H__
+#endif // MICROPY_INCLUDED_PY_BUILTIN_H
diff --git a/py/compile.h b/py/compile.h
index 45a9858..f6b262d 100644
--- a/py/compile.h
+++ b/py/compile.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_COMPILE_H__
-#define __MICROPY_INCLUDED_PY_COMPILE_H__
+#ifndef MICROPY_INCLUDED_PY_COMPILE_H
+#define MICROPY_INCLUDED_PY_COMPILE_H
 
 #include "py/lexer.h"
 #include "py/parse.h"
@@ -51,4 +51,4 @@
 // this is implemented in runtime.c
 mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_input_kind, mp_obj_dict_t *globals, mp_obj_dict_t *locals);
 
-#endif // __MICROPY_INCLUDED_PY_COMPILE_H__
+#endif // MICROPY_INCLUDED_PY_COMPILE_H
diff --git a/py/emit.h b/py/emit.h
index 0236a9b..a58e20e 100644
--- a/py/emit.h
+++ b/py/emit.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_PY_EMIT_H__
-#define __MICROPY_INCLUDED_PY_EMIT_H__
+#ifndef MICROPY_INCLUDED_PY_EMIT_H
+#define MICROPY_INCLUDED_PY_EMIT_H
 
 #include "py/lexer.h"
 #include "py/scope.h"
@@ -284,4 +283,4 @@
 #define mp_emitter_warning(pass, msg)
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_EMIT_H__
+#endif // MICROPY_INCLUDED_PY_EMIT_H
diff --git a/py/emitglue.h b/py/emitglue.h
index 37c4f1b..3099965 100644
--- a/py/emitglue.h
+++ b/py/emitglue.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_EMITGLUE_H__
-#define __MICROPY_INCLUDED_PY_EMITGLUE_H__
+#ifndef MICROPY_INCLUDED_PY_EMITGLUE_H
+#define MICROPY_INCLUDED_PY_EMITGLUE_H
 
 #include "py/obj.h"
 
@@ -74,4 +74,4 @@
 mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_args, mp_obj_t def_kw_args);
 mp_obj_t mp_make_closure_from_raw_code(const mp_raw_code_t *rc, mp_uint_t n_closed_over, const mp_obj_t *args);
 
-#endif // __MICROPY_INCLUDED_PY_EMITGLUE_H__
+#endif // MICROPY_INCLUDED_PY_EMITGLUE_H
diff --git a/py/formatfloat.h b/py/formatfloat.h
index 0196034..9c8d137 100644
--- a/py/formatfloat.h
+++ b/py/formatfloat.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_FORMATFLOAT_H__
-#define __MICROPY_INCLUDED_PY_FORMATFLOAT_H__
+#ifndef MICROPY_INCLUDED_PY_FORMATFLOAT_H
+#define MICROPY_INCLUDED_PY_FORMATFLOAT_H
 
 #include "py/mpconfig.h"
 
@@ -32,4 +32,4 @@
 int mp_format_float(mp_float_t f, char *buf, size_t bufSize, char fmt, int prec, char sign);
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_FORMATFLOAT_H__
+#endif // MICROPY_INCLUDED_PY_FORMATFLOAT_H
diff --git a/py/frozenmod.h b/py/frozenmod.h
index 7c1299b..6993167 100644
--- a/py/frozenmod.h
+++ b/py/frozenmod.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_FROZENMOD_H__
-#define __MICROPY_INCLUDED_PY_FROZENMOD_H__
+#ifndef MICROPY_INCLUDED_PY_FROZENMOD_H
+#define MICROPY_INCLUDED_PY_FROZENMOD_H
 
 #include "py/lexer.h"
 
@@ -38,4 +38,4 @@
 const char *mp_find_frozen_str(const char *str, size_t *len);
 mp_import_stat_t mp_frozen_stat(const char *str);
 
-#endif // __MICROPY_INCLUDED_PY_FROZENMOD_H__
+#endif // MICROPY_INCLUDED_PY_FROZENMOD_H
diff --git a/py/gc.h b/py/gc.h
index 7d8fe2b..1366955 100644
--- a/py/gc.h
+++ b/py/gc.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_GC_H__
-#define __MICROPY_INCLUDED_PY_GC_H__
+#ifndef MICROPY_INCLUDED_PY_GC_H
+#define MICROPY_INCLUDED_PY_GC_H
 
 #include <stdint.h>
 
@@ -64,4 +64,4 @@
 void gc_dump_info(void);
 void gc_dump_alloc_table(void);
 
-#endif // __MICROPY_INCLUDED_PY_GC_H__
+#endif // MICROPY_INCLUDED_PY_GC_H
diff --git a/py/lexer.h b/py/lexer.h
index 5d998b3..435aa09 100644
--- a/py/lexer.h
+++ b/py/lexer.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_LEXER_H__
-#define __MICROPY_INCLUDED_PY_LEXER_H__
+#ifndef MICROPY_INCLUDED_PY_LEXER_H
+#define MICROPY_INCLUDED_PY_LEXER_H
 
 #include <stdint.h>
 
@@ -192,4 +192,4 @@
 mp_lexer_t *mp_lexer_new_from_fd(qstr filename, int fd, bool close_fd);
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_LEXER_H__
+#endif // MICROPY_INCLUDED_PY_LEXER_H
diff --git a/py/misc.h b/py/misc.h
index 5ac0f93..cebbd38 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_MISC_H__
-#define __MICROPY_INCLUDED_PY_MISC_H__
+#ifndef MICROPY_INCLUDED_PY_MISC_H
+#define MICROPY_INCLUDED_PY_MISC_H
 
 // a mini library of useful types and functions
 
@@ -223,4 +223,4 @@
 #define MP_FLOAT_EXP_BIAS ((1 << (MP_FLOAT_EXP_BITS - 1)) - 1)
 #endif // MICROPY_PY_BUILTINS_FLOAT
 
-#endif // __MICROPY_INCLUDED_PY_MISC_H__
+#endif // MICROPY_INCLUDED_PY_MISC_H
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 32d6482..fb507a5 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_MPCONFIG_H__
-#define __MICROPY_INCLUDED_PY_MPCONFIG_H__
+#ifndef MICROPY_INCLUDED_PY_MPCONFIG_H
+#define MICROPY_INCLUDED_PY_MPCONFIG_H
 
 // This file contains default configuration settings for MicroPython.
 // You can override any of the options below using mpconfigport.h file
@@ -1253,4 +1253,4 @@
 #define MP_UNLIKELY(x) __builtin_expect((x), 0)
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_MPCONFIG_H__
+#endif // MICROPY_INCLUDED_PY_MPCONFIG_H
diff --git a/py/mperrno.h b/py/mperrno.h
index 6ea99ae..c515ed4 100644
--- a/py/mperrno.h
+++ b/py/mperrno.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_PY_MPERRNO_H__
-#define __MICROPY_INCLUDED_PY_MPERRNO_H__
+#ifndef MICROPY_INCLUDED_PY_MPERRNO_H
+#define MICROPY_INCLUDED_PY_MPERRNO_H
 
 #if MICROPY_USE_INTERNAL_ERRNO
 
@@ -142,4 +141,4 @@
 qstr mp_errno_to_str(mp_obj_t errno_val);
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_MPERRNO_H__
+#endif // MICROPY_INCLUDED_PY_MPERRNO_H
diff --git a/py/mphal.h b/py/mphal.h
index 8d5654f..93a0a40 100644
--- a/py/mphal.h
+++ b/py/mphal.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_MPHAL_H__
-#define __MICROPY_INCLUDED_PY_MPHAL_H__
+#ifndef MICROPY_INCLUDED_PY_MPHAL_H
+#define MICROPY_INCLUDED_PY_MPHAL_H
 
 #include "py/mpconfig.h"
 
@@ -80,4 +80,4 @@
 #include "extmod/virtpin.h"
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_MPHAL_H__
+#endif // MICROPY_INCLUDED_PY_MPHAL_H
diff --git a/py/mpprint.h b/py/mpprint.h
index 4fc904a..20bd875 100644
--- a/py/mpprint.h
+++ b/py/mpprint.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_MPPRINT_H__
-#define __MICROPY_INCLUDED_PY_MPPRINT_H__
+#ifndef MICROPY_INCLUDED_PY_MPPRINT_H
+#define MICROPY_INCLUDED_PY_MPPRINT_H
 
 #include "py/mpconfig.h"
 
@@ -71,4 +71,4 @@
 int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args);
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_MPPRINT_H__
+#endif // MICROPY_INCLUDED_PY_MPPRINT_H
diff --git a/py/mpstate.h b/py/mpstate.h
index 2b8f29a..b09ba08 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_MPSTATE_H__
-#define __MICROPY_INCLUDED_PY_MPSTATE_H__
+#ifndef MICROPY_INCLUDED_PY_MPSTATE_H
+#define MICROPY_INCLUDED_PY_MPSTATE_H
 
 #include <stdint.h>
 
@@ -248,4 +248,4 @@
 #define MP_STATE_THREAD(x) (mp_state_ctx.thread.x)
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_MPSTATE_H__
+#endif // MICROPY_INCLUDED_PY_MPSTATE_H
diff --git a/py/mpthread.h b/py/mpthread.h
index 04d4f19..602df83 100644
--- a/py/mpthread.h
+++ b/py/mpthread.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_MPTHREAD_H__
-#define __MICROPY_INCLUDED_PY_MPTHREAD_H__
+#ifndef MICROPY_INCLUDED_PY_MPTHREAD_H
+#define MICROPY_INCLUDED_PY_MPTHREAD_H
 
 #include "py/mpconfig.h"
 
@@ -58,4 +58,4 @@
 #define MP_THREAD_GIL_EXIT()
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_MPTHREAD_H__
+#endif // MICROPY_INCLUDED_PY_MPTHREAD_H
diff --git a/py/mpz.h b/py/mpz.h
index 5c88227..878febf 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_MPZ_H__
-#define __MICROPY_INCLUDED_PY_MPZ_H__
+#ifndef MICROPY_INCLUDED_PY_MPZ_H
+#define MICROPY_INCLUDED_PY_MPZ_H
 
 #include <stdint.h>
 
@@ -139,4 +139,4 @@
 #endif
 size_t mpz_as_str_inpl(const mpz_t *z, unsigned int base, const char *prefix, char base_char, char comma, char *str);
 
-#endif // __MICROPY_INCLUDED_PY_MPZ_H__
+#endif // MICROPY_INCLUDED_PY_MPZ_H
diff --git a/py/nlr.h b/py/nlr.h
index 7a71ef3..624e973 100644
--- a/py/nlr.h
+++ b/py/nlr.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_NLR_H__
-#define __MICROPY_INCLUDED_PY_NLR_H__
+#ifndef MICROPY_INCLUDED_PY_NLR_H
+#define MICROPY_INCLUDED_PY_NLR_H
 
 // non-local return
 // exception handling, basically a stack of setjmp/longjmp buffers
@@ -112,4 +112,4 @@
 
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_NLR_H__
+#endif // MICROPY_INCLUDED_PY_NLR_H
diff --git a/py/obj.h b/py/obj.h
index a3c06a2..f88c100 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_OBJ_H__
-#define __MICROPY_INCLUDED_PY_OBJ_H__
+#ifndef MICROPY_INCLUDED_PY_OBJ_H
+#define MICROPY_INCLUDED_PY_OBJ_H
 
 #include "py/mpconfig.h"
 #include "py/misc.h"
@@ -864,4 +864,4 @@
     memmove(((char*)dest) + (beg + slice_len) * (item_sz), ((char*)dest) + (end) * (item_sz), ((dest_len) + (len_adj) - ((beg) + (slice_len))) * (item_sz)); \
     memmove(((char*)dest) + (beg) * (item_sz), slice, slice_len * (item_sz));
 
-#endif // __MICROPY_INCLUDED_PY_OBJ_H__
+#endif // MICROPY_INCLUDED_PY_OBJ_H
diff --git a/py/objarray.h b/py/objarray.h
index 06a2a07..0389668 100644
--- a/py/objarray.h
+++ b/py/objarray.h
@@ -24,9 +24,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_PY_OBJARRAY_H__
-#define __MICROPY_INCLUDED_PY_OBJARRAY_H__
+#ifndef MICROPY_INCLUDED_PY_OBJARRAY_H
+#define MICROPY_INCLUDED_PY_OBJARRAY_H
 
 #include "py/obj.h"
 
@@ -40,4 +39,4 @@
     void *items;
 } mp_obj_array_t;
 
-#endif // __MICROPY_INCLUDED_PY_OBJARRAY_H__
+#endif // MICROPY_INCLUDED_PY_OBJARRAY_H
diff --git a/py/objexcept.h b/py/objexcept.h
index 3128fde..2232e1e 100644
--- a/py/objexcept.h
+++ b/py/objexcept.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_OBJEXCEPT_H__
-#define __MICROPY_INCLUDED_PY_OBJEXCEPT_H__
+#ifndef MICROPY_INCLUDED_PY_OBJEXCEPT_H
+#define MICROPY_INCLUDED_PY_OBJEXCEPT_H
 
 #include "py/obj.h"
 #include "py/objtuple.h"
@@ -37,4 +37,4 @@
     mp_obj_tuple_t *args;
 } mp_obj_exception_t;
 
-#endif // __MICROPY_INCLUDED_PY_OBJEXCEPT_H__
+#endif // MICROPY_INCLUDED_PY_OBJEXCEPT_H
diff --git a/py/objfun.h b/py/objfun.h
index d02fada..450c98f 100644
--- a/py/objfun.h
+++ b/py/objfun.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_OBJFUN_H__
-#define __MICROPY_INCLUDED_PY_OBJFUN_H__
+#ifndef MICROPY_INCLUDED_PY_OBJFUN_H
+#define MICROPY_INCLUDED_PY_OBJFUN_H
 
 #include "py/obj.h"
 
@@ -41,4 +41,4 @@
     mp_obj_t extra_args[];
 } mp_obj_fun_bc_t;
 
-#endif // __MICROPY_INCLUDED_PY_OBJFUN_H__
+#endif // MICROPY_INCLUDED_PY_OBJFUN_H
diff --git a/py/objgenerator.h b/py/objgenerator.h
index d1b9be4..d61332a 100644
--- a/py/objgenerator.h
+++ b/py/objgenerator.h
@@ -23,12 +23,12 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_OBJGENERATOR_H__
-#define __MICROPY_INCLUDED_PY_OBJGENERATOR_H__
+#ifndef MICROPY_INCLUDED_PY_OBJGENERATOR_H
+#define MICROPY_INCLUDED_PY_OBJGENERATOR_H
 
 #include "py/obj.h"
 #include "py/runtime.h"
 
 mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_val, mp_obj_t throw_val, mp_obj_t *ret_val);
 
-#endif // __MICROPY_INCLUDED_PY_OBJGENERATOR_H__
+#endif // MICROPY_INCLUDED_PY_OBJGENERATOR_H
diff --git a/py/objint.h b/py/objint.h
index da56c18..f341306 100644
--- a/py/objint.h
+++ b/py/objint.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_OBJINT_H__
-#define __MICROPY_INCLUDED_PY_OBJINT_H__
+#ifndef MICROPY_INCLUDED_PY_OBJINT_H
+#define MICROPY_INCLUDED_PY_OBJINT_H
 
 #include "py/mpz.h"
 #include "py/obj.h"
@@ -63,4 +63,4 @@
 mp_obj_t mp_obj_int_binary_op_extra_cases(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in);
 mp_obj_t mp_obj_int_pow3(mp_obj_t base, mp_obj_t exponent,  mp_obj_t modulus);
 
-#endif // __MICROPY_INCLUDED_PY_OBJINT_H__
+#endif // MICROPY_INCLUDED_PY_OBJINT_H
diff --git a/py/objlist.h b/py/objlist.h
index 5b2d216..740ba9f 100644
--- a/py/objlist.h
+++ b/py/objlist.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_OBJLIST_H__
-#define __MICROPY_INCLUDED_PY_OBJLIST_H__
+#ifndef MICROPY_INCLUDED_PY_OBJLIST_H
+#define MICROPY_INCLUDED_PY_OBJLIST_H
 
 #include "py/obj.h"
 
@@ -35,4 +35,4 @@
     mp_obj_t *items;
 } mp_obj_list_t;
 
-#endif // __MICROPY_INCLUDED_PY_OBJLIST_H__
+#endif // MICROPY_INCLUDED_PY_OBJLIST_H
diff --git a/py/objmodule.h b/py/objmodule.h
index 4e6612a..5bfbe51 100644
--- a/py/objmodule.h
+++ b/py/objmodule.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_OBJMODULE_H__
-#define __MICROPY_INCLUDED_PY_OBJMODULE_H__
+#ifndef MICROPY_INCLUDED_PY_OBJMODULE_H
+#define MICROPY_INCLUDED_PY_OBJMODULE_H
 
 #include "py/obj.h"
 
@@ -34,4 +34,4 @@
 mp_obj_t mp_module_get(qstr module_name);
 void mp_module_register(qstr qstr, mp_obj_t module);
 
-#endif // __MICROPY_INCLUDED_PY_OBJMODULE_H__
+#endif // MICROPY_INCLUDED_PY_OBJMODULE_H
diff --git a/py/objstr.h b/py/objstr.h
index e92832d..6fbed40 100644
--- a/py/objstr.h
+++ b/py/objstr.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_OBJSTR_H__
-#define __MICROPY_INCLUDED_PY_OBJSTR_H__
+#ifndef MICROPY_INCLUDED_PY_OBJSTR_H
+#define MICROPY_INCLUDED_PY_OBJSTR_H
 
 #include "py/obj.h"
 
@@ -102,4 +102,4 @@
 MP_DECLARE_CONST_FUN_OBJ_1(str_isupper_obj);
 MP_DECLARE_CONST_FUN_OBJ_1(str_islower_obj);
 
-#endif // __MICROPY_INCLUDED_PY_OBJSTR_H__
+#endif // MICROPY_INCLUDED_PY_OBJSTR_H
diff --git a/py/objtuple.h b/py/objtuple.h
index 555c3b3..6867023 100644
--- a/py/objtuple.h
+++ b/py/objtuple.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_OBJTUPLE_H__
-#define __MICROPY_INCLUDED_PY_OBJTUPLE_H__
+#ifndef MICROPY_INCLUDED_PY_OBJTUPLE_H
+#define MICROPY_INCLUDED_PY_OBJTUPLE_H
 
 #include "py/obj.h"
 
@@ -61,4 +61,4 @@
 
 mp_obj_t mp_obj_new_attrtuple(const qstr *fields, size_t n, const mp_obj_t *items);
 
-#endif // __MICROPY_INCLUDED_PY_OBJTUPLE_H__
+#endif // MICROPY_INCLUDED_PY_OBJTUPLE_H
diff --git a/py/objtype.h b/py/objtype.h
index 61efd00..104b20a 100644
--- a/py/objtype.h
+++ b/py/objtype.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_OBJTYPE_H__
-#define __MICROPY_INCLUDED_PY_OBJTYPE_H__
+#ifndef MICROPY_INCLUDED_PY_OBJTYPE_H
+#define MICROPY_INCLUDED_PY_OBJTYPE_H
 
 #include "py/obj.h"
 
@@ -49,4 +49,4 @@
 // this needs to be exposed for the above macros to work correctly
 mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
 
-#endif // __MICROPY_INCLUDED_PY_OBJTYPE_H__
+#endif // MICROPY_INCLUDED_PY_OBJTYPE_H
diff --git a/py/parse.h b/py/parse.h
index 769f5a8..fec1882 100644
--- a/py/parse.h
+++ b/py/parse.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_PARSE_H__
-#define __MICROPY_INCLUDED_PY_PARSE_H__
+#ifndef MICROPY_INCLUDED_PY_PARSE_H
+#define MICROPY_INCLUDED_PY_PARSE_H
 
 #include <stddef.h>
 #include <stdint.h>
@@ -104,4 +104,4 @@
 mp_parse_tree_t mp_parse(struct _mp_lexer_t *lex, mp_parse_input_kind_t input_kind);
 void mp_parse_tree_clear(mp_parse_tree_t *tree);
 
-#endif // __MICROPY_INCLUDED_PY_PARSE_H__
+#endif // MICROPY_INCLUDED_PY_PARSE_H
diff --git a/py/parsenum.h b/py/parsenum.h
index f140cfc..77fd0f4 100644
--- a/py/parsenum.h
+++ b/py/parsenum.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_PARSENUM_H__
-#define __MICROPY_INCLUDED_PY_PARSENUM_H__
+#ifndef MICROPY_INCLUDED_PY_PARSENUM_H
+#define MICROPY_INCLUDED_PY_PARSENUM_H
 
 #include "py/mpconfig.h"
 #include "py/lexer.h"
@@ -34,4 +34,4 @@
 mp_obj_t mp_parse_num_integer(const char *restrict str, size_t len, int base, mp_lexer_t *lex);
 mp_obj_t mp_parse_num_decimal(const char *str, size_t len, bool allow_imag, bool force_complex, mp_lexer_t *lex);
 
-#endif // __MICROPY_INCLUDED_PY_PARSENUM_H__
+#endif // MICROPY_INCLUDED_PY_PARSENUM_H
diff --git a/py/parsenumbase.h b/py/parsenumbase.h
index 9da9db8..143796d 100644
--- a/py/parsenumbase.h
+++ b/py/parsenumbase.h
@@ -23,11 +23,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_PARSENUMBASE_H__
-#define __MICROPY_INCLUDED_PY_PARSENUMBASE_H__
+#ifndef MICROPY_INCLUDED_PY_PARSENUMBASE_H
+#define MICROPY_INCLUDED_PY_PARSENUMBASE_H
 
 #include "py/mpconfig.h"
 
 size_t mp_parse_num_base(const char *str, size_t len, int *base);
 
-#endif // __MICROPY_INCLUDED_PY_PARSENUMBASE_H__
+#endif // MICROPY_INCLUDED_PY_PARSENUMBASE_H
diff --git a/py/qstr.h b/py/qstr.h
index 8c63fbb..4116eb8 100644
--- a/py/qstr.h
+++ b/py/qstr.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_QSTR_H__
-#define __MICROPY_INCLUDED_PY_QSTR_H__
+#ifndef MICROPY_INCLUDED_PY_QSTR_H
+#define MICROPY_INCLUDED_PY_QSTR_H
 
 #include "py/mpconfig.h"
 #include "py/misc.h"
@@ -76,4 +76,4 @@
 void qstr_pool_info(size_t *n_pool, size_t *n_qstr, size_t *n_str_data_bytes, size_t *n_total_bytes);
 void qstr_dump_data(void);
 
-#endif // __MICROPY_INCLUDED_PY_QSTR_H__
+#endif // MICROPY_INCLUDED_PY_QSTR_H
diff --git a/py/repl.h b/py/repl.h
index 048b0de..c2499a2 100644
--- a/py/repl.h
+++ b/py/repl.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_REPL_H__
-#define __MICROPY_INCLUDED_PY_REPL_H__
+#ifndef MICROPY_INCLUDED_PY_REPL_H
+#define MICROPY_INCLUDED_PY_REPL_H
 
 #include "py/mpconfig.h"
 #include "py/misc.h"
@@ -35,4 +35,4 @@
 size_t mp_repl_autocomplete(const char *str, size_t len, const mp_print_t *print, const char **compl_str);
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_REPL_H__
+#endif // MICROPY_INCLUDED_PY_REPL_H
diff --git a/py/ringbuf.h b/py/ringbuf.h
index 5e108af..b416927 100644
--- a/py/ringbuf.h
+++ b/py/ringbuf.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_RINGBUF_H__
-#define __MICROPY_INCLUDED_PY_RINGBUF_H__
+#ifndef MICROPY_INCLUDED_PY_RINGBUF_H
+#define MICROPY_INCLUDED_PY_RINGBUF_H
 
 typedef struct _ringbuf_t {
     uint8_t *buf;
@@ -69,4 +69,4 @@
     return 0;
 }
 
-#endif // __MICROPY_INCLUDED_PY_RINGBUF_H__
+#endif // MICROPY_INCLUDED_PY_RINGBUF_H
diff --git a/py/runtime.h b/py/runtime.h
index d75d23f..0add564 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_RUNTIME_H__
-#define __MICROPY_INCLUDED_PY_RUNTIME_H__
+#ifndef MICROPY_INCLUDED_PY_RUNTIME_H
+#define MICROPY_INCLUDED_PY_RUNTIME_H
 
 #include "py/mpstate.h"
 #include "py/obj.h"
@@ -178,4 +178,4 @@
 #define mp_warning(msg, ...)
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_RUNTIME_H__
+#endif // MICROPY_INCLUDED_PY_RUNTIME_H
diff --git a/py/runtime0.h b/py/runtime0.h
index 720fe6a..060ee8c 100644
--- a/py/runtime0.h
+++ b/py/runtime0.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_RUNTIME0_H__
-#define __MICROPY_INCLUDED_PY_RUNTIME0_H__
+#ifndef MICROPY_INCLUDED_PY_RUNTIME0_H
+#define MICROPY_INCLUDED_PY_RUNTIME0_H
 
 // These must fit in 8 bits; see scope.h
 #define MP_SCOPE_FLAG_VARARGS      (0x01)
@@ -151,4 +151,4 @@
 
 extern void *const mp_fun_table[MP_F_NUMBER_OF];
 
-#endif // __MICROPY_INCLUDED_PY_RUNTIME0_H__
+#endif // MICROPY_INCLUDED_PY_RUNTIME0_H
diff --git a/py/scope.h b/py/scope.h
index 826064d..4d0c1b1 100644
--- a/py/scope.h
+++ b/py/scope.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_SCOPE_H__
-#define __MICROPY_INCLUDED_PY_SCOPE_H__
+#ifndef MICROPY_INCLUDED_PY_SCOPE_H
+#define MICROPY_INCLUDED_PY_SCOPE_H
 
 #include "py/parse.h"
 #include "py/emitglue.h"
@@ -94,4 +94,4 @@
 id_info_t *scope_find_global(scope_t *scope, qstr qstr);
 void scope_find_local_and_close_over(scope_t *scope, id_info_t *id, qstr qst);
 
-#endif // __MICROPY_INCLUDED_PY_SCOPE_H__
+#endif // MICROPY_INCLUDED_PY_SCOPE_H
diff --git a/py/smallint.h b/py/smallint.h
index b9686be..b2bfc6d 100644
--- a/py/smallint.h
+++ b/py/smallint.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_SMALLINT_H__
-#define __MICROPY_INCLUDED_PY_SMALLINT_H__
+#ifndef MICROPY_INCLUDED_PY_SMALLINT_H
+#define MICROPY_INCLUDED_PY_SMALLINT_H
 
 #include "py/mpconfig.h"
 #include "py/misc.h"
@@ -65,4 +65,4 @@
 mp_int_t mp_small_int_modulo(mp_int_t dividend, mp_int_t divisor);
 mp_int_t mp_small_int_floor_divide(mp_int_t num, mp_int_t denom);
 
-#endif // __MICROPY_INCLUDED_PY_SMALLINT_H__
+#endif // MICROPY_INCLUDED_PY_SMALLINT_H
diff --git a/py/stackctrl.h b/py/stackctrl.h
index e915f50..84c0e14 100644
--- a/py/stackctrl.h
+++ b/py/stackctrl.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_STACKCTRL_H__
-#define __MICROPY_INCLUDED_PY_STACKCTRL_H__
+#ifndef MICROPY_INCLUDED_PY_STACKCTRL_H
+#define MICROPY_INCLUDED_PY_STACKCTRL_H
 
 #include "py/mpconfig.h"
 
@@ -45,4 +45,4 @@
 
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_STACKCTRL_H__
+#endif // MICROPY_INCLUDED_PY_STACKCTRL_H
diff --git a/py/stream.h b/py/stream.h
index 01199ab..0b5fd7c 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -23,8 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_STREAM_H__
-#define __MICROPY_INCLUDED_PY_STREAM_H__
+#ifndef MICROPY_INCLUDED_PY_STREAM_H
+#define MICROPY_INCLUDED_PY_STREAM_H
 
 #include "py/obj.h"
 #include "py/mperrno.h"
@@ -103,4 +103,4 @@
 #define mp_is_nonblocking_error(errno) (0)
 #endif
 
-#endif // __MICROPY_INCLUDED_PY_STREAM_H__
+#endif // MICROPY_INCLUDED_PY_STREAM_H
diff --git a/py/unicode.h b/py/unicode.h
index 89c28ed..f99c970 100644
--- a/py/unicode.h
+++ b/py/unicode.h
@@ -23,12 +23,12 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_PY_UNICODE_H__
-#define __MICROPY_INCLUDED_PY_UNICODE_H__
+#ifndef MICROPY_INCLUDED_PY_UNICODE_H
+#define MICROPY_INCLUDED_PY_UNICODE_H
 
 #include "py/mpconfig.h"
 #include "py/misc.h"
 
 mp_uint_t utf8_ptr_to_index(const byte *s, const byte *ptr);
 
-#endif // __MICROPY_INCLUDED_PY_UNICODE_H__
+#endif // MICROPY_INCLUDED_PY_UNICODE_H
diff --git a/stmhal/accel.h b/stmhal/accel.h
index 10b095f..42b1563 100644
--- a/stmhal/accel.h
+++ b/stmhal/accel.h
@@ -23,7 +23,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_ACCEL_H
+#define MICROPY_INCLUDED_STMHAL_ACCEL_H
 
 extern const mp_obj_type_t pyb_accel_type;
 
 void accel_init(void);
+
+#endif // MICROPY_INCLUDED_STMHAL_ACCEL_H
diff --git a/stmhal/adc.h b/stmhal/adc.h
index ebaccbe..6ec5584 100644
--- a/stmhal/adc.h
+++ b/stmhal/adc.h
@@ -23,6 +23,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_ADC_H
+#define MICROPY_INCLUDED_STMHAL_ADC_H
 
 extern const mp_obj_type_t pyb_adc_type;
 extern const mp_obj_type_t pyb_adc_all_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_ADC_H
diff --git a/stmhal/bufhelper.h b/stmhal/bufhelper.h
index abdeea6..55f57be 100644
--- a/stmhal/bufhelper.h
+++ b/stmhal/bufhelper.h
@@ -23,6 +23,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_BUFHELPER_H
+#define MICROPY_INCLUDED_STMHAL_BUFHELPER_H
 
 void pyb_buf_get_for_send(mp_obj_t o, mp_buffer_info_t *bufinfo, byte *tmp_data);
 mp_obj_t pyb_buf_get_for_recv(mp_obj_t o, vstr_t *vstr);
+
+#endif // MICROPY_INCLUDED_STMHAL_BUFHELPER_H
diff --git a/stmhal/can.h b/stmhal/can.h
index 4d4b1bb..7c40e9b 100644
--- a/stmhal/can.h
+++ b/stmhal/can.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_CAN_H
+#define MICROPY_INCLUDED_STMHAL_CAN_H
 
 #define PYB_CAN_1 (1)
 #define PYB_CAN_2 (2)
@@ -32,3 +34,5 @@
 void can_init0(void);
 void can_deinit(void);
 void can_rx_irq_handler(uint can_id, uint fifo_id);
+
+#endif // MICROPY_INCLUDED_STMHAL_CAN_H
diff --git a/stmhal/dac.h b/stmhal/dac.h
index ba44158..93192c0 100644
--- a/stmhal/dac.h
+++ b/stmhal/dac.h
@@ -23,7 +23,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_DAC_H
+#define MICROPY_INCLUDED_STMHAL_DAC_H
 
 void dac_init(void);
 
 extern const mp_obj_type_t pyb_dac_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_DAC_H
diff --git a/stmhal/dma.h b/stmhal/dma.h
index 57b8f86..d8b11ca 100644
--- a/stmhal/dma.h
+++ b/stmhal/dma.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_STMHAL_DMA_H__
-#define __MICROPY_INCLUDED_STMHAL_DMA_H__
+#ifndef MICROPY_INCLUDED_STMHAL_DMA_H
+#define MICROPY_INCLUDED_STMHAL_DMA_H
 
 typedef struct _dma_descr_t dma_descr_t;
 
@@ -101,4 +100,4 @@
 void dma_invalidate_channel(const dma_descr_t *dma_descr);
 void dma_idle_handler(int controller);
 
-#endif //__MICROPY_INCLUDED_STMHAL_DMA_H__
+#endif // MICROPY_INCLUDED_STMHAL_DMA_H
diff --git a/stmhal/extint.h b/stmhal/extint.h
index b04224c..0eae894 100644
--- a/stmhal/extint.h
+++ b/stmhal/extint.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_EXTINT_H
+#define MICROPY_INCLUDED_STMHAL_EXTINT_H
 
 // Vectors 0-15 are for regular pins
 // Vectors 16-22 are for internal sources.
@@ -61,3 +63,5 @@
 void Handle_EXTI_Irq(uint32_t line);
 
 extern const mp_obj_type_t extint_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_EXTINT_H
diff --git a/stmhal/flash.h b/stmhal/flash.h
index 007155e..c5b5bf3 100644
--- a/stmhal/flash.h
+++ b/stmhal/flash.h
@@ -23,7 +23,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_FLASH_H
+#define MICROPY_INCLUDED_STMHAL_FLASH_H
 
 uint32_t flash_get_sector_info(uint32_t addr, uint32_t *start_addr, uint32_t *size);
 void flash_erase(uint32_t flash_dest, const uint32_t *src, uint32_t num_word32);
 void flash_write(uint32_t flash_dest, const uint32_t *src, uint32_t num_word32);
+
+#endif // MICROPY_INCLUDED_STMHAL_FLASH_H
diff --git a/stmhal/font_petme128_8x8.h b/stmhal/font_petme128_8x8.h
index 7f928ed..f272777 100644
--- a/stmhal/font_petme128_8x8.h
+++ b/stmhal/font_petme128_8x8.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_FONT_PETME128_8X8_H
+#define MICROPY_INCLUDED_STMHAL_FONT_PETME128_8X8_H
 
 static const uint8_t font_petme128_8x8[] = {
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 32= 
@@ -122,3 +124,5 @@
     0x00,0x02,0x03,0x01,0x03,0x02,0x03,0x01, // 126=~
     0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, // 127
 };
+
+#endif // MICROPY_INCLUDED_STMHAL_FONT_PETME128_8X8_H
diff --git a/stmhal/gccollect.h b/stmhal/gccollect.h
index 07797be..2cb32a8 100644
--- a/stmhal/gccollect.h
+++ b/stmhal/gccollect.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_GCCOLLECT_H
+#define MICROPY_INCLUDED_STMHAL_GCCOLLECT_H
 
 // variables defining memory layout
 // (these probably belong somewhere else...)
@@ -37,3 +39,5 @@
 extern uint32_t _heap_end;
 extern uint32_t _estack;
 extern uint32_t _ram_end;
+
+#endif // MICROPY_INCLUDED_STMHAL_GCCOLLECT_H
diff --git a/stmhal/i2c.h b/stmhal/i2c.h
index fc7a6f6..eda076e 100644
--- a/stmhal/i2c.h
+++ b/stmhal/i2c.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_I2C_H
+#define MICROPY_INCLUDED_STMHAL_I2C_H
 
 #include "dma.h"
 
@@ -49,3 +51,5 @@
 uint32_t i2c_get_baudrate(I2C_InitTypeDef *init);
 void i2c_ev_irq_handler(mp_uint_t i2c_id);
 void i2c_er_irq_handler(mp_uint_t i2c_id);
+
+#endif // MICROPY_INCLUDED_STMHAL_I2C_H
diff --git a/stmhal/irq.h b/stmhal/irq.h
index 3518752..8d44b50 100644
--- a/stmhal/irq.h
+++ b/stmhal/irq.h
@@ -23,7 +23,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
 #ifndef MICROPY_INCLUDED_STMHAL_IRQ_H
 #define MICROPY_INCLUDED_STMHAL_IRQ_H
 
diff --git a/stmhal/lcd.h b/stmhal/lcd.h
index 6a4b004..be4f6ed 100644
--- a/stmhal/lcd.h
+++ b/stmhal/lcd.h
@@ -23,5 +23,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_LCD_H
+#define MICROPY_INCLUDED_STMHAL_LCD_H
 
 extern const mp_obj_type_t pyb_lcd_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_LCD_H
diff --git a/stmhal/led.h b/stmhal/led.h
index f4cd673..fc93481 100644
--- a/stmhal/led.h
+++ b/stmhal/led.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_LED_H
+#define MICROPY_INCLUDED_STMHAL_LED_H
 
 typedef enum {
     // PYBv3
@@ -48,3 +50,5 @@
 void led_debug(int value, int delay);
 
 extern const mp_obj_type_t pyb_led_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_LED_H
diff --git a/stmhal/modmachine.h b/stmhal/modmachine.h
index 164c5cf..ac39f85 100644
--- a/stmhal/modmachine.h
+++ b/stmhal/modmachine.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_STMHAL_MODMACHINE_H__
-#define __MICROPY_INCLUDED_STMHAL_MODMACHINE_H__
+#ifndef MICROPY_INCLUDED_STMHAL_MODMACHINE_H
+#define MICROPY_INCLUDED_STMHAL_MODMACHINE_H
 
 #include "py/mpstate.h"
 #include "py/nlr.h"
@@ -41,4 +40,4 @@
 MP_DECLARE_CONST_FUN_OBJ_0(machine_sleep_obj);
 MP_DECLARE_CONST_FUN_OBJ_0(machine_deepsleep_obj);
 
-#endif // __MICROPY_INCLUDED_STMHAL_MODMACHINE_H__
+#endif // MICROPY_INCLUDED_STMHAL_MODMACHINE_H
diff --git a/stmhal/modnetwork.h b/stmhal/modnetwork.h
index d3bc567..83e4255 100644
--- a/stmhal/modnetwork.h
+++ b/stmhal/modnetwork.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_MODNETWORK_H
+#define MICROPY_INCLUDED_STMHAL_MODNETWORK_H
 
 #define MOD_NETWORK_IPADDR_BUF_SIZE (4)
 
@@ -77,3 +79,5 @@
 void mod_network_init(void);
 void mod_network_register_nic(mp_obj_t nic);
 mp_obj_t mod_network_find_nic(const uint8_t *ip);
+
+#endif // MICROPY_INCLUDED_STMHAL_MODNETWORK_H
diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h
index d3ce11e..a8ea2f0 100644
--- a/stmhal/mpconfigport.h
+++ b/stmhal/mpconfigport.h
@@ -27,10 +27,6 @@
 // Options to control how MicroPython is built for this port,
 // overriding defaults in py/mpconfig.h.
 
-#pragma once
-#ifndef __INCLUDED_MPCONFIGPORT_H
-#define __INCLUDED_MPCONFIGPORT_H
-
 // board specific definitions
 #include "mpconfigboard.h"
 
@@ -350,5 +346,3 @@
 #include <alloca.h>
 
 #define MICROPY_PIN_DEFS_PORT_H "pin_defs_stmhal.h"
-
-#endif // __INCLUDED_MPCONFIGPORT_H
diff --git a/stmhal/mpthreadport.h b/stmhal/mpthreadport.h
index 3d8b4ef..8e2372d 100644
--- a/stmhal/mpthreadport.h
+++ b/stmhal/mpthreadport.h
@@ -23,8 +23,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_STMHAL_MPTHREADPORT_H__
-#define __MICROPY_INCLUDED_STMHAL_MPTHREADPORT_H__
 
 #include "py/mpthread.h"
 #include "pybthread.h"
@@ -53,5 +51,3 @@
 static inline void mp_thread_mutex_unlock(mp_thread_mutex_t *m) {
     pyb_mutex_unlock(m);
 }
-
-#endif // __MICROPY_INCLUDED_STMHAL_MPTHREADPORT_H__
diff --git a/stmhal/pendsv.h b/stmhal/pendsv.h
index 77c78d4..b64e613 100644
--- a/stmhal/pendsv.h
+++ b/stmhal/pendsv.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_PENDSV_H
+#define MICROPY_INCLUDED_STMHAL_PENDSV_H
 
 void pendsv_init(void);
 void pendsv_kbd_intr(void);
@@ -30,3 +32,5 @@
 // since we play tricks with the stack, the compiler must not generate a
 // prelude for this function
 void pendsv_isr_handler(void) __attribute__((naked));
+
+#endif // MICROPY_INCLUDED_STMHAL_PENDSV_H
diff --git a/stmhal/pin.h b/stmhal/pin.h
index a11b0a0..1ec4bd6 100644
--- a/stmhal/pin.h
+++ b/stmhal/pin.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_STMHAL_PIN_H__
-#define __MICROPY_INCLUDED_STMHAL_PIN_H__
+#ifndef MICROPY_INCLUDED_STMHAL_PIN_H
+#define MICROPY_INCLUDED_STMHAL_PIN_H
 
 // This file requires pin_defs_xxx.h (which has port specific enums and
 // defines, so we include it here. It should never be included directly
@@ -98,4 +97,4 @@
 const pin_af_obj_t *pin_find_af_by_index(const pin_obj_t *pin, mp_uint_t af_idx);
 const pin_af_obj_t *pin_find_af_by_name(const pin_obj_t *pin, const char *name);
 
-#endif // __MICROPY_INCLUDED_STMHAL_PIN_H__
+#endif // MICROPY_INCLUDED_STMHAL_PIN_H
diff --git a/stmhal/portmodules.h b/stmhal/portmodules.h
index 0b460f3..4e892da 100644
--- a/stmhal/portmodules.h
+++ b/stmhal/portmodules.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_PORTMODULES_H
+#define MICROPY_INCLUDED_STMHAL_PORTMODULES_H
 
 extern const mp_obj_module_t pyb_module;
 extern const mp_obj_module_t stm_module;
@@ -37,3 +39,5 @@
 
 MP_DECLARE_CONST_FUN_OBJ_0(mod_os_sync_obj);
 MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_dupterm_obj);
+
+#endif // MICROPY_INCLUDED_STMHAL_PORTMODULES_H
diff --git a/stmhal/pybthread.h b/stmhal/pybthread.h
index 6edb240..f628f93 100644
--- a/stmhal/pybthread.h
+++ b/stmhal/pybthread.h
@@ -23,7 +23,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
 #ifndef MICROPY_INCLUDED_STMHAL_PYBTHREAD_H
 #define MICROPY_INCLUDED_STMHAL_PYBTHREAD_H
 
diff --git a/stmhal/rng.h b/stmhal/rng.h
index ce1833e..f022f3a 100644
--- a/stmhal/rng.h
+++ b/stmhal/rng.h
@@ -23,8 +23,12 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_RNG_H
+#define MICROPY_INCLUDED_STMHAL_RNG_H
 
 void rng_init0(void);
 uint32_t rng_get(void);
 
 MP_DECLARE_CONST_FUN_OBJ_0(pyb_rng_get_obj);
+
+#endif // MICROPY_INCLUDED_STMHAL_RNG_H
diff --git a/stmhal/rtc.h b/stmhal/rtc.h
index 69d64c7..f382fa6 100644
--- a/stmhal/rtc.h
+++ b/stmhal/rtc.h
@@ -23,9 +23,13 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_RTC_H
+#define MICROPY_INCLUDED_STMHAL_RTC_H
 
 extern RTC_HandleTypeDef RTCHandle;
 extern const mp_obj_type_t pyb_rtc_type;
 
 void rtc_init_start(bool force_init);
 void rtc_init_finalise(void);
+
+#endif // MICROPY_INCLUDED_STMHAL_RTC_H
diff --git a/stmhal/sdcard.h b/stmhal/sdcard.h
index 237e48d..d595f0f 100644
--- a/stmhal/sdcard.h
+++ b/stmhal/sdcard.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_SDCARD_H
+#define MICROPY_INCLUDED_STMHAL_SDCARD_H
 
 // this is a fixed size and should not be changed
 #define SDCARD_BLOCK_SIZE (512)
@@ -42,3 +44,5 @@
 
 struct _fs_user_mount_t;
 void sdcard_init_vfs(struct _fs_user_mount_t *vfs, int part);
+
+#endif // MICROPY_INCLUDED_STMHAL_SDCARD_H
diff --git a/stmhal/servo.h b/stmhal/servo.h
index 0fca8fe..18fd493 100644
--- a/stmhal/servo.h
+++ b/stmhal/servo.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_SERVO_H
+#define MICROPY_INCLUDED_STMHAL_SERVO_H
 
 void servo_init(void);
 void servo_timer_irq_callback(void);
@@ -31,3 +33,5 @@
 
 MP_DECLARE_CONST_FUN_OBJ_2(pyb_servo_set_obj);
 MP_DECLARE_CONST_FUN_OBJ_2(pyb_pwm_set_obj);
+
+#endif // MICROPY_INCLUDED_STMHAL_SERVO_H
diff --git a/stmhal/spi.h b/stmhal/spi.h
index 5686bde..e6752fd 100644
--- a/stmhal/spi.h
+++ b/stmhal/spi.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_SPI_H
+#define MICROPY_INCLUDED_STMHAL_SPI_H
 
 extern SPI_HandleTypeDef SPIHandle1;
 extern SPI_HandleTypeDef SPIHandle2;
@@ -37,3 +39,5 @@
 void spi_init0(void);
 void spi_init(SPI_HandleTypeDef *spi, bool enable_nss_pin);
 SPI_HandleTypeDef *spi_get_handle(mp_obj_t o);
+
+#endif // MICROPY_INCLUDED_STMHAL_SPI_H
diff --git a/stmhal/stm32_it.h b/stmhal/stm32_it.h
index a168cda..d6ed1b2 100644
--- a/stmhal/stm32_it.h
+++ b/stmhal/stm32_it.h
@@ -25,6 +25,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_STM32_IT_H
+#define MICROPY_INCLUDED_STMHAL_STM32_IT_H
 
 /**
   ******************************************************************************
@@ -80,3 +82,5 @@
 #ifdef USE_USB_HS
 void OTG_HS_IRQHandler(void);
 #endif
+
+#endif // MICROPY_INCLUDED_STMHAL_STM32_IT_H
diff --git a/stmhal/storage.h b/stmhal/storage.h
index 4d3de77..0ecb571 100644
--- a/stmhal/storage.h
+++ b/stmhal/storage.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_STORAGE_H
+#define MICROPY_INCLUDED_STMHAL_STORAGE_H
 
 #define FLASH_BLOCK_SIZE (512)
 
@@ -45,3 +47,5 @@
 
 struct _fs_user_mount_t;
 void pyb_flash_init_vfs(struct _fs_user_mount_t *vfs);
+
+#endif // MICROPY_INCLUDED_STMHAL_STORAGE_H
diff --git a/stmhal/systick.h b/stmhal/systick.h
index 1e7f623..524afae 100644
--- a/stmhal/systick.h
+++ b/stmhal/systick.h
@@ -23,6 +23,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_SYSTICK_H
+#define MICROPY_INCLUDED_STMHAL_SYSTICK_H
 
 void sys_tick_wait_at_least(uint32_t stc, uint32_t delay_ms);
 bool sys_tick_has_passed(uint32_t stc, uint32_t delay_ms);
+
+#endif // MICROPY_INCLUDED_STMHAL_SYSTICK_H
diff --git a/stmhal/timer.h b/stmhal/timer.h
index a18d7cf..72e461f 100644
--- a/stmhal/timer.h
+++ b/stmhal/timer.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_TIMER_H
+#define MICROPY_INCLUDED_STMHAL_TIMER_H
 
 extern TIM_HandleTypeDef TIM5_Handle;
 
@@ -36,3 +38,5 @@
 void timer_irq_handler(uint tim_id);
 
 TIM_HandleTypeDef *pyb_timer_get_handle(mp_obj_t timer);
+
+#endif // MICROPY_INCLUDED_STMHAL_TIMER_H
diff --git a/stmhal/uart.h b/stmhal/uart.h
index 7fdc59d..7495309 100644
--- a/stmhal/uart.h
+++ b/stmhal/uart.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_UART_H
+#define MICROPY_INCLUDED_STMHAL_UART_H
 
 typedef enum {
     PYB_UART_NONE = 0,
@@ -47,3 +49,5 @@
 int uart_rx_char(pyb_uart_obj_t *uart_obj);
 void uart_tx_strn(pyb_uart_obj_t *uart_obj, const char *str, uint len);
 void uart_tx_strn_cooked(pyb_uart_obj_t *uart_obj, const char *str, uint len);
+
+#endif // MICROPY_INCLUDED_STMHAL_UART_H
diff --git a/stmhal/usb.h b/stmhal/usb.h
index 42e6c76..e04fe70 100644
--- a/stmhal/usb.h
+++ b/stmhal/usb.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_USB_H
+#define MICROPY_INCLUDED_STMHAL_USB_H
 
 #include "usbd_cdc_msc_hid0.h"
 
@@ -67,3 +69,5 @@
 void pyb_usb_host_init(void);
 void pyb_usb_host_process(void);
 uint pyb_usb_host_get_keyboard(void);
+
+#endif // MICROPY_INCLUDED_STMHAL_USB_H
diff --git a/stmhal/usbd_cdc_interface.h b/stmhal/usbd_cdc_interface.h
index d96861a..6f9a1e8 100644
--- a/stmhal/usbd_cdc_interface.h
+++ b/stmhal/usbd_cdc_interface.h
@@ -1,6 +1,8 @@
 /*

  * This file is part of the Micro Python project, http://micropython.org/

  */

+#ifndef MICROPY_INCLUDED_STMHAL_USBD_CDC_INTERFACE_H

+#define MICROPY_INCLUDED_STMHAL_USBD_CDC_INTERFACE_H

 

 /**

   ******************************************************************************

@@ -39,3 +41,5 @@
 

 int USBD_CDC_RxNum(void);

 int USBD_CDC_Rx(uint8_t *buf, uint32_t len, uint32_t timeout);

+

+#endif // MICROPY_INCLUDED_STMHAL_USBD_CDC_INTERFACE_H

diff --git a/stmhal/usbd_desc.h b/stmhal/usbd_desc.h
index 93e222f..f48e364 100644
--- a/stmhal/usbd_desc.h
+++ b/stmhal/usbd_desc.h
@@ -23,7 +23,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_USBD_DESC_H
+#define MICROPY_INCLUDED_STMHAL_USBD_DESC_H
 
 extern const USBD_DescriptorsTypeDef USBD_Descriptors;
 
 void USBD_SetVIDPIDRelease(uint16_t vid, uint16_t pid, uint16_t device_release_num, int cdc_only);
+
+#endif // MICROPY_INCLUDED_STMHAL_USBD_DESC_H
diff --git a/stmhal/usbd_hid_interface.h b/stmhal/usbd_hid_interface.h
index fbc8747..b2ff75f 100644
--- a/stmhal/usbd_hid_interface.h
+++ b/stmhal/usbd_hid_interface.h
@@ -1,6 +1,8 @@
 /*

  * This file is part of the MicroPython project, http://micropython.org/

  */

+#ifndef MICROPY_INCLUDED_STMHAL_USBD_HID_INTERFACE_H

+#define MICROPY_INCLUDED_STMHAL_USBD_HID_INTERFACE_H

 

 #include "usbd_cdc_msc_hid.h"

 

@@ -8,3 +10,5 @@
 

 int USBD_HID_RxNum(void);

 int USBD_HID_Rx(USBD_HandleTypeDef *pdev, uint8_t *buf, uint32_t len, uint32_t timeout);

+

+#endif // MICROPY_INCLUDED_STMHAL_USBD_HID_INTERFACE_H

diff --git a/stmhal/usbd_msc_storage.h b/stmhal/usbd_msc_storage.h
index 4a0d28c..a4bc800 100644
--- a/stmhal/usbd_msc_storage.h
+++ b/stmhal/usbd_msc_storage.h
@@ -23,6 +23,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_USBD_MSC_STORAGE_H
+#define MICROPY_INCLUDED_STMHAL_USBD_MSC_STORAGE_H
 
 extern const USBD_StorageTypeDef USBD_FLASH_STORAGE_fops;
 extern const USBD_StorageTypeDef USBD_SDCARD_STORAGE_fops;
+
+#endif // MICROPY_INCLUDED_STMHAL_USBD_MSC_STORAGE_H
diff --git a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h
index bc9d0d2..ec03c86 100644
--- a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h
+++ b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_STMHAL_USB_CDC_MSC_HID0_H__
-#define __MICROPY_INCLUDED_STMHAL_USB_CDC_MSC_HID0_H__
+#ifndef MICROPY_INCLUDED_STMHAL_USBDEV_CLASS_INC_USBD_CDC_MSC_HID0_H
+#define MICROPY_INCLUDED_STMHAL_USBDEV_CLASS_INC_USBD_CDC_MSC_HID0_H
 
 // these are exports for the CDC/MSC/HID interface that are independent
 // from any other definitions/declarations
@@ -49,4 +48,4 @@
     const uint8_t *report_desc;
 } USBD_HID_ModeInfoTypeDef;
 
-#endif // __MICROPY_INCLUDED_STMHAL_USB_CDC_MSC_HID0_H__
+#endif // MICROPY_INCLUDED_STMHAL_USBDEV_CLASS_INC_USBD_CDC_MSC_HID0_H
diff --git a/stmhal/usrsw.h b/stmhal/usrsw.h
index b6dff2c..9fbe610 100644
--- a/stmhal/usrsw.h
+++ b/stmhal/usrsw.h
@@ -23,8 +23,12 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_USRSW_H
+#define MICROPY_INCLUDED_STMHAL_USRSW_H
 
 void switch_init0(void);
 int switch_get(void);
 
 extern const mp_obj_type_t pyb_switch_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_USRSW_H
diff --git a/stmhal/wdt.h b/stmhal/wdt.h
index 362d6ef..0a486f7 100644
--- a/stmhal/wdt.h
+++ b/stmhal/wdt.h
@@ -23,5 +23,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_STMHAL_WDT_H
+#define MICROPY_INCLUDED_STMHAL_WDT_H
 
 extern const mp_obj_type_t pyb_wdt_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_WDT_H
diff --git a/teensy/hal_ftm.h b/teensy/hal_ftm.h
index 3dc1530..ad62735 100644
--- a/teensy/hal_ftm.h
+++ b/teensy/hal_ftm.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_TEENSY_HAL_FTM_H
+#define MICROPY_INCLUDED_TEENSY_HAL_FTM_H
 
 #define FTM0    ((FTM_TypeDef *)&FTM0_SC)
 #define FTM1    ((FTM_TypeDef *)&FTM1_SC)
@@ -181,4 +183,4 @@
 void HAL_FTM_IC_Start_IT(FTM_HandleTypeDef *hftm, uint32_t channel);
 void HAL_FTM_IC_DeInit(FTM_HandleTypeDef *hftm);
 
-
+#endif // MICROPY_INCLUDED_TEENSY_HAL_FTM_H
diff --git a/teensy/led.h b/teensy/led.h
index 7f4ba18..5c45166 100644
--- a/teensy/led.h
+++ b/teensy/led.h
@@ -1,3 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_LED_H
+#define MICROPY_INCLUDED_TEENSY_LED_H
+
 typedef enum {
     PYB_LED_BUILTIN = 1,
 } pyb_led_t;
@@ -7,3 +10,5 @@
 void led_toggle(pyb_led_t led);
 
 extern const mp_obj_type_t pyb_led_type;
+
+#endif // MICROPY_INCLUDED_TEENSY_LED_H
diff --git a/teensy/lexermemzip.h b/teensy/lexermemzip.h
index e5d4be5..cd7326a 100644
--- a/teensy/lexermemzip.h
+++ b/teensy/lexermemzip.h
@@ -1,2 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H
+#define MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H
+
 mp_lexer_t *mp_lexer_new_from_memzip_file(const char *filename);
 
+#endif // MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H
diff --git a/teensy/reg.h b/teensy/reg.h
index 5d1d274..0da6378 100644
--- a/teensy/reg.h
+++ b/teensy/reg.h
@@ -1,3 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_REG_H
+#define MICROPY_INCLUDED_TEENSY_REG_H
+
 typedef struct {
     const char *name;
     mp_uint_t   offset;
@@ -6,3 +9,5 @@
 #define REG_ENTRY(st, name) { #name, offsetof(st, name) }
 
 mp_obj_t reg_cmd(void *base, reg_t *reg, mp_uint_t num_reg, uint n_args, const mp_obj_t *args);
+
+#endif // MICROPY_INCLUDED_TEENSY_REG_H
diff --git a/teensy/servo.h b/teensy/servo.h
index 5f1c87b..1ad3435 100644
--- a/teensy/servo.h
+++ b/teensy/servo.h
@@ -1,3 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_SERVO_H
+#define MICROPY_INCLUDED_TEENSY_SERVO_H
+
 void servo_init(void);
 
 extern const mp_obj_type_t pyb_servo_type;
@@ -5,3 +8,4 @@
 MP_DECLARE_CONST_FUN_OBJ_2(pyb_servo_set_obj);
 MP_DECLARE_CONST_FUN_OBJ_2(pyb_pwm_set_obj);
 
+#endif // MICROPY_INCLUDED_TEENSY_SERVO_H
diff --git a/teensy/std.h b/teensy/std.h
index 4279187..ef55d22 100644
--- a/teensy/std.h
+++ b/teensy/std.h
@@ -1,3 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_STD_H
+#define MICROPY_INCLUDED_TEENSY_STD_H
+
 typedef unsigned int size_t;
 
 void __assert_func(void);
@@ -18,3 +21,5 @@
 
 int printf(const char *fmt, ...);
 int snprintf(char *str, size_t size, const char *fmt, ...);
+
+#endif // MICROPY_INCLUDED_TEENSY_STD_H
diff --git a/teensy/timer.h b/teensy/timer.h
index bfa7636..89095b0 100644
--- a/teensy/timer.h
+++ b/teensy/timer.h
@@ -23,8 +23,12 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_TEENSY_TIMER_H
+#define MICROPY_INCLUDED_TEENSY_TIMER_H
 
 extern const mp_obj_type_t pyb_timer_type;
 
 void timer_init0(void);
 void timer_deinit(void);
+
+#endif // MICROPY_INCLUDED_TEENSY_TIMER_H
diff --git a/teensy/usb.h b/teensy/usb.h
index 949d7a5..50fb3ff 100644
--- a/teensy/usb.h
+++ b/teensy/usb.h
@@ -1,3 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_USB_H
+#define MICROPY_INCLUDED_TEENSY_USB_H
+
 bool usb_vcp_is_connected(void);
 bool usb_vcp_is_enabled(void);
 int usb_vcp_rx_num(void);
@@ -5,3 +8,5 @@
 void usb_vcp_send_str(const char* str);
 void usb_vcp_send_strn(const char* str, int len);
 void usb_vcp_send_strn_cooked(const char *str, int len);
+
+#endif // MICROPY_INCLUDED_TEENSY_USB_H
diff --git a/unix/fdfile.h b/unix/fdfile.h
index 8e8e97c..591159d 100644
--- a/unix/fdfile.h
+++ b/unix/fdfile.h
@@ -24,12 +24,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_UNIX_FDFILE_H
+#define MICROPY_INCLUDED_UNIX_FDFILE_H
 
 #include "py/obj.h"
 
-#ifndef __MICROPY_INCLUDED_UNIX_FILE_H__
-#define __MICROPY_INCLUDED_UNIX_FILE_H__
-
 typedef struct _mp_obj_fdfile_t {
     mp_obj_base_t base;
     int fd;
@@ -38,4 +37,4 @@
 extern const mp_obj_type_t mp_type_fileio;
 extern const mp_obj_type_t mp_type_textio;
 
-#endif // __MICROPY_INCLUDED_UNIX_FILE_H__
+#endif // MICROPY_INCLUDED_UNIX_FDFILE_H
diff --git a/unix/input.h b/unix/input.h
index 7cbee33..a76b87e 100644
--- a/unix/input.h
+++ b/unix/input.h
@@ -1,3 +1,8 @@
+#ifndef MICROPY_INCLUDED_UNIX_INPUT_H
+#define MICROPY_INCLUDED_UNIX_INPUT_H
+
 char *prompt(char *p);
 void prompt_read_history(void);
 void prompt_write_history(void);
+
+#endif // MICROPY_INCLUDED_UNIX_INPUT_H
diff --git a/unix/mpthreadport.h b/unix/mpthreadport.h
index 51cf8d7..b158ed5 100644
--- a/unix/mpthreadport.h
+++ b/unix/mpthreadport.h
@@ -23,8 +23,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#ifndef __MICROPY_INCLUDED_UNIX_MPTHREADPORT_H__
-#define __MICROPY_INCLUDED_UNIX_MPTHREADPORT_H__
 
 #include <pthread.h>
 
@@ -32,5 +30,3 @@
 
 void mp_thread_init(void);
 void mp_thread_gc_others(void);
-
-#endif // __MICROPY_INCLUDED_UNIX_MPTHREADPORT_H__
diff --git a/windows/fmode.h b/windows/fmode.h
index 23d6d3d..c661c84 100644
--- a/windows/fmode.h
+++ b/windows/fmode.h
@@ -23,9 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
-#ifndef __MICROPY_INCLUDED_WINDOWS_FMODE_H__
-#define __MICROPY_INCLUDED_WINDOWS_FMODE_H__
+#ifndef MICROPY_INCLUDED_WINDOWS_FMODE_H
+#define MICROPY_INCLUDED_WINDOWS_FMODE_H
 
 // Treat files opened by open() as binary. No line ending translation is done.
 void set_fmode_binary(void);
@@ -35,4 +34,4 @@
 // When writing to the file \n will be converted into \r\n.
 void set_fmode_text(void);
 
-#endif
+#endif // MICROPY_INCLUDED_WINDOWS_FMODE_H
diff --git a/windows/init.h b/windows/init.h
index 69e5776..480befe 100644
--- a/windows/init.h
+++ b/windows/init.h
@@ -23,6 +23,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_WINDOWS_INIT_H
+#define MICROPY_INCLUDED_WINDOWS_INIT_H
 
 void init(void);
 void deinit(void);
+
+#endif // MICROPY_INCLUDED_WINDOWS_INIT_H
diff --git a/windows/msvc/dirent.h b/windows/msvc/dirent.h
index 6172913..fca0678 100644
--- a/windows/msvc/dirent.h
+++ b/windows/msvc/dirent.h
@@ -23,6 +23,8 @@
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
+#ifndef MICROPY_INCLUDED_WINDOWS_MSVC_DIRENT_H
+#define MICROPY_INCLUDED_WINDOWS_MSVC_DIRENT_H
 
 // dirent.h implementation for msvc
 
@@ -42,3 +44,5 @@
 DIR *opendir(const char *name);
 int closedir(DIR *dir);
 struct dirent *readdir(DIR *dir);
+
+#endif // MICROPY_INCLUDED_WINDOWS_MSVC_DIRENT_H
diff --git a/windows/msvc/sys/time.h b/windows/msvc/sys/time.h
index 96bca1c..a36648b 100644
--- a/windows/msvc/sys/time.h
+++ b/windows/msvc/sys/time.h
@@ -23,6 +23,10 @@
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
+#ifndef MICROPY_INCLUDED_WINDOWS_MSVC_SYS_TIME_H
+#define MICROPY_INCLUDED_WINDOWS_MSVC_SYS_TIME_H
 
 // Get the definitions for timeval etc
 #include <Winsock2.h>
+
+#endif // MICROPY_INCLUDED_WINDOWS_MSVC_SYS_TIME_H
diff --git a/windows/msvc/unistd.h b/windows/msvc/unistd.h
index add10c8..87787c3 100644
--- a/windows/msvc/unistd.h
+++ b/windows/msvc/unistd.h
@@ -23,6 +23,8 @@
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
+#ifndef MICROPY_INCLUDED_WINDOWS_MSVC_UNISTD_H
+#define MICROPY_INCLUDED_WINDOWS_MSVC_UNISTD_H
 
 // There's no unistd.h, but this is the equivalent
 #include <io.h>
@@ -38,3 +40,5 @@
 #define SEEK_CUR 1
 #define SEEK_END 2
 #define SEEK_SET 0
+
+#endif // MICROPY_INCLUDED_WINDOWS_MSVC_UNISTD_H
diff --git a/windows/realpath.h b/windows/realpath.h
index 6f0a29a..c7bb3ac 100644
--- a/windows/realpath.h
+++ b/windows/realpath.h
@@ -23,5 +23,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_WINDOWS_REALPATH_H
+#define MICROPY_INCLUDED_WINDOWS_REALPATH_H
 
 extern char *realpath(const char *path, char *resolved_path);
+
+#endif // MICROPY_INCLUDED_WINDOWS_REALPATH_H
diff --git a/windows/sleep.h b/windows/sleep.h
index 09ad4af..6c0c003 100644
--- a/windows/sleep.h
+++ b/windows/sleep.h
@@ -23,6 +23,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifndef MICROPY_INCLUDED_WINDOWS_SLEEP_H
+#define MICROPY_INCLUDED_WINDOWS_SLEEP_H
 
 void init_sleep(void);
 void deinit_sleep(void);
@@ -30,3 +32,5 @@
 #ifdef _MSC_VER
 int usleep(__int64 usec);
 #endif
+
+#endif // MICROPY_INCLUDED_WINDOWS_SLEEP_H
diff --git a/zephyr/modmachine.h b/zephyr/modmachine.h
index 596c59b..84e4d10 100644
--- a/zephyr/modmachine.h
+++ b/zephyr/modmachine.h
@@ -1,5 +1,5 @@
-#ifndef __MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H__
-#define __MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H__
+#ifndef MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H
+#define MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H
 
 #include "py/obj.h"
 
@@ -13,4 +13,4 @@
     uint32_t pin;
 } machine_pin_obj_t;
 
-#endif // __MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H__
+#endif // MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H